GitHub/LineageOS/G12/android_kernel_amlogic_linux-4.9.git
17 years agoi386: simplify smp_call_function_single() call sequence in cpuid
Avi Kivity [Wed, 17 Oct 2007 16:04:38 +0000 (18:04 +0200)]
i386: simplify smp_call_function_single() call sequence in cpuid

smp_call_function_single() now knows how to call the function on the
current cpu.

[ tglx: arch/x86 adaptation ]

Cc: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agox86: kmalloc + memset conversion to kzalloc
Mariusz Kozlowski [Wed, 17 Oct 2007 16:04:38 +0000 (18:04 +0200)]
x86: kmalloc + memset conversion to kzalloc

arch/x86_64/kernel/io_apic.c | 56080 -> 56038 (-42 bytes)

also eliminate unnecessary local variable assignment.

[ tglx: arch/x86 adaptation ]

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agoi386: no need to make enable_cpu_hotplug a variable
Adrian Bunk [Wed, 17 Oct 2007 16:04:38 +0000 (18:04 +0200)]
i386: no need to make enable_cpu_hotplug a variable

As long as there's no write access to this variable there's no reason to
let gcc check it at runtime.

[ tglx: arch/x86 adaptation ]

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agoi386: es7000 minor cleanups
Adrian Bunk [Wed, 17 Oct 2007 16:04:37 +0000 (18:04 +0200)]
i386: es7000 minor cleanups

This patch contains the following cleanups:
- make some needlessly global functions static
- #if 0 the unused es7000_stop_cpu()

AK: actually removed es7000_stop_cpu
AK: fixed a non ISO prototype too

[ tglx: arch/x86 adaptation ]

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agoi386: Remove local CPU logic in MTRR call to smp_call_function_single
akpm@linux-foundation.org [Wed, 17 Oct 2007 16:04:37 +0000 (18:04 +0200)]
i386: Remove local CPU logic in MTRR call to smp_call_function_single

smp_call_function_single handles the call to local CPU case correctly
now, no need to handle this in the caller.

[ tglx: arch/x86 adaptation ]

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agox86: Create clflush() inline, remove hardcoded wbinvd
H. Peter Anvin [Wed, 17 Oct 2007 16:04:37 +0000 (18:04 +0200)]
x86: Create clflush() inline, remove hardcoded wbinvd

Create an inline function for clflush(), with the proper arguments,
and use it instead of hard-coding the instruction.

This also removes one instance of hard-coded wbinvd, based on a patch
by Bauder de Oliveira Costa.

[ tglx: arch/x86 adaptation ]

Cc: Andi Kleen <andi@firstfloor.org>
Cc: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agox86: constify stacktrace_ops
Jan Beulich [Wed, 17 Oct 2007 16:04:37 +0000 (18:04 +0200)]
x86: constify stacktrace_ops

.. as they're never written to.

[ tglx: arch/x86 adaptation ]

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agox86: Some cleanups for pci gart code
Andi Kleen [Wed, 17 Oct 2007 16:04:37 +0000 (18:04 +0200)]
x86: Some cleanups for pci gart code

- Mark function static
- Clarify license

[ tglx: arch/x86 adaptation ]

Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agox86: misc. constifications
Jan Beulich [Wed, 17 Oct 2007 16:04:37 +0000 (18:04 +0200)]
x86: misc. constifications

Miscellaneous x86 stuff that can live in .rodata.

[ tglx: arch/x86 adaptation ]

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agox86: more struct irqaction initializer cleanups
Thomas Gleixner [Wed, 17 Oct 2007 16:04:36 +0000 (18:04 +0200)]
x86: more struct irqaction initializer cleanups

more struct irqaction initializer cleanups.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
17 years agox86: clean up struct irqaction initializers
Thomas Gleixner [Wed, 17 Oct 2007 16:04:36 +0000 (18:04 +0200)]
x86: clean up struct irqaction initializers

clean up struct irqaction initializers to C99.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
17 years agox86: remove reminder of i386 irqstat per cpu conversion
Thomas Gleixner [Wed, 17 Oct 2007 16:04:36 +0000 (18:04 +0200)]
x86: remove reminder of i386 irqstat per cpu conversion

The i386 irqstat per cpu conversion left an bogus export of the old
irqstat array in the header file. Remove it.

[ tglx: arch/x86 adaptation ]

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
17 years agox86_64: Remove serialize_cpu() inline
Andi Kleen [Wed, 17 Oct 2007 16:04:36 +0000 (18:04 +0200)]
x86_64: Remove serialize_cpu() inline

- It was redundant with sync_core()
- It was unused
- It was broken: no input arguments to cpuid; could fault randomly
  depending on eax contents.

Now it's gone.

[ tglx: arch/x86 adaptation ]

Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agoi386: misc cpuinit annotations
Satyam Sharma [Wed, 17 Oct 2007 16:04:36 +0000 (18:04 +0200)]
i386: misc cpuinit annotations

cpuid_class_cpu_callback() is callback function of a CPU hotplug
notifier_block (that is already marked as __cpuinitdata). Therefore
it can safely be marked as __cpuinit.

cpuid_device_create() is only referenced from other functions that
are __cpuinit or __init. So it can also be safely marked __cpuinit.

[ tglx: arch/x86 adaptation ]

Signed-off-by: Satyam Sharma <satyam@infradead.org>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agoi386: Misc cpuinit annotations
Satyam Sharma [Wed, 17 Oct 2007 16:04:36 +0000 (18:04 +0200)]
i386: Misc cpuinit annotations

msr_class_cpu_callback() can be marked __cpuinit, being the notifier
callback for a __cpuinitdata notifier_block. So can be marked
msr_device_create() too, called only from the newly-__cpuinit
msr_class_cpu_callback() or from __init-marked msr_init().

[ tglx: arch/x86 adaptation ]

Signed-off-by: Satyam Sharma <satyam@infradead.org>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agox86: add cpu codenames for Kconfig.cpu
Oliver Pinter [Wed, 17 Oct 2007 16:04:36 +0000 (18:04 +0200)]
x86: add cpu codenames for Kconfig.cpu

add cpu core name for arch/i386/Kconfig.cpu:Pentium 4 sections help
add Pentium D for arch/i386/Kconfig.cpu
add Pentium D for arch/x86_64/Kconfig

AK: Clarified some of the descriptions
[ tglx: arch/x86 adaptation ]

Signed-off-by: Oliver Pinter <oliver.pntr@gmail.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agoi386: Clean up duplicate includes in arch/i386/xen/
Jesper Juhl [Wed, 17 Oct 2007 16:04:36 +0000 (18:04 +0200)]
i386: Clean up duplicate includes in arch/i386/xen/

This patch cleans up duplicate includes in
arch/i386/xen/

[ tglx: arch/x86 adaptation ]

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agoi386: make some variables static
Adrian Bunk [Wed, 17 Oct 2007 16:04:36 +0000 (18:04 +0200)]
i386: make some variables static

This patch makes some needlessly global variables static.

[ tglx: arch/x86 adaptation ]

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agox86: hide cond_syscall behind __KERNEL__
Mike Frysinger [Wed, 17 Oct 2007 16:04:36 +0000 (18:04 +0200)]
x86: hide cond_syscall behind __KERNEL__

This brings x86_64 into line with all other architectures by only defining
cond_syscall() when __KERNEL__ is defined.

[ tglx: arch/x86 adaptation ]

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agoi386: make struct apic_probe static
Adrian Bunk [Wed, 17 Oct 2007 16:04:36 +0000 (18:04 +0200)]
i386: make struct apic_probe static

This patch makes the needlessly global struct apic_probe static.

