linux-block.git
15 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
Linus Torvalds [Thu, 8 Jan 2009 22:25:41 +0000 (14:25 -0800)]
Merge git://git./linux/kernel/git/davem/net-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (84 commits)
  wimax: fix kernel-doc for debufs_dentry member of struct wimax_dev
  net: convert pegasus driver to net_device_ops
  bnx2x: Prevent eeprom set when driver is down
  net: switch kaweth driver to netdevops
  pcnet32: round off carrier watch timer
  i2400m/usb: wrap USB power saving in #ifdef CONFIG_PM
  wimax: testing for rfkill support should also test for CONFIG_RFKILL_MODULE
  wimax: fix kconfig interactions with rfkill and input layers
  wimax: fix '#ifndef CONFIG_BUG' layout to avoid warning
  r6040: bump release number to 0.20
  r6040: warn about MAC address being unset
  r6040: check PHY status when bringing interface up
  r6040: make printks consistent with DRV_NAME
  gianfar: Fixup use of BUS_ID_SIZE
  mlx4_en: Returning real Max in get_ringparam
  mlx4_en: Consider inline packets on completion
  netdev: bfin_mac: enable bfin_mac net dev driver for BF51x
  qeth: convert to net_device_ops
  vlan: add neigh_setup
  dm9601: warn on invalid mac address
  ...

15 years agoMerge master.kernel.org:/home/rmk/linux-2.6-arm
Linus Torvalds [Thu, 8 Jan 2009 22:25:00 +0000 (14:25 -0800)]
Merge master.kernel.org:/home/rmk/linux-2.6-arm

* master.kernel.org:/home/rmk/linux-2.6-arm: (23 commits)
  [ARM] fix pxa930_trkball build errors
  [ARM] fix netx
  [ARM] fix pnx4008
  [ARM] fix pxa
  [ARM] remove missed CLPS7500 defconfig
  [ARM] clps711x: fix warning in edb7211-mm.c
  [ARM] clps711x: fix warning in fortunet
  [ARM] fix AT91, davinci, h720x, ks8695, msm, mx2, mx3, netx, omap1, omap2, pxa, s3c
  [ARM] Fix realview build
  [ARM] 5357/1: Kirkwood: add missing ge01 tclk initialization
  [ARM] 5358/1: AT2440EVB: Use new include path of mci.h
  [ARM] 5361/1: mv78xx0: fix compilation error
  [ARM] 5360/1: Orion: fix compilation error
  [ARM] 5359/1: Kirkwood: fix compilation error
  [ARM] S3C64XX: Fix EINT group macro definition
  [ARM] Ensure CONFIG_SERIAL_SAMSUNG_UARTS is always set.
  [ARM] S3C24XX: Add gpio_to_irq implementation
  [ARM] S3C24XX: Add gpio_to_irq() facility
  [ARM] footbridge: dc21285.c warning fixes
  [ARM] footbridge: add isa_init_irq() to common header
  ...

15 years agoMerge branch 'for-linus' of git://neil.brown.name/md
Linus Torvalds [Thu, 8 Jan 2009 22:03:34 +0000 (14:03 -0800)]
Merge branch 'for-linus' of git://neil.brown.name/md

* 'for-linus' of git://neil.brown.name/md:
  md: don't retry recovery of raid1 that fails due to error on source drive.
  md: Allow md devices to be created by name.
  md: make devices disappear when they are no longer needed.
  md: centralise all freeing of an 'mddev' in 'md_free'
  md: move allocation of ->queue from mddev_find to md_probe
  md: need another print_sb for mdp_superblock_1
  md: use list_for_each_entry macro directly
  md: raid0: make hash_spacing and preshift sector-based.
  md: raid0: Represent the size of strip zones in sectors.
  md: raid0 create_strip_zones(): Add KERN_INFO/KERN_ERR to printk's.
  md: raid0 create_strip_zones(): Make two local variables sector-based.
  md: raid0: Represent zone->zone_offset in sectors.
  md: raid0: Represent device offset in sectors.
  md: raid0_make_request(): Replace local variable block by sector.
  md: raid0_make_request(): Remove local variable chunk_size.
  md: raid0_make_request(): Replace chunksize_bits by chunksect_bits.
  md: use sysfs_notify_dirent to notify changes to md/sync_action.
  md: fix bitmap-on-external-file bug.

15 years agoMerge branch 'devel'
Russell King [Thu, 8 Jan 2009 22:01:49 +0000 (22:01 +0000)]
Merge branch 'devel'

15 years agoMerge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzi...
Linus Torvalds [Thu, 8 Jan 2009 22:01:36 +0000 (14:01 -0800)]
Merge branch 'upstream-linus' of git://git./linux/kernel/git/jgarzik/libata-dev

* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev:
  libata: clean up the SFF code for coding style
  libata: Add 32bit PIO support
  [libata] ahci: Withdraw IGN_SERR_INTERNAL for SB800 SATA
  pata_hpt366: reimplement mode programming
  [libata] pata_hpt3x3: correct _freeze() function declaration
  libata: Add special ata_pio_need_iordy() handling for Compact Flash.
  pata_platform: __pata_platform_remove() shouldn't be in discard section
  sata_sil24: remove unused sil24_port_multiplier
  [libata] ahci: Add SATA GEN3 related messages
  ata_piix: save, use saved and restore IOCFG
  pata_ali: Fix and workaround for FIFO DMA bug
  pata_ali: force initialise a few bits
  pata_hpt3x3: Workarounds for chipset

15 years agoMerge branch 'next-footbridge' of git://aeryn.fluff.org.uk/bjdooks/linux
Russell King [Thu, 8 Jan 2009 22:01:34 +0000 (22:01 +0000)]
Merge branch 'next-footbridge' of git://aeryn.fluff.org.uk/bjdooks/linux

15 years agolibata: clean up the SFF code for coding style
Alan Cox [Mon, 5 Jan 2009 14:16:13 +0000 (14:16 +0000)]
libata: clean up the SFF code for coding style

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
15 years agolibata: Add 32bit PIO support
Alan Cox [Mon, 5 Jan 2009 14:16:39 +0000 (14:16 +0000)]
libata: Add 32bit PIO support

This matters for some controllers and in one or two cases almost doubles
PIO performance. Add a bmdma32 operations set we can inherit and activate
it for some controllers

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
15 years ago[libata] ahci: Withdraw IGN_SERR_INTERNAL for SB800 SATA
Shane Huang [Tue, 30 Dec 2008 02:53:41 +0000 (10:53 +0800)]
[libata] ahci: Withdraw IGN_SERR_INTERNAL for SB800 SATA

There is an issue in ATI SB600/SB700 SATA that PxSERR.E should not be
set on some conditions, which will lead to many SATA ODD error messages.
commit 55a61604cd1354e1783364e1c901034f2f474b7d is the workaround.
Since SB800 fixed this HW issue, IGN_SERR_INTERNAL should be withdrawn
for SB800.

Signed-off-by: Shane Huang <shane.huang@amd.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
15 years agomd: don't retry recovery of raid1 that fails due to error on source drive.
NeilBrown [Thu, 8 Jan 2009 21:31:11 +0000 (08:31 +1100)]
md: don't retry recovery of raid1 that fails due to error on source drive.

If a raid1 has only one working drive and it has a sector which
gives an error on read, then an attempt to recover onto a spare will
fail, but as the single remaining drive is not removed from the
array, the recovery will be immediately re-attempted, resulting
in an infinite recovery loop.

So detect this situation and don't retry recovery once an error
on the lone remaining drive is detected.

