platform/upstream/kernel-adaptation-pc.git
17 years ago[SPARC64]: Convert PCI over to generic struct iommu/strbuf.
David S. Miller [Fri, 27 Apr 2007 04:08:21 +0000 (21:08 -0700)]
[SPARC64]: Convert PCI over to generic struct iommu/strbuf.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC]: device_node name constification fallout
Stephen Rothwell [Thu, 26 Apr 2007 07:03:53 +0000 (00:03 -0700)]
[SPARC]: device_node name constification fallout

A couple of routines need their arguments to be const.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: Convert SBUS over to generic iommu/strbuf structs.
David S. Miller [Wed, 25 Apr 2007 22:58:22 +0000 (15:58 -0700)]
[SPARC64]: Convert SBUS over to generic iommu/strbuf structs.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: Add generic iommu and strbuf structs to iommu.h
David S. Miller [Wed, 25 Apr 2007 07:12:09 +0000 (00:12 -0700)]
[SPARC64]: Add generic iommu and strbuf structs to iommu.h

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: Consolidate {sbus,pci}_iommu_arena.
David S. Miller [Wed, 25 Apr 2007 06:51:18 +0000 (23:51 -0700)]
[SPARC64]: Consolidate {sbus,pci}_iommu_arena.

Move to asm-sparc64/iommu.h and rename to plain "iommu_arena".

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC]: Make device_node name and type const
Stephen Rothwell [Thu, 12 Apr 2007 21:38:34 +0000 (14:38 -0700)]
[SPARC]: Make device_node name and type const

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: constify some paramaters of OF routines
Stephen Rothwell [Thu, 29 Mar 2007 18:22:57 +0000 (11:22 -0700)]
[SPARC64]: constify some paramaters of OF routines

This starts bringing the PowerPC and Sparc64 implemetations back closer
together.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[TIGON3]: of_get_property() returns const.
David S. Miller [Thu, 29 Mar 2007 08:57:57 +0000 (01:57 -0700)]
[TIGON3]: of_get_property() returns const.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: Fix PCI rework to adhere to of_get_property() const return.
David S. Miller [Thu, 29 Mar 2007 08:50:16 +0000 (01:50 -0700)]
[SPARC64]: Fix PCI rework to adhere to of_get_property() const return.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: Document and fix calculation of pages_avail.
David S. Miller [Fri, 16 Mar 2007 05:52:18 +0000 (22:52 -0700)]
[SPARC64]: Document and fix calculation of pages_avail.

It should be set to the total number of pages that the
system will really have available after things like
initmem, the bootmem map, and initrd are freed up.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: Make sure pbm->prom_node is setup easly enough in psycho.c
David S. Miller [Fri, 16 Mar 2007 04:44:03 +0000 (21:44 -0700)]
[SPARC64]: Make sure pbm->prom_node is setup easly enough in psycho.c

It needs to be ready before we invoke pci_determine_mem_io_space().

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: Use bootmem_bootmap_pages() in choose_bootmap_pfn().
David S. Miller [Fri, 16 Mar 2007 02:36:53 +0000 (19:36 -0700)]
[SPARC64]: Use bootmem_bootmap_pages() in choose_bootmap_pfn().

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: Add proper header file extern for cmdline_memory_size.
David S. Miller [Fri, 16 Mar 2007 01:29:13 +0000 (18:29 -0700)]
[SPARC64]: Add proper header file extern for cmdline_memory_size.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: Kill sparc_ultra_dump_{i,d}tlb()
David S. Miller [Fri, 16 Mar 2007 01:26:00 +0000 (18:26 -0700)]
[SPARC64]: Kill sparc_ultra_dump_{i,d}tlb()

While useful in odd circumstances to debug something, they are
normally totally unused and anyone can fetch this code out of the
history if they really need it.

And in any event, the person who needs this kind of code is usually me
:-)

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: Use DECLARE_BITMAP and BITS_TO_LONGS in mm/init.c
David S. Miller [Fri, 16 Mar 2007 00:51:26 +0000 (17:51 -0700)]
[SPARC64]: Use DECLARE_BITMAP and BITS_TO_LONGS in mm/init.c

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: Give move verbose show_mem() output just like i386.
David S. Miller [Thu, 15 Mar 2007 23:00:29 +0000 (16:00 -0700)]
[SPARC64]: Give move verbose show_mem() output just like i386.

We now report everything i386 does except for highmem which
doesn't apply.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: Mark show_mem() printk's with KERN_INFO.
David S. Miller [Thu, 15 Mar 2007 22:56:07 +0000 (15:56 -0700)]
[SPARC64]: Mark show_mem() printk's with KERN_INFO.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: Kill kvaddr_to_phys() and friends.
David S. Miller [Thu, 15 Mar 2007 22:50:11 +0000 (15:50 -0700)]
[SPARC64]: Kill kvaddr_to_phys() and friends.

Just inline it into flush_icache_range() which is the only
user.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: Privatize sun4u_get_pte() and fix name.
David S. Miller [Thu, 15 Mar 2007 22:44:05 +0000 (15:44 -0700)]
[SPARC64]: Privatize sun4u_get_pte() and fix name.

__get_phys is only called from init.c as is prom_virt_to_phys(),
__get_iospace() is not called at all, and sun4u_get_pte() is largely
misnamed.

Privatize the implementation and helper functions of
sun4u_get_phys() to mm/init.c, and rename to
kvaddr_to_paddr().