[ tglx: arch/x86 adaptation ]

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agox86: 0 -> NULL, for arch/x86_64
Yoann Padioleau [Wed, 17 Oct 2007 16:04:35 +0000 (18:04 +0200)]
x86: 0 -> NULL, for arch/x86_64

When comparing a pointer, it's clearer to compare it to NULL than to 0.

[ tglx: arch/x86 adaptation ]

Signed-off-by: Yoann Padioleau <padator@wanadoo.fr>
Signed-off-by: Andi Kleen <ak@suse.de>
Cc: ak@suse.de
Cc: discuss@x86-64.org
Cc: akpm@linux-foundation.org
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agoi386: Clean up duplicate includes in arch/i386/kernel/
Jesper Juhl [Wed, 17 Oct 2007 16:04:35 +0000 (18:04 +0200)]
i386: Clean up duplicate includes in arch/i386/kernel/

This patch cleans up duplicate includes in arch/i386/kernel/

[ tglx: arch/x86 adaptation ]

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agox86: remove rogue default m in drivers/video/Kconfig
Andi Kleen [Wed, 17 Oct 2007 16:04:35 +0000 (18:04 +0200)]
x86: remove rogue default m in drivers/video/Kconfig

Remove rogue default m in drivers/video/Kconfig

default m is near always wrong, like here. For some reason ACPI
likes to reintroduce these and I like to immediately squash them again
before they pollute too many .configs.

Cc: len.brown@intel.com
Cc: luming.yu@gmail.com
Acked-by: Len Brown <len.brown@intel.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agox86: intel_cacheinfo misc section annotation fixes
Satyam Sharma [Wed, 17 Oct 2007 16:04:35 +0000 (18:04 +0200)]
x86: intel_cacheinfo misc section annotation fixes

cache_shared_cpu_map_setup() and cache_remove_shared_cpu_map()
are functions called from another function that is __cpuinit.  But the
!CONFIG_SMP empty-body stubs of these functions are unconditionally
marked __init, which is actively wrong, and will lead to oops.  But we
never saw this oops, because they always managed to get inlined in their
callsites, by virtue of being empty-body stubs!  They should still be
__cpuinit, of course.

assocs[], levels[] and types[] are only referenced from function that is
__cpuinit.  So these are candidates for being marked __cpuinitdata.

[akpm@linux-foundation.org: build fix]
Signed-off-by: Satyam Sharma <satyam@infradead.org>
Cc: Andi Kleen <ak@suse.de>
Cc: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agox86: use dev_to_node() to get node for device in dma_alloc_pages()
Yinghai Lu [Wed, 17 Oct 2007 16:04:35 +0000 (18:04 +0200)]
x86: use dev_to_node() to get node for device in dma_alloc_pages()

use dev_to_node() to get node for device in dma_alloc_pages().

Signed-off-by: Yinghai Lu <yinghai.lu@sun.com>
Acked-by: Christoph Lameter <clameter@sgi.com>
Cc: Christoph Lameter <clameter@sgi.com>
Cc: Andy Whitcroft <apw@shadowen.org>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agox86: pci use pci=bfsort for HP DL385 G2 and DL585 G2
Michal Schmidt [Wed, 17 Oct 2007 16:04:35 +0000 (18:04 +0200)]
x86: pci use pci=bfsort for HP DL385 G2 and DL585 G2

HP ProLiant systems DL385 G2 and DL585 G2 need pci=bfsort to enumerate PCI
devices in the expected order.

Matt sayeth:

  biosdevname is a userspace app I wrote to help solve this so we don't need
  to patch the kernel for future systems.  It's not integrated into any
  distributions properly yet, but is included in openSUSE 10.3 and Fedora 8
  for people who want to download and install it there.  It acts as a udev
  helper.

  For the time being, patching the kernel is necessary.  I really hope
  biosdevname eliminates that need in future distributions.

  http://linux.dell.com/biosdevname/

Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
Cc: <john.cagle@hp.com>
Cc: Matt Domsch <Matt_Domsch@dell.com>
Cc: Andy Gospodarek <andy@greyhouse.net>
Cc: Greg KH <greg@kroah.com>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agox86: Calgary: fix disable busnum for CalIOC2
Muli Ben-Yehuda [Wed, 17 Oct 2007 16:04:35 +0000 (18:04 +0200)]
x86: Calgary: fix disable busnum for CalIOC2

The old check we used based on dev->bus->number is wrong for devices on
CalIOC2.  Instead look whether we have an IOMMU table for that bus - if
not, translation is disabled.

Thanks to Murillo Fernandes Bernardes <bernarde@br.ibm.com> for
spotting, suggesting a fix and testing.

Signed-off-by: Muli Ben-Yehuda <muli@il.ibm.com>
Acked-by: Murillo Fernandes Bernardes <bernarde@br.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agox86: NX bit handling in change_page_attr()
Huang, Ying [Wed, 17 Oct 2007 16:04:35 +0000 (18:04 +0200)]
x86: NX bit handling in change_page_attr()

This patch fixes a bug of change_page_attr/change_page_attr_addr on
Intel x86_64 CPUs.  After changing page attribute to be executable with
these functions, the page remains un-executable on Intel x86_64 CPU.
Because on Intel x86_64 CPU, only if the "NX" bits of all four level
page tables are cleared, the corresponding page is executable (refer to
section 4.13.2 of Intel 64 and IA-32 Architectures Software Developer's
Manual).  So, the bug is fixed through clearing the "NX" bit of PMD when
splitting the huge PMD.

Signed-off-by: Huang Ying <ying.huang@intel.com>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agox86: voyager don't try to support uniprocessor builds
James Bottomley [Wed, 17 Oct 2007 16:04:35 +0000 (18:04 +0200)]
x86: voyager don't try to support uniprocessor builds

A while ago Randy Dunlap and Adrian Bunk suggested we simply prevent UP
voyager building.  I resisted this on the grounds that the nagging was the
only thing that was going to cause me to look at this.  However, now I
think we should probably take this course.

Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agox86: stop nmi softlockup warnings in show_mem()
Prarit Bhargava [Wed, 17 Oct 2007 16:04:34 +0000 (18:04 +0200)]
x86: stop nmi softlockup warnings in show_mem()

When dumping memory via sysrq-m it is possible to take a bogus NMI
watchdog or softlockup watchdog because the dump can take a long time on
big memory systems.

Occasionally tickle the watchdog when doing the dump.

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
17 years agox86: fix CONFIG_PAGEALLOC related boot hangs/OOMs
Ingo Molnar [Wed, 17 Oct 2007 16:04:34 +0000 (18:04 +0200)]
x86: fix CONFIG_PAGEALLOC related boot hangs/OOMs

if CONFIG_PAGEALLOC is enabled then X86_FEATURE_PSE is disabled and all
the kernel physical RAM pagetables are set up as 4K pages. This is
needed so that CONFIG_PAGEALLOC can do finegrained mapping and unmapping
of pages.

as a side-effect though, the total size of memory allocated as kernel
pagetables increases significantly. All these pagetables are allocated
via alloc_bootmem_low_pages(), straight out of the lowmem DMA pool. If
the system has enough RAM and a large kernel image then almost all of
the 16 MB lowmem DMA pool is allocated to the image and to pagetables -
leaving no space for __GFP_DMA allocations.