Allow recovery to be retried once every time a spare is added
in case the problem wasn't actually a media error.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agomd: Allow md devices to be created by name.
NeilBrown [Thu, 8 Jan 2009 21:31:10 +0000 (08:31 +1100)]
md: Allow md devices to be created by name.

Using sequential numbers to identify md devices is somewhat artificial.
Using names can be a lot more user-friendly.

Also, creating md devices by opening the device special file is a bit
awkward.

So this patch provides a new option for creating and naming devices.

Writing a name such as "md_home" to
    /sys/modules/md_mod/parameters/new_array
will cause an array with that name to be created.  It will appear in
/sys/block/ /proc/partitions and /proc/mdstat as 'md_home'.
It will have an arbitrary minor number allocated.

md devices that a created by an open are destroyed on the last
close when the device is inactive.
For named md devices, they will not be destroyed until the array
is explicitly stopped, either with the STOP_ARRAY ioctl or by
writing 'clear' to /sys/block/md_XXXX/md/array_state.

The name of the array must start 'md_' to avoid conflict with
other devices.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agomd: make devices disappear when they are no longer needed.
NeilBrown [Thu, 8 Jan 2009 21:31:10 +0000 (08:31 +1100)]
md: make devices disappear when they are no longer needed.

Currently md devices, once created, never disappear until the module
is unloaded.  This is essentially because the gendisk holds a
reference to the mddev, and the mddev holds a reference to the
gendisk, this a circular reference.

If we drop the reference from mddev to gendisk, then we need to ensure
that the mddev is destroyed when the gendisk is destroyed.  However it
is not possible to hook into the gendisk destruction process to enable
this.

So we drop the reference from the gendisk to the mddev and destroy the
gendisk when the mddev gets destroyed.  However this has a
complication.
Between the call
   __blkdev_get->get_gendisk->kobj_lookup->md_probe
and the call
   __blkdev_get->md_open

there is no obvious way to hold a reference on the mddev any more, so
unless something is done, it will disappear and gendisk will be
destroyed prematurely.

Also, once we decide to destroy the mddev, there will be an unlockable
moment before the gendisk is unlinked (blk_unregister_region) during
which a new reference to the gendisk can be created.  We need to
ensure that this reference can not be used.  i.e. the ->open must
fail.

So:
 1/  in md_probe we set a flag in the mddev (hold_active) which
     indicates that the array should be treated as active, even
     though there are no references, and no appearance of activity.
     This is cleared by md_release when the device is closed if it
     is no longer needed.
     This ensures that the gendisk will survive between md_probe and
     md_open.

 2/  In md_open we check if the mddev we expect to open matches
     the gendisk that we did open.
     If there is a mismatch we return -ERESTARTSYS and modify
     __blkdev_get to retry from the top in that case.
     In the -ERESTARTSYS sys case we make sure to wait until
     the old gendisk (that we succeeded in opening) is really gone so
     we loop at most once.

Some udev configurations will always open an md device when it first
appears.   If we allow an md device that was just created by an open
to disappear on an immediate close, then this can race with such udev
configurations and result in an infinite loop the device being opened
and closed, then re-open due to the 'ADD' even from the first open,
and then close and so on.
So we make sure an md device, once created by an open, remains active
at least until some md 'ioctl' has been made on it.  This means that
all normal usage of md devices will allow them to disappear promptly
when not needed, but the worst that an incorrect usage will do it
cause an inactive md device to be left in existence (it can easily be
removed).

As an array can be stopped by writing to a sysfs attribute
  echo clear > /sys/block/mdXXX/md/array_state
we need to use scheduled work for deleting the gendisk and other
kobjects.  This allows us to wait for any pending gendisk deletion to
complete by simply calling flush_scheduled_work().

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agomd: centralise all freeing of an 'mddev' in 'md_free'
NeilBrown [Thu, 8 Jan 2009 21:31:09 +0000 (08:31 +1100)]
md: centralise all freeing of an 'mddev' in 'md_free'

md_free is the .release handler for the md kobj_type.
So it makes sense to release all the objects referenced by
the mddev in there, rather than just prior to calling kobject_put
for what we think is the last time.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agomd: move allocation of ->queue from mddev_find to md_probe
NeilBrown [Thu, 8 Jan 2009 21:31:08 +0000 (08:31 +1100)]
md: move allocation of ->queue from mddev_find to md_probe

It is more balanced to just do simple initialisation in mddev_find,
which allocates and links a new md device, and leave all the
more sophisticated allocation to md_probe (which calls mddev_find).
md_probe already allocated the gendisk.  It should allocate the
queue too.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agomd: need another print_sb for mdp_superblock_1
Cheng Renquan [Thu, 8 Jan 2009 21:31:08 +0000 (08:31 +1100)]
md: need another print_sb for mdp_superblock_1

md_print_devices is called in two code path: MD_BUG(...), and md_ioctl
with PRINT_RAID_DEBUG.  it will dump out all in use md devices
information;

However, it wrongly processed two types of superblock in one:

The header file <linux/raid/md_p.h> has defined two types of superblock,
struct mdp_superblock_s (typedefed with mdp_super_t) according to md with
metadata 0.90, and struct mdp_superblock_1 according to md with metadata
1.0 and later,

These two types of superblock are very different,

The md_print_devices code processed them both in mdp_super_t, that would
lead to wrong informaton dump like:

[ 6742.345877]
[ 6742.345887] md: **********************************
[ 6742.345890] md: * <COMPLETE RAID STATE PRINTOUT> *
[ 6742.345892] md: **********************************
[ 6742.345896] md1: <ram7><ram6><ram5><ram4>
[ 6742.345907] md: rdev ram7, SZ:00065472 F:0 S:1 DN:3
[ 6742.345909] md: rdev superblock:
[ 6742.345914] md:  SB: (V:0.90.0) ID:<42ef13c7.598c059a.5f9f1645.801e9ee6> CT:4919856d
[ 6742.345918] md:     L5 S00065472 ND:4 RD:4 md1 LO:2 CS:65536
[ 6742.345922] md:     UT:4919856d ST:1 AD:4 WD:4 FD:0 SD:0 CSUM:b7992907 E:00000001
[ 6742.345924]      D  0:  DISK<N:0,(1,8),R:0,S:6>
[ 6742.345930]      D  1:  DISK<N:1,(1,10),R:1,S:6>
[ 6742.345933]      D  2:  DISK<N:2,(1,12),R:2,S:6>
[ 6742.345937]      D  3:  DISK<N:3,(1,14),R:3,S:6>
[ 6742.345942] md:     THIS:  DISK<N:3,(1,14),R:3,S:6>
...
[ 6742.346058] md0: <ram3><ram2><ram1><ram0>
[ 6742.346067] md: rdev ram3, SZ:00065472 F:0 S:1 DN:3
[ 6742.346070] md: rdev superblock:
[ 6742.346073] md:  SB: (V:1.0.0) ID:<369aad81.00000000.00000000.00000000> CT:9a322a9c
[ 6742.346077] md:     L-1507699579 S976570180 ND:48 RD:0 md0 LO:65536 CS:196610
[ 6742.346081] md:     UT:00000018 ST:0 AD:131048 WD:0 FD:8 SD:0 CSUM:00000000 E:00000000
[ 6742.346084]      D  0:  DISK<N:-1,(-1,-1),R:-1,S:-1>
[ 6742.346089]      D  1:  DISK<N:-1,(-1,-1),R:-1,S:-1>
[ 6742.346092]      D  2:  DISK<N:-1,(-1,-1),R:-1,S:-1>
[ 6742.346096]      D  3:  DISK<N:-1,(-1,-1),R:-1,S:-1>
[ 6742.346102] md:     THIS:  DISK<N:0,(0,0),R:0,S:0>
...
[ 6742.346219] md: **********************************
[ 6742.346221]