The only used of this thing is flush_icache_range(), and thus
things can be considerably further simplified.  For example,
we should only see module or PAGE_OFFSET kernel addresses here,
so we don't need the OBP firmware range handling at all.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: Kill _start[]/_end[] declarations in mm/init.c
David S. Miller [Thu, 15 Mar 2007 22:09:06 +0000 (15:09 -0700)]
[SPARC64]: Kill _start[]/_end[] declarations in mm/init.c

We already get those from asm/sections.h

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: MAX_PHYSADDR_BITS et al. really need to be 42 bits not 41.
David S. Miller [Thu, 15 Mar 2007 07:21:45 +0000 (00:21 -0700)]
[SPARC64]: MAX_PHYSADDR_BITS et al. really need to be 42 bits not 41.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: Simplify read_obp_memory().
David S. Miller [Thu, 15 Mar 2007 07:06:34 +0000 (00:06 -0700)]
[SPARC64]: Simplify read_obp_memory().

Kick out empty entries as soon as we spot them, and use memmove()
instead of a silly loop to make the operation more clear.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: Use SPARSEMEM_STATIC
David S. Miller [Thu, 15 Mar 2007 05:47:01 +0000 (22:47 -0700)]
[SPARC64]: Use SPARSEMEM_STATIC

Decrease the SECTION_SIZE_BITS --> MAX_PHYSADDR_BITS
range a little bit.

The cost of going to SPARSEMEM_STATIC becomes 8K of BSS space, and in
return we save a pointer dereferences on every page struct lookup.
Even better we hit the main kernel image for the base address which is
in a hugepage locked TLB entry.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: Use DECLARE_BITMAP in struct pci_iommu.
David S. Miller [Thu, 15 Mar 2007 01:33:49 +0000 (18:33 -0700)]
[SPARC64]: Use DECLARE_BITMAP in struct pci_iommu.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: Force dummy host controller onto bus zero.
David S. Miller [Tue, 13 Mar 2007 02:40:26 +0000 (19:40 -0700)]
[SPARC64]: Force dummy host controller onto bus zero.

This helps deal with the invisible bridge that sits between
the host controller and the top-most visisble PCI devices
on hypervisor systems.

For example, on T1000 the bus-range property says 2 --> 4
and so there is a PCI express bridge at bus 2, devfn 0, etc.

So if we don't force the dummy host controller to bus zero,
we'll try to create two devices with the same domain/bus/devfn
triplet.

Also, add some more log diagnostics to make debugging stuff like this
easyer.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: Add dummy host controller to root of all PCI domains.
David S. Miller [Sun, 11 Mar 2007 23:42:53 +0000 (16:42 -0700)]
[SPARC64]: Add dummy host controller to root of all PCI domains.

We fake up a dummy one in all cases because that is the simplest
thing to do and it happens to be necessary for hypervisor systems.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: Const'ify pci_iommu_ops.
David S. Miller [Sat, 10 Mar 2007 00:58:43 +0000 (16:58 -0800)]
[SPARC64]: Const'ify pci_iommu_ops.

Based upon a similar patch for x86_64 written by
Stephen Hemminger.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: Kill pbm->pci_first_slot.
David S. Miller [Fri, 9 Mar 2007 07:06:39 +0000 (23:06 -0800)]
[SPARC64]: Kill pbm->pci_first_slot.

Set but never used.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: Kill pci_controller->pbms_same_domain
David S. Miller [Fri, 9 Mar 2007 06:52:11 +0000 (22:52 -0800)]
[SPARC64]: Kill pci_controller->pbms_same_domain

We don't do the "Simba APB is a PBM" bogosity for Sabre
controllers any longer, so this pbms_same_domain thing
is no longer necessary.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: Kill pci_controller->base_address_update().
David S. Miller [Fri, 9 Mar 2007 06:46:02 +0000 (22:46 -0800)]
[SPARC64]: Kill pci_controller->base_address_update().

Implemented but never actually used.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: Kill pci_controller->resource_adjust()
David S. Miller [Fri, 9 Mar 2007 06:42:19 +0000 (22:42 -0800)]
[SPARC64]: Kill pci_controller->resource_adjust()

All the implementations can be identical and generic, so
no need for controller specific methods.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: Kill PBM ranges software state.
David S. Miller [Fri, 9 Mar 2007 06:28:17 +0000 (22:28 -0800)]
[SPARC64]: Kill PBM ranges software state.

It is only used in one spot and we can just fetch the
OF property right there.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: Kill PBM intmap software state.
David S. Miller [Fri, 9 Mar 2007 06:11:00 +0000 (22:11 -0800)]
[SPARC64]: Kill PBM intmap software state.

Set but never used.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: Consolidate PCI mem/io resource determination.
David S. Miller [Fri, 9 Mar 2007 05:55:49 +0000 (21:55 -0800)]
[SPARC64]: Consolidate PCI mem/io resource determination.

It can be done for every PCI configuration using OF properties.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: Fix sabre pci controllers with new probing scheme.
David S. Miller [Sun, 4 Mar 2007 20:53:19 +0000 (12:53 -0800)]
[SPARC64]: Fix sabre pci controllers with new probing scheme.

The SIMBA APB bridge is strange, it is a PCI bridge but it lacks
some standard OF properties, in particular it lacks a 'ranges'
property.