this results in drivers failing and the bootup hanging:

 swapper invoked oom-killer: gfp_mask=0x80d1, order=0, oomkilladj=0
  [<4015059f>] out_of_memory+0x17f/0x1c0
  [<40151f3c>] __alloc_pages+0x37c/0x3a0
  [<40168cd7>] slob_new_page+0x37/0x50
  [<40168dff>] slob_alloc+0x10f/0x190
  [<40169010>] __kmalloc_node+0x80/0x90
  [<405a17e3>] scsi_host_alloc+0x33/0x2c0
  [<405a1a82>] scsi_register+0x12/0x60
  [<40d5889e>] aha1542_detect+0x9e/0x940
  [<405c5ba5>] ultrastor_detect+0x265/0x5f0
  [<401352f5>] getnstimeofday+0x35/0xf0
  [<40d58751>] init_this_scsi_driver+0x41/0xf0
  [<40d0b856>] kernel_init+0x136/0x310
  [<40d58710>] init_this_scsi_driver+0x0/0xf0
  [<40d0b720>] kernel_init+0x0/0x310
  [<40105547>] kernel_thread_helper+0x7/0x10
  =======================

the fix is to first allocate from above the DMA pool, and if that fails
(for example due to it being a machine with less than 16 MB of RAM),
allocate from the DMA pool as a fallback.

With this fix applied i was able to boot a PAGEALLOC=y kernel that would
hang before.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agox86: prepare page allocator for high allocations on PAGEALLOC=y
Ingo Molnar [Wed, 17 Oct 2007 16:04:34 +0000 (18:04 +0200)]
x86: prepare page allocator for high allocations on PAGEALLOC=y

To preserve the DMA pool in CONFIG_DEBUG_PAGEALLOC=y kernels, we'll
allocate pagetables from above the 16MB DMA limit, so we'll have to set
up boot pagetables to cover 16MB more RAM (worst-case).

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agox86: do not crash on non-Geode PCs in TSC probe
Ingo Molnar [Wed, 17 Oct 2007 16:04:34 +0000 (18:04 +0200)]
x86: do not crash on non-Geode PCs in TSC probe

with this fix Geode kernels can be booted (and QA-ed) on generic PCs.

otherwise it crashes and burns during early bootup:

Detected 2160.212 MHz processor.
general protection fault: 0000 [#1]
PREEMPT SMP
Modules linked in:
CPU:    0
EIP:    0060:[<c09071f6>]    Not tainted VLI
EFLAGS: 00010002   (2.6.23-rc9 #90)
EIP is at tsc_init+0xa6/0x150
eax: 00000001   ebx: c1dce000   ecx: 00001900   edx: 00000001
esi: 00051000   edi: 00051000   ebp: c08fdfc4   esp: c08fdfa4
ds: 007b   es: 007b   fs: 00d8  gs: 0000  ss: 0068
Process swapper (pid: 0, ti=c08fc000 task=c082a180 task.ti=c08fc000)
Stack: c076b870 00000870 000000d4 0000001d c0831e80 c1dce000 00051000 00051000
       c08fdfcc c09053f8 c08fdff8 c09045ff 000001e2 c09040a0 00051000 00000020
       0004e500 c0932140 00020800 00099800 c08ed000 01409007 00000000
Call Trace:
 [<c010517a>] show_trace_log_lvl+0x1a/0x30
 [<c0105246>] show_stack_log_lvl+0xb6/0x100
 [<c0105732>] show_registers+0x212/0x3a0
 [<c0105aa4>] die+0x104/0x220
 [<c0105f5f>] do_general_protection+0x1ef/0x2b0
 [<c06699f2>] error_code+0x72/0x78
 [<c09053f8>] time_init+0x8/0x20
 [<c09045ff>] start_kernel+0x1af/0x320
 [<00000000>] 0x0
 =======================
Code: 31 d2 b8 00 00 09 3d f7 35 2c 70 9b c0 a3 04 95 8f c0 e8 ce 4e 99 ff b8 e0 45 93 c0 e8 94 b1 c5 ff e8 7f 3d 80 ff b9 00 19 00 00 <0f> 32 f6 c4 01 74 07 83 25 24 ce 82 c0 fd 8b 0d 20 ce 82 c0 b8
EIP: [<c09071f6>] tsc_init+0xa6/0x150 SS:ESP 0068:c08fdfa4
Kernel panic - not syncing: Attempted to kill the idle task!

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agox86: enable NMI watchdog on nosmp
Ingo Molnar [Wed, 17 Oct 2007 16:04:34 +0000 (18:04 +0200)]
x86: enable NMI watchdog on nosmp

if nosmp has been passed as a boot option, but nmi_watchdog=2 has also
been enabled then keep minimal local APIC functionality around to make
the watchdog work.

this allowed me to debug a hard hang that would only occur with a nosmp
bootup.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agox86_64: Fix compat emulation of PTRACE_GET/SET_THREAD_AREA
Andi Kleen [Wed, 17 Oct 2007 16:04:34 +0000 (18:04 +0200)]
x86_64: Fix compat emulation of PTRACE_GET/SET_THREAD_AREA

Since the 64bit kernel has different indexes for this TLS segments
the address needs to be adjusted in the ptrace 32bit emulation.

[ tglx: arch/x86 adaptation ]

Reported-by: Amnon Shiloh
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agox86: call free_init_pages() with irqs enabled in alternative_instructions()
Fengguang Wu [Wed, 17 Oct 2007 16:04:34 +0000 (18:04 +0200)]
x86: call free_init_pages() with irqs enabled in alternative_instructions()

In alternative_instructions(), call free_init_pages() with irqs enabled.

It fixes the warning message in smp_call_function*(), which should not be
called with irqs disabled.

[    0.310000] CPU: L1 I Cache: 64K (64 bytes/line), D cache 64K (64 bytes/line)
[    0.310000] CPU: L2 Cache: 512K (64 bytes/line)
[    0.310000] CPU 0/0 -> Node 0
[    0.310000] SMP alternatives: switching to UP code
[    0.310000] Freeing SMP alternatives: 25k freed
[    0.310000] WARNING: at arch/x86_64/kernel/smp.c:397 smp_call_function_mask()
[    0.310000]
[    0.310000] Call Trace:
[    0.310000]  [<ffffffff8100dbde>] dump_trace+0x3ee/0x4a0
[    0.310000]  [<ffffffff8100dcd3>] show_trace+0x43/0x70
[    0.310000]  [<ffffffff8100dd15>] dump_stack+0x15/0x20
[    0.310000]  [<ffffffff8101cd44>] smp_call_function_mask+0x94/0xa0
[    0.310000]  [<ffffffff8101d0b2>] smp_call_function+0x32/0x40
[    0.310000]  [<ffffffff8104277f>] on_each_cpu+0x1f/0x50
[    0.310000]  [<ffffffff81026eac>] global_flush_tlb+0x8c/0x110
[    0.310000]  [<ffffffff81025c85>] free_init_pages+0xe5/0xf0
[    0.310000]  [<ffffffff81549b5e>] alternative_instructions+0x7e/0x150
[    0.310000]  [<ffffffff8154a2ea>] check_bugs+0x1a/0x20
[    0.310000]  [<ffffffff81540c4a>] start_kernel+0x2da/0x380
[    0.310000]  [<ffffffff81540132>] _sinittext+0x132/0x140
[    0.310000]
[    0.320000] ACPI: Core revision 20070126
[    0.560000] Using local APIC timer interrupts.
[    0.590000] Detected 62.496 MHz APIC timer.
[    0.590000] Brought up 1 CPUs

[ tglx: arch/x86 adaptation ]

Cc: Laurent Vivier <Laurent.Vivier@bull.net>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Fengguang Wu <wfg@mail.ustc.edu.cn>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agox86: mark read_crX() asm code as volatile
Kirill Korotaev [Wed, 17 Oct 2007 16:04:33 +0000 (18:04 +0200)]
x86: mark read_crX() asm code as volatile

Some gcc versions (I checked at least 4.1.1 from RHEL5 & 4.1.2 from gentoo)
can generate incorrect code with read_crX()/write_crX() functions mix up,
due to cached results of read_crX().

The small app for x8664 below compiled with -O2 demonstrates this
(i686 does the same thing):

17 years agox86: initialize 64bit registers for a.out executables
Andi Kleen [Wed, 17 Oct 2007 16:04:33 +0000 (18:04 +0200)]
x86: initialize 64bit registers for a.out executables

Previously the data from before the exec was kept in there. Zero
them instead.

[ tglx: arch/x86 adaptation ]

Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agox86: return correct error code from child_rip in x86_64 entry.S
Andrey Mirkin [Wed, 17 Oct 2007 16:04:33 +0000 (18:04 +0200)]
x86: return correct error code from child_rip in x86_64 entry.S

Right now register edi is just cleared before calling do_exit.
That is wrong because correct return value will be ignored.
Value from rax should be copied to rdi instead of clearing edi.

AK: changed to 32bit move because it's strictly an int

[ tglx: arch/x86 adaptation ]

Signed-off-by: Andrey Mirkin <major@openvz.org>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agoi386: avoid temporarily inconsistent pte-s
Jan Beulich [Wed, 17 Oct 2007 16:04:33 +0000 (18:04 +0200)]
i386: avoid temporarily inconsistent pte-s

One more of these issues (which were considered fixed a few releases
back): other than on x86-64, i386 allows set_fixmap() to replace
already present mappings. Consequently, on PAE, care must be taken to
not update the high half of a pte while the low half is still holding
the old value.

[ tglx: arch/x86 adaptation ]

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
 arch/x86/mm/pgtable_32.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

17 years agoi386: fix section mismatch warning in intel.c
Sam Ravnborg [Wed, 17 Oct 2007 16:04:33 +0000 (18:04 +0200)]
i386: fix section mismatch warning in intel.c

Fix following section mismatch warning:
WARNING: vmlinux.o(.text+0xc88c): Section mismatch: reference to .init.text:trap_init_f00f_bug (between 'init_intel' and 'cpuid4_cache_lookup')

init_intel are __cpuint where trap_init_f00f_bug is __init.
Fixed by declaring trap_init_f00f_bug __cpuinit.

Moved the defintion of trap_init_f00f_bug to the sole user in init.c
so the ugly prototype in intel.c could get killed.

Frank van Maarseveen <frankvm@frankvm.com> supplied the .config used
to reproduce the warning.

[ tglx: arch/x86 adaptation ]

Cc: Frank van Maarseveen <frankvm@frankvm.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agoi386: Fix section mismatch
Satyam Sharma [Wed, 17 Oct 2007 16:04:33 +0000 (18:04 +0200)]
i386: Fix section mismatch

Fix bugzilla #8679

WARNING: arch/i386/kernel/built-in.o(.data+0x2148): Section mismatch: reference
to .init.text: (between 'thermal_throttle_cpu_notifier' and 'mtrr_mutex')

comes because struct notifier_block thermal_throttle_cpu_notifier in
arch/i386/kernel/cpu/mcheck/therm_throt.c goes in .data section but the
notifier callback function itself has been marked __cpuinit which becomes
__init == .init.text when HOTPLUG_CPU=n.  The warning is bogus because the
callback will never be called out if HOTPLUG_CPU=n in the first place (as
one can see from kernel/cpu.c, the cpu_chain itself is __cpuinitdata :-)

So, let's mark thermal_throttle_cpu_notifier as __cpuinitdata to fix
the section mismatch warning.

[ tglx: arch/x86 adaptation ]

Signed-off-by: Satyam Sharma <satyam@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agoi386: fix 4 bit apicid assumption of mach-default
Siddha, Suresh B [Wed, 17 Oct 2007 16:04:33 +0000 (18:04 +0200)]
i386: fix 4 bit apicid assumption of mach-default

Fix get_apic_id() in mach-default, so that it uses 8 bits incase of
xAPIC case and 4 bits for legacy APIC case.

This fixes the i386 kernel assumption that apic id is less than 16 for
xAPIC platforms with 8 cpus or less and makes the kernel boot on such
platforms.

[ tglx: arch/x86 adaptation ]

Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Cc: Andi Kleen <ak@suse.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agox86: fix off-by-one in find_next_zero_string
Andrew Hastings [Wed, 17 Oct 2007 16:04:33 +0000 (18:04 +0200)]
x86: fix off-by-one in find_next_zero_string

Fix an off-by-one error in find_next_zero_string which prevents
allocating the last bit.

[ tglx: arch/x86 adaptation ]

Signed-off-by: Andrew Hastings <abh@cray.com> on behalf of Cray Inc.
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agoi386: export i386 smp_call_function_mask() to modules
Laurent Vivier [Wed, 17 Oct 2007 16:04:33 +0000 (18:04 +0200)]
i386: export i386 smp_call_function_mask() to modules

This patch export i386 smp_call_function_mask() with EXPORT_SYMBOL().

This function is needed by KVM to call a function on a set of CPUs.

[ tglx: arch/x86 adaptation ]

Signed-off-by: Laurent Vivier <Laurent.Vivier@bull.net>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agox86: Install unstripped copy of 64bit vdso to disk
Roland McGrath [Wed, 17 Oct 2007 16:04:32 +0000 (18:04 +0200)]
x86: Install unstripped copy of 64bit vdso to disk

This keeps an unstripped copy of the 64bit vDSO images built before they are
stripped and embedded in the kernel.  The unstripped copies get installed
in $(MODLIB)/vdso/ by "make install" (or you can explicitly use the
subtarget "make vdso_install").  These files can be useful when they
contain source-level debugging information.

[ tglx: arch/x86 adaptation ]

Signed-off-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agox86_64: install unstripped copies of compat vdso on disk
Roland McGrath [Wed, 17 Oct 2007 16:04:32 +0000 (18:04 +0200)]
x86_64: install unstripped copies of compat vdso on disk

This keeps an unstripped copy of the vDSO images built before they are
stripped and embedded in the kernel.  The unstripped copies get installed
in $(MODLIB)/vdso/ by "make install" (or you can explicitly use the
subtarget "make vdso_install").  These files can be useful when they
contain source-level debugging information.

[ tglx: arch/x86 adaptation ]

Signed-off-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agoi386: setup_trampoline() must be __cpuinit
Adrian Bunk [Wed, 17 Oct 2007 16:04:32 +0000 (18:04 +0200)]
i386: setup_trampoline() must be __cpuinit

WARNING: arch/i386/kernel/built-in.o(.text+0xf201): Section mismatch: reference to .init.data:trampoline_end (between 'setup_trampoline' and 'cpu_coregroup_map')
WARNING: arch/i386/kernel/built-in.o(.text+0xf207): Section mismatch: reference to .init.data:trampoline_data (between 'setup_trampoline' and 'cpu_coregroup_map')
WARNING: arch/i386/kernel/built-in.o(.text+0xf21a): Section mismatch: reference to .init.data:trampoline_data (between 'setup_trampoline' and 'cpu_coregroup_map')

Harmless but annoying warnings present when building an i386 SMP kernel
with CONFIG_HOTPLUG_CPU=n and gcc < 4.0 .

[ tglx: arch/x86 adaptation ]

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agox86: clean up apicid_to_node declaration
Andrew Morton [Wed, 17 Oct 2007 16:04:32 +0000 (18:04 +0200)]
x86: clean up apicid_to_node declaration

Use the correct #define in the declaration of apicid_to_node[], to
match the definition.

[ tglx: arch/x86 adaptation ]

Cc: Andi Kleen <ak@suse.de>
Cc: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agoi386: make Oprofile call shutdown() only once per session
Stephane Eranian [Wed, 17 Oct 2007 16:04:32 +0000 (18:04 +0200)]
i386: make Oprofile call shutdown() only once per session

Oprofile: call model->shutdown() only once to avoid calling release_ev*()
multiple times

[ tglx: arch/x86 adaptation ]

Signed-off-by: Stephane Eranian <eranian@hpl.hp.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17 years agox86: C1E late detection fix. Really switch off lapic timer
Thomas Gleixner [Wed, 17 Oct 2007 16:04:32 +0000 (18:04 +0200)]
x86: C1E late detection fix. Really switch off lapic timer

Doh, I completely missed that devices marked DUMMY are not running
the set_mode function. So we force broadcasting, but we keep the
local APIC timer running.

Let the clock event layer mark the device _after_ switching it off.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
17 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/mingo/linux-2.6-sched
Linus Torvalds [Wed, 17 Oct 2007 16:11:18 +0000 (09:11 -0700)]
Merge git://git./linux/kernel/git/mingo/linux-2.6-sched

* git://git.kernel.org/pub/scm/linux/kernel/git/mingo/linux-2.6-sched:
  sched: fix new task startup crash
  sched: fix !SYSFS build breakage
  sched: fix improper load balance across sched domain
  sched: more robust sd-sysctl entry freeing

17 years agoMerge branch 'for-linus' of git://git.kernel.dk/data/git/linux-2.6-block
Linus Torvalds [Wed, 17 Oct 2007 16:08:13 +0000 (09:08 -0700)]
Merge branch 'for-linus' of git://git.kernel.dk/data/git/linux-2.6-block

* 'for-linus' of git://git.kernel.dk/data/git/linux-2.6-block:
  [SCSI] Remove full sg table memset()
  [SCSI] ide-scsi: remove usage of sg_last()
  Fix loop terminating conditions in fill_sg().
  [BLOCK] Clear sg entry before filling in blk_rq_map_sg()
  IA64: iommu uses sg_next with an invalid sg element
  cciss: disable DMA refetch on Smart Array P600
  swiotlb: fix map_sg failure handling
  SPARC64: fix iommu sg chaining
  [SCSI] ide-scsi: use scsi_sg_count() instead of ->use_sg

17 years agoMerge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
Linus Torvalds [Wed, 17 Oct 2007 16:05:55 +0000 (09:05 -0700)]
Merge branch 'merge' of git://git./linux/kernel/git/paulus/powerpc

* 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc: (24 commits)
  [POWERPC] Fix vmemmap warning in init_64.c
  [POWERPC] Fix 64 bits vDSO DWARF info for CR register
  [POWERPC] Add 1TB workaround for PA6T
  [POWERPC] Enable NO_HZ and high res timers for pseries and ppc64 configs
  [POWERPC] Quieten cache information at boot
  [POWERPC] Quieten clockevent printk
  [POWERPC] Enable SLUB in *_defconfig
  [POWERPC] Fix 1TB segment detection
  [POWERPC] Fix iSeries_hpte_insert prototype
  [POWERPC] Fix copyright symbol
  [POWERPC] ibmebus: Move to of_device and of_platform_driver, match eHCA and eHEA drivers
  [POWERPC] ibmebus: Add device creation and bus probing based on of_device
  [POWERPC] ibmebus: Remove bus match/probe/remove functions
  [POWERPC] Move of_device allocation into of_device.[ch]
  [POWERPC] mpc52xx: device tree changes for FEC and MDIO
  [POWERPC] bestcomm: GenBD task support
  [POWERPC] bestcomm: FEC task support
  [POWERPC] bestcomm: ATA task support
  [POWERPC] bestcomm: core bestcomm support for Freescale MPC5200
  [POWERPC] mpc52xx: Update mpc52xx_psc structure with B revision changes
  ...

17 years agoMerge branch 'for-linus' of git://oss.sgi.com:8090/xfs/xfs-2.6
Linus Torvalds [Wed, 17 Oct 2007 16:04:11 +0000 (09:04 -0700)]
Merge branch 'for-linus' of git://oss.sgi.com:8090/xfs/xfs-2.6

* 'for-linus' of git://oss.sgi.com:8090/xfs/xfs-2.6: (59 commits)
  [XFS] eagerly remove vmap mappings to avoid upsetting Xen
  [XFS] simplify validata_fields
  [XFS] no longer using io_vnode, as was remaining from 23 cherrypick
  [XFS] Remove STATIC which was missing from prior manual merge
  [XFS] Put back the QUEUE_ORDERED_NONE test in the barrier check.
  [XFS] Turn off XBF_ASYNC flag before re-reading superblock.
  [XFS] avoid race in sync_inodes() that can fail to write out all dirty data
  [XFS] This fix prevents bulkstat from spinning in an infinite loop.
  [XFS] simplify xfs_create/mknod/symlink prototype
  [XFS] avoid xfs_getattr in XFS_IOC_FSGETXATTR ioctl
  [XFS] get_bulkall() could return incorrect inode state
  [XFS] Kill unused IOMAP_EOF flag
  [XFS] fix when DMAPI mount option processing happens
  [XFS] ensure file size is logged on synchronous writes
  [XFS] growlock should be a mutex
  [XFS] replace some large xfs_log_priv.h macros by proper functions
  [XFS] kill struct bhv_vfs
  [XFS] move syncing related members from struct bhv_vfs to struct xfs_mount
  [XFS] kill the vfs_flags member in struct bhv_vfs
  [XFS] kill the vfs_fsid and vfs_altfsid members in struct bhv_vfs
  ...

17 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/hpa/linux...
Linus Torvalds [Wed, 17 Oct 2007 16:00:30 +0000 (09:00 -0700)]
Merge branch 'master' of git://git./linux/kernel/git/hpa/linux-2.6-x86setup

* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/hpa/linux-2.6-x86setup:
  Remove magic macros for screen_info structure members
  [x86] remove uses of magic macros for boot_params access

17 years agosecurity/ cleanups
Adrian Bunk [Wed, 17 Oct 2007 06:31:38 +0000 (23:31 -0700)]
security/ cleanups

This patch contains the following cleanups that are now possible:
- remove the unused security_operations->inode_xattr_getsuffix
- remove the no longer used security_operations->unregister_security
- remove some no longer required exit code
- remove a bunch of no longer used exports

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Acked-by: James Morris <jmorris@namei.org>
Cc: Chris Wright <chrisw@sous-sol.org>
Cc: Stephen Smalley <sds@tycho.nsa.gov>
Cc: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoImplement file posix capabilities
Serge E. Hallyn [Wed, 17 Oct 2007 06:31:36 +0000 (23:31 -0700)]
Implement file posix capabilities

Implement file posix capabilities.  This allows programs to be given a
subset of root's powers regardless of who runs them, without having to use
setuid and giving the binary all of root's powers.

This version works with Kaigai Kohei's userspace tools, found at
http://www.kaigai.gr.jp/index.php.  For more information on how to use this
patch, Chris Friedhoff has posted a nice page at
http://www.friedhoff.org/fscaps.html.

Changelog:
Nov 27:
Incorporate fixes from Andrew Morton
(security-introduce-file-caps-tweaks and
security-introduce-file-caps-warning-fix)
Fix Kconfig dependency.
Fix change signaling behavior when file caps are not compiled in.

Nov 13:
Integrate comments from Alexey: Remove CONFIG_ ifdef from
capability.h, and use %zd for printing a size_t.

Nov 13:
Fix endianness warnings by sparse as suggested by Alexey
Dobriyan.

Nov 09:
Address warnings of unused variables at cap_bprm_set_security
when file capabilities are disabled, and simultaneously clean
up the code a little, by pulling the new code into a helper
function.

Nov 08:
For pointers to required userspace tools and how to use
them, see http://www.friedhoff.org/fscaps.html.

Nov 07:
Fix the calculation of the highest bit checked in
check_cap_sanity().

Nov 07:
Allow file caps to be enabled without CONFIG_SECURITY, since
capabilities are the default.
Hook cap_task_setscheduler when !CONFIG_SECURITY.
Move capable(TASK_KILL) to end of cap_task_kill to reduce
audit messages.

Nov 05:
Add secondary calls in selinux/hooks.c to task_setioprio and
task_setscheduler so that selinux and capabilities with file
cap support can be stacked.

Sep 05:
As Seth Arnold points out, uid checks are out of place
for capability code.

Sep 01:
Define task_setscheduler, task_setioprio, cap_task_kill, and
task_setnice to make sure a user cannot affect a process in which
they called a program with some fscaps.

One remaining question is the note under task_setscheduler: are we
ok with CAP_SYS_NICE being sufficient to confine a process to a
cpuset?

It is a semantic change, as without fsccaps, attach_task doesn't
allow CAP_SYS_NICE to override the uid equivalence check.  But since
it uses security_task_setscheduler, which elsewhere is used where
CAP_SYS_NICE can be used to override the uid equivalence check,
fixing it might be tough.

     task_setscheduler
 note: this also controls cpuset:attach_task.  Are we ok with
     CAP_SYS_NICE being used to confine to a cpuset?
     task_setioprio
     task_setnice
 sys_setpriority uses this (through set_one_prio) for another
 process.  Need same checks as setrlimit

Aug 21:
Updated secureexec implementation to reflect the fact that
euid and uid might be the same and nonzero, but the process
might still have elevated caps.

Aug 15:
Handle endianness of xattrs.
Enforce capability version match between kernel and disk.
Enforce that no bits beyond the known max capability are
set, else return -EPERM.
With this extra processing, it may be worth reconsidering
doing all the work at bprm_set_security rather than
d_instantiate.

Aug 10:
Always call getxattr at bprm_set_security, rather than
caching it at d_instantiate.

[morgan@kernel.org: file-caps clean up for linux/capability.h]
[bunk@kernel.org: unexport cap_inode_killpriv]
Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
Cc: Stephen Smalley <sds@tycho.nsa.gov>
Cc: James Morris <jmorris@namei.org>
Cc: Chris Wright <chrisw@sous-sol.org>
Cc: Andrew Morgan <morgan@kernel.org>
Signed-off-by: Andrew Morgan <morgan@kernel.org>
Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoifdef struct task_struct::security
Alexey Dobriyan [Wed, 17 Oct 2007 06:31:35 +0000 (23:31 -0700)]
ifdef struct task_struct::security

For those who don't care about CONFIG_SECURITY.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Cc: "Serge E. Hallyn" <serge@hallyn.com>
Cc: Casey Schaufler <casey@schaufler-ca.com>
Cc: James Morris <jmorris@namei.org>
Cc: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agosecurity: Convert LSM into a static interface
James Morris [Wed, 17 Oct 2007 06:31:32 +0000 (23:31 -0700)]
security: Convert LSM into a static interface

Convert LSM into a static interface, as the ability to unload a security
module is not required by in-tree users and potentially complicates the
overall security architecture.

Needlessly exported LSM symbols have been unexported, to help reduce API
abuse.

Parameters for the capability and root_plug modules are now specified
at boot.

The SECURITY_FRAMEWORK_VERSION macro has also been removed.

In a nutshell, there is no safe way to unload an LSM.  The modular interface
is thus unecessary and broken infrastructure.  It is used only by out-of-tree
modules, which are often binary-only, illegal, abusive of the API and
dangerous, e.g.  silently re-vectoring SELinux.

[akpm@linux-foundation.org: cleanups]
[akpm@linux-foundation.org: USB Kconfig fix]
[randy.dunlap@oracle.com: fix LSM kernel-doc]
Signed-off-by: James Morris <jmorris@namei.org>
Acked-by: Chris Wright <chrisw@sous-sol.org>
Cc: Stephen Smalley <sds@tycho.nsa.gov>
Cc: "Serge E. Hallyn" <serue@us.ibm.com>
Acked-by: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoAdd section IDs to Documentation/DocBook/filesystems.tmpl
Rob Landley [Wed, 17 Oct 2007 06:31:31 +0000 (23:31 -0700)]
Add section IDs to Documentation/DocBook/filesystems.tmpl

Add recommended section IDs to Documentation/DocBook/filesystems.tmpl

Signed-off-by: Rob Landley <rob@landley.net>
Cc: "Randy.Dunlap" <rdunlap@xenotime.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoFix "make htmldocs" build break.
Rob Landley [Wed, 17 Oct 2007 06:31:31 +0000 (23:31 -0700)]
Fix "make htmldocs" build break.

Fix two htmldocs build breaks, introduced by moving include/linux/usb_gadget.h to
include/linux/usb/gadget.h and combining resume.c and suspend.c into main.c in
drivers/base/power.

Signed-off-by: Rob Landley <rob@landley.net>
Cc: "Randy.Dunlap" <rdunlap@xenotime.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoAdd Documentation/RCU/00-Index
Rob Landley [Wed, 17 Oct 2007 06:31:30 +0000 (23:31 -0700)]
Add Documentation/RCU/00-Index

Add Documentation/RCU/00-INDEX

Signed-off-by: Rob Landley <rob@landley.net>
Acked-by: Paul E. McKenney <paulmck@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoAdd recommended section IDs to deviceiobook.tmpl
Rob Landley [Wed, 17 Oct 2007 06:31:30 +0000 (23:31 -0700)]
Add recommended section IDs to deviceiobook.tmpl

Add recommended section ID tags to deviceiobook.tmpl

Because otherwise the link #anchors in the html vary from build to build.

Signed-off-by: Rob Landley <rob@landley.net>
Cc: "Randy.Dunlap" <rdunlap@xenotime.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoremap_file_pages: kernel-doc corrections
Randy Dunlap [Wed, 17 Oct 2007 06:31:29 +0000 (23:31 -0700)]
remap_file_pages: kernel-doc corrections

Fix kernel-doc for sys_remap_file_pages() and add info to the 'prot' NOTE.
Rename __prot parameter to prot.

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Acked-by: Nick Piggin <nickpiggin@yahoo.com.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoDocumentation/vm/slabinfo.c: clean up this code
WANG Cong [Wed, 17 Oct 2007 06:31:29 +0000 (23:31 -0700)]
Documentation/vm/slabinfo.c: clean up this code

This patch does the following cleanups for Documentation/vm/slabinfo.c:

- Fix two memory leaks;
- Constify some char pointers;
- Use snprintf instead of sprintf in case of buffer overflow;
- Fix some indentations;
- Other little improvements.

Acked-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agovm.txt: document min_free_pages as critical for correctness
Pavel Machek [Wed, 17 Oct 2007 06:31:28 +0000 (23:31 -0700)]
vm.txt: document min_free_pages as critical for correctness

min_free_pages is critical for correctness, document it as such.

Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agokdump: documentation cleanups
Pavel Machek [Wed, 17 Oct 2007 06:31:28 +0000 (23:31 -0700)]
kdump: documentation cleanups

This cleans up kdump documentation a bit. Plus I do not think we want
to mention Linux trademark in _every_ file in documentation....

Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoUpdate DMA-mapping documentation
Matthew Wilcox [Wed, 17 Oct 2007 06:31:27 +0000 (23:31 -0700)]
Update DMA-mapping documentation

A couple of updates haven't considered whether the documentation makes
sense as a whole any more.  Three changes here:

 - Remove the reference to the "DAC Addressing for Address Space Hungry
   Devices" section which was deleted by Jan Beulich.
 - Remove the comment about DMA_24BIT_MASK which became obsolete when
   Tobias Klauser changed the code to actually use DMA_24BIT_MASK.
 - Remove the section "64-bit DMA and DAC cycle support" since it's
   fully covered above, and contains a reference to the section deleted
   by Jan.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoAdd Documentation/power/00-INDEX
Rob Landley [Wed, 17 Oct 2007 06:31:26 +0000 (23:31 -0700)]
Add Documentation/power/00-INDEX

Add Documentation/power/00-INDEX

Signed-off-by: Rob Landley <rob@landley.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoAdd entries to Documentation/powerpc
Rob Landley [Wed, 17 Oct 2007 06:31:26 +0000 (23:31 -0700)]
Add entries to Documentation/powerpc

Add two missing entries to Documentation/powerpc/00-INDEX

Signed-off-by: Rob Landley <rob@landley.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoAdd Documentation/{w1,w1/masters}/00-INDEX
Rob Landley [Wed, 17 Oct 2007 06:31:25 +0000 (23:31 -0700)]
Add Documentation/{w1,w1/masters}/00-INDEX

Two 00-INDEX files under Documentation/w1

Signed-off-by: Rob Landley <rob@landley.net>
Acked-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoAdd missing entries to top level Documentation/00-INDEX
Rob Landley [Wed, 17 Oct 2007 06:31:25 +0000 (23:31 -0700)]
Add missing entries to top level Documentation/00-INDEX

Add missing entries to Documentation/00-INDEX

Signed-off-by: Rob Landley <rob@landley.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoTweak Documentation/SM501.txt
Rob Landley [Wed, 17 Oct 2007 06:31:24 +0000 (23:31 -0700)]
Tweak Documentation/SM501.txt

The existing Documentation/SM501.txt gives no clue what the chip is or does,
so copy the description from Kconfig help text.

Acked-by: Ben Dooks <ben@simtec.co.uk>
Signed-off-by: Rob Landley <rob@landley.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoAdd reset_devices to the recommended parameters
Bernhard Walle [Wed, 17 Oct 2007 06:31:23 +0000 (23:31 -0700)]
Add reset_devices to the recommended parameters

This patch adds the "reset_devices" option (that's used only by one device
driver for now) to the recommended list of command line parameters for kdump.

Meaning (Documentation/kernel-parameters.txt):
    reset_devices   [KNL] Force drivers to reset the underlying device
                    during initialization.

Signed-off-by: Bernhard Walle <bwalle@suse.de>
Cc: "Randy.Dunlap" <rdunlap@xenotime.net>
Cc: Vivek Goyal <vgoyal@in.ibm.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Haren Myneni <hbabu@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoExpress new ELF32 mechanisms in documentation
Bernhard Walle [Wed, 17 Oct 2007 06:31:22 +0000 (23:31 -0700)]
Express new ELF32 mechanisms in documentation

This patch reflects the
http://git.kernel.org/?p=linux/kernel/git/horms/kexec-tools-testing.git;a=commit;h=b9c3648e690ad0dad12389659673206213a09760
change in kexec-tools-testing also now in the kernel documentation.

Signed-off-by: Bernhard Walle <bwalle@suse.de>
Cc: "Randy.Dunlap" <rdunlap@xenotime.net>
Cc: Vivek Goyal <vgoyal@in.ibm.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Haren Myneni <hbabu@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoUpdate help text for CONFIG_CRASH_DUMP
Randy Dunlap [Wed, 17 Oct 2007 06:31:22 +0000 (23:31 -0700)]
Update help text for CONFIG_CRASH_DUMP

Fix typos in CONFIG_RELOCATABLE.  Use tab + 2 spaces for indentation on all
lines.

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Bernhard Walle <bwalle@suse.de>
Cc: Vivek Goyal <vgoyal@in.ibm.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Haren Myneni <hbabu@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoExpress relocatability of kernel on x86_64 in documentation
Bernhard Walle [Wed, 17 Oct 2007 06:31:21 +0000 (23:31 -0700)]
Express relocatability of kernel on x86_64 in documentation

This patch adapts the Documentation/kdump/kdump.txt file to express the fact
that the x86_64 kernel is now also relocatable.  This makes i386 and x86_64
now behave the same, simplifying the documentation.

Signed-off-by: Bernhard Walle <bwalle@suse.de>
Cc: "Randy.Dunlap" <rdunlap@xenotime.net>
Cc: Vivek Goyal <vgoyal@in.ibm.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Haren Myneni <hbabu@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoDocumentation: delete unreferenced xterm-linux.xpm file
Robert P. J. Day [Wed, 17 Oct 2007 06:31:20 +0000 (23:31 -0700)]
Documentation: delete unreferenced xterm-linux.xpm file

Signed-off-by: Robert P. J. Day <rpjday@mindspring.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agokernel-doc: fix doc blocks and html
Randy Dunlap [Wed, 17 Oct 2007 06:31:20 +0000 (23:31 -0700)]
kernel-doc: fix doc blocks and html

Johannes Berg reports (Thanks!) that &struct names are not highlighted in
html output format when they are inside a DOC: block.

DOC: blocks were not escaped thru xml_escape() like other kernel-doc
comments were.  Fixed that.

However, that left a problem with <p> ($blankline_html) being processed
thru xml_escape(), converting it to &lt;p&gt;, which isn't good for the
generated html output (the <p> should remain unchanged), so this patch also
introduces the notion of "local" kernel-doc meta-characters
('\\\\mnemonic:'), which are converted to html just before writing the
stream to its output file.

Please report any problems that you (anyone) see in "highlighting" in any
output mode (text, man, html, xml).

Also update copyright to include me.

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoAdd a 00-INDEX file to Documentation/telephony/
Jesper Juhl [Wed, 17 Oct 2007 06:31:19 +0000 (23:31 -0700)]
Add a 00-INDEX file to Documentation/telephony/

Add a 00-INDEX file to Documentation/telephony/

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Acked-by: Rob Landley <rob@landley.net>
Cc: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoAdd a 00-INDEX file to Documentation/sysctl/
Jesper Juhl [Wed, 17 Oct 2007 06:31:19 +0000 (23:31 -0700)]
Add a 00-INDEX file to Documentation/sysctl/

Add a 00-INDEX file to Documentation/sysctl/

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Cc: Rob Landley <rob@landley.net>
Cc: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoAdd a 00-INDEX file to Documentation/mips/
Jesper Juhl [Wed, 17 Oct 2007 06:31:18 +0000 (23:31 -0700)]
Add a 00-INDEX file to Documentation/mips/

Add a 00-INDEX file to Documentation/mips/

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Cc: Rob Landley <rob@landley.net>
Cc: Randy Dunlap <rdunlap@xenotime.net>
Cc: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agodoc: move vm/00-INDEX to Documentation/vm
David Rientjes [Wed, 17 Oct 2007 06:31:17 +0000 (23:31 -0700)]
doc: move vm/00-INDEX to Documentation/vm

Looks like the 00-INDEX file lost its parent directory in -rc6-mm1.

Signed-off-by: David Rientjes <rientjes@google.com>
Cc: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoAdd a missing 00-INDEX file for Documentation/vm/
Jesper Juhl [Wed, 17 Oct 2007 06:31:17 +0000 (23:31 -0700)]
Add a missing 00-INDEX file for Documentation/vm/

This patch adds a 00-INDEX file to Documentation/vm/

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Acked-by: Rob Landley <rob@landley.net>
Cc: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoDocumentation: add entries to filesystems/00-INDEX for several untracked files
Denis Cheng [Wed, 17 Oct 2007 06:31:16 +0000 (23:31 -0700)]
Documentation: add entries to filesystems/00-INDEX for several untracked files

Signed-off-by: Denis Cheng <crquan@gmail.com>
Cc: Rob Landley <rob@landley.net>
Cc: "Randy.Dunlap" <rdunlap@xenotime.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoDocumentation/make/headers_install.txt
Rob Landley [Wed, 17 Oct 2007 06:31:16 +0000 (23:31 -0700)]
Documentation/make/headers_install.txt

Some documentation for "make headers_install".

Signed-off-by: Rob Landley <rob@landley.net>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoClean up duplicate includes in Documentation/
Jesper Juhl [Wed, 17 Oct 2007 06:31:15 +0000 (23:31 -0700)]
Clean up duplicate includes in Documentation/

This patch cleans up duplicate includes in
Documentation/

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agor/o bind mounts: create cleanup helper svc_msnfs()
Dave Hansen [Wed, 17 Oct 2007 06:31:15 +0000 (23:31 -0700)]
r/o bind mounts: create cleanup helper svc_msnfs()

I'm going to be modifying nfsd_rename() shortly to support read-only bind
mounts.  This #ifdef is around the area I'm patching, and it starts to get
really ugly if I just try to add my new code by itself.  Using this little
helper makes things a lot cleaner to use.

Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
Acked-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agor/o bind mounts: give permission() a local 'mnt' variable
Dave Hansen [Wed, 17 Oct 2007 06:31:14 +0000 (23:31 -0700)]
r/o bind mounts: give permission() a local 'mnt' variable

First of all, this makes the structure jumping look a little bit cleaner.  So,
this stands alone as a tiny cleanup.  But, we also need 'mnt' by itself a few
more times later in this series, so this isn't _just_ a cleanup.

Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agor/o bind mounts: rearrange may_open() to be r/o friendly
Dave Hansen [Wed, 17 Oct 2007 06:31:14 +0000 (23:31 -0700)]
r/o bind mounts: rearrange may_open() to be r/o friendly

may_open() calls vfs_permission() before it does checks for IS_RDONLY(inode).
It checks _again_ inside of vfs_permission().

The check inside of vfs_permission() is going away eventually.  With the
mnt_want/drop_write() functions, all of the r/o checks (except for this one)
are consistently done before calling permission().  Because of this, I'd like
to use permission() to hold a debugging check to make sure that the
mnt_want/drop_write() calls are actually being made.

So, to do this:
1. remove the IS_RDONLY() check from permission()
2. enforce that you must mnt_want_write() before
   even calling permission()
3. actually add the debugging check to permission()

We need to rearrange may_open() to do r/o checks before calling permission().
Here's the patch.

Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agor/o bind mounts: filesystem helpers for custom 'struct file's
Dave Hansen [Wed, 17 Oct 2007 06:31:13 +0000 (23:31 -0700)]
r/o bind mounts: filesystem helpers for custom 'struct file's

Why do we need r/o bind mounts?

This feature allows a read-only view into a read-write filesystem.  In the
process of doing that, it also provides infrastructure for keeping track of
the number of writers to any given mount.

This has a number of uses.  It allows chroots to have parts of filesystems
writable.  It will be useful for containers in the future because users may
have root inside a container, but should not be allowed to write to
somefilesystems.  This also replaces patches that vserver has had out of the
tree for several years.

It allows security enhancement by making sure that parts of your filesystem
read-only (such as when you don't trust your FTP server), when you don't want
to have entire new filesystems mounted, or when you want atime selectively
updated.  I've been using the following script to test that the feature is
working as desired.  It takes a directory and makes a regular bind and a r/o
bind mount of it.  It then performs some normal filesystem operations on the
three directories, including ones that are expected to fail, like creating a
file on the r/o mount.

This patch:

Some filesystems forego the vfs and may_open() and create their own 'struct
file's.

This patch creates a couple of helper functions which can be used by these
filesystems, and will provide a unified place which the r/o bind mount code
may patch.

Also, rename an existing, static-scope init_file() to a less generic name.

Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoPNP: add debug message for adding new device
Bjorn Helgaas [Wed, 17 Oct 2007 06:31:12 +0000 (23:31 -0700)]
PNP: add debug message for adding new device

Add PNP debug message when adding a device, remove similar PNPACPI message
with less information.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Adam Belay <ambx1@neo.rr.com>
Cc: Len Brown <lenb@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoPNP: simplify PNPBIOS insert_device
Bjorn Helgaas [Wed, 17 Oct 2007 06:31:11 +0000 (23:31 -0700)]
PNP: simplify PNPBIOS insert_device

Hoist the struct pnp_dev alloc up into the function where it's used.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Adam Belay <ambx1@neo.rr.com>
Cc: Len Brown <lenb@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoPNP: use dev_info() in system driver
Bjorn Helgaas [Wed, 17 Oct 2007 06:31:11 +0000 (23:31 -0700)]
PNP: use dev_info() in system driver

Use dev_info() for a little consistency.  Changes this:

    pnp: 00:01: ioport range 0xf50-0xf58 has been reserved
    pnp: 00:01: ioport range 0x408-0x40f has been reserved
    pnp: 00:01: ioport range 0x900-0x903 has been reserved

to this:

    system 00:01: ioport range 0xf50-0xf58 has been reserved
    system 00:01: ioport range 0x408-0x40f has been reserved
    system 00:01: ioport range 0x900-0x903 has been reserved

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Adam Belay <ambx1@neo.rr.com>
Cc: Len Brown <lenb@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoPNP: use dev_info(), dev_err(), etc in core
Bjorn Helgaas [Wed, 17 Oct 2007 06:31:10 +0000 (23:31 -0700)]
PNP: use dev_info(), dev_err(), etc in core

If we have the struct pnp_dev available, we can use dev_info(), dev_err(),
etc., to give a little more information and consistency.

[akpm@linux-foundation.org: fix warning]
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Adam Belay <ambx1@neo.rr.com>
Cc: Len Brown <lenb@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoPNP: simplify PNP card error handling
Bjorn Helgaas [Wed, 17 Oct 2007 06:31:09 +0000 (23:31 -0700)]
PNP: simplify PNP card error handling

No functional change; just return errors early instead of putting the main
part of the function inside an "if" statement.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Adam Belay <ambx1@neo.rr.com>
Cc: Len Brown <lenb@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoPNP: remove null pointer checks
Bjorn Helgaas [Wed, 17 Oct 2007 06:31:09 +0000 (23:31 -0700)]
PNP: remove null pointer checks

Remove some null pointer checks.  Null pointers in these areas indicate
programming errors, and I think it's better to oops immediately rather than
return an error that is easily ignored.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Adam Belay <ambx1@neo.rr.com>
Cc: Len Brown <lenb@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoFix very high interrupt rate for IRQ8 (rtc) unless pnpacpi=off
Krzysztof Oledzki [Wed, 17 Oct 2007 06:31:08 +0000 (23:31 -0700)]
Fix very high interrupt rate for IRQ8 (rtc) unless pnpacpi=off

Workaround for broken systems with BIOS that makes RTC interrupt level
triggered and/or active low.

See http://bugzilla.kernel.org/show_bug.cgi?id=5243

Based on the patch from Shaohua Li <shaohua.li@intel.com>

Signed-off-by: Krzysztof Piotr Oledzki <ole@ans.pl>
Cc: "Li, Shaohua" <shaohua.li@intel.com>
Cc: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Andi Kleen <ak@suse.de>
Cc: Adam Belay <ambx1@neo.rr.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoPNP: don't fail device init if no DMA channel available
Jan Beulich [Wed, 17 Oct 2007 06:31:07 +0000 (23:31 -0700)]
PNP: don't fail device init if no DMA channel available

Most drivers for devices supporting ISA DMA can operate without DMA as well
(falling back zo PIO).  Thus it seems inappropriate for PNP to fail device
initialization in case none of the possible DMA channels are available.
Instead, it should be left to the driver to decide what to do if
request_dma() fails.

The patch at once adjusts the code to account for the fact that
pnp_assign_dma() now doesn't need to report failure anymore.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Cc: Adam Belay <ambx1@neo.rr.com>
Cc: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>