Here md1 is metadata 0.90.0, and md0 is metadata 1.2

After some more code to distinguish these two types of superblock, in this patch,

it will generate dump information like:

[ 7906.755790]
[ 7906.755799] md: **********************************
[ 7906.755802] md: * <COMPLETE RAID STATE PRINTOUT> *
[ 7906.755804] md: **********************************
[ 7906.755808] md1: <ram7><ram6><ram5><ram4>
[ 7906.755819] md: rdev ram7, SZ:00065472 F:0 S:1 DN:3
[ 7906.755821] md: rdev superblock (MJ:0):
[ 7906.755826] md:  SB: (V:0.90.0) ID:<3fca7a0d.a612bfed.5f9f1645.801e9ee6> CT:491989f3
[ 7906.755830] md:     L5 S00065472 ND:4 RD:4 md1 LO:2 CS:65536
[ 7906.755834] md:     UT:491989f3 ST:1 AD:4 WD:4 FD:0 SD:0 CSUM:00fb52ad E:00000001
[ 7906.755836]      D  0:  DISK<N:0,(1,8),R:0,S:6>
[ 7906.755842]      D  1:  DISK<N:1,(1,10),R:1,S:6>
[ 7906.755845]      D  2:  DISK<N:2,(1,12),R:2,S:6>
[ 7906.755849]      D  3:  DISK<N:3,(1,14),R:3,S:6>
[ 7906.755855] md:     THIS:  DISK<N:3,(1,14),R:3,S:6>
...
[ 7906.755972] md0: <ram3><ram2><ram1><ram0>
[ 7906.755981] md: rdev ram3, SZ:00065472 F:0 S:1 DN:3
[ 7906.755984] md: rdev superblock (MJ:1):
[ 7906.755989] md:  SB: (V:1) (F:0) Array-ID:<5fbcf158:55aa:5fbe:9a79:1e939880dcbd>
[ 7906.755990] md:    Name: "DG5:0" CT:1226410480
[ 7906.755998] md:       L5 SZ130944 RD:4 LO:2 CS:128 DO:24 DS:131048 SO:8 RO:0
[ 7906.755999] md:     Dev:00000003 UUID: 9194d744:87f7:a448:85f2:7497b84ce30a
[ 7906.756001] md:       (F:0) UT:1226410480 Events:0 ResyncOffset:-1 CSUM:0dbcd829
[ 7906.756003] md:         (MaxDev:384)
...
[ 7906.756113] md: **********************************
[ 7906.756116]

this md0 (metadata 1.2) information dumping is exactly according to struct
mdp_superblock_1.

Signed-off-by: Cheng Renquan <crquan@gmail.com>
Cc: Neil Brown <neilb@suse.de>
Cc: Dan Williams <dan.j.williams@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: NeilBrown <neilb@suse.de>
15 years agomd: use list_for_each_entry macro directly
Cheng Renquan [Thu, 8 Jan 2009 21:31:08 +0000 (08:31 +1100)]
md: use list_for_each_entry macro directly

The rdev_for_each macro defined in <linux/raid/md_k.h> is identical to
list_for_each_entry_safe, from <linux/list.h>, it should be defined to
use list_for_each_entry_safe, instead of reinventing the wheel.

But some calls to each_entry_safe don't really need a safe version,
just a direct list_for_each_entry is enough, this could save a temp
variable (tmp) in every function that used rdev_for_each.

In this patch, most rdev_for_each loops are replaced by list_for_each_entry,
totally save many tmp vars; and only in the other situations that will call
list_del to delete an entry, the safe version is used.

Signed-off-by: Cheng Renquan <crquan@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
15 years agomd: raid0: make hash_spacing and preshift sector-based.
Andre Noll [Thu, 8 Jan 2009 21:31:08 +0000 (08:31 +1100)]
md: raid0: make hash_spacing and preshift sector-based.

This patch renames the hash_spacing and preshift members of struct
raid0_private_data to spacing and sector_shift respectively and
changes the semantics as follows:

We always have spacing = 2 * hash_spacing. In case
sizeof(sector_t) > sizeof(u32) we also have sector_shift = preshift + 1
while sector_shift = preshift = 0 otherwise.

Note that the values of nb_zone and zone are unaffected by these changes
because in the sector_div() preceeding the assignement of these two
variables both arguments double.

Signed-off-by: Andre Noll <maan@systemlinux.org>
Signed-off-by: NeilBrown <neilb@suse.de>
15 years agomd: raid0: Represent the size of strip zones in sectors.
Andre Noll [Thu, 8 Jan 2009 21:31:07 +0000 (08:31 +1100)]
md: raid0: Represent the size of strip zones in sectors.

This completes the block -> sector conversion of struct strip_zone.

Signed-off-by: Andre Noll <maan@systemlinux.org>
Signed-off-by: NeilBrown <neilb@suse.de>
15 years agomd: raid0 create_strip_zones(): Add KERN_INFO/KERN_ERR to printk's.
Andre Noll [Thu, 8 Jan 2009 21:31:07 +0000 (08:31 +1100)]
md: raid0 create_strip_zones(): Add KERN_INFO/KERN_ERR to printk's.

This patch consists only of these trivial changes.

Signed-off-by: Andre Noll <maan@systemlinux.org>
Signed-off-by: NeilBrown <neilb@suse.de>
15 years agomd: raid0 create_strip_zones(): Make two local variables sector-based.
Andre Noll [Thu, 8 Jan 2009 21:31:07 +0000 (08:31 +1100)]
md: raid0 create_strip_zones(): Make two local variables sector-based.

current_offset and curr_zone_offset stored the corresponding offsets
as 1K quantities. Rename them to current_start and curr_zone_start
to match the naming of struct strip_zone and store the offsets as
sector counts.

Also, add KERN_INFO to the printk() affected by this change to make
checkpatch happy.

Signed-off-by: Andre Noll <maan@systemlinux.org>
Signed-off-by: NeilBrown <neilb@suse.de>
15 years agomd: raid0: Represent zone->zone_offset in sectors.
Andre Noll [Thu, 8 Jan 2009 21:31:07 +0000 (08:31 +1100)]
md: raid0: Represent zone->zone_offset in sectors.

For the same reason as in the previous patch, rename it from zone_offset
to zone_start.

Signed-off-by: Andre Noll <maan@systemlinux.org>
Signed-off-by: NeilBrown <neilb@suse.de>
15 years agomd: raid0: Represent device offset in sectors.
Andre Noll [Thu, 8 Jan 2009 21:31:06 +0000 (08:31 +1100)]
md: raid0: Represent device offset in sectors.

Rename zone->dev_offset to zone->dev_start to make sure all users
have been converted.

Signed-off-by: Andre Noll <maan@systemlinux.org>
Signed-off-by: NeilBrown <neilb@suse.de>
15 years agomd: raid0_make_request(): Replace local variable block by sector.
Andre Noll [Thu, 8 Jan 2009 21:31:06 +0000 (08:31 +1100)]
md: raid0_make_request(): Replace local variable block by sector.

This change already simplifies the code a bit.

Signed-off-by: Andre Noll <maan@systemlinux.org>
Signed-off-by: NeilBrown <neilb@suse.de>
15 years agomd: raid0_make_request(): Remove local variable chunk_size.
Andre Noll [Thu, 8 Jan 2009 21:31:06 +0000 (08:31 +1100)]
md: raid0_make_request(): Remove local variable chunk_size.