What you have to do is read the IO and MEM range registers in
the APB bridge to determine the ranges handled by each bridge.
So fill in the bus resources by doing that.

Since we now handle this quirk in the generic PCI and OF device
probing layers, we can flat out eliminate all of that code from
the sabre pci controller driver.

In fact we can thus eliminate completely another quirk of the sabre
driver.  It tried to make the two APB bridges look like PBMs but that
makes zero sense now (and it's questionable whether it ever made sense).
So now just use pbm_A and probe the whole PCI hierarchy using that as
the root.

This simplification allows many future cleanups to occur.

Also, I've found yet another quirk that needs to be worked around
while testing this.  You can't use the 'class-code' OF firmware
property, especially for IDE controllers.  We have to read the value
out of PCI config space or else we'll see the value the device was
showing before it was programmed into native mode.

I'm starting to think it might be wise to just read all of the values
out of PCI config space instead of using the OF properties. :-/

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: Fix obppath pci device sysfs creation.
David S. Miller [Thu, 1 Mar 2007 19:46:13 +0000 (11:46 -0800)]
[SPARC64]: Fix obppath pci device sysfs creation.

Need to traverse recursively down child busses else we only
get the file created under devices at the top-level.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: Minor cleanups to schizo pci controller driver.
David S. Miller [Thu, 1 Mar 2007 19:20:37 +0000 (11:20 -0800)]
[SPARC64]: Minor cleanups to schizo pci controller driver.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: Internalize pci_memspace_mask.
David S. Miller [Thu, 1 Mar 2007 07:38:38 +0000 (23:38 -0800)]
[SPARC64]: Internalize pci_memspace_mask.

The only user was bus_dvma_to_mem() which is no longer used
by any driver, so kill that, and the export of pci_memspace_mask.

The only user now is the PCI mmap support code.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: Probe PCI bus using OF device tree.
David S. Miller [Thu, 1 Mar 2007 07:35:04 +0000 (23:35 -0800)]
[SPARC64]: Probe PCI bus using OF device tree.

Almost entirely taken from the 64-bit PowerPC PCI code.

This allowed to eliminate a ton of cruft from the sparc64
PCI layer.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64] isa: Convert to use pci_device_to_OF_node().
David S. Miller [Thu, 1 Mar 2007 02:01:38 +0000 (18:01 -0800)]
[SPARC64] isa: Convert to use pci_device_to_OF_node().

Also, do not try to compute resources by hand, instead use
the pre-computed ones in the of_device.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64] ebus: Convert to use pci_device_to_OF_node().
David S. Miller [Thu, 1 Mar 2007 01:55:46 +0000 (17:55 -0800)]
[SPARC64] ebus: Convert to use pci_device_to_OF_node().

Also, we don't need to store or use the PBM so kill that
from the linux_ebus.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[IGAFB]: Use pci_device_to_OF_node() on sparc.
David S. Miller [Thu, 1 Mar 2007 01:05:06 +0000 (17:05 -0800)]
[IGAFB]: Use pci_device_to_OF_node() on sparc.

Also __sparc__ --> CONFIG_SPARC

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[ATYFB]: Use pci_device_to_OF_node() in sparc.
David S. Miller [Thu, 1 Mar 2007 01:02:45 +0000 (17:02 -0800)]
[ATYFB]: Use pci_device_to_OF_node() in sparc.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[OPENPROM]: Use pci_device_to_OF_node().
David S. Miller [Wed, 25 Apr 2007 23:01:51 +0000 (16:01 -0700)]
[OPENPROM]: Use pci_device_to_OF_node().

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[TULIP]: Use pci_device_to_OF_node() on sparc.
David S. Miller [Thu, 29 Mar 2007 08:41:28 +0000 (01:41 -0700)]
[TULIP]: Use pci_device_to_OF_node() on sparc.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[TULIP]: Use CONFIG_SPARC consistently in ifdef tests.
David S. Miller [Thu, 29 Mar 2007 08:39:44 +0000 (01:39 -0700)]
[TULIP]: Use CONFIG_SPARC consistently in ifdef tests.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[TG3]: Use pci_device_to_OF_node() on sparc.
David S. Miller [Thu, 29 Mar 2007 08:38:42 +0000 (01:38 -0700)]
[TG3]: Use pci_device_to_OF_node() on sparc.

And use CONFIG_SPARC instead of CONFIG_SPARC64 as the
test.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SUNHME]: Use pci_device_to_OF_node().
David S. Miller [Thu, 1 Mar 2007 00:40:57 +0000 (16:40 -0800)]
[SUNHME]: Use pci_device_to_OF_node().

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SUNGEM]: Consolidate powerpc and sparc MAC probing code.
David S. Miller [Thu, 29 Mar 2007 08:36:44 +0000 (01:36 -0700)]
[SUNGEM]: Consolidate powerpc and sparc MAC probing code.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SUNGEM]: __sparc__ --> CONFIG_SPARC
David S. Miller [Wed, 28 Feb 2007 23:42:50 +0000 (15:42 -0800)]
[SUNGEM]: __sparc__ --> CONFIG_SPARC

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[RADEON]: Probe clocks and monitor using OF properties on sparc.
David S. Miller [Thu, 29 Mar 2007 08:33:46 +0000 (01:33 -0700)]
[RADEON]: Probe clocks and monitor using OF properties on sparc.