We might as well use chunk_sects instead.

Signed-off-by: Andre Noll <maan@systemlinux.org>
Signed-off-by: NeilBrown <neilb@suse.de>
15 years agomd: raid0_make_request(): Replace chunksize_bits by chunksect_bits.
Andre Noll [Thu, 8 Jan 2009 21:31:06 +0000 (08:31 +1100)]
md: raid0_make_request(): Replace chunksize_bits by chunksect_bits.

As ffz(~(2 * x)) = ffz(~x) + 1, we have

chunksect_bits = chunksize_bits + 1.

Fixup all users accordingly.

Signed-off-by: Andre Noll <maan@systemlinux.org>
Signed-off-by: NeilBrown <neilb@suse.de>
15 years agomd: use sysfs_notify_dirent to notify changes to md/sync_action.
NeilBrown [Thu, 8 Jan 2009 21:31:05 +0000 (08:31 +1100)]
md: use sysfs_notify_dirent to notify changes to md/sync_action.

There is no compelling need for this, but sysfs_notify_dirent is a
nicer interface and the change is good for consistency.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agomd: fix bitmap-on-external-file bug.
NeilBrown [Thu, 8 Jan 2009 21:31:05 +0000 (08:31 +1100)]
md: fix bitmap-on-external-file bug.

commit a2ed9615e3222645007fc19991aedf30eed3ecfd
fixed a bug with 'internal' bitmaps, but in the process broke
'in a file' bitmaps.  So they are broken in 2.6.28

This fixes it, and needs to go in 2.6.28-stable.

Signed-off-by: NeilBrown <neilb@suse.de>
Cc: stable@kernel.org
15 years agopata_hpt366: reimplement mode programming
Tejun Heo [Thu, 8 Jan 2009 21:29:20 +0000 (16:29 -0500)]
pata_hpt366: reimplement mode programming

Reimplement mode programming logic of pata_hpt366 such that it's
identical to that of IDE hpt366 driver.  The differences were...

* pata_hpt366 used 0xCFFF8FFFF to mask pio modes and 0x3FFFFFFF dma
  modes.  IDE hpt366 uses 0xC1F8FFFF for PIO, 0x303800FF for MWDMA and
  0x30070000 for UDMA.

* pata_hpt366 doesn't set 0x08000000 for PIO unless it's already set
  and always turns it on for MWDMA/UDMA.  IDE hpt366 doesn't bother
  with the bit.  It always uses what was there.

* IDE hpt366 always clears 0xC0000000.  pata_hpt366 doesn't.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
15 years ago[libata] pata_hpt3x3: correct _freeze() function declaration
Jeff Garzik [Thu, 8 Jan 2009 21:28:21 +0000 (16:28 -0500)]
[libata] pata_hpt3x3: correct _freeze() function declaration

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
15 years agolibata: Add special ata_pio_need_iordy() handling for Compact Flash.
David Daney [Wed, 10 Dec 2008 23:39:12 +0000 (15:39 -0800)]
libata: Add special ata_pio_need_iordy() handling for Compact Flash.

According to the Compact Flash specification r4.1, PIO modes 5 and 6
do not use iordy.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
15 years agopata_platform: __pata_platform_remove() shouldn't be in discard section
Sonic Zhang [Wed, 7 Jan 2009 16:37:12 +0000 (00:37 +0800)]
pata_platform: __pata_platform_remove() shouldn't be in discard section

--
  UPD     include/linux/compile.h