Just like powerpc does.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC]: Use strcasecmp for OFW property name comparisons.
David S. Miller [Thu, 29 Mar 2007 08:28:51 +0000 (01:28 -0700)]
[SPARC]: Use strcasecmp for OFW property name comparisons.

This allows us to simplify sharing code with powerpc which
has properties that have various forms of capitalization
when on the sparc64 side the property is all lower-case.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[STRING]: Move strcasecmp/strncasecmp to lib/string.c
David S. Miller [Thu, 29 Mar 2007 08:18:42 +0000 (01:18 -0700)]
[STRING]: Move strcasecmp/strncasecmp to lib/string.c

We have several platforms using local copies of identical
code.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC]: constify some paramaters of OF routines
Stephen Rothwell [Thu, 29 Mar 2007 07:54:04 +0000 (00:54 -0700)]
[SPARC]: constify some paramaters of OF routines

This starts bringing the PowerPC and Sparc implemetations back closer
together.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC/64]: constify of_get_property return
Stephen Rothwell [Thu, 29 Mar 2007 07:53:28 +0000 (00:53 -0700)]
[SPARC/64]: constify of_get_property return

Finally, we actually change the functions themselves.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC/64] constify of_get_property return: sound
Stephen Rothwell [Thu, 29 Mar 2007 07:50:57 +0000 (00:50 -0700)]
[SPARC/64] constify of_get_property return: sound

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64] constify of_get_property return: include
Stephen Rothwell [Thu, 29 Mar 2007 07:50:29 +0000 (00:50 -0700)]
[SPARC64] constify of_get_property return: include

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC/64] constify of_get_property return: drivers
Stephen Rothwell [Thu, 29 Mar 2007 07:49:54 +0000 (00:49 -0700)]
[SPARC/64] constify of_get_property return: drivers

The only unfortunate bit here is that the name field of struct map_info
is not const, so for now we put a cast on the assignment of it.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: constify of_get_property return: arch/sparc64
Stephen Rothwell [Mon, 23 Apr 2007 22:53:27 +0000 (15:53 -0700)]
[SPARC64]: constify of_get_property return: arch/sparc64

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC]: constify of_get_property return: arch/sparc
Stephen Rothwell [Thu, 29 Mar 2007 07:47:23 +0000 (00:47 -0700)]
[SPARC]: constify of_get_property return: arch/sparc

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: Small cleanups time.c
Tony Breeds [Thu, 29 Mar 2007 02:10:12 +0000 (19:10 -0700)]
[SPARC64]: Small cleanups time.c

- Removes days_in_mo[], as it's almost identical to month_days[]
- Use the leapyear() macro
- Line length wrapping.

Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: Fix sparc64_next_event() error return.
David S. Miller [Tue, 27 Mar 2007 08:20:14 +0000 (01:20 -0700)]
[SPARC64]: Fix sparc64_next_event() error return.

It should return an error code not a boolean.

Based upon an hpet timer fix by Thomas Gleixner.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: Add clocksource/clockevents support.
David S. Miller [Mon, 5 Mar 2007 23:28:37 +0000 (15:28 -0800)]
[SPARC64]: Add clocksource/clockevents support.

I'd like to thank John Stul and others for helping
me along the way.

A lot of cleanups fell out of this.  For example, the get_compare()
tick_op was totally unused, so was deleted.  And the most often used
tick_op members were grouped together for cache-friendlyness.

The sparc64 TSC is given to the kernel as a one-shot timer.

tick_ops->init_timer() simply turns off the privileged bit in
the tick register (when possible), and disables the interrupt
by setting bit 63 in the compare register.  The ->disable_irq()
op also sets this bit.

tick_ops->add_compare() is changed to:

1) Add the given delta to "tick" not to "compare"
2) Return a boolean which, if true, means that the tick
   value read after writing the compare value was found
   to have incremented past the initial tick value.  This
   mirrors logic used in the HPET driver's ->next_event()
   method.

Each tick_ops implementation also now provides a name string.
And we feed this into the clocksource and clockevents layers.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: Add tick_nohz_{stop,restart}_sched_tick() calls to cpu_idle().
David S. Miller [Thu, 22 Feb 2007 14:24:45 +0000 (06:24 -0800)]
[SPARC64]: Add tick_nohz_{stop,restart}_sched_tick() calls to cpu_idle().

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: Unify timer interrupt handler.
David S. Miller [Thu, 22 Feb 2007 14:24:10 +0000 (06:24 -0800)]
[SPARC64]: Unify timer interrupt handler.

Things were scattered all over the place, split between
SMP and non-SMP.

Unify it all so that dyntick support is easier to add.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[SPARC64]: Synchronize RTC clock via timer just like x86.
David S. Miller [Thu, 22 Feb 2007 12:16:21 +0000 (04:16 -0800)]
[SPARC64]: Synchronize RTC clock via timer just like x86.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years agoLinux 2.6.21 v2.6.21
Linus Torvalds [Thu, 26 Apr 2007 03:08:32 +0000 (20:08 -0700)]
Linux 2.6.21

.. ok, enough waffling about it already. "Just do it!"

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoMerge master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6
Linus Torvalds [Wed, 25 Apr 2007 20:51:45 +0000 (13:51 -0700)]
Merge /pub/scm/linux/kernel/git/davem/sparc-2.6

* master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6:
  [PARPORT] SUNBPP: Fix OOPS when debugging is enabled.
  [SPARC] openprom: Switch to ref counting PCI API

17 years agoMerge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Linus Torvalds [Wed, 25 Apr 2007 20:51:21 +0000 (13:51 -0700)]
Merge /pub/scm/linux/kernel/git/davem/net-2.6

* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6:
  [NETLINK]: Infinite recursion in netlink.

17 years agopacket: fix error handling
Andrew Morton [Wed, 25 Apr 2007 20:01:21 +0000 (13:01 -0700)]
packet: fix error handling

The packet driver is assuming (reasonably) that the (undocumented)
request.errors is an errno.  But it is in fact some mysterious bitfield.  When
things go wrong we return weird positive numbers to the VFS as pointers and it
goes oops.

Thanks to William Heimbigner for reporting and diagnosis.

(It doesn't oops, but this driver still doesn't work for William)

Cc: William Heimbigner <icxcnika@mar.tar.cc>
Cc: Peter Osterlund <petero2@telia.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years ago[NETLINK]: Infinite recursion in netlink.
Alexey Kuznetsov [Wed, 25 Apr 2007 20:07:28 +0000 (13:07 -0700)]
[NETLINK]: Infinite recursion in netlink.

Reply to NETLINK_FIB_LOOKUP messages were misrouted back to kernel,
which resulted in infinite recursion and stack overflow.

The bug is present in all kernel versions since the feature appeared.

The patch also makes some minimal cleanup:

1. Return something consistent (-ENOENT) when fib table is missing
2. Do not crash when queue is empty (does not happen, but yet)
3. Put result of lookup

Signed-off-by: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years agocfq-iosched: fix alias + front merge bug
Jens Axboe [Wed, 25 Apr 2007 09:53:48 +0000 (11:53 +0200)]
cfq-iosched: fix alias + front merge bug

There's a really rare and obscure bug in CFQ, that causes a crash in
cfq_dispatch_insert() due to rq == NULL.  One example of the resulting
oops is seen here:

http://lkml.org/lkml/2007/4/15/41

Neil correctly diagnosed the situation for how this can happen: if two
concurrent requests with the exact same sector number (due to direct IO
or aliasing between MD and the raw device access), the alias handling
will add the request to the sortlist, but next_rq remains NULL.

Read the more complete analysis at:

http://lkml.org/lkml/2007/4/25/57

This looks like it requires md to trigger, even though it should
potentially be possible to due with O_DIRECT (at least if you edit the
kernel and doctor some of the unplug calls).

The fix is to move the ->next_rq update to when we add a request to the
rbtree. Then we remove the possibility for a request to exist in the
rbtree code, but not have ->next_rq correctly updated.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoIPv6: fix Routing Header Type 0 handling thinko
YOSHIFUJI Hideaki [Wed, 25 Apr 2007 02:13:49 +0000 (11:13 +0900)]
IPv6: fix Routing Header Type 0 handling thinko

Oops, thinko.  The test for accempting a RH0 was exatly the wrong way
around.

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoMerge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Linus Torvalds [Wed, 25 Apr 2007 01:20:32 +0000 (18:20 -0700)]
Merge /pub/scm/linux/kernel/git/davem/net-2.6

* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6:
  [BNX2]: Fix occasional NETDEV WATCHDOG on 5709.
  [IPV6]: Disallow RH0 by default.
  [XFRM]: beet: fix pseudo header length value
  [TCP]: Congestion control initialization.

17 years ago[BNX2]: Fix occasional NETDEV WATCHDOG on 5709.
Michael Chan [Tue, 24 Apr 2007 22:35:53 +0000 (15:35 -0700)]
[BNX2]: Fix occasional NETDEV WATCHDOG on 5709.

Tweak a register setting to prevent the tx mailbox from halting.

Update version to 1.5.8.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[IPV6]: Disallow RH0 by default.
YOSHIFUJI Hideaki [Tue, 24 Apr 2007 21:58:30 +0000 (14:58 -0700)]
[IPV6]: Disallow RH0 by default.

A security issue is emerging.  Disallow Routing Header Type 0 by default
as we have been doing for IPv4.
Note: We allow RH2 by default because it is harmless.

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years ago[MIPS] Fix oprofile logic to physical counter remapping
Ralf Baechle [Tue, 24 Apr 2007 20:42:20 +0000 (21:42 +0100)]
[MIPS] Fix oprofile logic to physical counter remapping

This did cause oprofile to fail on non-multithreaded systems with more
than 2 processors such as the BCM1480.

Reported by Manish Lachwani (mlachwani@mvista.com).

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
17 years agoMerge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik...
Linus Torvalds [Tue, 24 Apr 2007 18:05:20 +0000 (11:05 -0700)]
Merge branch 'upstream-linus' of /linux/kernel/git/jgarzik/netdev-2.6

* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6:
  drivers/net/hamradio/baycom_ser_fdx build fix
  usb-net/pegasus: fix pegasus carrier detection
  sis900: Allocate rx replacement buffer before rx operation
  [netdrvr] depca: handle platform_device_add() failure

17 years agodrivers/net/hamradio/baycom_ser_fdx build fix
Andrew Morton [Tue, 24 Apr 2007 16:51:03 +0000 (12:51 -0400)]
drivers/net/hamradio/baycom_ser_fdx build fix

sparc64:

drivers/net/hamradio/baycom_ser_fdx.c: In function `ser12_open':
drivers/net/hamradio/baycom_ser_fdx.c:417: error: `NR_IRQS' undeclared (first us
e in this function)
drivers/net/hamradio/baycom_ser_fdx.c:417: error: (Each undeclared identifier is
 reported only once
drivers/net/hamradio/baycom_ser_fdx.c:417: error: for each function it appears i
n.)

Cc: Folkert van Heusden <folkert@vanheusden.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agousb-net/pegasus: fix pegasus carrier detection
Dan Williams [Tue, 24 Apr 2007 14:20:06 +0000 (10:20 -0400)]
usb-net/pegasus: fix pegasus carrier detection

Broken by 4a1728a28a193aa388900714bbb1f375e08a6d8e which switched the
return semantics of read_mii_word() but didn't fix usage of
read_mii_word() to conform to the new semantics.

Setting carrier to off based on the NO_CARRIER flag is also incorrect as
that flag only triggers on TX failure and therefore isn't correct when
no frames are being transmitted.  Since there is already a 2*HZ MII
carrier check going on, defer to that.

Add a TRUST_LINK_STATUS feature flag for adapters where the LINK_STATUS
flag is actually correct, and use that rather than the NO_CARRIER flag.

Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agosis900: Allocate rx replacement buffer before rx operation
Neil Horman [Fri, 20 Apr 2007 13:54:58 +0000 (09:54 -0400)]
sis900: Allocate rx replacement buffer before rx operation

The sis900 driver appears to have a bug in which the receive routine
passes the skbuff holding the received frame to the network stack before
refilling the buffer in the rx ring.  If a new skbuff cannot be allocated, the
driver simply leaves a hole in the rx ring, which causes the driver to stop
receiving frames and become non-recoverable without an rmmod/insmod according to
reporters.  This patch reverses that order, attempting to allocate a replacement
buffer first, and receiving the new frame only if one can be allocated.  If no
skbuff can be allocated, the current skbuf in the rx ring is recycled, dropping
the current frame, but keeping the NIC operational.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years ago[netdrvr] depca: handle platform_device_add() failure
Andrea Righi [Tue, 24 Apr 2007 16:40:57 +0000 (12:40 -0400)]
[netdrvr] depca: handle platform_device_add() failure

The following patch fixes a kernel bug in depca_platform_probe().

We don't use a dynamic pointer for pldev->dev.platform_data, so it seems
that the correct way to proceed if platform_device_add(pldev) fails is
to explicitly set the pldev->dev.platform_data pointer to NULL, before
calling the platform_device_put(pldev), or it will be kfree'ed by
platform_device_release().

Signed-off-by: Jeff Garzik <jeff@garzik.org>
17 years agoMerge branch 'for-linus' of git://one.firstfloor.org/home/andi/git/linux-2.6
Linus Torvalds [Tue, 24 Apr 2007 16:36:53 +0000 (09:36 -0700)]
Merge branch 'for-linus' of git://one.firstfloor.org/home/andi/git/linux-2.6

* 'for-linus' of git://one.firstfloor.org/home/andi/git/linux-2.6:
  [PATCH] i386: Fix some warnings added by earlier patch
  [PATCH] x86-64: Always flush all pages in change_page_attr
  [PATCH] x86: Remove noreplacement option
  [PATCH] x86-64: make GART PTEs uncacheable

17 years agoMerge master.kernel.org:/pub/scm/linux/kernel/git/bart/ide-2.6
Linus Torvalds [Tue, 24 Apr 2007 16:32:07 +0000 (09:32 -0700)]
Merge /pub/scm/linux/kernel/git/bart/ide-2.6

* master.kernel.org:/pub/scm/linux/kernel/git/bart/ide-2.6:
  Revert "adjust legacy IDE resource setting (v2)"

17 years ago8250: fix possible deadlock between serial8250_handle_port() and serial8250_interrupt()
Jiri Kosina [Mon, 23 Apr 2007 21:41:21 +0000 (14:41 -0700)]
8250: fix possible deadlock between serial8250_handle_port() and serial8250_interrupt()

Commit 40b36daa introduced possibility that serial8250_backup_timeout() ->
serial8250_handle_port() locks port.lock without disabling irqs, thus
allowing deadlock against interrupt handler (port.lock is acquired in
serial8250_interrupt()).

Spotted by lockdep.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Cc: Dave Jones <davej@codemonkey.org.uk>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Alex Williamson <alex.williamson@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agofault injection: add entry to MAINTAINERS
Akinobu Mita [Mon, 23 Apr 2007 21:41:20 +0000 (14:41 -0700)]
fault injection: add entry to MAINTAINERS

Add maintainer for fault injection support.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoChar: icom, mark __init as __devinit
Jiri Slaby [Mon, 23 Apr 2007 21:41:20 +0000 (14:41 -0700)]
Char: icom, mark __init as __devinit

Two functions are called from __devinit context, but they are marked as
__init. Fix this.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoreiserfs: fix xattr root locking/refcount bug
Jeff Mahoney [Mon, 23 Apr 2007 21:41:17 +0000 (14:41 -0700)]
reiserfs: fix xattr root locking/refcount bug

The listxattr() and getxattr() operations are only protected by a read
lock.  As a result, if either of these operations run in parallel, a race
condition exists where the xattr_root will end up being cached twice, which
results in the leaking of a reference and a BUG() on umount.

This patch refactors get_xa_root(), __get_xa_root(), and create_xa_root(),
into one get_xa_root() function that takes the appropriate locking around
the entire critical section.