`___pata_platform_remove' referenced in section `__ksymtab_gpl' of
drivers/built-in.o: defined in discarded section `.devexit.text' of
drivers/built-in.o
make: *** [.tmp_vmlinux1] Error 1
--

__pata_platform_remove() should not be in discarded section
__pata_platform_remove(struct device *dev) is invoked in both
pata_platform.c and pata_of_platform.c by reomve function defined in
discarded section ".devexit.text". An exported function should not be put
into discarded section.

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
15 years agosata_sil24: remove unused sil24_port_multiplier
Grant Grundler [Wed, 7 Jan 2009 02:26:40 +0000 (11:26 +0900)]
sata_sil24: remove unused sil24_port_multiplier

AFAICT, struct sil24_port_multiplier isn't used anywhere. Remove it.

Signed-off-by: Grant Grundler <grundler@google.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
15 years ago[libata] ahci: Add SATA GEN3 related messages
Shane Huang [Tue, 30 Dec 2008 03:00:37 +0000 (11:00 +0800)]
[libata] ahci: Add SATA GEN3 related messages

The present AHCI driver seems to support SATA GEN 3 speed, but the related
messages should be modified.

Signed-off-by: Shane Huang <shane.huang@amd.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
15 years agoata_piix: save, use saved and restore IOCFG
Tejun Heo [Fri, 2 Jan 2009 03:04:48 +0000 (12:04 +0900)]
ata_piix: save, use saved and restore IOCFG

Certain ACPI implementations mess up IOCFG on _STM making libata
detect cable type incorrectly after a suspend/resume cycle.  This
patch makes ata_piix save IOCFG on attach, use the saved value for
things which aren't dynamic and restore it on detach so that the next
driver also gets the BIOS initialized value.

This patch contains the following changes.

* makes ich_pata_cable_detect() use saved_iocfg.

* make piix_iocfg_bit18_quirk() take @host and use saved_iocfg.

* hpriv allocation moved upwards to save iocfg before doing anything
  else.

This fixes bz#11879.  Andreas Mohr reported and diagnosed the problem.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Andreas Mohr <andi@lisas.de>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
15 years agopata_ali: Fix and workaround for FIFO DMA bug
Alan Cox [Mon, 5 Jan 2009 14:13:53 +0000 (14:13 +0000)]
pata_ali: Fix and workaround for FIFO DMA bug

In very obscure cases this can cause problems. We need to help the hardware
out a bit to avoid DMA problems on a reset.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
15 years agopata_ali: force initialise a few bits
Alan Cox [Mon, 5 Jan 2009 14:13:22 +0000 (14:13 +0000)]
pata_ali: force initialise a few bits

We can't assume some of the setup here on non x86 boxes.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
15 years agopata_hpt3x3: Workarounds for chipset
Alan Cox [Mon, 5 Jan 2009 14:12:51 +0000 (14:12 +0000)]
pata_hpt3x3: Workarounds for chipset

Correct the DMA bit flags (UDMA and MWDMA were swapped)
Add workarounds so that we clear ERR and INTR bits before issuing a DMA
Add workarounds so that we stop a live DMA before touching the CTL register

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
15 years agoasync: make async_synchronize_full() more serializing
Arjan van de Ven [Thu, 8 Jan 2009 20:35:11 +0000 (12:35 -0800)]
async: make async_synchronize_full() more serializing

turns out that there are real problems with allowing async
tasks that are scheduled from async tasks to run after
the async_synchronize_full() returns.

This patch makes the _full more strict and a complete
synchronization. Later I might need to add back a lighter
form of synchronization for other uses.. but not right now.

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agowimax: fix kernel-doc for debufs_dentry member of struct wimax_dev
Inaky Perez-Gonzalez [Thu, 8 Jan 2009 20:56:57 +0000 (12:56 -0800)]
wimax: fix kernel-doc for debufs_dentry member of struct wimax_dev

Reported by Randy Dunlap from a warning in the v2.6.29 merge window
tree as of 2009/1/8.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agonet: convert pegasus driver to net_device_ops
Oliver Neukum [Thu, 8 Jan 2009 19:22:25 +0000 (11:22 -0800)]
net: convert pegasus driver to net_device_ops

This converts the pegasus driver to use of the new net_device_ops structure

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agobnx2x: Prevent eeprom set when driver is down
Eilon Greenstein [Thu, 8 Jan 2009 19:21:43 +0000 (11:21 -0800)]
bnx2x: Prevent eeprom set when driver is down

Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agonet: switch kaweth driver to netdevops
Oliver Neukum [Thu, 8 Jan 2009 19:20:22 +0000 (11:20 -0800)]
net: switch kaweth driver to netdevops

This converts the kaweth ethernet USB driver to netdevops.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agopcnet32: round off carrier watch timer
Stephen Hemminger [Thu, 8 Jan 2009 19:17:13 +0000 (11:17 -0800)]
pcnet32: round off carrier watch timer

The link check watchdog timer on this driver fires every two seconds, but
since not aligned it causes extra wakeups. It is more important on this
driver than most because it is the hardware that is emulated by default
when using network interfaces on VMware.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agoi2400m/usb: wrap USB power saving in #ifdef CONFIG_PM
Inaky Perez-Gonzalez [Thu, 8 Jan 2009 19:08:25 +0000 (11:08 -0800)]
i2400m/usb: wrap USB power saving in #ifdef CONFIG_PM

Current code was assuming PM was always enabled, which is not
correct. Code which accesses members in the struct usb_device that are
dependant on CONFIG_PM must be protected the same.

Reported by Randy Dunlap from a build error in the linux-next tree on
07/01/2009.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agowimax: testing for rfkill support should also test for CONFIG_RFKILL_MODULE
Inaky Perez-Gonzalez [Thu, 8 Jan 2009 19:08:01 +0000 (11:08 -0800)]
wimax: testing for rfkill support should also test for CONFIG_RFKILL_MODULE

Current WiMAX rfkill code is missing the case where rfkill is compiled
in as modules and works only when rfkill is compiled in. This is not
correct. Fixed to test for CONFIG_RFKILL or CONFIG_RKILL_MODULE.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agowimax: fix kconfig interactions with rfkill and input layers
Inaky Perez-Gonzalez [Thu, 8 Jan 2009 19:07:36 +0000 (11:07 -0800)]
wimax: fix kconfig interactions with rfkill and input layers

WiMAX can work without RFKILL, but it was missing a check to make sure
RFKILL is not being made a module with wimax compiled into the
kernel. This caused failed builds in s390, where CONFIG_INPUT is
always off.

When RFKILL is enabled, the code uses the input layer to report
hardware switch changes; thus, if RFKILL is enabled, INPUT has to be
too. It also needs to display some message when INPUT is disabled that
explains why WiMAX is not selectable.

(issues found by Randy Dunlap in the linux-next tree).

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agowimax: fix '#ifndef CONFIG_BUG' layout to avoid warning
Inaky Perez-Gonzalez [Thu, 8 Jan 2009 19:06:48 +0000 (11:06 -0800)]
wimax: fix '#ifndef CONFIG_BUG' layout to avoid warning

Reported by Randy Dunlap:

> Also, this warning needs to be fixed:
>
> linux-next-20090106/net/wimax/id-table.c:133: warning: ISO C90
> forbids mixed declarations and code

Move the return on #defined(CONFIG_BUG) below the variable
declarations so it doesn't violate ISO C90.

On wimax_id_table_release() we want to do a debug check if CONFIG_BUG
is enabled. However, we also want the debug code to be always compiled
to ensure there is no bitrot. It will be optimized out by the compiler
when CONFIG_BUG is disabled.

Added a note to the function header stating this.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agoMerge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
David S. Miller [Thu, 8 Jan 2009 19:05:59 +0000 (11:05 -0800)]
Merge branch 'master' of /linux/kernel/git/torvalds/linux-2.6

15 years agor6040: bump release number to 0.20
Florian Fainelli [Thu, 8 Jan 2009 19:03:57 +0000 (11:03 -0800)]
r6040: bump release number to 0.20

This patch bumps release number to 0.20 and 07Jan2009.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agor6040: warn about MAC address being unset
Florian Fainelli [Thu, 8 Jan 2009 19:02:30 +0000 (11:02 -0800)]
r6040: warn about MAC address being unset

Some bootloader/BIOSes do not set the MAC
address, warn about that.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agor6040: check PHY status when bringing interface up
Florian Fainelli [Thu, 8 Jan 2009 19:01:58 +0000 (11:01 -0800)]
r6040: check PHY status when bringing interface up

This patch makes the driver properly initialize the PHY
status if not correctly set by the bootloader/BIOS.
It prevents some boards to bring up the link on boot.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agor6040: make printks consistent with DRV_NAME
Florian Fainelli [Thu, 8 Jan 2009 19:00:52 +0000 (11:00 -0800)]
r6040: make printks consistent with DRV_NAME

This patch fixes some printks which were not prefixed
with DRV_NAME, useful when having multiple cards/drivers
on the system.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agogianfar: Fixup use of BUS_ID_SIZE
Kumar Gala [Thu, 8 Jan 2009 18:58:38 +0000 (10:58 -0800)]
gianfar: Fixup use of BUS_ID_SIZE

Commit b31a1d8b41513b96e9c7ec2f68c5734cef0b26a4 ("gianfar: Convert
gianfar to an of_platform_driver") went back to using BUS_ID_SIZE
instead of sizeof() as per the larger patch series that will remove
"char bus_id[20]" from struct device.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agomlx4_en: Returning real Max in get_ringparam
Yevgeny Petrilin [Thu, 8 Jan 2009 18:57:37 +0000 (10:57 -0800)]
mlx4_en: Returning real Max in get_ringparam

Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agomlx4_en: Consider inline packets on completion
Yevgeny Petrilin [Thu, 8 Jan 2009 18:57:15 +0000 (10:57 -0800)]
mlx4_en: Consider inline packets on completion

Was trying to unmap work queue entries that had inline packets,
so naturally weren't mapped.

Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agonetdev: bfin_mac: enable bfin_mac net dev driver for BF51x
Sonic Zhang [Thu, 8 Jan 2009 18:52:26 +0000 (10:52 -0800)]
netdev: bfin_mac: enable bfin_mac net dev driver for BF51x

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agoqeth: convert to net_device_ops
Frank Blaschka [Thu, 8 Jan 2009 18:50:55 +0000 (10:50 -0800)]
qeth: convert to net_device_ops

qeth_l2, qeth_l3 convert to net_device_ops.
qeth_l3 remove vlan neigh_setup hack since it does not work any longer
with the new net_device_ops.

Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agovlan: add neigh_setup
Frank Blaschka [Thu, 8 Jan 2009 18:50:20 +0000 (10:50 -0800)]
vlan: add neigh_setup

In case the real device has a neigh_setup function, this
neigh_setup function should be used for the vlan device.

Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agodm9601: warn on invalid mac address
Wu Fengguang [Thu, 8 Jan 2009 18:47:01 +0000 (10:47 -0800)]
dm9601: warn on invalid mac address

Add warnings on invalid mac address to help disclose/debug problems.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Acked-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agodm9601: tell HW about random generated mac address
Wu Fengguang [Tue, 6 Jan 2009 18:52:58 +0000 (18:52 +0000)]
dm9601: tell HW about random generated mac address

Otherwise unicast RX will only work in promisc mode.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agotcp6: Add GRO support
Herbert Xu [Thu, 8 Jan 2009 18:41:23 +0000 (10:41 -0800)]
tcp6: Add GRO support

This patch adds GRO support for TCP over IPv6.  The code is exactly
the same as the IPv4 version except for the pseudo-header checksum
computation.

Note that I've removed the unused tcphdr argument from tcp_v6_check
rather than invent a bogus value for GRO.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agoipv6: Add GRO support
Herbert Xu [Thu, 8 Jan 2009 18:40:57 +0000 (10:40 -0800)]
ipv6: Add GRO support

This patch adds GRO support for IPv6.  IPv6 GRO supports extension
headers in the same way as GSO (by using the same infrastructure).
It's also simpler compared to IPv4 since we no longer have to worry
about fragmentation attributes or header checksums.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agoMerge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
Linus Torvalds [Thu, 8 Jan 2009 17:10:16 +0000 (09:10 -0800)]
Merge branch 'next' of git://git./linux/kernel/git/benh/powerpc

* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc: (53 commits)
  serial: Add driver for the Cell Network Processor serial port NWP device
  powerpc: enable dynamic ftrace
  powerpc/cell: Fix the prototype of create_vma_map()
  powerpc/mm: Make clear_fixmap() actually work
  powerpc/kdump: Use ppc_save_regs() in crash_setup_regs()
  powerpc: Export cacheable_memzero as its now used in a driver
  powerpc: Fix missing semicolons in mmu_decl.h
  powerpc/pasemi: local_irq_save uses an unsigned long
  powerpc/cell: Fix some u64 vs. long types
  powerpc/cell: Use correct types in beat files
  powerpc: Use correct type in prom_init.c
  powerpc: Remove unnecessary casts
  mtd/ps3vram: Use _PAGE_NO_CACHE in memory ioremap
  mtd/ps3vram: Use msleep in waits
  mtd/ps3vram: Use proper kernel types
  mtd/ps3vram: Cleanup ps3vram driver messages
  mtd/ps3vram: Remove ps3vram debug routines
  mtd/ps3vram: Add modalias support to the ps3vram driver
  mtd/ps3vram: Add ps3vram driver for accessing video RAM as MTD
  powerpc: Fix iseries drivers build failure without CONFIG_VIOPATH
  ...

15 years agofix similar typos to successfull
Coly Li [Thu, 8 Jan 2009 02:09:16 +0000 (18:09 -0800)]
fix similar typos to successfull

When I review ocfs2 code, find there are 2 typos to "successfull".  After
doing grep "successfull " in kernel tree, 22 typos found totally -- great
minds always think alike :)

This patch fixes all the similar typos. Thanks for Randy's ack and comments.

Signed-off-by: Coly Li <coyli@suse.de>
Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
Acked-by: Roland Dreier <rolandd@cisco.com>
Cc: Jeremy Kerr <jk@ozlabs.org>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Theodore Ts'o <tytso@mit.edu>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Vlad Yasevich <vladislav.yasevich@hp.com>
Cc: Sridhar Samudrala <sri@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoMake various things static
Roel Kluin [Thu, 8 Jan 2009 02:09:15 +0000 (18:09 -0800)]
Make various things static

Building an allnoconfig kernel, sparse asked whether these could be
static, so I checked, and they are only used in the file where they are
declared.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agogeneric swap(): dcache: use swap() instead of private do_switch()
Wu Fengguang [Thu, 8 Jan 2009 02:09:14 +0000 (18:09 -0800)]
generic swap(): dcache: use swap() instead of private do_switch()

Use the new generic implementation.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agogeneric swap(): sched: remove local swap() macro
Wu Fengguang [Thu, 8 Jan 2009 02:09:14 +0000 (18:09 -0800)]
generic swap(): sched: remove local swap() macro

Use the new generic implementation.

Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agogeneric swap(): ext4: remove local swap() macro
Wu Fengguang [Thu, 8 Jan 2009 02:09:13 +0000 (18:09 -0800)]
generic swap(): ext4: remove local swap() macro

Use the new generic implementation.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
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>
15 years agogeneric swap(): ext3: remove local swap() macro
Wu Fengguang [Thu, 8 Jan 2009 02:09:12 +0000 (18:09 -0800)]
generic swap(): ext3: remove local swap() macro

Use the new generic implementation.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
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>
15 years agogeneric swap(): introduce global macro swap(a, b)
Wu Fengguang [Thu, 8 Jan 2009 02:09:12 +0000 (18:09 -0800)]
generic swap(): introduce global macro swap(a, b)

There have been some local definitions of swap(), it's time to replace
them all with a uniform one.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agogeneric swap(): lib/sort.c: rename swap to swap_func
Wu Fengguang [Thu, 8 Jan 2009 02:09:11 +0000 (18:09 -0800)]
generic swap(): lib/sort.c: rename swap to swap_func

This is to avoid name clashes for the introduction of a global swap()
macro.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agogeneric swap(): iphase: rename swap() to swap_byte_order()
Wu Fengguang [Thu, 8 Jan 2009 02:09:10 +0000 (18:09 -0800)]
generic swap(): iphase: rename swap() to swap_byte_order()

In preparation for the introduction of a generic swap() macro.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agogeneric swap(): sparc: rename swap() to swap_ulong()
Wu Fengguang [Thu, 8 Jan 2009 02:09:10 +0000 (18:09 -0800)]
generic swap(): sparc: rename swap() to swap_ulong()

In preparation for the introduction of a generic swap() macro.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoremove lots of double-semicolons
Fernando Carrijo [Thu, 8 Jan 2009 02:09:08 +0000 (18:09 -0800)]
remove lots of double-semicolons

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Theodore Ts'o <tytso@mit.edu>
Acked-by: Mark Fasheh <mfasheh@suse.com>
Acked-by: David S. Miller <davem@davemloft.net>
Cc: James Morris <jmorris@namei.org>
Acked-by: Casey Schaufler <casey@schaufler-ca.com>
Acked-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoromfs: romfs_iget() - unsigned ino >= 0 is always true
roel kluin [Thu, 8 Jan 2009 02:09:08 +0000 (18:09 -0800)]
romfs: romfs_iget() - unsigned ino >= 0 is always true

romfs_strnlen() returns int
unsigned X >= 0 is always true

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: roel kluin <roel.kluin@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agovmcore: remove saved_max_pfn check
Magnus Damm [Thu, 8 Jan 2009 02:09:06 +0000 (18:09 -0800)]
vmcore: remove saved_max_pfn check

Remove the saved_max_pfn check from the /proc/vmcore function
read_from_oldmem().  No need to verify, we should be able to just trust
that "elfcorehdr=" is correctly passed to the crash kernel on the kernel
command line like we do with other parameters.

The read_from_oldmem() function in fs/proc/vmcore.c is quite similar to
read_from_oldmem() in drivers/char/mem.c, but only in the latter it makes
sense to use saved_max_pfn.  For oldmem it is used to determine when to
stop reading.  For vmcore we already have the elf header info pointing out
the physical memory regions, no need to pass the end-of- old-memory twice.

Removing the saved_max_pfn check from vmcore makes it possible for
architectures to skip oldmem but still support crash dump through vmcore -
without the need for the old saved_max_pfn cruft.

Architectures that want to play safe can do the saved_max_pfn check in
copy_oldmem_page().  Not sure why anyone would want to do that, but that's
even safer than today - the saved_max_pfn check in vmcore removed by this
patch only checks the first page.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
Acked-by: Simon Horman <horms@verge.net.au>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agow1: send status messages after command processing
Evgeniy Polyakov [Thu, 8 Jan 2009 02:09:05 +0000 (18:09 -0800)]
w1: send status messages after command processing

Send completion status of the commands to the userspace.  Message and
protocol are described in the documentation.

Signed-off-by: Evgeniy Polyakov <zbr@ioremap.net>
Cc: Paul Alfille <paul.alfille@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agow1: added w1 reset command
Evgeniy Polyakov [Thu, 8 Jan 2009 02:09:04 +0000 (18:09 -0800)]
w1: added w1 reset command

Command which allows to reset the bus.

Signed-off-by: Evgeniy Polyakov <zbr@ioremap.net>
Cc: Paul Alfille <paul.alfille@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agow1: move w1 commands from defines to enum
Evgeniy Polyakov [Thu, 8 Jan 2009 02:09:03 +0000 (18:09 -0800)]
w1: move w1 commands from defines to enum

Signed-off-by: Evgeniy Polyakov <zbr@ioremap.net>
Cc: Paul Alfille <paul.alfille@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agow1: allow master IO commands
Evgeniy Polyakov [Thu, 8 Jan 2009 02:09:03 +0000 (18:09 -0800)]
w1: allow master IO commands

This small patchset extendes existing commands with reset, master IO and
status messages.  Reset is used to reset the bus for given master device,
master IO command allows to initiate IO against bus itself not selecting
slave device first, which can be used to probe the device for example.
And status messages carry command completion status back to the userspace
(namely very useful to get -ENODEV from when requested device was not
found).

Great thanks to Paul Alfille of OWFS for testing and commands suggestions.

This patch:

Allow starting of IO not against already found slave devices, but against
the bus itself, which can be used for example to probe devices.

[akpm@linux-foundation.org: reindent switch statements]
Signed-off-by: Evgeniy Polyakov <zbr@ioremap.net>
Cc: Paul Alfille <paul.alfille@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agow1: documentation update
Evgeniy Polyakov [Thu, 8 Jan 2009 02:09:02 +0000 (18:09 -0800)]
w1: documentation update

Signed-off-by: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agow1: list slaves commands
Evgeniy Polyakov [Thu, 8 Jan 2009 02:09:01 +0000 (18:09 -0800)]
w1: list slaves commands

Initiates search (or alarm search) and returns all found devices to
userspace.  Found devices are not added into the system (i.e.  they are
not attached to family devices or bus masters), it will be done via (if
was not done yet) usual timed searching.

Signed-off-by: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agow1: add touch block command
Evgeniy Polyakov [Thu, 8 Jan 2009 02:09:01 +0000 (18:09 -0800)]
w1: add touch block command

Writes and returns sampled data back to userspace.

Signed-off-by: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agow1: add list masters w1 command
Evgeniy Polyakov [Thu, 8 Jan 2009 02:08:59 +0000 (18:08 -0800)]
w1: add list masters w1 command

This patch series introduces and extends several userspace commands
used with netlink protocol.

Touch block command allows to write data and return sampled data to
the userspace.

Extended search and alarm seach commands to return list of slave
devices found during given search.

List masters command allows to send all registered master IDs to the
userspace.

Great thanks to Paul Alfille (owfs) who
tested this implementation and wrote w1-to-network daemon
http://sourceforge.net/projects/w1repeater/ and

Frederik Deweerdt and Randy Dunlap for review.

This patch:

Returns list of registered bus master devices.

Signed-off-by: Evgeniy Polyakov <zbr@ioremap.net>
Cc: Paul Alfille <paul.alfille@gmail.com>
Cc: Frederik Deweerdt <frederik.deweerdt@xprog.eu>
Cc: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agow1: add 1-wire master driver for i.MX27 / i.MX31
Sascha Hauer [Thu, 8 Jan 2009 02:08:58 +0000 (18:08 -0800)]
w1: add 1-wire master driver for i.MX27 / i.MX31

This patch adds support for the 1-wire master interface for i.MX27 and
i.MX31.

Signed-off-by: Luotao Fu <l.fu@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Evgeniy Polyakov <zbr@ioremap.net>
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agotpm: clean up tpm_nsc driver for platform_device suspend/resume compliance
David Smith [Thu, 8 Jan 2009 02:08:57 +0000 (18:08 -0800)]
tpm: clean up tpm_nsc driver for platform_device suspend/resume compliance

Signed-off-by: Marcel Selhorst <tpm@selhorst.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agomisc: add dell-laptop driver
Matthew Garrett [Thu, 8 Jan 2009 02:08:56 +0000 (18:08 -0800)]
misc: add dell-laptop driver

Add a driver for controlling Dell-specific backlight and rfkill interfaces.
This driver makes use of the dcdbas interface to the Dell firmware to
allow the backlight and rfkill interfaces on Dell systems to be driven
through the standardised sysfs interfaces.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
Cc: Matt Domsch <Matt_Domsch@dell.com>
Cc: Ivo van Doorn <ivdoorn@gmail.com>
Cc: Len Brown <lenb@kernel.org>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agodcdbas: export functionality for use in other drivers
Matthew Garrett [Thu, 8 Jan 2009 02:08:54 +0000 (18:08 -0800)]
dcdbas: export functionality for use in other drivers

The dcdbas code allows calls to be made into the firmware on Dell systems.
 Exporting this to other drivers allows them to implement Dell-specific
functionality in a safe way.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
Cc: Matt Domsch <Matt_Domsch@dell.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoELF: implement AT_RANDOM for glibc PRNG seeding
Kees Cook [Thu, 8 Jan 2009 02:08:52 +0000 (18:08 -0800)]
ELF: implement AT_RANDOM for glibc PRNG seeding

While discussing[1] the need for glibc to have access to random bytes
during program load, it seems that an earlier attempt to implement
AT_RANDOM got stalled.  This implements a random 16 byte string, available
to every ELF program via a new auxv AT_RANDOM vector.

[1] http://sourceware.org/ml/libc-alpha/2008-10/msg00006.html

Ulrich said:

glibc needs right after startup a bit of random data for internal
protections (stack canary etc).  What is now in upstream glibc is that we
always unconditionally open /dev/urandom, read some data, and use it.  For
every process startup.  That's slow.

...

The solution is to provide a limited amount of random data to the
starting process in the aux vector.  I suggested 16 bytes and this is
what the patch implements.  If we need only 16 bytes or less we use the
data directly.  If we need more we'll use the 16 bytes to see a PRNG.
This avoids the costly /dev/urandom use and it allows the kernel to use
the most adequate source of random data for this purpose.  It might not
be the same pool as that for /dev/urandom.

Concerns were expressed about the depletion of the randomness pool.  But
this patch doesn't make the situation worse, it doesn't deplete entropy
more than happens now.

Signed-off-by: Kees Cook <kees.cook@canonical.com>
Cc: Jakub Jelinek <jakub@redhat.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Ulrich Drepper <drepper@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agomqueue: fix si_pid value in mqueue do_notify()
Sukadev Bhattiprolu [Thu, 8 Jan 2009 02:08:50 +0000 (18:08 -0800)]
mqueue: fix si_pid value in mqueue do_notify()

If a process registers for asynchronous notification on a POSIX message
queue, it gets a signal and a siginfo_t structure when a message arrives
on the message queue.  The si_pid in the siginfo_t structure is set to the
PID of the process that sent the message to the message queue.

The principle is the following:
. when mq_notify(SIGEV_SIGNAL) is called, the caller registers for
  notification when a msg arrives. The associated pid structure is stroed into
  inode_info->notify_owner. Let's call this process P1.
. when mq_send() is called by say P2, P2 sends a signal to P1 to notify
  him about msg arrival.

The way .si_pid is set today is not correct, since it doesn't take into account
the fact that the process that is sending the message might not be in the
same namespace as the notified one.

This patch proposes to set si_pid to the sender's pid into the notify_owner
namespace.

Signed-off-by: Nadia Derbey <Nadia.Derbey@bull.net>
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Cc: Roland McGrath <roland@redhat.com>
Cc: Bastian Blank <bastian@waldi.eu.org>
Cc: Pavel Emelyanov <xemul@openvz.org>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agopid: generalize task_active_pid_ns
Eric W. Biederman [Thu, 8 Jan 2009 02:08:49 +0000 (18:08 -0800)]
pid: generalize task_active_pid_ns

Currently task_active_pid_ns is not safe to call after a task becomes a
zombie and exit_task_namespaces is called, as nsproxy becomes NULL.  By
reading the pid namespace from the pid of the task we can trivially solve
this problem at the cost of one extra memory read in what should be the
same cacheline as we read the namespace from.

When moving things around I have made task_active_pid_ns out of line
because keeping it in pid_namespace.h would require adding includes of
pid.h and sched.h that I don't think we want.

This change does make task_active_pid_ns unsafe to call during
copy_process until we attach a pid on the task_struct which seems to be a
reasonable trade off.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Roland McGrath <roland@redhat.com>
Cc: Bastian Blank <bastian@waldi.eu.org>
Cc: Pavel Emelyanov <xemul@openvz.org>
Cc: Nadia Derbey <Nadia.Derbey@bull.net>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agopid: implement ns_of_pid
Eric W. Biederman [Thu, 8 Jan 2009 02:08:46 +0000 (18:08 -0800)]
pid: implement ns_of_pid

A current problem with the pid namespace is that it is easy to do pid
related work after exit_task_namespaces which drops the nsproxy pointer.

However if we are doing pid namespace related work we are always operating
on some struct pid which retains the pid_namespace pointer of the pid
namespace it was allocated in.

So provide ns_of_pid which allows us to find the pid namespace a pid was
allocated in.

Using this we have the needed infrastructure to do pid namespace related
work at anytime we have a struct pid, removing the chance of accidentally
having a NULL pointer dereference when accessing current->nsproxy.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Roland McGrath <roland@redhat.com>
Cc: Bastian Blank <bastian@waldi.eu.org>
Cc: Pavel Emelyanov <xemul@openvz.org>
Cc: Nadia Derbey <Nadia.Derbey@bull.net>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agocpuset: remove remaining pointers to cpumask_t
Li Zefan [Thu, 8 Jan 2009 02:08:45 +0000 (18:08 -0800)]
cpuset: remove remaining pointers to cpumask_t

Impact: cleanups, use new cpumask API

Final trivial cleanups: mainly s/cpumask_t/struct cpumask

Note there is a FIXME in generate_sched_domains(). A future patch will
change struct cpumask *doms to struct cpumask *doms[].
(I suppose Rusty will do this.)

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Acked-by: Mike Travis <travis@sgi.com>
Cc: Paul Menage <menage@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agocpuset: convert cpuset->cpus_allowed to cpumask_var_t
Li Zefan [Thu, 8 Jan 2009 02:08:44 +0000 (18:08 -0800)]
cpuset: convert cpuset->cpus_allowed to cpumask_var_t

Impact: use new cpumask API

This patch mainly does the following things:
- change cs->cpus_allowed from cpumask_t to cpumask_var_t
- call alloc_bootmem_cpumask_var() for top_cpuset in cpuset_init_early()
- call alloc_cpumask_var() for other cpusets
- replace cpus_xxx() to cpumask_xxx()

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Acked-by: Mike Travis <travis@sgi.com>
Cc: Paul Menage <menage@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agocpuset: don't allocate trial cpuset on stack
Li Zefan [Thu, 8 Jan 2009 02:08:43 +0000 (18:08 -0800)]
cpuset: don't allocate trial cpuset on stack

Impact: cleanups, reduce stack usage

This patch prepares for the next patch.  When we convert
cpuset.cpus_allowed to cpumask_var_t, (trialcs = *cs) no longer works.

Another result of this patch is reducing stack usage of trialcs.
sizeof(*cs) can be as large as 148 bytes on x86_64, so it's really not
good to have it on stack.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Acked-by: Mike Travis <travis@sgi.com>
Cc: Paul Menage <menage@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agocpuset: convert cpuset_attach() to use cpumask_var_t
Li Zefan [Thu, 8 Jan 2009 02:08:42 +0000 (18:08 -0800)]
cpuset: convert cpuset_attach() to use cpumask_var_t

Impact: reduce stack usage

Allocate a global cpumask_var_t at boot, and use it in cpuset_attach(), so
we won't fail cpuset_attach().

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Acked-by: Mike Travis <travis@sgi.com>
Cc: Paul Menage <menage@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agocpuset: remove on stack cpumask_t in cpuset_can_attach()
Li Zefan [Thu, 8 Jan 2009 02:08:41 +0000 (18:08 -0800)]
cpuset: remove on stack cpumask_t in cpuset_can_attach()

Impact: reduce stack usage

Just use cs->cpus_allowed, and no need to allocate a cpumask_var_t.

Signed-off-by: Li Zefan <lizf@cn.fujistu.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Acked-by: Mike Travis <travis@sgi.com>
Cc: Paul Menage <menage@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agocpuset: remove on stack cpumask_t in cpuset_sprintf_cpulist()
Li Zefan [Thu, 8 Jan 2009 02:08:41 +0000 (18:08 -0800)]
cpuset: remove on stack cpumask_t in cpuset_sprintf_cpulist()

This patchset converts cpuset to use new cpumask API, and thus
remove on stack cpumask_t to reduce stack usage.

Before:
 # cat kernel/cpuset.c include/linux/cpuset.h | grep -c cpumask_t
 21
After:
 # cat kernel/cpuset.c include/linux/cpuset.h | grep -c cpumask_t
 0

This patch:

Impact: reduce stack usage

It's safe to call cpulist_scnprintf inside callback_mutex, and thus we can
just remove the cpumask_t and no need to allocate a cpumask_var_t.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Acked-by: Mike Travis <travis@sgi.com>
Cc: Paul Menage <menage@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agocpusets: set task's cpu_allowed to cpu_possible_map when attaching it into top cpuset
Miao Xie [Thu, 8 Jan 2009 02:08:40 +0000 (18:08 -0800)]
cpusets: set task's cpu_allowed to cpu_possible_map when attaching it into top cpuset

I found a bug on my dual-cpu box.  I created a sub cpuset in top cpuset
and assign 1 to its cpus.  And then we attach some tasks into this sub
cpuset.  After this, we offline CPU1.  Now, the tasks in this new cpuset
are moved into top cpuset automatically because there is no cpu in sub
cpuset.  Then we online CPU1, we find all the tasks which doesn't belong
to top cpuset originally just run on CPU0.

We fix this bug by setting task's cpu_allowed to cpu_possible_map when
attaching it into top cpuset.  This method needn't modify the current
behavior of cpusets on CPU hotplug, and all of tasks in top cpuset use
cpu_possible_map to initialize their cpu_allowed.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Cc: Paul Menage <menage@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agocpuset: rcu_read_lock() to protect task_cs()
Lai Jiangshan [Thu, 8 Jan 2009 02:08:39 +0000 (18:08 -0800)]
cpuset: rcu_read_lock() to protect task_cs()

task_cs() calls task_subsys_state().

We must use rcu_read_lock() to protect cgroup_subsys_state().

It's correct that top_cpuset is never freed, but cgroup_subsys_state()
accesses css_set, this css_set maybe freed when task_cs() called.

We use use rcu_read_lock() to protect it.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Acked-by: Paul Menage <menage@google.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Pavel Emelyanov <xemul@openvz.org>
Cc: Balbir Singh <balbir@in.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>