Reported, diagnosed and tested by Andrea Righi <a.righi@cineca.it>

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Cc: Andrea Righi <a.righi@cineca.it>
Cc: "Vladimir V. Saveliev" <vs@namesys.com>
Cc: Edward Shishkin <edward@namesys.com>
Cc: Alex Zarochentsev <zam@namesys.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agohwmon/w83627ehf: Don't redefine REGION_OFFSET
Jean Delvare [Mon, 23 Apr 2007 21:41:16 +0000 (14:41 -0700)]
hwmon/w83627ehf: Don't redefine REGION_OFFSET

On ia64, kernel headers define REGION_OFFSET so we can't use that.
Reported by Andrew Morton.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: David Hubbard <david.c.hubbard@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agodo not truncate irq number for icom adapter
Olaf Hering [Mon, 23 Apr 2007 21:41:15 +0000 (14:41 -0700)]
do not truncate irq number for icom adapter

irq values are u32, not u8. Large irq numbers will be truncated,
free_irq may free a different irq.

Remove incorrectly sized struct member and use the one from pci_dev.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoAllow reading tainted flag as user
Bastian Blank [Mon, 23 Apr 2007 21:41:14 +0000 (14:41 -0700)]
Allow reading tainted flag as user

The commit 34f5a39899f3f3e815da64f48ddb72942d86c366 restricted reading
of the tainted value. The attached patch changes this back to a
write-only check and restores the read behaviour of older versions.

Signed-off-by: Bastian Blank <bastian@waldi.eu.org>
Cc: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoacpi-thermal: fix mod_timer() interval
Andrew Morton [Mon, 23 Apr 2007 21:41:13 +0000 (14:41 -0700)]
acpi-thermal: fix mod_timer() interval

Use relative time, not absolute.  Discovered by Jung-Ik (John) Lee
<jilee@google.com>.

Cc: Jung-Ik (John) Lee <jilee@google.com>
Acked-by: 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 agov9fs: don't use primary fid when removing file
Latchesar Ionkov [Mon, 23 Apr 2007 21:41:11 +0000 (14:41 -0700)]
v9fs: don't use primary fid when removing file

v9fs_insert uses v9fs_fid_lookup (which also locks the fid) to get the
primary fid associated with the dentry and destroys the v9fs_fid struct
after removing the file.  If another process called v9fs_fid_lookup on the
same dentry, it may wait undefinitely for the fid's lock (as the struct is
freed).

This patch changes v9fs_remove to use a cloned fid, so the primary fid is
not locked and freed.

Signed-off-by: Latchesar Ionkov <lucho@ionkov.net>
Cc: Eric Van Hensbergen <ericvh@hera.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoieee1394: update MAINTAINERS database
Stefan Richter [Mon, 23 Apr 2007 21:41:10 +0000 (14:41 -0700)]
ieee1394: update MAINTAINERS database

  - update Ben's address
  - replace Ben's contact by mine as raw1394's 2nd contact
  - eth1394's and pcilynx's maintenance doesn't really differ from that
    of other parts of the stack like video1394

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Acked-by: Ben Collins <ben.collins@ubuntu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agopage migration: fix NR_FILE_PAGES accounting
Christoph Lameter [Mon, 23 Apr 2007 21:41:09 +0000 (14:41 -0700)]
page migration: fix NR_FILE_PAGES accounting

NR_FILE_PAGES must be accounted for depending on the zone that the page
belongs to.  If we replace the page in the radix tree then we may have to
shift the count to another zone.

Suggested-by: Ethan Solomita <solo@google.com>
Eventually-typed-in-by: Christoph Lameter <clameter@sgi.com>
Cc: Martin Bligh <mbligh@mbligh.org>
Cc: <stable@kernel.org>
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoFix spelling in drivers/video/Kconfig
Miguel Ojeda [Mon, 23 Apr 2007 21:41:09 +0000 (14:41 -0700)]
Fix spelling in drivers/video/Kconfig

Signed-off-by: Miguel Ojeda Sandonis <maxextreme@gmail.com>
Cc: "Antonino A. Daplas" <adaplas@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoAdd mbuesch to .mailmap
Michael Buesch [Mon, 23 Apr 2007 21:41:08 +0000 (14:41 -0700)]
Add mbuesch to .mailmap

Signed-off-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoparide drivers: initialize spinlocks
Alexey Dobriyan [Mon, 23 Apr 2007 21:41:07 +0000 (14:41 -0700)]
paride drivers: initialize spinlocks

pcd_lock and pf_spin_lock are passed to blk_init_queue() which, seeing them
as valid lock pointer, sets it as ->queue_lock.

The problem is that pcd_lock and pf_spin_lock aren't initialized anywhere.

Signed-off-by: Alexey Dobriyan <adobriyan@sw.ru>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoMAINTAINERS: use lists.linux-foundation.org
David Brownell [Mon, 23 Apr 2007 21:41:06 +0000 (14:41 -0700)]
MAINTAINERS: use lists.linux-foundation.org

Update various mailing list addresses to use "lists.linux-foundation.org"
instead of "lists.osdl.org", to help phase out the old addresses.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoTaskstats fix the structure members alignment issue
Balbir Singh [Mon, 23 Apr 2007 21:41:05 +0000 (14:41 -0700)]
Taskstats fix the structure members alignment issue

We broke the the alignment of members of taskstats to the 8 byte boundary
with the CSA patches.  In the current kernel, the taskstats structure is
not suitable for use by 32 bit applications in a 64 bit kernel.

On x86_64

Offsets of taskstats' members (64 bit kernel, 64 bit application)

@taskstats'offsetof[@taskstats'indices] = (
        0,      # version
        4,      # ac_exitcode
        8,      # ac_flag
        9,      # ac_nice
        16,     # cpu_count
        24,     # cpu_delay_total
        32,     # blkio_count
        40,     # blkio_delay_total
        48,     # swapin_count
        56,     # swapin_delay_total
        64,     # cpu_run_real_total
        72,     # cpu_run_virtual_total
        80,     # ac_comm
        112,    # ac_sched
        113,    # ac_pad
        116,    # ac_uid
        120,    # ac_gid
        124,    # ac_pid
        128,    # ac_ppid
        132,    # ac_btime
        136,    # ac_etime
        144,    # ac_utime
        152,    # ac_stime
        160,    # ac_minflt
        168,    # ac_majflt
        176,    # coremem
        184,    # virtmem
        192,    # hiwater_rss
        200,    # hiwater_vm
        208,    # read_char
        216,    # write_char
        224,    # read_syscalls
        232,    # write_syscalls
        240,    # read_bytes
        248,    # write_bytes
        256,    # cancelled_write_bytes
    );

Offsets of taskstats' members (64 bit kernel, 32 bit application)

@taskstats'offsetof[@taskstats'indices] = (
        0,      # version
        4,      # ac_exitcode
        8,      # ac_flag
        9,      # ac_nice
        12,     # cpu_count
        20,     # cpu_delay_total
        28,     # blkio_count
        36,     # blkio_delay_total
        44,     # swapin_count
        52,     # swapin_delay_total
        60,     # cpu_run_real_total
        68,     # cpu_run_virtual_total
        76,     # ac_comm
        108,    # ac_sched
        109,    # ac_pad
        112,    # ac_uid
        116,    # ac_gid
        120,    # ac_pid
        124,    # ac_ppid
        128,    # ac_btime
        132,    # ac_etime
        140,    # ac_utime
        148,    # ac_stime
        156,    # ac_minflt
        164,    # ac_majflt
        172,    # coremem
        180,    # virtmem
        188,    # hiwater_rss
        196,    # hiwater_vm
        204,    # read_char
        212,    # write_char
        220,    # read_syscalls
        228,    # write_syscalls
        236,    # read_bytes
        244,    # write_bytes
        252,    # cancelled_write_bytes
    );

This is one way to solve the problem without re-arranging structure members
is to pack the structure.  The patch adds an __attribute__((aligned(8))) to
the taskstats structure members so that 32 bit applications using taskstats
can work with a 64 bit kernel.

Using __attribute__((packed)) would break the 64 bit alignment of members.

The fix was tested on x86_64. After the fix, we got

Offsets of taskstats' members (64 bit kernel, 64 bit application)

@taskstats'offsetof[@taskstats'indices] = (
        0,      # version
        4,      # ac_exitcode
        8,      # ac_flag
        9,      # ac_nice
        16,     # cpu_count
        24,     # cpu_delay_total
        32,     # blkio_count
        40,     # blkio_delay_total
        48,     # swapin_count
        56,     # swapin_delay_total
        64,     # cpu_run_real_total
        72,     # cpu_run_virtual_total
        80,     # ac_comm
        112,    # ac_sched
        113,    # ac_pad
        120,    # ac_uid
        124,    # ac_gid
        128,    # ac_pid
        132,    # ac_ppid
        136,    # ac_btime
        144,    # ac_etime
        152,    # ac_utime
        160,    # ac_stime
        168,    # ac_minflt
        176,    # ac_majflt
        184,    # coremem
        192,    # virtmem
        200,    # hiwater_rss
        208,    # hiwater_vm
        216,    # read_char
        224,    # write_char
        232,    # read_syscalls
        240,    # write_syscalls
        248,    # read_bytes
        256,    # write_bytes
        264,    # cancelled_write_bytes
    );

Offsets of taskstats' members (64 bit kernel, 32 bit application)

@taskstats'offsetof[@taskstats'indices] = (
        0,      # version
        4,      # ac_exitcode
        8,      # ac_flag
        9,      # ac_nice
        16,     # cpu_count
        24,     # cpu_delay_total
        32,     # blkio_count
        40,     # blkio_delay_total
        48,     # swapin_count
        56,     # swapin_delay_total
        64,     # cpu_run_real_total
        72,     # cpu_run_virtual_total
        80,     # ac_comm
        112,    # ac_sched
        113,    # ac_pad
        120,    # ac_uid
        124,    # ac_gid
        128,    # ac_pid
        132,    # ac_ppid
        136,    # ac_btime
        144,    # ac_etime
        152,    # ac_utime
        160,    # ac_stime
        168,    # ac_minflt
        176,    # ac_majflt
        184,    # coremem
        192,    # virtmem
        200,    # hiwater_rss
        208,    # hiwater_vm
        216,    # read_char
        224,    # write_char
        232,    # read_syscalls
        240,    # write_syscalls
        248,    # read_bytes
        256,    # write_bytes
        264,    # cancelled_write_bytes
    );

Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Cc: Jay Lan <jlan@engr.sgi.com>
Cc: Shailabh Nagar <nagar@watson.ibm.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>