2.6.33.3-stable review
Subsystems (67)
cover 2.6.33.3-stable review
This is the start of the stable review cycle for the 2.6.33.3 release. There are 139 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Saturday, April 24, 15:00:00 UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v2.6/stable-review/patch-2.6.33.3-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
Documentation/i2c/busses/i2c-i801 | 3 +- Makefile | 2 +- arch/arm/boot/compressed/head.S | 2 +- arch/ia64/kvm/kvm-ia64.c | 9 +- arch/mips/mm/tlbex.c | 22 ++- arch/powerpc/kvm/book3s.c | 5 +- arch/powerpc/platforms/pseries/offline_states.h | 22 ++- arch/s390/mm/vmem.c | 11 +- arch/sh/include/asm/elf.h | 6 +- arch/sh/kernel/smp.c | 1 + arch/sparc/kernel/ptrace_32.c | 4 + arch/sparc/kernel/ptrace_64.c | 4 + arch/um/sys-x86_64/Makefile | 3 +- arch/x86/Kconfig.cpu | 2 +- arch/x86/include/asm/rwsem.h | 81 +++++--- arch/x86/include/asm/smp.h | 9 + arch/x86/kernel/amd_iommu.c | 6 +- arch/x86/kernel/amd_iommu_init.c | 5 +- arch/x86/kernel/aperture_64.c | 15 ++- arch/x86/kernel/apic/apic.c | 2 + arch/x86/kernel/cpu/intel_cacheinfo.c | 250 ++++++++++++++--------- arch/x86/kernel/cpu/perf_event.c | 104 ++++++++++- arch/x86/kernel/crash.c | 6 - arch/x86/kernel/hpet.c | 8 +- arch/x86/kernel/kgdb.c | 2 +- arch/x86/kernel/mpparse.c | 4 +- arch/x86/kernel/pci-gart_64.c | 3 + arch/x86/kvm/mmu.c | 11 +- arch/x86/kvm/svm.c | 25 ++- arch/x86/kvm/vmx.c | 37 +++- arch/x86/kvm/x86.c | 45 ++--- arch/x86/lib/Makefile | 3 +- arch/x86/lib/cache-smp.c | 19 ++ arch/x86/lib/rwsem_64.S | 81 ++++++++ arch/x86/pci/irq.c | 2 + arch/x86/power/hibernate_asm_32.S | 15 +- drivers/acpi/acpica/exprep.c | 17 ++ drivers/acpi/ec.c | 35 +--- drivers/ata/ahci.c | 6 + drivers/ata/ata_piix.c | 8 + drivers/ata/libata-core.c | 3 + drivers/ata/pata_via.c | 1 + drivers/char/agp/intel-agp.c | 15 +- drivers/char/raw.c | 1 + drivers/char/tty_io.c | 2 + drivers/gpu/drm/drm_crtc_helper.c | 1 + drivers/gpu/drm/drm_edid.c | 11 +- drivers/gpu/drm/drm_fops.c | 16 +- drivers/gpu/drm/i915/intel_lvds.c | 8 + drivers/gpu/drm/radeon/atom.c | 10 + drivers/gpu/drm/radeon/r300.c | 5 +- drivers/gpu/drm/radeon/radeon_combios.c | 20 ++- drivers/gpu/drm/radeon/radeon_connectors.c | 7 +- drivers/gpu/drm/radeon/radeon_cp.c | 10 +- drivers/gpu/drm/radeon/radeon_cs.c | 15 +- drivers/gpu/drm/radeon/radeon_device.c | 8 + drivers/gpu/drm/radeon/radeon_encoders.c | 8 +- drivers/gpu/drm/radeon/radeon_legacy_tv.c | 29 +++- drivers/gpu/drm/radeon/rs600.c | 2 +- drivers/hid/hid-gyration.c | 5 +- drivers/hwmon/sht15.c | 13 +- drivers/i2c/busses/Kconfig | 5 +- drivers/i2c/busses/i2c-i801.c | 5 +- drivers/infiniband/ulp/ipoib/ipoib_cm.c | 2 + drivers/input/sparse-keymap.c | 2 +- drivers/input/tablet/wacom_sys.c | 12 +- drivers/md/dm-ioctl.c | 19 +- drivers/md/dm.c | 7 +- drivers/md/dm.h | 4 +- drivers/md/linear.c | 12 +- drivers/md/multipath.c | 20 +- drivers/md/raid0.c | 13 +- drivers/md/raid10.c | 28 ++- drivers/md/raid5.c | 19 +- drivers/net/e1000e/netdev.c | 2 + drivers/net/wireless/ath/ar9170/usb.c | 2 +- drivers/net/wireless/ath/ath9k/main.c | 3 +- drivers/net/wireless/b43/Kconfig | 6 +- drivers/net/wireless/b43/Makefile | 2 +- drivers/net/wireless/b43/b43.h | 12 +- drivers/net/wireless/b43/dma.c | 2 - drivers/net/wireless/b43/main.c | 11 +- drivers/net/wireless/b43/pio.h | 40 ---- drivers/net/wireless/iwlwifi/iwl-4965.c | 11 +- drivers/net/wireless/iwlwifi/iwl-5000.c | 2 + drivers/net/wireless/iwlwifi/iwl-agn.c | 2 +- drivers/net/wireless/iwlwifi/iwl-scan.c | 27 +-- drivers/net/wireless/iwlwifi/iwl3945-base.c | 4 +- drivers/pci/pci.c | 24 ++- drivers/scsi/libiscsi.c | 5 +- drivers/usb/class/cdc-acm.c | 43 ++-- drivers/usb/class/cdc-acm.h | 1 - drivers/video/backlight/mbp_nvidia_bl.c | 45 ++++ drivers/video/sunxvr500.c | 24 ++- drivers/watchdog/hpwdt.c | 2 +- drivers/watchdog/iTCO_wdt.c | 99 +++++++++- fs/9p/vfs_file.c | 2 +- fs/block_dev.c | 3 +- fs/cifs/cifssmb.c | 19 ++- fs/ecryptfs/inode.c | 108 +++++----- fs/ecryptfs/super.c | 1 - fs/ext4/ext4.h | 6 +- fs/ext4/extents.c | 2 +- fs/ext4/inode.c | 2 +- fs/fat/namei_vfat.c | 6 +- fs/nfs/client.c | 3 +- fs/nfs/dir.c | 2 +- fs/nfs/nfs4proc.c | 4 +- fs/nfsd/nfs4xdr.c | 12 +- fs/ocfs2/acl.c | 77 +++++++- fs/ocfs2/suballoc.c | 13 +- fs/proc/base.c | 5 +- fs/quota/dquot.c | 12 +- fs/reiserfs/super.c | 10 +- fs/xfs/linux-2.6/xfs_aops.c | 93 +++++---- fs/xfs/linux-2.6/xfs_sync.c | 10 +- fs/xfs/xfs_iget.c | 19 ++- include/drm/drm_pciids.h | 2 + include/linux/dm-ioctl.h | 9 +- include/linux/freezer.h | 7 +- include/linux/fs.h | 1 + include/linux/kfifo.h | 3 +- include/linux/kvm_host.h | 7 +- include/linux/module.h | 2 +- include/linux/nfs_fs_sb.h | 1 + include/linux/pci.h | 5 + include/linux/pci_ids.h | 3 + kernel/cgroup_freezer.c | 9 +- kernel/irq/manage.c | 10 + kernel/lockdep.c | 6 +- kernel/module.c | 2 +- kernel/power/process.c | 2 +- kernel/sched.c | 10 +- mm/readahead.c | 2 +- net/mac80211/mesh.c | 3 - net/mac80211/mesh_hwmp.c | 4 +- net/mac80211/rx.c | 5 + net/mac80211/tx.c | 6 + net/mac80211/util.c | 20 ++- sound/pci/hda/hda_intel.c | 10 + sound/pci/hda/patch_analog.c | 8 + sound/pci/hda/patch_realtek.c | 1 + sound/pci/mixart/mixart.c | 24 ++- sound/usb/usbmidi.c | 24 ++- virt/kvm/kvm_main.c | 13 +- 145 files changed, 1513 insertions(+), 697 deletions(-)
PATCH 1/139 drm/edid: allow certain bogus edids to hit a fixup path rather than fail
2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Ben Skeggs <[email protected]>
commit 44fef22416886a04d432043f741a6faf2c6ffefd upstream.
--- drivers/gpu/drm/drm_edid.c | 9 --------- 1 file changed, 9 deletions(-)
drivers/gpu/drm/drm_edid.c +0 -9
@@ -707,15 +707,6 @@ static struct drm_display_mode *drm_mode mode->vsync_end = mode->vsync_start + vsync_pulse_width; mode->vtotal = mode->vdisplay + vblank; -/* perform the basic check for the detailed timing */ -if (mode->hsync_end > mode->htotal || - mode->vsync_end > mode->vtotal) { -drm_mode_destroy (dev, mode); -DRM_DEBUG_KMS ("Incorrect detailed timing. " -"Sync is beyond the blank.\n" ); -return NULL ; - } -/* Some EDIDs have bogus h/vtotal values */ if (mode->hsync_end > mode->htotal) mode->htotal = mode->hsync_end +1 ;
PATCH 2/139 drm/radeon: add new RS880 pci id
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alex Deucher <[email protected]>
commit 338e2b1d571e4873908b199c90d6a31f65137fe3 upstream.
This should go to 2.6.33 stable as well.
--- include/drm/drm_pciids.h | 1 + 1 file changed, 1 insertion(+)
include/drm/drm_pciids.h +1 -0
@@ -375,6 +375,7 @@ {0x1002, 0x9712, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ {0x1002, 0x9713, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ {0x1002, 0x9714, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ + {0x1002, 0x9715, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ {0, 0, 0} #define r128_PCI_IDS \
PATCH 3/139 drm: remove the EDID blob stored in the EDID property when it is disconnected
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Zhao Yakui <[email protected]>
commit 725398322d05486109375fbb85c3404108881e17 upstream.
Now the EDID property will be updated when the corresponding EDID can be obtained from the external display device. But after the external device is plugged-out, the EDID property is not updated. In such case we still get the corresponding EDID property although it is already detected as disconnected.
https://bugs.freedesktop.org/show_bug.cgi?id=26743
--- drivers/gpu/drm/drm_crtc_helper.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/drm_crtc_helper.c +1 -0
@@ -104,6 +104,7 @@ int drm_helper_probe_single_connector_moif (connector->status == connector_status_disconnected) {DRM_DEBUG_KMS ("%s is disconnected\n" ,drm_get_connector_name (connector)); +drm_mode_connector_update_edid_property (connector,NULL ); goto prune; }
PATCH 4/139 fat: fix buffer overflow in vfat_create_shortname()
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Nikolaus Schulz <[email protected]>
commit 30d1872d9eb3663b4cf7bdebcbf5cd465674cced upstream.
When using the string representation of a random counter as part of the base name, ensure that it is no longer than 4 bytes.
Since we are repeatedly decrementing the counter in a loop until we have found a unique base name, the counter may wrap around zero; therefore, it is not enough to mask its higher bits before entering the loop, this must be done inside the loop.
--- fs/fat/namei_vfat.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/fat/namei_vfat.c +3 -3
@@ -309,7 +309,7 @@ static int vfat_create_shortname(struct {struct fat_mount_options *opts = &MSDOS_SB (dir->i_sb)->options;wchar_t *ip, *ext_start, *end, *name_start; -unsigned char base[9 ], ext[4 ], buf[8 ], *p; +unsigned char base[9 ], ext[4 ], buf[5 ], *p;unsigned char charbuf[NLS_MAX_CHARSET_SIZE ];int chl, chi;int sz =0 , extlen, baselen, i, numtail_baselen, numtail2_baselen;
@@ -467,7 +467,7 @@ static int vfat_create_shortname(structreturn 0 ; } - i = jiffies &0xffff ; + i = jiffies; sz = (jiffies >>16 ) &0x7 ;if (baselen >2 ) { baselen = numtail2_baselen;
@@ -476,7 +476,7 @@ static int vfat_create_shortname(struct name_res[baselen +4 ] ='~' ; name_res[baselen +5 ] ='1' + sz;while (1 ) { -sprintf (buf,"%04X" , i); +snprintf (buf,sizeof (buf),"%04X" , i &0xffff );memcpy (&name_res[baselen], buf,4 );if (vfat_find_form (dir, name_res) <0 )break ;
PATCH 5/139 oom: fix the unsafe usage of badness() in proc_oom_score()
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Oleg Nesterov <[email protected]>
commit b95c35e76b29ba812e5dabdd91592e25ec640e93 upstream.
proc_oom_score(task) has a reference to task_struct, but that is all. If this task was already released before we take tasklist_lock
- we can't use task->group_leader, it points to nowhere
- it is not safe to call badness() even if this task is ->group_leader, has_intersects_mems_allowed() assumes it is safe to iterate over ->thread_group list.
- even worse, badness() can hit ->signal == NULL
Add the pid_alive() check to ensure __unhash_process() was not called.
Also, use "task" instead of task->group_leader. badness() should return the same result for any sub-thread. Currently this is not true, but this should be changed anyway.
--- fs/proc/base.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/proc/base.c +3 -2
@@ -442,12 +442,13 @@ static const struct file_operations procunsigned long badness (struct task_struct *p,unsigned long uptime);static int proc_oom_score (struct task_struct *task,char *buffer) { -unsigned long points; +unsigned long points =0 ;struct timespec uptime;do_posix_clock_monotonic_gettime (&uptime);read_lock (&tasklist_lock); - points =badness (task->group_leader, uptime.tv_sec); +if (pid_alive (task)) + points =badness (task, uptime.tv_sec);read_unlock (&tasklist_lock);return sprintf (buffer,"%lu\n" , points); }
PATCH 6/139 drm/radeon/kms: never treat rs4xx as AGP
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alex Deucher <[email protected]>
commit f95df9ca6896978108201a77422a1ae2cdc595ec upstream.
RS4xx+ IGP chips use an internal gart, however, some of them have the agp cap bits set in their pci configs. Make sure to clear the AGP flag as AGP will not work with them.
Should fix fdo bug 27225
--- drivers/gpu/drm/radeon/radeon_device.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/radeon/radeon_device.c +8 -0
@@ -655,6 +655,14 @@ int radeon_device_init(struct radeon_devreturn r;radeon_check_arguments (rdev); +/* all of the newer IGP chips have an internal gart +* However some rs4xx report as AGP, so remove that here. +*/ +if ((rdev->family >=CHIP_RS400 ) && + (rdev->flags &RADEON_IS_IGP )) { + rdev->flags &= ~RADEON_IS_AGP ; + } +if (rdev->flags &RADEON_IS_AGP && radeon_agpmode ==-1 ) {radeon_agp_disable (rdev); }
PATCH 7/139 drm/radeon/kms: Fix NULL pointer dereference if memory allocation failed in a simple way
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
Quoted 4 lines
From: Pauli Nieminen <[email protected]>
Date: Fri, 19 Mar 2010 07:44:33 +0000
Subject: drm/radeon/kms: Fix NULL pointer dereference if memory allocation failed.
2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
Quoted 10 lines
From: Pauli Nieminen <[email protected]>
commit
fcbc451ba1948fba967198bd150ecbd10bbb7075upstream.When there is allocation failure in
radeon_cs_parser_relocsparser->nrelocsis not cleaned. This causes NULL pointer defeference inradeon_cs_parser_finiwhen clean up code is trying to loop over the relocation array and free the objects.Fix adds a check for a possible NULL pointer in clean up code.
[...]
This patch breaks compiling kernel 2.6.33 + the current stable queue:
CC [M] drivers/gpu/drm/radeon/radeon_cs.o/tmp/buildd/linux-sidux-2.6-2.6.33/debian/build/source_amd64_none/drivers/gpu/drm/radeon/radeon_cs.c: In function 'radeon_cs_parser_fini':/tmp/buildd/linux-sidux-2.6-2.6.33/debian/build/source_amd64_none/drivers/gpu/drm/radeon/radeon_cs.c:200: error: implicit declaration of function 'drm_gem_object_unreference_unlocked' make[6]: *** [drivers/gpu/drm/radeon/radeon_cs.o] Error 1
as it depends on the introduction of drm_gem_object_unreference_unlocked() in:
Commit: c3ae90c099bb62387507e86da7cf799850444b08 Author: Luca Barbieri <[email protected]> AuthorDate: Tue Feb 9 05:49:11 2010 +0000
drm: introduce drm_gem_object_[handle_]unreference_unlocked
This patch introduces the drm_gem_object_unreference_unlocked and drm_gem_object_handle_unreference_unlocked functions that do not require holding struct_mutex.
drm_gem_object_unreference_unlocked calls the new ->gem_free_object_unlocked entry point if available, and otherwise just takes struct_mutex and just calls ->gem_free_object
which in turn suggests:
Commit: bc9025bdc4e2b591734cca17697093845007b63d Author: Luca Barbieri <[email protected]> AuthorDate: Tue Feb 9 05:49:12 2010 +0000
Use drm_gem_object_[handle_]unreference_unlocked where possible
Mostly obvious simplifications.
The i915 pread/pwrite ioctls, intel_overlay_put_image and nouveau_gem_new were incorrectly using the locked versions without locking: this is also fixed in this patch.
which don't really look like candidates for 2.6.33-stable.
drivers/gpu/drm/radeon/radeon_cs.c static void radeon_cs_parser_fini(struct · line 196
Quoted 12 lines
drivers/gpu/drm/radeon/radeon_cs.c +1
-5@@ -193,11 +193,13 @@ static void radeon_cs_parser_fini(structradeon_bo_list_fence (&parser->validated, parser->ib->fence); }radeon_bo_list_unreserve (&parser->validated); -for (i =0 ; i < parser->nrelocs; i++) { -if (parser->relocs[i].gobj) { -mutex_lock (&parser->rdev->ddev->struct_mutex); -drm_gem_object_unreference (parser->relocs[i].gobj); -mutex_unlock (&parser->rdev->ddev->struct_mutex); +if (parser->relocs !=NULL ) {
^ the only important part, the rest merely covers the new indentation
level
drivers/gpu/drm/radeon/radeon_cs.c static void radeon_cs_parser_fini(struct · line 200
Quoted 4 lines
drivers/gpu/drm/radeon/radeon_cs.c +4
-0+for (i =0 ; i < parser->nrelocs; i++) { +if (parser->relocs[i].gobj) { +mutex_lock (&parser->rdev->ddev->struct_mutex); +drm_gem_object_unreference_unlocked (parser->relocs[i].gobj);
^ drm_gem_object_unreference_unlocked() doesn't exist in 2.6.33, yet
we can use drm_gem_object_unreference() instead.
drivers/gpu/drm/radeon/radeon_cs.c static void radeon_cs_parser_fini(struct · line 205
Quoted 5 lines
drivers/gpu/drm/radeon/radeon_cs.c +2
-0+mutex_unlock (&parser->rdev->ddev->struct_mutex); + } } }kfree (parser->track);
As a consequence, I'd suggest to merely backport the NULL pointer check, while ignoring the simplification of using the newly introduced drm_gem_object_unreference_unlocked() from 2.6.34:
--- drivers/gpu/drm/radeon/radeon_cs.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/radeon/radeon_cs.c +7 -5
@@ -193,11 +193,13 @@ static void radeon_cs_parser_fini(structradeon_bo_list_fence (&parser->validated, parser->ib->fence); }radeon_bo_list_unreserve (&parser->validated); -for (i =0 ; i < parser->nrelocs; i++) { -if (parser->relocs[i].gobj) { -mutex_lock (&parser->rdev->ddev->struct_mutex); -drm_gem_object_unreference (parser->relocs[i].gobj); -mutex_unlock (&parser->rdev->ddev->struct_mutex); +if (parser->relocs !=NULL ) { +for (i =0 ; i < parser->nrelocs; i++) { +if (parser->relocs[i].gobj) { +mutex_lock (&parser->rdev->ddev->struct_mutex); +drm_gem_object_unreference (parser->relocs[i].gobj); +mutex_unlock (&parser->rdev->ddev->struct_mutex); + } } }kfree (parser->track);
PATCH 8/139 drm/radeon/kms: dont print error on -ERESTARTSYS.
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Dave Airlie <[email protected]>
commit 97f23b3d85a4d734a8584dade3a34579931c8f8d upstream.
We can get this if the user moves the mouse when we are waiting to move some stuff around in the validate. Don't fail.
--- drivers/gpu/drm/radeon/radeon_cs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/radeon/radeon_cs.c +2 -1
@@ -248,7 +248,8 @@ int radeon_cs_ioctl(struct drm_device *d } r =radeon_cs_parser_relocs (&parser);if (r) { -DRM_ERROR ("Failed to parse relocation !\n" ); +if (r != -ERESTARTSYS ) +DRM_ERROR ("Failed to parse relocation %d!\n" , r);radeon_cs_parser_fini (&parser, r);mutex_unlock (&rdev->cs_mutex);return r;
PATCH 9/139 drm/radeon/kms: fix pal tv-out support on legacy IGP chips
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alex Deucher <[email protected]>
commit 15f7207761cfcf8f53fb6e5cacffe060478782c3 upstream.
Based on ddx patch by Andrzej Hajda.
--- drivers/gpu/drm/radeon/radeon_legacy_tv.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-)
drivers/gpu/drm/radeon/radeon_legacy_tv.c +24 -5
@@ -57,6 +57,10 @@#define NTSC_TV_PLL_N_14 693#define NTSC_TV_PLL_P_14 7 +#define PAL_TV_PLL_M_14 19 +#define PAL_TV_PLL_N_14 353 +#define PAL_TV_PLL_P_14 5 +#define VERT_LEAD_IN_LINES 2#define FRAC_BITS 0xe#define FRAC_MASK 0x3fff
@@ -205,9 +209,24 @@ static const struct radeon_tv_mode_const 630627, /* defRestart */ 347, /* crtcPLL_N */ 14, /* crtcPLL_M */ - 8, /* crtcPLL_postDiv */ + 8, /* crtcPLL_postDiv */ 1022, /* pixToTV */ }, + {/* PAL timing for 14 Mhz ref clk */ +800 ,/* horResolution */ +600 ,/* verResolution */ +TV_STD_PAL ,/* standard */ +1131 ,/* horTotal */ +742 ,/* verTotal */ +813 ,/* horStart */ +840 ,/* horSyncStart */ +633 ,/* verSyncStart */ +708369 ,/* defRestart */ +211 ,/* crtcPLL_N */ +9 ,/* crtcPLL_M */ +8 ,/* crtcPLL_postDiv */ + 759, /* pixToTV */ + }, };#define N_AVAILABLE_MODES ARRAY_SIZE(available_tv_modes)
@@ -242,7 +261,7 @@ static const struct radeon_tv_mode_constif (pll->reference_freq ==2700 ) const_ptr = &available_tv_modes[1 ];else - const_ptr = &available_tv_modes[1 ];/* FIX ME */ + const_ptr = &available_tv_modes[3 ]; }return const_ptr; }
@@ -685,9 +704,9 @@ void radeon_legacy_tv_mode_set(struct dr n =PAL_TV_PLL_N_27 ; p =PAL_TV_PLL_P_27 ; }else { - m =PAL_TV_PLL_M_27 ; - n =PAL_TV_PLL_N_27 ; - p =PAL_TV_PLL_P_27 ; + m =PAL_TV_PLL_M_14 ; + n =PAL_TV_PLL_N_14 ; + p =PAL_TV_PLL_P_14 ; } }
PATCH 10/139 drm: Return ENODEV if the inode mapping changes
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Chris Wilson <[email protected]>
commit da58405860b992d2bb21ebae5d685fe3204dd3f0 upstream.
Replace a BUG_ON with an error code in the event that the inode mapping changes between calls to drm_open. This may happen for instance if udev is loaded subsequent to the original opening of the device:
[ 644.291870] kernel BUG at drivers/gpu/drm/drm_fops.c:146! [ 644.291876] invalid opcode: 0000 [#1] SMP [ 644.291882] last sysfs file: /sys/kernel/uevent_seqnum [ 644.291888] [ 644.291895] Pid: 7276, comm: lt-cairo-test-s Not tainted 2.6.34-rc1 #2 N150/N210/N220 /N150/N210/N220 [ 644.291903] EIP: 0060:[<c11c70e3>] EFLAGS: 00210283 CPU: 0 [ 644.291912] EIP is at drm_open+0x4b1/0x4e2 [ 644.291918] EAX: f72d8d18 EBX: f790a400 ECX: f73176b8 EDX: 00000000 [ 644.291923] ESI: f790a414 EDI: f790a414 EBP: f647ae20 ESP: f647adfc [ 644.291929] DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068 [ 644.291937] Process lt-cairo-test-s (pid: 7276, ti=f647a000 task=f73f5c80 task.ti=f647a000) [ 644.291941] Stack: [ 644.291945] 00000000 f7bb7400 00000080 f6451100 f73176b8 f6479214 f6451100 f73176b8 [ 644.291957] <0> c1297ce0 f647ae34 c11c6c04 f73176b8 f7949800 00000000 f647ae54 c1080ac5 [ 644.291969] <0> f7949800 f6451100 00000000 f6451100 f73176b8 f6452780 f647ae70 c107d1e6 [ 644.291982] Call Trace: [ 644.291991] [<c11c6c04>] ? drm_stub_open+0x8a/0xb8 [ 644.292000] [<c1080ac5>] ? chrdev_open+0xef/0x106 [ 644.292008] [<c107d1e6>] ? __dentry_open+0xd4/0x1a6 [ 644.292015] [<c107d35b>] ? nameidata_to_filp+0x31/0x45 [ 644.292022] [<c10809d6>] ? chrdev_open+0x0/0x106 [ 644.292030] [<c10864e2>] ? do_last+0x346/0x423 [ 644.292037] [<c108789f>] ? do_filp_open+0x190/0x415 [ 644.292046] [<c1071eb5>] ? handle_mm_fault+0x214/0x710 [ 644.292053] [<c107d008>] ? do_sys_open+0x4d/0xe9 [ 644.292061] [<c1016462>] ? do_page_fault+0x211/0x23f [ 644.292068] [<c107d0f0>] ? sys_open+0x23/0x2b [ 644.292075] [<c1002650>] ? sysenter_do_call+0x12/0x26 [ 644.292079] Code: 89 f0 89 55 dc e8 8d 96 0a 00 8b 45 e0 8b 55 dc 83 78 04 01 75 28 8b 83 18 02 00 00 85 c0 74 0f 8b 4d ec 3b 81 ac 00 00 00 74 13 <0f> 0b eb fe 8b 4d ec 8b 81 ac 00 00 00 89 83 18 02 00 00 89 f0 [ 644.292143] EIP: [<c11c70e3>] drm_open+0x4b1/0x4e2 SS:ESP 0068:f647adfc [ 644.292175] ---[ end trace 2ddd476af89a60fa ]---
--- drivers/gpu/drm/drm_fops.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/gpu/drm/drm_fops.c +9 -7
@@ -140,14 +140,16 @@ int drm_open(struct inode *inode, structspin_unlock (&dev->count_lock); } out: -mutex_lock (&dev->struct_mutex); -if (minor->type ==DRM_MINOR_LEGACY ) { -BUG_ON ((dev->dev_mapping !=NULL ) && - (dev->dev_mapping != inode->i_mapping)); -if (dev->dev_mapping ==NULL ) - dev->dev_mapping = inode->i_mapping; +if (!retcode) { +mutex_lock (&dev->struct_mutex); +if (minor->type ==DRM_MINOR_LEGACY ) { +if (dev->dev_mapping ==NULL ) + dev->dev_mapping = inode->i_mapping; +else if (dev->dev_mapping != inode->i_mapping) + retcode = -ENODEV ; + } +mutex_unlock (&dev->struct_mutex); } -mutex_unlock (&dev->struct_mutex);return retcode; }
PATCH 11/139 sh: Fix FDPIC binary loader
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Andrew Stubbs <[email protected]>
commit d5ab780305bb6d60a7b5a74f18cf84eb6ad153b1 upstream.
Ensure that the aux table is properly initialized, even when optional features are missing. Without this, the FDPIC loader did not work.
--- arch/sh/include/asm/elf.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/sh/include/asm/elf.h +4 -2
@@ -211,7 +211,9 @@ extern void __kernel_vsyscall;#define VSYSCALL_AUX_ENT \ if (vdso_enabled) \ - NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_BASE); + NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_BASE); \ + else \ + NEW_AUX_ENT(AT_IGNORE, 0);#else #define VSYSCALL_AUX_ENT #endif /* CONFIG_VSYSCALL */
@@ -219,7 +221,7 @@ extern void __kernel_vsyscall;#ifdef CONFIG_SH_FPU #define FPU_AUX_ENT NEW_AUX_ENT(AT_FPUCW, FPSCR_INIT)#else -#define FPU_AUX_ENT +#define FPU_AUX_ENT NEW_AUX_ENT(AT_IGNORE, 0)#endif extern int l1i_cache_shape, l1d_cache_shape, l2_cache_shape;
PATCH 12/139 sh: Enable the mmu in start_secondary()
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Matt Fleming <[email protected]>
commit 4bea3418c737891894b9d3d3e9f8bbd67d66fa38 upstream.
For the boot, enable_mmu() is called from setup_arch() but we don't call setup_arch() for any of the other cpus. So turn on the non-boot cpu's mmu inside of start_secondary().
I noticed this bug on an SMP board when trying to map I/O memory (smsc911x registers) into the kernel address space. Since the Address Translation bit in MMUCR wasn't set, accessing the virtual address where the smsc911x registers were supposedly mapped actually performed a physical address access.
--- arch/sh/kernel/smp.c | 1 + 1 file changed, 1 insertion(+)
arch/sh/kernel/smp.c +1 -0
@@ -69,6 +69,7 @@ asmlinkage void __cpuinit start_secondarunsigned int cpu;struct mm_struct *mm = &init_mm; +enable_mmu ();atomic_inc (&mm->mm_count);atomic_inc (&mm->mm_users); current->active_mm = mm;
PATCH 13/139 reiserfs: Fix locking BUG during mount failure
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jeff Mahoney <[email protected]>
commit b7b7fa43103a9fb30dbcc60cbd5161fdfc25f904 upstream.
Commit 8ebc423238341b52912c7295b045a32477b33f09 (reiserfs: kill-the-BKL) introduced a bug in the mount failure case.
The error label releases the lock before calling journal_release_error, but it requires that the lock be held. do_journal_release unlocks and retakes it. When it releases it without it held, we trigger a BUG().
The error_alloc label skips the unlock since the lock isn't held yet but none of the other conditions that are clean up exist yet either.
This patch returns immediately after the kzalloc failure and moves the reiserfs_write_unlock after the journal_release_error call.
This was reported in https://bugzilla.novell.com/show_bug.cgi?id=591807
--- fs/reiserfs/super.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
fs/reiserfs/super.c +4 -6
@@ -1619,10 +1619,8 @@ static int reiserfs_fill_super(struct susave_mount_options (s, data); sbi =kzalloc (sizeof (struct reiserfs_sb_info ),GFP_KERNEL ); -if (!sbi) { - errval = -ENOMEM ; - goto error_alloc; - } +if (!sbi) +return -ENOMEM ; s->s_fs_info = sbi;/* Set default values for options: non-aggressive tails, RO on errors */ REISERFS_SB (s)->s_mount_opt |= (1 <<REISERFS_SMALLTAIL );
@@ -1879,12 +1877,12 @@ static int reiserfs_fill_super(struct sureturn (0 ); error: -reiserfs_write_unlock (s); -error_alloc:if (jinit_done) {/* kill the commit thread, free journal ram */ journal_release_error (NULL , s); } +reiserfs_write_unlock (s); +reiserfs_free_bitmap_cache (s);if (SB_BUFFER_WITH_SB (s))brelse (SB_BUFFER_WITH_SB (s));
PATCH 14/139 libiscsi: Fix recovery slowdown regression
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Mike Christie <[email protected]>
commit 4ae0a6c15efcc37e94e3f30e3533bdec03c53126 upstream.
We could be failing/stopping a connection due to libiscsi starting recovery/cleanup, but the xmit path or scsi eh thread path could be dropping the connection at the same time.
As a result the session->state gets set to failed instead of in recovery. We end up not blocking the session
and so the replacement timeout never gets started and we only end up failing the IO when scsi_softirq_done sees that the
cmd has been running for (cmd->allowed + 1) * rq->timeout secs.
We used to fail the IO right away so users are seeing a long delay when using dm-multipath. This problem was added in 2.6.28.
--- drivers/scsi/libiscsi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/libiscsi.c +3 -2
@@ -3027,14 +3027,15 @@ static void iscsi_start_session_recovery session->state =ISCSI_STATE_TERMINATE ; else if (conn->stop_stage != STOP_CONN_RECOVER) session->state = ISCSI_STATE_IN_RECOVERY; + + old_stop_stage = conn->stop_stage; + conn->stop_stage = flag;spin_unlock_bh (&session->lock);del_timer_sync (&conn->transport_timer);iscsi_suspend_tx (conn);spin_lock_bh (&session->lock); - old_stop_stage = conn->stop_stage; - conn->stop_stage = flag; conn->c_stage =ISCSI_CONN_STOPPED ;spin_unlock_bh (&session->lock);
PATCH 15/139 x86,kgdb: Always initialize the hw breakpoint attribute
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jason Wessel <[email protected]>
commit ab310b5edb8b601bcb02491ed6f7676da4fd1757 upstream.
It is required to call hw_breakpoint_init() on an attr before using it in any other calls. This fixes the problem where kgdb will sometimes fail to initialize on x86_64.
LKML-Reference: <[email protected]>
--- arch/x86/kernel/kgdb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/kgdb.c +1 -1
@@ -618,8 +618,8 @@ int kgdb_arch_init(void)* portion of kgdb because this operation requires mutexs to * complete. */ +hw_breakpoint_init (&attr); attr.bp_addr = (unsigned long )kgdb_arch_init; - attr.type =PERF_TYPE_BREAKPOINT ; attr.bp_len =HW_BREAKPOINT_LEN_1 ; attr.bp_type =HW_BREAKPOINT_W ; attr.disabled =1 ;
PATCH 16/139 Freezer: Fix buggy resume test for tasks frozen with cgroup freezer
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Matt Helsley <[email protected]>
commit 5a7aadfe2fcb0f69e2acc1fbefe22a096e792fc9 upstream.
When the cgroup freezer is used to freeze tasks we do not want to thaw those tasks during resume. Currently we test the cgroup freezer state of the resuming tasks to see if the cgroup is FROZEN. If so then we don't thaw the task. However, the FREEZING state also indicates that the task should remain frozen.
This also avoids a problem pointed out by Oren Ladaan: the freezer state transition from FREEZING to FROZEN is updated lazily when userspace reads or writes the freezer.state file in the cgroup filesystem. This means that resume will thaw tasks in cgroups which should be in the FROZEN state if there is no read/write of the freezer.state file to trigger this transition before suspend.
NOTE: Another "simple" solution would be to always update the cgroup freezer state during resume. However it's a bad choice for several reasons:
Updating the cgroup freezer state is somewhat expensive because it requires walking all the tasks in the cgroup and checking if they are each frozen. Worse, this could easily make resume run in N^2 time where N is the number of tasks in the cgroup. Finally, updating the freezer state from this code path requires trickier locking because of the way locks must be ordered.
Instead of updating the freezer state we rely on the fact that lazy updates only manage the transition from FREEZING to FROZEN. We know that a cgroup with the FREEZING state may actually be FROZEN so test for that state too. This makes sense in the resume path even for partially-frozen cgroups -- those that really are FREEZING but not FROZEN.
--- include/linux/freezer.h | 7 +++++-- kernel/cgroup_freezer.c | 9 ++++++--- kernel/power/process.c | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-)
include/linux/freezer.h +5 -2
@@ -64,9 +64,12 @@ extern bool freeze_task(struct task_struextern void cancel_freezing (struct task_struct *p);#ifdef CONFIG_CGROUP_FREEZER -extern int cgroup_frozen (struct task_struct *task); +extern int cgroup_freezing_or_frozen (struct task_struct *task);#else /* !CONFIG_CGROUP_FREEZER */ -static inline int cgroup_frozen (struct task_struct *task) {return 0 ; } +static inline int cgroup_freezing_or_frozen (struct task_struct *task) +{ +return 0 ; +}#endif /* !CONFIG_CGROUP_FREEZER */ /*
kernel/cgroup_freezer.c +6 -3
@@ -47,17 +47,20 @@ static inline struct freezer *task_freez struct freezer, css); } -int cgroup_frozen (struct task_struct *task) +int cgroup_freezing_or_frozen (struct task_struct *task) {struct freezer *freezer;enum freezer_state state;task_lock (task); freezer =task_freezer (task); - state = freezer->state; +if (!freezer->css.cgroup->parent) + state =CGROUP_THAWED ;/* root cgroup can't be frozen */ +else + state = freezer->state;task_unlock (task); -return state ==CGROUP_FROZEN ; +return (state ==CGROUP_FREEZING ) || (state ==CGROUP_FROZEN ); }/*
kernel/power/process.c +1 -1
@@ -145,7 +145,7 @@ static void thaw_tasks(bool nosig_only)if (nosig_only &&should_send_signal (p))continue ; -if (cgroup_frozen (p)) +if (cgroup_freezing_or_frozen (p))continue ;thaw_process (p);
PATCH 17/139 iwlwifi: fix regulatory
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Reinette Chatre <[email protected]>
commit f6c8f1523a2de3b84340e45913cbcee8bee74570 upstream.
Commit "cfg80211: convert bools into flags" mistakenly modified iwlwifi's regulatory settings instead of just converting it. Fix this.
This fixes http://bugzilla.intellinuxwireless.org/show_bug.cgi?id=2172
--- drivers/net/wireless/iwlwifi/iwl-agn.c | 2 +- drivers/net/wireless/iwlwifi/iwl3945-base.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/iwlwifi/iwl-agn.c +1 -1
@@ -2461,7 +2461,7 @@ static int iwl_setup_mac(struct iwl_privBIT (NL80211_IFTYPE_STATION ) |BIT (NL80211_IFTYPE_ADHOC ); - hw->wiphy->flags |=WIPHY_FLAG_STRICT_REGULATORY | + hw->wiphy->flags |=WIPHY_FLAG_CUSTOM_REGULATORY |WIPHY_FLAG_DISABLE_BEACON_HINTS ;/*
drivers/net/wireless/iwlwifi/iwl3945-base.c +1 -1
@@ -3903,7 +3903,7 @@ static int iwl3945_setup_mac(struct iwl_BIT (NL80211_IFTYPE_STATION ) |BIT (NL80211_IFTYPE_ADHOC ); - hw->wiphy->flags |=WIPHY_FLAG_STRICT_REGULATORY | + hw->wiphy->flags |=WIPHY_FLAG_CUSTOM_REGULATORY |WIPHY_FLAG_DISABLE_BEACON_HINTS ; hw->wiphy->max_scan_ssids =PROBE_OPTION_MAX_3945 ;
PATCH 18/139 iwlwifi: counting number of tfds can be free for 4965
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Wey-Yi Guy <[email protected]>
commit be6b38bcb175613f239e0b302607db346472c6b6 upstream.
Forget one hunk in 4965 during "iwlwifi: error checking for number of tfds in queue" patch.
--- drivers/net/wireless/iwlwifi/iwl-4965.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/wireless/iwlwifi/iwl-4965.c +2 -4
@@ -2034,16 +2034,14 @@ static void iwl4965_rx_reply_tx(struct i tx_resp->failure_frame); freed =iwl_tx_queue_reclaim (priv, txq_id, index); -if (qc &&likely (sta_id !=IWL_INVALID_STATION )) - priv->stations[sta_id].tid[tid].tfds_in_queue -= freed; +iwl_free_tfds_in_queue (priv, sta_id, tid, freed);if (priv->mac80211_registered && (iwl_queue_space (&txq->q) > txq->q.low_mark))iwl_wake_queue (priv, txq_id); } -if (qc &&likely (sta_id !=IWL_INVALID_STATION )) -iwl_txq_check_empty (priv, sta_id, tid, txq_id); +iwl_txq_check_empty (priv, sta_id, tid, txq_id);if (iwl_check_bits (status,TX_ABORT_REQUIRED_MSK ))IWL_ERR (priv,"TODO: Implement Tx ABORT REQUIRED!!!\n" );
PATCH 19/139 iwlwifi: range checking issue
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Dan Carpenter <[email protected]>
commit 8e1a53c615e8efe0fac670f2973da64758748a8a upstream.
IWL_RATE_COUNT is 13 and IWL_RATE_COUNT_LEGACY is 12.
IWL_RATE_COUNT_LEGACY is the right one here because iwl3945_rates doesn't support 60M and also that's how "rates" is defined in iwlcore_init_geos() from drivers/net/wireless/iwlwifi/iwl-core.c.
rates = kzalloc((sizeof(struct ieee80211_rate) * IWL_RATE_COUNT_LEGACY),
GFP_KERNEL);
--- drivers/net/wireless/iwlwifi/iwl3945-base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/iwlwifi/iwl3945-base.c +1 -1
@@ -1926,7 +1926,7 @@ static void iwl3945_init_hw_rates(struct {int i; -for (i =0 ; i <IWL_RATE_COUNT ; i++) { +for (i =0 ; i <IWL_RATE_COUNT_LEGACY ; i++) { rates[i].bitrate = iwl3945_rates[i].ieee *5 ; rates[i].hw_value = i;/* Rate scaling will work on indexes */ rates[i].hw_value_short = i;
PATCH 20/139 setup correct int pipe type in ar9170_usb_exec_cmd
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Valentin Longchamp <[email protected]>
commit 2d20c72c021d96f8b9230396c8e3782f204214ec upstream.
An int urb is constructed but we fill it in with a bulk pipe type.
Commit f661c6f8c67bd55e93348f160d590ff9edf08904 implemented a pipe type check when CONFIG_USB_DEBUG is enabled. The check failed for all the ar9170 usb transfers and the driver could not configure the wifi dongle.
This went unnoticed until now because most people don't have CONFIG_USB_DEBUG enabled.
--- drivers/net/wireless/ath/ar9170/usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ar9170/usb.c +1 -1
@@ -414,7 +414,7 @@ static int ar9170_usb_exec_cmd(struct arspin_unlock_irqrestore (&aru->common.cmdlock, flags);usb_fill_int_urb (urb, aru->udev, -usb_sndbulkpipe (aru->udev,AR9170_EP_CMD ), +usb_sndintpipe (aru->udev,AR9170_EP_CMD ), aru->common.cmdbuf, plen +4 , ar9170_usb_tx_urb_complete,NULL ,1 );
PATCH 21/139 mac80211: fix PREQ processing and one small bug
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Porsch, Marco <[email protected]>
commit 533866b12cce484994163b1e201778cbac4c04c5 upstream.
1st) a PREQ should only be processed, if it has the same SN and better metric (instead of better or equal).
2nd) next_hop[ETH_ALEN] now actually used to buffer mpath->next_hop->sta.addr for use out of lock.
--- net/mac80211/mesh_hwmp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/mac80211/mesh_hwmp.c +2 -2
@@ -391,7 +391,7 @@ static u32 hwmp_route_info_get(struct ieif (SN_GT (mpath->sn, orig_sn) || (mpath->sn == orig_sn && action ==MPATH_PREQ && - new_metric > mpath->metric)) { + new_metric >= mpath->metric)) { process = false; fresh_info = false; }
@@ -611,7 +611,7 @@ static void hwmp_prep_frame_process(strumesh_path_sel_frame_tx (MPATH_PREP , flags, orig_addr,cpu_to_le32 (orig_sn),0 , target_addr, -cpu_to_le32 (target_sn), mpath->next_hop->sta.addr, hopcount, +cpu_to_le32 (target_sn), next_hop, hopcount, ttl,cpu_to_le32 (lifetime),cpu_to_le32 (metric),0 , sdata);rcu_read_unlock ();
PATCH 22/139 mac80211: move netdev queue enabling to correct spot
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Johannes Berg <[email protected]>
commit 7236fe29fd72d17074574ba312e7f1bb9d10abaa upstream.
"mac80211: fix skb buffering issue" still left a race between enabling the hardware queues and the virtual interface queues. In hindsight it's totally obvious that enabling the netdev queues for a hardware queue when the hardware queue is enabled is wrong, because it could well possible that we can fill the hw queue with packets we already have pending. Thus, we must only enable the netdev queues once all the pending packets have been processed and sent off to the device.
In testing, I haven't been able to trigger this race condition, but it's clearly there, possibly only when aggregation is being enabled.
--- net/mac80211/tx.c | 6 ++++++ net/mac80211/util.c | 12 ++++++------ 2 files changed, 12 insertions(+), 6 deletions(-)
net/mac80211/tx.c +6 -0
@@ -1945,6 +1945,7 @@ static bool ieee80211_tx_pending_skb(strvoid ieee80211_tx_pending (unsigned long data) {struct ieee80211_local *local = (struct ieee80211_local *)data; +struct ieee80211_sub_if_data *sdata;unsigned long flags;int i;bool txok;
@@ -1983,6 +1984,11 @@ void ieee80211_tx_pending(unsigned longif (!txok)break ; } + +if (skb_queue_empty (&local->pending[i])) +list_for_each_entry_rcu (sdata, &local->interfaces, list) +netif_tx_wake_queue ( +netdev_get_tx_queue (sdata->dev, i)); }spin_unlock_irqrestore (&local->queue_stop_reason_lock, flags);
net/mac80211/util.c +6 -6
@@ -280,13 +280,13 @@ static void __ieee80211_wake_queue(struc/* someone still has this queue stopped */ return ; -if (!skb_queue_empty (&local->pending[queue])) +if (skb_queue_empty (&local->pending[queue])) { +rcu_read_lock (); +list_for_each_entry_rcu (sdata, &local->interfaces, list) +netif_tx_wake_queue (netdev_get_tx_queue (sdata->dev, queue)); +rcu_read_unlock (); + }else tasklet_schedule (&local->tx_pending_tasklet); - -rcu_read_lock (); -list_for_each_entry_rcu (sdata, &local->interfaces, list) -netif_tx_wake_queue (netdev_get_tx_queue (sdata->dev, queue)); -rcu_read_unlock (); } void ieee80211_wake_queue_by_reason(struct ieee80211_hw *hw, int queue,
PATCH 23/139 mac80211: tear down all agg queues when restart/reconfig hw
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Wey-Yi Guy <[email protected]>
commit 74e2bd1fa3ae9695af566ad5a7a288898787b909 upstream.
When there is a need to restart/reconfig hw, tear down all the aggregation queues and let the mac80211 and driver get in-sync to have the opportunity to re-establish the aggregation queues again.
Need to wait until driver re-establish all the station information before tear down the aggregation queues, driver(at least iwlwifi driver) will reject the stop aggregation queue request if station is not ready. But also need to make sure the aggregation queues are tear down before waking up the queues, so mac80211 will not sending frames with aggregation bit set.
--- net/mac80211/util.c | 8 ++++++++ 1 file changed, 8 insertions(+)
net/mac80211/util.c +8 -0
@@ -1145,6 +1145,14 @@ int ieee80211_reconfig(struct ieee80211_ } } +rcu_read_lock (); +if (hw->flags &IEEE80211_HW_AMPDU_AGGREGATION ) { +list_for_each_entry_rcu (sta, &local->sta_list, list) { +ieee80211_sta_tear_down_BA_sessions (sta); + } + } +rcu_read_unlock (); +/* add back keys */ list_for_each_entry (sdata, &local->interfaces, list)if (netif_running (sdata->dev))
PATCH 24/139 sparc: Fix regset register window handling.
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: David S. Miller <[email protected]>
[ Upstream commit b857bd292223f54aaae3693c82fa7299a99991cd ]
We have to adjust 'reg_window' down by 16 becuase the 'pos' iterator we'll use to index into the stack slots will be between 16 and 32.
--- arch/sparc/kernel/ptrace_32.c | 4 ++++ arch/sparc/kernel/ptrace_64.c | 4 ++++ 2 files changed, 8 insertions(+)
arch/sparc/kernel/ptrace_32.c +4 -0
@@ -65,6 +65,7 @@ static int genregs32_get(struct task_str *k++ = regs->u_regs[pos++]; reg_window = (unsigned long __user *) regs->u_regs[UREG_I6 ]; + reg_window -=16 ;for (; count >0 && pos <32 ; count--) {if (get_user (*k++, ®_window[pos++]))return -EFAULT ;
@@ -76,6 +77,7 @@ static int genregs32_get(struct task_str } reg_window = (unsigned long __user *) regs->u_regs[UREG_I6 ]; + reg_window -=16 ;for (; count >0 && pos <32 ; count--) {if (get_user (reg, ®_window[pos++]) ||put_user (reg, u++))
@@ -141,6 +143,7 @@ static int genregs32_set(struct task_str regs->u_regs[pos++] = *k++; reg_window = (unsigned long __user *) regs->u_regs[UREG_I6 ]; + reg_window -=16 ;for (; count >0 && pos <32 ; count--) {if (put_user (*k++, ®_window[pos++]))return -EFAULT ;
@@ -153,6 +156,7 @@ static int genregs32_set(struct task_str } reg_window = (unsigned long __user *) regs->u_regs[UREG_I6 ]; + reg_window -=16 ;for (; count >0 && pos <32 ; count--) {if (get_user (reg, u++) ||put_user (reg, ®_window[pos++]))
arch/sparc/kernel/ptrace_64.c +4 -0
@@ -492,6 +492,7 @@ static int genregs32_get(struct task_str *k++ = regs->u_regs[pos++]; reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6 ]; + reg_window -=16 ;if (target == current) {for (; count >0 && pos <32 ; count--) {if (get_user (*k++, ®_window[pos++]))
@@ -516,6 +517,7 @@ static int genregs32_get(struct task_str } reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6 ]; + reg_window -=16 ;if (target == current) {for (; count >0 && pos <32 ; count--) { if (get_user(reg, ®_window[pos++]) ||
@@ -599,6 +601,7 @@ static int genregs32_set(struct task_str regs->u_regs[pos++] = *k++; reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6 ]; + reg_window -=16 ;if (target == current) {for (; count >0 && pos <32 ; count--) {if (put_user (*k++, ®_window[pos++]))
@@ -625,6 +628,7 @@ static int genregs32_set(struct task_str } reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6 ]; + reg_window -=16 ;if (target == current) {for (; count >0 && pos <32 ; count--) { if (get_user(reg, u++) ||
PATCH 25/139 sunxvr500: Ignore secondary output PCI devices.
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: David S. Miller <[email protected]>
[ Upstream commit bdd32ce95f79fb5cc964cd789d7ae4500bba7c6f ]
These just represent the secondary and further heads attached to the card, and they have different sets of PCI bar registers to map.
So don't try to drive them in the main driver.
--- drivers/video/sunxvr500.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-)
drivers/video/sunxvr500.c +17 -7
@@ -242,11 +242,27 @@ static int __devinit e3d_set_fbinfo(strustatic int __devinit e3d_pci_register (struct pci_dev *pdev,const struct pci_device_id *ent) { +struct device_node *of_node; +const char *device_type;struct fb_info *info;struct e3d_info *ep;unsigned int line_length;int err; + of_node =pci_device_to_OF_node (pdev); +if (!of_node) { +printk (KERN_ERR "e3d: Cannot find OF node of %s\n" , +pci_name (pdev)); +return -ENODEV ; + } + + device_type =of_get_property (of_node,"device_type" ,NULL ); +if (!device_type) { +printk (KERN_INFO "e3d: Ignoring secondary output device " +"at %s\n" ,pci_name (pdev)); +return -ENODEV ; + } + err =pci_enable_device (pdev);if (err <0 ) { printk(KERN_ERR "e3d: Cannot enable PCI device %s\n",
@@ -265,13 +281,7 @@ static int __devinit e3d_pci_register(st ep->info = info; ep->pdev = pdev;spin_lock_init (&ep->lock); - ep->of_node =pci_device_to_OF_node (pdev); -if (!ep->of_node) { -printk (KERN_ERR "e3d: Cannot find OF node of %s\n" , -pci_name (pdev)); - err = -ENODEV ; - goto err_release_fb; - } + ep->of_node = of_node;/* Read the PCI base register of the frame buffer, which we * need in order to interpret the RAMDAC_VID_*FB* values in
PATCH 26/139 WATCHDOG: hpwdt - fix lower timeout limit
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Thomas Mingarelli <[email protected]>
commit 8ba42bd88c6982fe224b09c33151c797b0fdf1a5 upstream.
[Novell Bug 581103] HP Watchdog driver has arbitrary (wrong) timeout limits. Fix the lower timeout limit to a more appropriate value.
--- drivers/watchdog/hpwdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/hpwdt.c +1 -1
@@ -443,7 +443,7 @@ static void hpwdt_ping(void)static int hpwdt_change_timer (int new_margin) {/* Arbitrary, can't find the card's limits */ -if (new_margin <30 || new_margin >600 ) { +if (new_margin <5 || new_margin >600 ) {printk (KERN_WARNING "hpwdt: New value passed in is invalid: %d seconds.\n" , new_margin);
PATCH 27/139 WATCHDOG: iTCO_wdt: TCO Watchdog patch for additional Intel Cougar Point DeviceIDs
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Seth Heasley <[email protected]>
commit 4c7d849204341dea19be941a3c1eb4bdffac9cc4 upstream.
This patch adds the Intel Cougar Point PCH LPC Controller DeviceIDs for iTCO Watchdog.
--- drivers/watchdog/iTCO_wdt.c | 99 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 93 insertions(+), 6 deletions(-)
drivers/watchdog/iTCO_wdt.c +93 -6
@@ -115,8 +115,37 @@ enum iTCO_chipsets {TCO_3420 ,/* 3420 */ TCO_3450 ,/* 3450 */ TCO_EP80579 ,/* EP80579 */ -TCO_CPTD ,/* CPT Desktop */ - TCO_CPTM, /* CPT Mobile */ +TCO_CPT1 ,/* Cougar Point */ +TCO_CPT2 ,/* Cougar Point Desktop */ +TCO_CPT3 ,/* Cougar Point Mobile */ +TCO_CPT4 ,/* Cougar Point */ +TCO_CPT5 ,/* Cougar Point */ +TCO_CPT6 ,/* Cougar Point */ +TCO_CPT7 ,/* Cougar Point */ +TCO_CPT8 ,/* Cougar Point */ +TCO_CPT9 ,/* Cougar Point */ +TCO_CPT10 ,/* Cougar Point */ +TCO_CPT11 ,/* Cougar Point */ +TCO_CPT12 ,/* Cougar Point */ +TCO_CPT13 ,/* Cougar Point */ +TCO_CPT14 ,/* Cougar Point */ +TCO_CPT15 ,/* Cougar Point */ +TCO_CPT16 ,/* Cougar Point */ +TCO_CPT17 ,/* Cougar Point */ +TCO_CPT18 ,/* Cougar Point */ +TCO_CPT19 ,/* Cougar Point */ +TCO_CPT20 ,/* Cougar Point */ +TCO_CPT21 ,/* Cougar Point */ +TCO_CPT22 ,/* Cougar Point */ +TCO_CPT23 ,/* Cougar Point */ +TCO_CPT24 ,/* Cougar Point */ +TCO_CPT25 ,/* Cougar Point */ +TCO_CPT26 ,/* Cougar Point */ +TCO_CPT27 ,/* Cougar Point */ +TCO_CPT28 ,/* Cougar Point */ +TCO_CPT29 ,/* Cougar Point */ +TCO_CPT30 ,/* Cougar Point */ + TCO_CPT31, /* Cougar Point */ }; static struct {
@@ -173,8 +202,37 @@ static struct { {"3420", 2}, {"3450", 2}, {"EP80579", 2}, - {"CPT Desktop", 2}, - {"CPT Mobile", 2}, + {"Cougar Point", 2}, + {"Cougar Point", 2}, + {"Cougar Point", 2}, + {"Cougar Point", 2}, + {"Cougar Point", 2}, + {"Cougar Point", 2}, + {"Cougar Point", 2}, + {"Cougar Point", 2}, + {"Cougar Point", 2}, + {"Cougar Point", 2}, + {"Cougar Point", 2}, + {"Cougar Point", 2}, + {"Cougar Point", 2}, + {"Cougar Point", 2}, + {"Cougar Point", 2}, + {"Cougar Point", 2}, + {"Cougar Point", 2}, + {"Cougar Point", 2}, + {"Cougar Point", 2}, + {"Cougar Point", 2}, + {"Cougar Point", 2}, + {"Cougar Point", 2}, + {"Cougar Point", 2}, + {"Cougar Point", 2}, + {"Cougar Point", 2}, + {"Cougar Point", 2}, + {"Cougar Point", 2}, + {"Cougar Point", 2}, + {"Cougar Point", 2}, + {"Cougar Point", 2}, + {"Cougar Point", 2}, {NULL, 0} };
@@ -259,8 +317,37 @@ static struct pci_device_id iTCO_wdt_pci { ITCO_PCI_DEVICE(0x3b14, TCO_3420)}, { ITCO_PCI_DEVICE(0x3b16, TCO_3450)}, { ITCO_PCI_DEVICE(0x5031, TCO_EP80579)}, - { ITCO_PCI_DEVICE(0x1c42, TCO_CPTD)}, - { ITCO_PCI_DEVICE(0x1c43, TCO_CPTM)}, + { ITCO_PCI_DEVICE(0x1c41, TCO_CPT1)}, + { ITCO_PCI_DEVICE(0x1c42, TCO_CPT2)}, + { ITCO_PCI_DEVICE(0x1c43, TCO_CPT3)}, + { ITCO_PCI_DEVICE(0x1c44, TCO_CPT4)}, + { ITCO_PCI_DEVICE(0x1c45, TCO_CPT5)}, + { ITCO_PCI_DEVICE(0x1c46, TCO_CPT6)}, + { ITCO_PCI_DEVICE(0x1c47, TCO_CPT7)}, + { ITCO_PCI_DEVICE(0x1c48, TCO_CPT8)}, + { ITCO_PCI_DEVICE(0x1c49, TCO_CPT9)}, + { ITCO_PCI_DEVICE(0x1c4a, TCO_CPT10)}, + { ITCO_PCI_DEVICE(0x1c4b, TCO_CPT11)}, + { ITCO_PCI_DEVICE(0x1c4c, TCO_CPT12)}, + { ITCO_PCI_DEVICE(0x1c4d, TCO_CPT13)}, + { ITCO_PCI_DEVICE(0x1c4e, TCO_CPT14)}, + { ITCO_PCI_DEVICE(0x1c4f, TCO_CPT15)}, + { ITCO_PCI_DEVICE(0x1c50, TCO_CPT16)}, + { ITCO_PCI_DEVICE(0x1c51, TCO_CPT17)}, + { ITCO_PCI_DEVICE(0x1c52, TCO_CPT18)}, + { ITCO_PCI_DEVICE(0x1c53, TCO_CPT19)}, + { ITCO_PCI_DEVICE(0x1c54, TCO_CPT20)}, + { ITCO_PCI_DEVICE(0x1c55, TCO_CPT21)}, + { ITCO_PCI_DEVICE(0x1c56, TCO_CPT22)}, + { ITCO_PCI_DEVICE(0x1c57, TCO_CPT23)}, + { ITCO_PCI_DEVICE(0x1c58, TCO_CPT24)}, + { ITCO_PCI_DEVICE(0x1c59, TCO_CPT25)}, + { ITCO_PCI_DEVICE(0x1c5a, TCO_CPT26)}, + { ITCO_PCI_DEVICE(0x1c5b, TCO_CPT27)}, + { ITCO_PCI_DEVICE(0x1c5c, TCO_CPT28)}, + { ITCO_PCI_DEVICE(0x1c5d, TCO_CPT29)}, + { ITCO_PCI_DEVICE(0x1c5e, TCO_CPT30)}, + { ITCO_PCI_DEVICE(0x1c5f, TCO_CPT31)}, { 0, }, /* End of list */ };MODULE_DEVICE_TABLE (pci, iTCO_wdt_pci_tbl);
PATCH 28/139 genirq: Force MSI irq handlers to run with interrupts disabled
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Thomas Gleixner <[email protected]>
commit 753649dbc49345a73a2454c770a3f2d54d11aec6 upstream.
Network folks reported that directing all MSI-X vectors of their multi queue NICs to a single core can cause interrupt stack overflows when enough interrupts fire at the same time.
This is caused by the fact that we run interrupt handlers by default with interrupts enabled unless the driver reuqests the interrupt with the IRQF_DISABLED set. The NIC handlers do not set this flag, so simultaneous interrupts can nest unlimited and cause the stack overflow.
The only safe counter measure is to run the interrupt handlers with interrupts disabled. We can't switch to this mode in general right now, but it is safe to do so for MSI interrupts.
Force IRQF_DISABLED for MSI interrupt handlers.
--- kernel/irq/manage.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
kernel/irq/manage.c +10 -0
@@ -753,6 +753,16 @@ __setup_irq(unsigned int irq, struct irqif (new->flags &IRQF_ONESHOT ) desc->status |=IRQ_ONESHOT ; +/* +* Force MSI interrupts to run with interrupts +* disabled. The multi vector cards can cause stack +* overflows due to nested interrupts when enough of +* them are directed to a core and fire at the same +* time. +*/ +if (desc->msi_desc) + new->flags |=IRQF_DISABLED ; +if (!(desc->status &IRQ_NOAUTOEN )) { desc->depth =0 ; desc->status &= ~IRQ_DISABLED ;
PATCH 29/139 tty: release_one_tty() forgets to put pids
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Oleg Nesterov <[email protected]>
commit 6da8d866d0d39e9509ff826660f6a86a6757c966 upstream.
release_one_tty(tty) can be called when tty still has a reference to pgrp/session. In this case we leak the pid.
--- drivers/char/tty_io.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/char/tty_io.c +2 -0
@@ -1423,6 +1423,8 @@ static void release_one_tty(struct work_list_del_init (&tty->tty_files);file_list_unlock (); +put_pid (tty->pgrp); +put_pid (tty->session);free_tty_struct (tty); }
PATCH 30/139 HID: fix oops in gyration_event()
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jiri Kosina <[email protected]>
commit d8e4ebf8b603bdcd091540e6b5bddf0dec10d516 upstream.
Fix oops caused by dereferencing field->hidinput in cases where the device hasn't been claimed by hid-input.
--- drivers/hid/hid-gyration.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/hid/hid-gyration.c +4 -1
@@ -53,10 +53,13 @@ static int gyration_input_mapping(structstatic int gyration_event (struct hid_device *hdev,struct hid_field *field,struct hid_usage *usage,__s32 value) { -struct input_dev *input = field->hidinput->input; + +if (!(hdev->claimed &HID_CLAIMED_INPUT ) || !field->hidinput) +return 0 ;if ((usage->hid &HID_USAGE_PAGE ) ==HID_UP_GENDESK && (usage->hid &0xff ) ==0x82 ) { +struct input_dev *input = field->hidinput->input;input_event (input, usage->type, usage->code,1 );input_sync (input);input_event (input, usage->type, usage->code,0 );
PATCH 31/139 raw: fsync method is now required
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Anton Blanchard <[email protected]>
commit 55ab3a1ff843e3f0e24d2da44e71bffa5d853010 upstream.
Commit 148f948ba877f4d3cdef036b1ff6d9f68986706a (vfs: Introduce new helpers for syncing after writing to O_SYNC file or IS_SYNC inode) broke the raw driver.
We now call through generic_file_aio_write -> generic_write_sync -> vfs_fsync_range. vfs_fsync_range has:
if (!fop || !fop->fsync) {
ret = -EINVAL;
goto out;
}But drivers/char/raw.c doesn't set an fsync method.
We have two options: fix it or remove the raw driver completely. I'm happy to do either, the fact this has been broken for so long suggests it is rarely used.
The patch below adds an fsync method to the raw driver. My knowledge of the block layer is pretty sketchy so this could do with a once over.
If we instead decide to remove the raw driver, this patch might still be useful as a backport to 2.6.33 and 2.6.32.
--- drivers/char/raw.c | 1 + fs/block_dev.c | 3 ++- include/linux/fs.h | 1 + 3 files changed, 4 insertions(+), 1 deletion(-)
drivers/char/raw.c +1 -0
@@ -247,6 +247,7 @@ static const struct file_operations raw_ .aio_read = generic_file_aio_read, .write = do_sync_write, .aio_write = blkdev_aio_write, + .fsync = block_fsync, .open = raw_open, .release= raw_release, .ioctl = raw_ioctl,
fs/block_dev.c +2 -1
@@ -404,7 +404,7 @@ static loff_t block_llseek(struct file ** NULL first argument is nfsd_sync_dir() and that's not a directory. */ -static int block_fsync (struct file *filp,struct dentry *dentry,int datasync) +int block_fsync (struct file *filp,struct dentry *dentry,int datasync) {struct block_device *bdev =I_BDEV (filp->f_mapping->host);int error;
@@ -418,6 +418,7 @@ static int block_fsync(struct file *filp error =0 ;return error; } +EXPORT_SYMBOL (block_fsync);/* * pseudo-fs
include/linux/fs.h +1 -0
@@ -2214,6 +2214,7 @@ extern int generic_segment_checks(const/* fs/block_dev.c */ extern ssize_t blkdev_aio_write (struct kiocb *iocb,const struct iovec *iov,unsigned long nr_segs,loff_t pos); +extern int block_fsync (struct file *filp,struct dentry *dentry,int datasync);/* fs/splice.c */ extern ssize_t generic_file_splice_read(struct file *, loff_t *,
PATCH 32/139 readahead: fix NULL filp dereference
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Wu Fengguang <[email protected]>
commit 70655c06bd3f25111312d63985888112aed15ac5 upstream.
btrfs relocate_file_extent_cluster() calls us with NULL filp:
[ 4005.426805] BUG: unable to handle kernel NULL pointer dereference at 00000021 [ 4005.426818] IP: [<c109a130>] page_cache_sync_readahead+0x18/0x3e
--- mm/readahead.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/readahead.c +1 -1
@@ -502,7 +502,7 @@ void page_cache_sync_readahead(struct adreturn ;/* be dumb */ -if (filp->f_mode &FMODE_RANDOM ) { +if (filp && (filp->f_mode &FMODE_RANDOM )) {force_page_cache_readahead (mapping, filp, offset, req_size);return ; }
PATCH 33/139 include/linux/kfifo.h: fix INIT_KFIFO()
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: David Härdeman <[email protected]>
commit 530cd330dc3865e3107304a6e84fdc332aa72f7d upstream.
DECLARE_KFIFO creates a union with a struct kfifo and a buffer array with size [size + sizeof(struct kfifo)].
INIT_KFIFO then sets the buffer pointer in struct kfifo to point to the beginning of the buffer array which means that the first call to kfifo_in will overwrite members of the struct kfifo.
include/linux/kfifo.h +2 -1
@@ -86,7 +86,8 @@ union { \*/ #define INIT_KFIFO (name) \ name = __kfifo_initializer(sizeof(name##kfifo_buffer) - \ - sizeof(struct kfifo), name##kfifo_buffer) + sizeof(struct kfifo), \ + name##kfifo_buffer + sizeof(struct kfifo))/** * DEFINE_KFIFO - macro to define and initialize a kfifo
PATCH 34/139 ALSA: mixart: range checking proc file
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Dan Carpenter <[email protected]>
commit b0cc58a25d04160d39a80e436847eaa2fbc5aa09 upstream.
The original code doesn't take into consideration that the value of MIXART_BA0_SIZE - pos can be less than zero which would lead to a large unsigned value for "count".
Also I moved the check that read size is a multiple of 4 bytes below the code that adjusts "count".
--- sound/pci/mixart/mixart.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-)
sound/pci/mixart/mixart.c +14 -10
@@ -1161,13 +1161,15 @@ static long snd_mixart_BA0_read(struct s unsigned long count, unsigned long pos) {struct mixart_mgr *mgr = entry->private_data; +unsigned long maxsize; - count = count & ~3 ;/* make sure the read size is a multiple of 4 bytes */ -if (count <=0 ) +if (pos >=MIXART_BA0_SIZE )return 0 ; -if (pos + count >MIXART_BA0_SIZE ) - count = (long )(MIXART_BA0_SIZE - pos); -if (copy_to_user_fromio (buf,MIXART_MEM ( mgr, pos ), count)) + maxsize =MIXART_BA0_SIZE - pos; +if (count > maxsize) + count = maxsize; + count = count & ~3 ;/* make sure the read size is a multiple of 4 bytes */ +if (copy_to_user_fromio (buf,MIXART_MEM (mgr, pos), count))return -EFAULT ;return count; }
@@ -1180,13 +1182,15 @@ static long snd_mixart_BA1_read(struct s unsigned long count, unsigned long pos) {struct mixart_mgr *mgr = entry->private_data; +unsigned long maxsize; - count = count & ~3 ;/* make sure the read size is a multiple of 4 bytes */ -if (count <=0 ) +if (pos >MIXART_BA1_SIZE )return 0 ; -if (pos + count >MIXART_BA1_SIZE ) - count = (long )(MIXART_BA1_SIZE - pos); -if (copy_to_user_fromio (buf,MIXART_REG ( mgr, pos ), count)) + maxsize =MIXART_BA1_SIZE - pos; +if (count > maxsize) + count = maxsize; + count = count & ~3 ;/* make sure the read size is a multiple of 4 bytes */ +if (copy_to_user_fromio (buf,MIXART_REG (mgr, pos), count))return -EFAULT ;return count; }
PATCH 35/139 ALSA: hda: Fix 0 dB offset for Lenovo Thinkpad models using AD1981
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Daniel T Chen <[email protected]>
commit b8e80cf386419453678b01bef830f53445ebb15d upstream.
The OR's hardware distorts at PCM 100% because it does not correspond to 0 dB. Fix this in patch_ad1981() for all models using the Thinkpad quirk.
--- sound/pci/hda/patch_analog.c | 8 ++++++++ 1 file changed, 8 insertions(+)
sound/pci/hda/patch_analog.c +8 -0
@@ -1805,6 +1805,14 @@ static int patch_ad1981(struct hda_codeccase AD1981_THINKPAD : spec->mixers[0 ] = ad1981_thinkpad_mixers; spec->input_mux = &ad1981_thinkpad_capture_source; +/* set the upper-limit for mixer amp to 0dB for avoiding the +* possible damage by overloading +*/ +snd_hda_override_amp_caps (codec,0x11 ,HDA_INPUT , + (0x17 <<AC_AMPCAP_OFFSET_SHIFT ) | + (0x17 <<AC_AMPCAP_NUM_STEPS_SHIFT ) | + (0x05 <<AC_AMPCAP_STEP_SIZE_SHIFT ) | + (1 <<AC_AMPCAP_MUTE_SHIFT ));break ;case AD1981_TOSHIBA : spec->mixers[0 ] = ad1981_hp_mixers;
PATCH 36/139 ALSA: hda - Add ASRock mobo to MSI blacklist
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Michele Ballabio <[email protected]>
commit 4193d13b2c2b694aa59e629e6daf6269d7922f13 upstream.
This avoids a lockup at boot.
--- sound/pci/hda/hda_intel.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/hda_intel.c +1 -0
@@ -2357,6 +2357,7 @@ static struct snd_pci_quirk msi_black_liSND_PCI_QUIRK (0x1043 ,0x81f2 ,"ASUS" ,0 ),/* Athlon64 X2 + nvidia */ SND_PCI_QUIRK (0x1043 ,0x81f6 ,"ASUS" ,0 ),/* nvidia */ SND_PCI_QUIRK (0x1043 ,0x822d ,"ASUS" ,0 ),/* Athlon64 X2 + nvidia MCP55 */ + SND_PCI_QUIRK(0x1849, 0x0888, "ASRock", 0), /* Athlon64 X2 + nvidia */ {} };
PATCH 37/139 ALSA: hda - Add MSI blacklist for Aopen MZ915-M
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Takashi Iwai <[email protected]>
commit 3815595e78d2baae6feb866e737f92d8ef48b337 upstream.
The device needs MSI disablement. Added to the quirk list.
--- sound/pci/hda/hda_intel.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/hda_intel.c +1 -0
@@ -2358,6 +2358,7 @@ static struct snd_pci_quirk msi_black_liSND_PCI_QUIRK (0x1043 ,0x81f6 ,"ASUS" ,0 ),/* nvidia */ SND_PCI_QUIRK (0x1043 ,0x822d ,"ASUS" ,0 ),/* Athlon64 X2 + nvidia MCP55 */ SND_PCI_QUIRK (0x1849 ,0x0888 ,"ASRock" ,0 ),/* Athlon64 X2 + nvidia */ + SND_PCI_QUIRK(0xa0a0, 0x0575, "Aopen MZ915-M", 0), /* ICH6 */ {} };
PATCH 38/139 backlight: mbp_nvidia_bl - add five more MacBook variants
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Evan McClain <[email protected]>
commit 36bc5ee6a8d13333980fa54e97d3469d3d4cda98 upstream.
This adds the MacBook 1,1 2,1 3,1 4,1 and 4,2 to the DMI tables.
--- drivers/video/backlight/mbp_nvidia_bl.c | 45 ++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+)
drivers/video/backlight/mbp_nvidia_bl.c +45 -0
@@ -139,6 +139,51 @@ static int mbp_dmi_match(const struct dmstatic const struct dmi_system_id __initdata mbp_device_table[] = { { .callback = mbp_dmi_match, + .ident ="MacBook 1,1" , + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Apple Inc." ), +DMI_MATCH (DMI_PRODUCT_NAME ,"MacBook1,1" ), + }, + .driver_data = (void *)&intel_chipset_data, + }, + { + .callback = mbp_dmi_match, + .ident ="MacBook 2,1" , + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Apple Inc." ), +DMI_MATCH (DMI_PRODUCT_NAME ,"MacBook2,1" ), + }, + .driver_data = (void *)&intel_chipset_data, + }, + { + .callback = mbp_dmi_match, + .ident ="MacBook 3,1" , + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Apple Inc." ), +DMI_MATCH (DMI_PRODUCT_NAME ,"MacBook3,1" ), + }, + .driver_data = (void *)&intel_chipset_data, + }, + { + .callback = mbp_dmi_match, + .ident ="MacBook 4,1" , + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Apple Inc." ), +DMI_MATCH (DMI_PRODUCT_NAME ,"MacBook4,1" ), + }, + .driver_data = (void *)&intel_chipset_data, + }, + { + .callback = mbp_dmi_match, + .ident ="MacBook 4,2" , + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Apple Inc." ), +DMI_MATCH (DMI_PRODUCT_NAME ,"MacBook4,2" ), + }, + .driver_data = (void *)&intel_chipset_data, + }, + { + .callback = mbp_dmi_match, .ident ="MacBookPro 3,1" , .matches = {DMI_MATCH (DMI_SYS_VENDOR ,"Apple Inc." ),
PATCH 39/139 pata_via: Add VIA VX900 support
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: [email protected] <[email protected]>
commit 4f1deba435ef75380c1d06fda860c7a15ea16fdf upstream.
--- drivers/ata/pata_via.c | 1 + 1 file changed, 1 insertion(+)
drivers/ata/pata_via.c +1 -0
@@ -697,6 +697,7 @@ static const struct pci_device_id via[] { PCI_VDEVICE(VIA, 0x3164), }, { PCI_VDEVICE(VIA, 0x5324), }, { PCI_VDEVICE(VIA, 0xC409), VIA_IDFLAG_SINGLE }, + { PCI_VDEVICE(VIA, 0x9001), VIA_IDFLAG_SINGLE }, { }, };
PATCH 40/139 libata: disable NCQ on Crucial C300 SSD
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Tejun Heo <[email protected]>
commit 68b0ddb289220b6d4d865be128939663be34959d upstream.
Crucial said,
Thank you for contacting us. We know that with our M225 line of SSDs you sometimes need to disable NCQ (native command queuing) to avoid just the type of errors you're seeing. Our recommendation for the M225 is to add libata.force=noncq to your Linux kernel boot options, under the kernel ATA library option.
I have sent your feedback to the engineers working on the C300, and asked them to please pass it on to the firmware team. I have been notified that they are in the process of testing and finalizing a new firmware version, that you can expect to see released around the end of April. We’ll keep you posted as to when it will be available for download.
So, turn off NCQ on the drive w/ the current firmware revision.
Reported in the following bug.
https://bugzilla.kernel.org/show_bug.cgi?id=15573
--- drivers/ata/libata-core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/ata/libata-core.c +3 -0
@@ -4348,6 +4348,9 @@ static const struct ata_blacklist_entry { "HTS541080G9SA00", "MB4OC60D", ATA_HORKAGE_NONCQ, }, { "HTS541010G9SA00", "MBZOC60D", ATA_HORKAGE_NONCQ, }, + /* https://bugzilla.kernel.org/show_bug.cgi?id=15573 */ + { "C300-CTFDDAC128MAG", "0001", ATA_HORKAGE_NONCQ, }, + /* devices which puke on READ_NATIVE_MAX */ { "HDS724040KLSA80", "KFAOA20N", ATA_HORKAGE_BROKEN_HPA, }, { "WDC WD3200JD-00KLB0", "WD-WCAMR1130137", ATA_HORKAGE_BROKEN_HPA },
PATCH 41/139 s390: disable change bit override
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Christian Borntraeger <[email protected]>
commit 6af7eea2aee57b869f34eba0a94ef122fe90fbfd upstream.
commit 6a985c6194017de2c062916ad1cd00dee0302c40
([S390] s390: use change recording override for kernel mapping) deactivated the change bit recording for the kernel mapping to improve the performance. This works most of the time, but there are cases (e.g. kernel runs in home space, futex atomic compare xcmg) where we modify user memory with the kernel mapping instead of the user mapping.
Instead of fixing these cases, this patch just deactivates change bit override to avoid future problems with other kernel code that might use the kernel mapping for user memory.
--- arch/s390/mm/vmem.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
arch/s390/mm/vmem.c +3 -8
@@ -70,12 +70,8 @@ static pte_t __ref *vmem_pte_alloc(void) pte =alloc_bootmem (PTRS_PER_PTE *sizeof (pte_t));if (!pte)return NULL ; -if (MACHINE_HAS_HPAGE ) -clear_table ((unsigned long *) pte, _PAGE_TYPE_EMPTY | _PAGE_CO, -PTRS_PER_PTE *sizeof (pte_t)); -else -clear_table ((unsigned long *) pte, _PAGE_TYPE_EMPTY, -PTRS_PER_PTE *sizeof (pte_t)); +clear_table ((unsigned long *) pte, _PAGE_TYPE_EMPTY, +PTRS_PER_PTE *sizeof (pte_t));return pte; }
@@ -116,8 +112,7 @@ static int vmem_add_mem(unsigned long stif (MACHINE_HAS_HPAGE && !(address & ~HPAGE_MASK ) && (address +HPAGE_SIZE <= start + size) && (address >=HPAGE_SIZE )) { -pte_val (pte) |= _SEGMENT_ENTRY_LARGE | - _SEGMENT_ENTRY_CO; +pte_val (pte) |= _SEGMENT_ENTRY_LARGE;pmd_val (*pm_dir) =pte_val (pte); address +=HPAGE_SIZE -PAGE_SIZE ;continue ;
PATCH 42/139 cifs: Fix a kernel BUG with remote OS/2 server (try #3)
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Suresh Jayaraman <[email protected]>
commit 6513a81e9325d712f1bfb9a1d7b750134e49ff18 upstream.
While chasing a bug report involving a OS/2 server, I noticed the server sets pSMBr->CountHigh to a incorrect value even in case of normal writes. This results in 'nbytes' being computed wrongly and triggers a kernel BUG at mm/filemap.c.
void iov_iter_advance(struct iov_iter *i, size_t bytes)
{
BUG_ON(i->count < bytes); <--- BUG hereWhy the server is setting 'CountHigh' is not clear but only does so after writing 64k bytes. Though this looks like the server bug, the client side crash may not be acceptable.
The workaround is to mask off high 16 bits if the number of bytes written as returned by the server is greater than the bytes requested by the client as suggested by Jeff Layton.
--- fs/cifs/cifssmb.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
fs/cifs/cifssmb.c +16 -0
@@ -1517,6 +1517,14 @@ CIFSSMBWrite(const int xid, struct cifsT *nbytes =le16_to_cpu (pSMBr->CountHigh); *nbytes = (*nbytes) <<16 ; *nbytes +=le16_to_cpu (pSMBr->Count); + +/* +* Mask off high 16 bits when bytes written as returned by the +* server is greater than bytes requested by the client. Some +* OS/2 servers are known to set incorrect CountHigh values. +*/ +if (*nbytes > count) + *nbytes &=0xFFFF ; }cifs_buf_release (pSMB);
@@ -1605,6 +1613,14 @@ CIFSSMBWrite2(const int xid, struct cifs *nbytes =le16_to_cpu (pSMBr->CountHigh); *nbytes = (*nbytes) <<16 ; *nbytes +=le16_to_cpu (pSMBr->Count); + +/* +* Mask off high 16 bits when bytes written as returned by the +* server is greater than bytes requested by the client. OS/2 +* servers are known to set incorrect CountHigh values. +*/ +if (*nbytes > count) + *nbytes &=0xFFFF ; }/* cifs_small_buf_release(pSMB); */ /* Freed earlier now in SendReceive2 */
PATCH 43/139 CIFS: initialize nbytes at the beginning of CIFSSMBWrite()
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Steve French <[email protected]>
commit a24e2d7d8f512340991ef0a59cb5d08d491b8e98 upstream.
By doing this we always overwrite nbytes value that is being passed on to CIFSSMBWrite() and need not rely on the callers to initialize. CIFSSMBWrite2 is doing this already.
--- fs/cifs/cifssmb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/cifs/cifssmb.c +2 -1
@@ -1430,6 +1430,8 @@ CIFSSMBWrite(const int xid, struct cifsT__u32 bytes_sent;__u16 byte_count; + *nbytes =0 ; +/* cFYI(1, ("write at %lld %d bytes", offset, count));*/ if (tcon->ses ==NULL )return -ECONNABORTED ;
@@ -1512,7 +1514,6 @@ CIFSSMBWrite(const int xid, struct cifsTcifs_stats_inc (&tcon->num_writes);if (rc) {cFYI (1 , ("Send error in write = %d" , rc)); - *nbytes =0 ; }else { *nbytes =le16_to_cpu (pSMBr->CountHigh); *nbytes = (*nbytes) <<16 ;
PATCH 44/139 ath9k: fix double calls to ath_radio_enable
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Felix Fietkau <[email protected]>
commit 1144601118507f8b3b676a9a392584d216d3f2cc upstream.
With the enable_radio being uninitialized, ath_radio_enable() might be called twice, which can leave some hardware in an undefined state.
--- drivers/net/wireless/ath/ath9k/main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/ath/ath9k/main.c +1 -2
@@ -2721,8 +2721,7 @@ static int ath9k_config(struct ieee80211 all_wiphys_idle =ath9k_all_wiphys_idle (sc);ath9k_set_wiphy_idle (aphy, idle); -if (!idle && all_wiphys_idle) - enable_radio = true; + enable_radio = (!idle && all_wiphys_idle);/* * After we unlock here its possible another wiphy
PATCH 45/139 iwlwifi: need check for valid qos packet before free
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Wey-Yi Guy <[email protected]>
commit ece6444c2fe80dab679beb5f0d58b091f1933b00 upstream.
For 4965, need to check it is valid qos frame before free, only valid QoS frame has the tid used to free the packets.
--- drivers/net/wireless/iwlwifi/iwl-4965.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/net/wireless/iwlwifi/iwl-4965.c +9 -4
@@ -2008,7 +2008,9 @@ static void iwl4965_rx_reply_tx(struct iIWL_DEBUG_TX_REPLY (priv,"Retry scheduler reclaim scd_ssn " "%d index %d\n" , scd_ssn , index); freed =iwl_tx_queue_reclaim (priv, txq_id, index); -iwl_free_tfds_in_queue (priv, sta_id, tid, freed); +if (qc) +iwl_free_tfds_in_queue (priv, sta_id, + tid, freed); if (priv->mac80211_registered && (iwl_queue_space(&txq->q) > txq->q.low_mark) &&
@@ -2034,14 +2036,17 @@ static void iwl4965_rx_reply_tx(struct i tx_resp->failure_frame); freed =iwl_tx_queue_reclaim (priv, txq_id, index); -iwl_free_tfds_in_queue (priv, sta_id, tid, freed); +if (qc &&likely (sta_id !=IWL_INVALID_STATION )) +iwl_free_tfds_in_queue (priv, sta_id, tid, freed); +else if (sta_id ==IWL_INVALID_STATION ) +IWL_DEBUG_TX_REPLY (priv,"Station not known\n" );if (priv->mac80211_registered && (iwl_queue_space (&txq->q) > txq->q.low_mark))iwl_wake_queue (priv, txq_id); } - -iwl_txq_check_empty (priv, sta_id, tid, txq_id); +if (qc &&likely (sta_id !=IWL_INVALID_STATION )) +iwl_txq_check_empty (priv, sta_id, tid, txq_id);if (iwl_check_bits (status,TX_ABORT_REQUIRED_MSK ))IWL_ERR (priv,"TODO: Implement Tx ABORT REQUIRED!!!\n" );
PATCH 46/139 mac80211: Handle mesh action frames in ieee80211_rx_h_action
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Javier Cardona <[email protected]>
commit 1cb561f83793191cf86a2db3948d28f5f42df9ff upstream.
This fixes the problem introduced in commit 8404080568613d93ad7cf0a16dfb68 which broke mesh peer link establishment.
changes:
v2 Added missing break (Johannes)
v3 Broke original patch into two (Johannes)
--- net/mac80211/mesh.c | 3 --- net/mac80211/rx.c | 5 +++++ 2 files changed, 5 insertions(+), 3 deletions(-)
net/mac80211/mesh.c +0 -3
@@ -749,9 +749,6 @@ ieee80211_mesh_rx_mgmt(struct ieee80211_switch (fc &IEEE80211_FCTL_STYPE ) {case IEEE80211_STYPE_ACTION : -if (skb->len <IEEE80211_MIN_ACTION_SIZE ) -return RX_DROP_MONITOR ; -/* fall through */ case IEEE80211_STYPE_PROBE_RESP :case IEEE80211_STYPE_BEACON :skb_queue_tail (&ifmsh->skb_queue, skb);
net/mac80211/rx.c +5 -0
@@ -2355,6 +2355,11 @@ static int prepare_for_handlers(struct i/* should never get here */ WARN_ON (1 );break ; +case MESH_PLINK_CATEGORY : +case MESH_PATH_SEL_CATEGORY : +if (ieee80211_vif_is_mesh (&sdata->vif)) +return ieee80211_mesh_rx_mgmt (sdata, rx->skb); +break ; }return 1 ;
PATCH 47/139 ARM: 6031/1: fix Thumb-2 decompressor
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Rabin Vincent <[email protected]>
commit d4d9959c099751158c5cf14813fe378e206339c6 upstream.
98e12b5a6e05413 ("ARM: Fix decompressor's kernel size estimation for ROM=y") broke the Thumb-2 decompressor because it added an entry in the LC0 table but didn't adjust the offset the Thumb-2 code uses to load the SP from that table. Fix it.
--- arch/arm/boot/compressed/head.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/compressed/head.S +1 -1
@@ -172,7 +172,7 @@ not_angel: adr r0, LC0 ARM( ldmia r0, {r1, r2, r3, r4, r5, r6, r11, ip, sp}) THUMB( ldmia r0, {r1, r2, r3, r4, r5, r6, r11, ip} ) - THUMB( ldr sp, [r0, #28] ) + THUMB( ldr sp, [r0, #32] ) subs r0, r0, r1 @ calculate the delta offset @ if delta is zero, we are
PATCH 48/139 drm/edid/quirks: Envision EN2028
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Adam Jackson <[email protected]>
commit ba1163de2f74d624e7b0e530c4104c98ede0045a upstream.
Claims 1280x1024 preferred, physically 1600x1200
cf. http://bugzilla.redhat.com/530399
--- drivers/gpu/drm/drm_edid.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/drm_edid.c +2 -0
@@ -85,6 +85,8 @@ static struct edid_quirk {/* Envision Peripherals, Inc. EN-7100e */ { "EPI", 59264, EDID_QUIRK_135_CLOCK_TOO_HIGH }, +/* Envision EN2028 */ + { "EPI", 8232, EDID_QUIRK_PREFER_LARGE_60 },/* Funai Electronics PM36B */ { "FCM", 13600, EDID_QUIRK_PREFER_LARGE_75 |
PATCH 49/139 drm/radeon: R300 AD only has one quad pipe.
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <[email protected]>
commit 57b54ea6b7863ccfeb41851b5f58f9fd1b83c79e upstream.
Gleaned from the Mesa code.
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=27355 .
--- drivers/gpu/drm/radeon/r300.c | 5 +++-- drivers/gpu/drm/radeon/radeon_cp.c | 10 ++++++---- 2 files changed, 9 insertions(+), 6 deletions(-)
drivers/gpu/drm/radeon/r300.c +3 -2
@@ -364,11 +364,12 @@ void r300_gpu_init(struct radeon_devicer100_hdp_reset (rdev);/* FIXME: rv380 one pipes ? */ -if ((rdev->family ==CHIP_R300 ) || (rdev->family ==CHIP_R350 )) { +if ((rdev->family ==CHIP_R300 && rdev->pdev->device !=0x4144 ) || + (rdev->family ==CHIP_R350 )) {/* r300,r350 */ rdev->num_gb_pipes =2 ; }else { -/* rv350,rv370,rv380 */ +/* rv350,rv370,rv380,r300 AD */ rdev->num_gb_pipes =1 ; } rdev->num_z_pipes =1 ;
drivers/gpu/drm/radeon/radeon_cp.c +6 -4
@@ -417,8 +417,9 @@ static int radeon_do_wait_for_idle(drm_rreturn -EBUSY ; } -static void radeon_init_pipes (drm_radeon_private_t *dev_priv) +static void radeon_init_pipes (struct drm_device *dev) { +drm_radeon_private_t *dev_priv = dev->dev_private;uint32_t gb_tile_config, gb_pipe_sel =0 ;if ((dev_priv->flags &RADEON_FAMILY_MASK ) ==CHIP_RV530 ) {
@@ -436,11 +437,12 @@ static void radeon_init_pipes(drm_radeon dev_priv->num_gb_pipes = ((gb_pipe_sel >>12 ) &0x3 ) +1 ; }else {/* R3xx */ -if (((dev_priv->flags &RADEON_FAMILY_MASK ) ==CHIP_R300 ) || +if (((dev_priv->flags &RADEON_FAMILY_MASK ) ==CHIP_R300 && + dev->pdev->device !=0x4144 ) || ((dev_priv->flags &RADEON_FAMILY_MASK ) ==CHIP_R350 )) { dev_priv->num_gb_pipes =2 ; }else { -/* R3Vxx */ +/* RV3xx/R300 AD */ dev_priv->num_gb_pipes =1 ; } }
@@ -736,7 +738,7 @@ static int radeon_do_engine_reset(struct/* setup the raster pipes */ if ((dev_priv->flags &RADEON_FAMILY_MASK ) >=CHIP_R300 ) -radeon_init_pipes (dev_priv); +radeon_init_pipes (dev);/* Reset the CP ring */ radeon_do_cp_reset (dev_priv);
PATCH 50/139 drm/radeon/kms: fix washed out image on legacy tv dac
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alex Deucher <[email protected]>
commit 643acacf02679befd0f98ac3c5fecb805f1c9548 upstream.
bad cast was overwriting the tvdac adj values Fixes fdo bug 27478
--- drivers/gpu/drm/radeon/radeon_connectors.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/radeon_connectors.c +1 -1
@@ -315,7 +315,7 @@ int radeon_connector_set_property(struct radeon_encoder =to_radeon_encoder (encoder);if (!radeon_encoder->enc_priv)return 0 ; -if (rdev->is_atom_bios) { +if (ASIC_IS_AVIVO (rdev) || radeon_r4xx_atom) {struct radeon_encoder_atom_dac *dac_int; dac_int = radeon_encoder->enc_priv; dac_int->tv_std = val;
PATCH 51/139 drm/radeon/kms/combios: verify dac_adj values are valid
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alex Deucher <[email protected]>
commit 3a89b4a9ca7ce11e3b7d5119aea917b9fc29a302 upstream.
Some vbios dac_adj tables are all zeros. Check for that case and use the default table if so.
Should fix fdo bug 27478.
--- drivers/gpu/drm/radeon/radeon_combios.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
drivers/gpu/drm/radeon/radeon_combios.c +15 -5
@@ -670,7 +670,9 @@ struct radeon_encoder_primary_dac *radeo dac =RBIOS8 (dac_info +0x3 ) &0xf ; p_dac->ps2_pdac_adj = (bg <<8 ) | (dac); } - found =1 ; +/* if the values are all zeros, use the table */ +if (p_dac->ps2_pdac_adj) + found =1 ; } out:
@@ -812,7 +814,9 @@ struct radeon_encoder_tv_dac *radeon_com bg =RBIOS8 (dac_info +0x10 ) &0xf ; dac =RBIOS8 (dac_info +0x11 ) &0xf ; tv_dac->ntsc_tvdac_adj = (bg <<16 ) | (dac <<20 ); - found =1 ; +/* if the values are all zeros, use the table */ +if (tv_dac->ps2_tvdac_adj) + found =1 ; }else if (rev >1 ) { bg =RBIOS8 (dac_info +0xc ) &0xf ; dac = (RBIOS8 (dac_info +0xc ) >>4 ) &0xf ;
@@ -825,7 +829,9 @@ struct radeon_encoder_tv_dac *radeon_com bg =RBIOS8 (dac_info +0xe ) &0xf ; dac = (RBIOS8 (dac_info +0xe ) >>4 ) &0xf ; tv_dac->ntsc_tvdac_adj = (bg <<16 ) | (dac <<20 ); - found =1 ; +/* if the values are all zeros, use the table */ +if (tv_dac->ps2_tvdac_adj) + found =1 ; } tv_dac->tv_std =radeon_combios_get_tv_info (rdev); }
@@ -842,7 +848,9 @@ struct radeon_encoder_tv_dac *radeon_com (bg <<16 ) | (dac <<20 ); tv_dac->pal_tvdac_adj = tv_dac->ps2_tvdac_adj; tv_dac->ntsc_tvdac_adj = tv_dac->ps2_tvdac_adj; - found =1 ; +/* if the values are all zeros, use the table */ +if (tv_dac->ps2_tvdac_adj) + found =1 ; }else { bg =RBIOS8 (dac_info +0x4 ) &0xf ; dac =RBIOS8 (dac_info +0x5 ) &0xf ;
@@ -850,7 +858,9 @@ struct radeon_encoder_tv_dac *radeon_com (bg <<16 ) | (dac <<20 ); tv_dac->pal_tvdac_adj = tv_dac->ps2_tvdac_adj; tv_dac->ntsc_tvdac_adj = tv_dac->ps2_tvdac_adj; - found =1 ; +/* if the values are all zeros, use the table */ +if (tv_dac->ps2_tvdac_adj) + found =1 ; } }else {DRM_INFO ("No TV DAC info found in BIOS\n" );
PATCH 52/139 x86-32, resume: do a global tlb flush in S4 resume
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Shaohua Li <[email protected]>
commit 8ae06d223f8203c72104e5c0c4ee49a000aedb42 upstream.
Colin King reported a strange oops in S4 resume code path (see below). The test system has i5/i7 CPU. The kernel doesn't open PAE, so 4M page table is used. The oops always happen a virtual address 0xc03ff000, which is mapped to the last 4k of first 4M memory. Doing a global tlb flush fixes the issue.
EIP: 0060:[<c0493a01>] EFLAGS: 00010086 CPU: 0 EIP is at copy_loop+0xe/0x15
EAX: 36aeb000 EBX: 00000000 ECX: 00000400 EDX: f55ad46c
ESI: 0f800000 EDI: c03ff000 EBP: f67fbec4 ESP: f67fbea8
DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
...
...
CR2: 00000000c03ff000
LKML-Reference: <[email protected]>
--- arch/x86/power/hibernate_asm_32.S | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
arch/x86/power/hibernate_asm_32.S +7 -8
@@ -27,10 +27,17 @@ ENTRY(swsusp_arch_suspend) ret ENTRY(restore_image) + movl mmu_cr4_features, %ecx movl resume_pg_dir, %eax subl $__PAGE_OFFSET, %eax movl %eax, %cr3 + jecxz 1f # cr4 Pentium and higher, skip if zero + andl $~(X86_CR4_PGE), %ecx + movl %ecx, %cr4; # turn off PGE + movl %cr3, %eax; # flush TLB + movl %eax, %cr3 +1: movl restore_pblist, %edx .p2align 4,,7
@@ -54,16 +61,8 @@ done: movl $swapper_pg_dir, %eax subl $__PAGE_OFFSET, %eax movl %eax, %cr3 - /* Flush TLB, including "global" things (vmalloc) */ movl mmu_cr4_features, %ecx jecxz 1f # cr4 Pentium and higher, skip if zero - movl %ecx, %edx - andl $~(X86_CR4_PGE), %edx - movl %edx, %cr4; # turn off PGE -1: - movl %cr3, %eax; # flush TLB - movl %eax, %cr3 - jecxz 1f # cr4 Pentium and higher, skip if zero movl %ecx, %cr4; # turn PGE back on 1:
PATCH 53/139 x86: Handle overlapping mptables
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Andi Kleen <[email protected]>
commit 909fc87b32b3b9e3f0b87dcc5d98319c41900c58 upstream.
We found a system where the MP table MPC and MPF structures overlap.
That doesn't really matter because the mptable is not used anyways with ACPI, but it leads to a panic in the early allocator due to the overlapping reservations in 2.6.33.
Earlier kernels handled this without problems.
Simply change these reservations to reserve_early_overlap_ok to avoid the panic.
LKML-Reference: <[email protected]>
--- arch/x86/kernel/mpparse.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/mpparse.c +2 -2
@@ -664,7 +664,7 @@ static void __init smp_reserve_memory(st {unsigned long size =get_mpc_size (mpf->physptr); -reserve_early (mpf->physptr, mpf->physptr+size,"MP-table mpc" ); +reserve_early_overlap_ok (mpf->physptr, mpf->physptr+size,"MP-table mpc" ); }static int __init smp_scan_config (unsigned long base,unsigned long length)
@@ -693,7 +693,7 @@ static int __init smp_scan_config(unsign mpf, (u64)virt_to_phys(mpf)); mem =virt_to_phys (mpf); -reserve_early (mem, mem +sizeof (*mpf),"MP-table mpf" ); +reserve_early_overlap_ok (mem, mem +sizeof (*mpf),"MP-table mpf" );if (mpf->physptr)smp_reserve_memory (mpf);
PATCH 54/139 x86, hpet: Erratum workaround for read after write of HPET comparator
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Pallipadi, Venkatesh <[email protected]>
commit 8da854cb02156c90028233ae1e85ce46a1d3f82c upstream.
Quoted 31 lines · Justin Piszcz
Hello,
Again, on the Intel DP55KG board:
# uname -a Linux host 2.6.33 #1 SMP Wed Feb 24 18:31:00 EST 2010 x86_64 GNU/Linux[ 1.237600] ------------[ cut here ]------------ [ 1.237890] WARNING: at arch/x86/kernel/hpet.c:404 hpet_next_event+0x70/0x80() [ 1.238221] Hardware name: [ 1.238504] hpet: compare register read back failed. [ 1.238793] Modules linked in: [ 1.239315] Pid: 0, comm: swapper Not tainted 2.6.33 #1 [ 1.239605] Call Trace: [ 1.239886] <IRQ> [<ffffffff81056c13>] ? warn_slowpath_common+0x73/0xb0 [ 1.240409] [<ffffffff81079608>] ? tick_dev_program_event+0x38/0xc0 [ 1.240699] [<ffffffff81056cb0>] ? warn_slowpath_fmt+0x40/0x50 [ 1.240992] [<ffffffff81079608>] ? tick_dev_program_event+0x38/0xc0 [ 1.241281] [<ffffffff81041ad0>] ? hpet_next_event+0x70/0x80 [ 1.241573] [<ffffffff81079608>] ? tick_dev_program_event+0x38/0xc0 [ 1.241859] [<ffffffff81078e32>] ? tick_handle_oneshot_broadcast+0xe2/0x100 [ 1.246533] [<ffffffff8102a67a>] ? timer_interrupt+0x1a/0x30 [ 1.246826] [<ffffffff81085499>] ? handle_IRQ_event+0x39/0xd0 [ 1.247118] [<ffffffff81087368>] ? handle_edge_irq+0xb8/0x160 [ 1.247407] [<ffffffff81029f55>] ? handle_irq+0x15/0x20 [ 1.247689] [<ffffffff810294a2>] ? do_IRQ+0x62/0xe0 [ 1.247976] [<ffffffff8146be53>] ? ret_from_intr+0x0/0xa [ 1.248262] <EOI> [<ffffffff8102f277>] ? mwait_idle+0x57/0x80 [ 1.248796] [<ffffffff8102645c>] ? cpu_idle+0x5c/0xb0 [ 1.249080] ---[ end trace db7f668fb6fef4e1 ]---
Quoted 1 line
Is this something Intel has to fix or is it a bug in the kernel?
This is a chipset erratum.
Thomas: You mentioned we can retain this check only for known-buggy and hpet debug kind of options. But here is the simple workaround patch for this particular erratum.
Some chipsets have a erratum due to which read immediately following a write of HPET comparator returns old comparator value instead of most recently written value.
Erratum 15 in
"Intel I/O Controller Hub 9 (ICH9) Family Specification Update"
(http://www.intel.com/assets/pdf/specupdate/316973.pdf)
Workaround for the errata is to read the comparator twice if the first one fails.
LKML-Reference: <[email protected]>
--- arch/x86/kernel/hpet.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
arch/x86/kernel/hpet.c +7 -1
@@ -399,9 +399,15 @@ static int hpet_next_event(unsigned long* then we might have a real hardware problem. We can not do * much about it here, but at least alert the user/admin with * a prominent warning. +* An erratum on some chipsets (ICH9,..), results in comparator read +* immediately following a write returning old value. Workaround +* for this is to read this value second time, when first +* read returns old value. */ -WARN_ONCE (hpet_readl (HPET_Tn_CMP (timer)) != cnt, +if (unlikely ((u32 )hpet_readl (HPET_Tn_CMP (timer)) != cnt)) { +WARN_ONCE (hpet_readl (HPET_Tn_CMP (timer)) != cnt,KERN_WARNING "hpet: compare register read back failed.\n" ); + }return (s32)(hpet_readl (HPET_COUNTER ) - cnt) >=0 ? -ETIME :0 ; }
PATCH 55/139 x86: Fix double enable_IR_x2apic() call on SMP kernel on !SMP boards
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Suresh Siddha <[email protected]>
commit 472a474c6630efd195d3738339fd1bdc8aa3b1aa upstream.
Jan Grossmann reported kernel boot panic while booting SMP kernel on his system with a single core cpu. SMP kernels call enable_IR_x2apic() from native_smp_prepare_cpus() and on platforms where the kernel doesn't find SMP configuration we ended up again calling enable_IR_x2apic() from the APIC_init_uniprocessor() call in the smp_sanity_check(). Thus leading to kernel panic.
Don't call enable_IR_x2apic() and default_setup_apic_routing() from APIC_init_uniprocessor() in CONFIG_SMP case.
NOTE: this kind of non-idempotent and assymetric initialization sequence is rather fragile and unclean, we'll clean that up in v2.6.35. This is the minimal fix for v2.6.34.
LKML-Reference: <[email protected]>
--- arch/x86/kernel/apic/apic.c | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/kernel/apic/apic.c +2 -0
@@ -1640,8 +1640,10 @@ int __init APIC_init_uniprocessor(void) }#endif +#ifndef CONFIG_SMP enable_IR_x2apic ();default_setup_apic_routing (); +#endif verify_local_APIC ();connect_bsp_APIC ();
PATCH 56/139 sched: sched_getaffinity(): Allow less than NR_CPUS length
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: KOSAKI Motohiro <[email protected]>
commit cd3d8031eb4311e516329aee03c79a08333141f1 upstream.
[ Note, this commit changes the syscall ABI for > 1024 CPUs systems. ]
Recently, some distro decided to use NR_CPUS=4096 for mysterious reasons. Unfortunately, glibc sched interface has the following definition:
# define __CPU_SETSIZE 1024
# define __NCPUBITS (8 * sizeof (__cpu_mask))
typedef unsigned long int __cpu_mask;
typedef struct
{
__cpu_mask __bits[__CPU_SETSIZE / __NCPUBITS];
} cpu_set_t;It mean, if NR_CPUS is bigger than 1024, cpu_set_t makes an ABI issue ...
More recently, Sharyathi Nagesh reported following test program makes misterious syscall failure:
-----------------------------------------------------------------------
#define _GNU_SOURCE
#include<stdio.h>
#include<errno.h>
#include<sched.h>
int main()
{
cpu_set_t set;
if (sched_getaffinity(0, sizeof(cpu_set_t), &set) < 0)
printf("\n Call is failing with:%d", errno); }
-----------------------------------------------------------------------
Because the kernel assumes len argument of sched_getaffinity() is bigger than NR_CPUS. But now it is not correct.
Now we are faced with the following annoying dilemma, due to the limitations of the glibc interface built in years ago:
(1) if we change glibc's __CPU_SETSIZE definition, we lost binary compatibility of _all_ application.
(2) if we don't change it, we also lost binary compatibility of Sharyathi's use case.
Then, I would propse to change the rule of the len argument of sched_getaffinity().
Old:
len should be bigger than NR_CPUS
New:
len should be bigger than maximum possible cpu id
This creates the following behavior:
(A) In the real 4096 cpus machine, the above test program still return -EINVAL.
(B) NR_CPUS=4096 but the machine have less than 1024 cpus (almost all machines in the world), the above can run successfully.
Fortunatelly, BIG SGI machine is mainly used for HPC use case. It means they can rebuild their programs.
IOW we hope they are not annoyed by this issue ...
LKML-Reference: <[email protected]>
--- kernel/sched.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
kernel/sched.c +7 -3
@@ -6717,7 +6717,9 @@ SYSCALL_DEFINE3(sched_getaffinity, pid_tint ret;cpumask_var_t mask; -if (len <cpumask_size ()) +if (len < nr_cpu_ids) +return -EINVAL ; +if (len & (sizeof (unsigned long )-1 ))return -EINVAL ;if (!alloc_cpumask_var (&mask,GFP_KERNEL ))
@@ -6725,10 +6727,12 @@ SYSCALL_DEFINE3(sched_getaffinity, pid_t ret =sched_getaffinity (pid, mask);if (ret ==0 ) { -if (copy_to_user (user_mask_ptr, mask,cpumask_size ())) +int retlen =min (len,cpumask_size ()); + +if (copy_to_user (user_mask_ptr, mask, retlen)) ret = -EFAULT ;else - ret =cpumask_size (); + ret = retlen; }free_cpumask_var (mask);
PATCH 57/139 sched: Fix sched_getaffinity()
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Anton Blanchard <[email protected]>
commit 84fba5ec91f11c0efb27d0ed6098f7447491f0df upstream.
taskset on 2.6.34-rc3 fails on one of my ppc64 test boxes with the following error:
sched_getaffinity(0, 16, 0x10029650030) = -1 EINVAL (Invalid argument)
This box has 128 threads and 16 bytes is enough to cover it.
Commit cd3d8031eb4311e516329aee03c79a08333141f1 (sched:sched_getaffinity(): Allow less than NR_CPUS length) is comparing this 16 bytes agains nr_cpu_ids.
Fix it by comparing nr_cpu_ids to the number of bits in the cpumask we pass in.
LKML-Reference: <20100406070218.GM5594@kryten>
--- kernel/sched.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched.c +1 -1
@@ -6717,7 +6717,7 @@ SYSCALL_DEFINE3(sched_getaffinity, pid_tint ret;cpumask_var_t mask; -if (len < nr_cpu_ids) +if ((len *BITS_PER_BYTE ) < nr_cpu_ids)return -EINVAL ;if (len & (sizeof (unsigned long )-1 ))return -EINVAL ;
PATCH 58/139 NFSv4: Fall back to ordinary lookup if nfs4_atomic_open() returns EISDIR
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Trond Myklebust <[email protected]>
commit 80e60639f1b7c121a7fea53920c5a4b94009361a upstream.
--- fs/nfs/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/dir.c +1 -1
@@ -1025,12 +1025,12 @@ static struct dentry *nfs_atomic_lookup( res =NULL ; goto out;/* This turned out not to be a regular file */ +case -EISDIR :case -ENOTDIR : goto no_open;case -ELOOP :if (!(nd->intent.open.flags &O_NOFOLLOW )) goto no_open; -/* case -EISDIR: */ /* case -EINVAL: */ default : goto out;
PATCH 59/139 NFSv4: fix delegated locking
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Trond Myklebust <[email protected]>
commit 0df5dd4aae211edeeeb84f7f84f6d093406d7c22 upstream.
Arnaud Giersch reports that NFSv4 locking is broken when we hold a delegation since commit 8e469ebd6dc32cbaf620e134d79f740bf0ebab79 (NFSv4:
Don't allow posix locking against servers that don't support it).
According to Arnaud, the lock succeeds the first time he opens the file (since we cannot do a delegated open) but then fails after we start using delegated opens.
The following patch fixes it by ensuring that locking behaviour is governed by a per-filesystem capability flag that is initially set, but gets cleared if the server ever returns an OPEN without the NFS4_OPEN_RESULT_LOCKTYPE_POSIX flag being set.
--- fs/nfs/client.c | 3 ++- fs/nfs/nfs4proc.c | 4 +++- include/linux/nfs_fs_sb.h | 1 + 3 files changed, 6 insertions(+), 2 deletions(-)
fs/nfs/client.c +2 -1
@@ -1293,7 +1293,8 @@ static int nfs4_init_server(struct nfs_s/* Initialise the client representation from the mount data */ server->flags = data->flags; - server->caps |=NFS_CAP_ATOMIC_OPEN |NFS_CAP_CHANGE_ATTR ; + server->caps |=NFS_CAP_ATOMIC_OPEN |NFS_CAP_CHANGE_ATTR | +NFS_CAP_POSIX_LOCK ; server->options = data->options;/* Get a client record */
fs/nfs/nfs4proc.c +3 -1
@@ -1520,6 +1520,8 @@ static int _nfs4_proc_open(struct nfs4_onfs_post_op_update_inode (dir, o_res->dir_attr); }else nfs_refresh_inode (dir, o_res->dir_attr); +if ((o_res->rflags &NFS4_OPEN_RESULT_LOCKTYPE_POSIX ) ==0 ) + server->caps &= ~NFS_CAP_POSIX_LOCK ;if (o_res->rflags &NFS4_OPEN_RESULT_CONFIRM ) { status =_nfs4_proc_open_confirm (data);if (status !=0 )
@@ -1660,7 +1662,7 @@ static int _nfs4_do_open(struct inode *d status =PTR_ERR (state);if (IS_ERR (state)) goto err_opendata_put; -if ((opendata->o_res.rflags &NFS4_OPEN_RESULT_LOCKTYPE_POSIX ) !=0 ) +if (server->caps &NFS_CAP_POSIX_LOCK )set_bit (NFS_STATE_POSIX_LOCKS , &state->flags);nfs4_opendata_put (opendata);nfs4_put_state_owner (sp);
include/linux/nfs_fs_sb.h +1 -0
@@ -176,6 +176,7 @@ struct nfs_server {#define NFS_CAP_ATIME (1U << 11)#define NFS_CAP_CTIME (1U << 12)#define NFS_CAP_MTIME (1U << 13) +#define NFS_CAP_POSIX_LOCK (1U << 14)/* maximum number of slots to use */
PATCH 60/139 Input: wacom - switch mode upon system resume
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Ping Cheng <[email protected]>
commit 014f61504af276ba9d9544d8a7401d8f8526eb73 upstream.
When Wacom devices wake up from a sleep, the switch mode command (wacom_query_tablet_data) is needed before wacom_open is called. wacom_query_tablet_data should not be executed inside wacom_open since wacom_open is called more than once during probe.
wacom_retrieve_hid_descriptor is removed from wacom_resume due to the fact that the required descriptors are stored properly upon system resume.
--- drivers/input/tablet/wacom_sys.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/input/tablet/wacom_sys.c +7 -5
@@ -644,13 +644,15 @@ static int wacom_resume(struct usb_interint rv;mutex_lock (&wacom->lock); -if (wacom->open) { + +/* switch to wacom mode first */ +wacom_query_tablet_data (intf, features); + +if (wacom->open) rv =usb_submit_urb (wacom->irq,GFP_NOIO ); -/* switch to wacom mode if needed */ -if (!wacom_retrieve_hid_descriptor (intf, features)) -wacom_query_tablet_data (intf, features); - }else +else rv =0 ; +mutex_unlock (&wacom->lock);return rv;
PATCH 61/139 Input: sparse-keymap - free the right keymap on error
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Yong Wang <[email protected]>
commit 88fcf710c13bd41f2b98c5411e4f21ab98da4fb4 upstream.
'map' is allocated in sparse_keymap_setup() and it it the one that should be freed on error instead of 'keymap'.
--- drivers/input/sparse-keymap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/sparse-keymap.c +1 -1
@@ -161,7 +161,7 @@ int sparse_keymap_setup(struct input_devreturn 0 ; err_out: -kfree (keymap); +kfree (map);return error; }
PATCH 62/139 ALSA: hda - add a quirk for Clevo M570U laptop
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Joerg Schirottke <[email protected]>
commit d1501ea844eefdf925f6b711875b4b2b928fddf8 upstream.
Added the matching model for Clevo laptop M570U.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -9074,6 +9074,7 @@ static struct snd_pci_quirk alc882_cfg_tSND_PCI_QUIRK (0x1462 ,0xaa08 ,"MSI" , ALC883_TARGA_2ch_DIG),SND_PCI_QUIRK (0x147b ,0x1083 ,"Abit IP35-PRO" ,ALC883_6ST_DIG ), +SND_PCI_QUIRK (0x1558 ,0x0571 ,"Clevo laptop M570U" , ALC883_3ST_6ch_DIG),SND_PCI_QUIRK (0x1558 ,0x0721 ,"Clevo laptop M720R" ,ALC883_CLEVO_M720 ),SND_PCI_QUIRK (0x1558 ,0x0722 ,"Clevo laptop M720SR" ,ALC883_CLEVO_M720 ), SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
PATCH 63/139 ALSA: usb - Fix Oops after usb-midi disconnection
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Takashi Iwai <[email protected]>
commit 29aac005ff4dc8a5f50b80f4e5c4f59b21c0fb50 upstream.
usb-midi causes sometimes Oops at snd_usbmidi_output_drain() after disconnection. This is due to the access to the endpoints which have been already released at disconnection while the files are still alive.
This patch fixes the problem by checking disconnection state at snd_usbmidi_output_drain() and by releasing urbs but keeping the endpoint instances until really all freed.
--- sound/usb/usbmidi.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-)
sound/usb/usbmidi.c +18 -6
@@ -984,6 +984,8 @@ static void snd_usbmidi_output_drain(strDEFINE_WAIT (wait);long timeout =msecs_to_jiffies (50 ); +if (ep->umidi->disconnected) +return ;/* * The substream buffer is empty, but some data might still be in the * currently active URBs, so we have to wait for those to complete.
@@ -1121,14 +1123,21 @@ static int snd_usbmidi_in_endpoint_creat* Frees an output endpoint. * May be called when ep hasn't been initialized completely. */ -static void snd_usbmidi_out_endpoint_delete (struct snd_usb_midi_out_endpoint * ep) +static void snd_usbmidi_out_endpoint_clear (struct snd_usb_midi_out_endpoint *ep) {unsigned int i;for (i =0 ; i <OUTPUT_URBS ; ++i) -if (ep->urbs[i].urb) +if (ep->urbs[i].urb) {free_urb_and_buffer (ep->umidi, ep->urbs[i].urb, ep->max_transfer); + ep->urbs[i].urb =NULL ; + } +} + +static void snd_usbmidi_out_endpoint_delete (struct snd_usb_midi_out_endpoint *ep) +{ +snd_usbmidi_out_endpoint_clear (ep);kfree (ep); }
@@ -1260,15 +1269,18 @@ void snd_usbmidi_disconnect(struct list_usb_kill_urb (ep->out->urbs[j].urb);if (umidi->usb_protocol_ops->finish_out_endpoint) umidi->usb_protocol_ops->finish_out_endpoint (ep->out); + ep->out->active_urbs =0 ; +if (ep->out->drain_urbs) { + ep->out->drain_urbs =0 ; +wake_up (&ep->out->drain_wait); + } }if (ep->in)for (j =0 ; j <INPUT_URBS ; ++j)usb_kill_urb (ep->in->urbs[j]);/* free endpoints here; later call can result in Oops */ -if (ep->out) { -snd_usbmidi_out_endpoint_delete (ep->out); - ep->out =NULL ; - } +if (ep->out) +snd_usbmidi_out_endpoint_clear (ep->out);if (ep->in) {snd_usbmidi_in_endpoint_delete (ep->in); ep->in =NULL ;
PATCH 64/139 hwmon: (sht15) Fix sht15_calc_temp interpolation function
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jerome Oufella <[email protected]>
commit 328a2c22abd08911e37fa66f1358f829cecd72e9 upstream.
I discovered two issues.
First the previous sht15_calc_temp() loop did not iterate through the temppoints array since the (data->supply_uV > temppoints[i - 1].vdd) test is always true in this direction.
Also the two-points linear interpolation function was returning biased values due to a stray division by 1000 which shouldn't be there.
[JD: Also change the default value for d1 from 0 to something saner.]
--- drivers/hwmon/sht15.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/hwmon/sht15.c +3 -3
@@ -302,13 +302,13 @@ error_ret:**/ static inline int sht15_calc_temp (struct sht15_data *data) { -int d1 =0 ; +int d1 = temppoints[0 ].d1;int i; -for (i =1 ; i <ARRAY_SIZE (temppoints); i++) +for (i =ARRAY_SIZE (temppoints) -1 ; i >0 ; i--)/* Find pointer to interpolate */ if (data->supply_uV > temppoints[i -1 ].vdd) { - d1 = (data->supply_uV/1000 - temppoints[i -1 ].vdd) + d1 = (data->supply_uV - temppoints[i -1 ].vdd) * (temppoints[i].d1 - temppoints[i -1 ].d1) / (temppoints[i].vdd - temppoints[i -1 ].vdd) + temppoints[i -1 ].d1;
PATCH 65/139 hwmon: (sht15) Properly handle the case CONFIG_REGULATOR=n
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jean Delvare <[email protected]>
commit c7a78d2c2e2537fd24903e966f34aae50319d587 upstream.
When CONFIG_REGULATOR isn't set, regulator_get_voltage() returns 0. Properly handle this case by not trusting the value.
--- drivers/hwmon/sht15.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/hwmon/sht15.c +6 -1
@@ -541,7 +541,12 @@ static int __devinit sht15_probe(struct/* If a regulator is available, query what the supply voltage actually is!*/ data->reg =regulator_get (data->dev,"vcc" );if (!IS_ERR (data->reg)) { - data->supply_uV =regulator_get_voltage (data->reg); +int voltage; + + voltage =regulator_get_voltage (data->reg); +if (voltage) + data->supply_uV = voltage; +regulator_enable (data->reg);/* setup a notifier block to update this if another device * causes the voltage to change */
PATCH 66/139 drm/i915: Add no_lvds entry for the Clientron U800
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Stefan Bader <[email protected]>
commit 9875557ee8247c3f7390d378c027b45c7535a224 upstream.
This system claims to have a LVDS but has not.
--- drivers/gpu/drm/i915/intel_lvds.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/i915/intel_lvds.c +8 -0
@@ -899,6 +899,14 @@ static const struct dmi_system_id intel_ DMI_MATCH(DMI_PRODUCT_VERSION, "AO00001JW"), }, }, + { + .callback = intel_no_lvds_dmi_callback, + .ident = "Clientron U800", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Clientron"), + DMI_MATCH(DMI_PRODUCT_NAME, "U800"), + }, + }, { }/* terminating entry */ };
PATCH 67/139 drm/radeon/kms: more atom parser fixes (v2)
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alex Deucher <[email protected]>
commit 65384a1d41c4e91f0b49d90d11b7f424d6e5c58e upstream.
shr/shl ops need the full dst rather than the pre-masked version. Fixes fdo bug 27478 and kernel bug 15738.
v2: remove some unsed vars, add comments
--- drivers/gpu/drm/radeon/atom.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/gpu/drm/radeon/atom.c +10 -0
@@ -881,11 +881,16 @@ static void atom_op_shl(atom_exec_contexuint8_t attr =U8 ((*ptr)++), shift;uint32_t saved, dst;int dptr = *ptr; +uint32_t dst_align = atom_dst_to_src[(attr >>3 ) &7 ][(attr >>6 ) &3 ];SDEBUG (" dst: " ); dst =atom_get_dst (ctx, arg, attr, ptr, &saved,1 ); +/* op needs to full dst value */ + dst = saved; shift =atom_get_src (ctx, attr, ptr);SDEBUG (" shift: %d\n" , shift); dst <<= shift; + dst &= atom_arg_mask[dst_align]; + dst >>= atom_arg_shift[dst_align];SDEBUG (" dst: " );atom_put_dst (ctx, arg, attr, &dptr, dst, saved); }
@@ -895,11 +900,16 @@ static void atom_op_shr(atom_exec_contexuint8_t attr =U8 ((*ptr)++), shift;uint32_t saved, dst;int dptr = *ptr; +uint32_t dst_align = atom_dst_to_src[(attr >>3 ) &7 ][(attr >>6 ) &3 ];SDEBUG (" dst: " ); dst =atom_get_dst (ctx, arg, attr, ptr, &saved,1 ); +/* op needs to full dst value */ + dst = saved; shift =atom_get_src (ctx, attr, ptr);SDEBUG (" shift: %d\n" , shift); dst >>= shift; + dst &= atom_arg_mask[dst_align]; + dst >>= atom_arg_shift[dst_align];SDEBUG (" dst: " );atom_put_dst (ctx, arg, attr, &dptr, dst, saved); }
PATCH 68/139 drm/radeon/kms: disable the tv encoder when tv/cv is not in use
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alex Deucher <[email protected]>
commit d3a67a43b0460bae3e2ac14092497833344ac10d upstream.
Switching between TV and VGA caused VGA to break on some systems since the TV encoder was left enabled when VGA was used.
fixes fdo bug 25520.
--- drivers/gpu/drm/radeon/radeon_encoders.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon_encoders.c +6 -2
@@ -1276,8 +1276,12 @@ radeon_atom_encoder_mode_set(struct drm_case ENCODER_OBJECT_ID_INTERNAL_DAC2 :case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2 :atombios_dac_setup (encoder,ATOM_ENABLE ); -if (radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT |ATOM_DEVICE_CV_SUPPORT )) -atombios_tv_setup (encoder,ATOM_ENABLE ); +if (radeon_encoder->devices & (ATOM_DEVICE_TV_SUPPORT |ATOM_DEVICE_CV_SUPPORT )) { +if (radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT |ATOM_DEVICE_CV_SUPPORT )) +atombios_tv_setup (encoder,ATOM_ENABLE ); +else +atombios_tv_setup (encoder,ATOM_DISABLE ); + }break ; }atombios_apply_encoder_quirks (encoder, adjusted_mode);
PATCH 69/139 drm/radeon/kms: fix tv dac conflict resolver
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alex Deucher <[email protected]>
commit 08d075116db3592db218bfe0f554cd93c9e12505 upstream.
On systems with the tv dac shared between DVI and TV, we can only use the dac for one of the connectors. However, when using a digital monitor on the DVI port, you can use the dac for the TV connector just fine. Check the use_digital status when resolving the conflict.
Fixes fdo bug 27649, possibly others.
--- drivers/gpu/drm/radeon/radeon_connectors.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/radeon/radeon_connectors.c +5 -0
@@ -162,12 +162,14 @@ radeon_connector_analog_encoder_conflict {struct drm_device *dev = connector->dev;struct drm_connector *conflict; +struct radeon_connector *radeon_conflict;int i;list_for_each_entry (conflict, &dev->mode_config.connector_list, head) {if (conflict == connector)continue ; + radeon_conflict =to_radeon_connector (conflict);for (i =0 ; i <DRM_CONNECTOR_MAX_ENCODER ; i++) {if (conflict->encoder_ids[i] ==0 )break ;
@@ -177,6 +179,9 @@ radeon_connector_analog_encoder_conflictif (conflict->status != connector_status_connected)continue ; +if (radeon_conflict->use_digital) +continue ; +if (priority == true) {DRM_INFO ("1: conflicting encoders switching off %s\n" ,drm_get_connector_name (conflict));DRM_INFO ("in favor of %s\n" ,drm_get_connector_name (connector));
PATCH 70/139 drm/radeon/kms: fix rs600 tlb flush
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jerome Glisse <[email protected]>
commit 30f69f3fb20bd719b5e1bf879339914063d38f47 upstream.
Typo in in flush leaded to no flush of the RS600 tlb which ultimately leaded to massive system ram corruption, with this patch everythings seems to work properly.
--- drivers/gpu/drm/radeon/rs600.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/rs600.c +1 -1
@@ -175,7 +175,7 @@ void rs600_gart_tlb_flush(struct radeon_WREG32_MC (R_000100_MC_PT0_CNTL , tmp); tmp =RREG32_MC (R_000100_MC_PT0_CNTL ); - tmp |=S_000100_INVALIDATE_ALL_L1_TLBS (1 ) &S_000100_INVALIDATE_L2_CACHE (1 ); + tmp |=S_000100_INVALIDATE_ALL_L1_TLBS (1 ) |S_000100_INVALIDATE_L2_CACHE (1 );WREG32_MC (R_000100_MC_PT0_CNTL , tmp); tmp =RREG32_MC (R_000100_MC_PT0_CNTL );
PATCH 71/139 drm/radeon/kms: add FireMV 2400 PCI ID.
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Dave Airlie <[email protected]>
commit 79b9517a33a283c5d9db875c263670ed1e055f7e upstream.
This is an M24/X600 chip.
Quoted 1 line
From RH# 581927
--- include/drm/drm_pciids.h | 1 + 1 file changed, 1 insertion(+)
include/drm/drm_pciids.h +1 -0
@@ -6,6 +6,7 @@ {0x1002, 0x3150, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \ {0x1002, 0x3152, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ {0x1002, 0x3154, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ + {0x1002, 0x3155, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ {0x1002, 0x3E50, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \ {0x1002, 0x3E54, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \ {0x1002, 0x4136, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS100|RADEON_IS_IGP}, \
PATCH 72/139 x86/amd-iommu: Pt mode fix for domain_destroy
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Chris Wright <[email protected]>
commit 04e856c072b84042bb56c487c2868638bb3f78db upstream.
After a guest is shutdown, assigned devices are not properly returned to the pt domain. This can leave the device using stale cached IOMMU data, and result in a non-functional device after it's re-bound to the host driver. For example, I see this upon rebinding:
AMD-Vi: Event logged [IO_PAGE_FAULT device=02:00.0 domain=0x0000 address=0x000000007e2a8000 flags=0x0050]
AMD-Vi: Event logged [IO_PAGE_FAULT device=02:00.0 domain=0x0000 address=0x000000007e2a8040 flags=0x0050]
AMD-Vi: Event logged [IO_PAGE_FAULT device=02:00.0 domain=0x0000 address=0x000000007e2a8080 flags=0x0050]
AMD-Vi: Event logged [IO_PAGE_FAULT device=02:00.0 domain=0x0000 address=0x000000007e2a80c0 flags=0x0050] 0000:02:00.0: eth2: Detected Hardware Unit Hang:
...
The amd_iommu_destroy_domain() function calls do_detach() which doesn't reattach the pt domain to the device. Use __detach_device() instead.
--- arch/x86/kernel/amd_iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/amd_iommu.c +1 -1
@@ -2298,7 +2298,7 @@ static void cleanup_domain(struct proteclist_for_each_entry_safe (dev_data, next, &domain->dev_list, list) {struct device *dev = dev_data->dev; -do_detach (dev); +__detach_device (dev);atomic_set (&dev_data->bind,0 ); }
PATCH 73/139 x86/amd-iommu: Use helper function to destroy domain
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Joerg Roedel <[email protected]>
commit 8b408fe4f853dcfa18d133aa4cf1d7546b4c3870 upstream.
In the amd_iommu_domain_destroy the protection_domain_free function is partly reimplemented. The 'partly' is the bug here because the domain is not deleted from the domain list. This results in use-after-free errors and data-corruption. Fix it by just using protection_domain_free instead.
--- arch/x86/kernel/amd_iommu.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
arch/x86/kernel/amd_iommu.c +1 -3
@@ -2379,9 +2379,7 @@ static void amd_iommu_domain_destroy(strfree_pagetable (domain); -domain_id_free (domain->id); - -kfree (domain); +protection_domain_free (domain); dom->priv =NULL ; }
PATCH 74/139 x86/amd-iommu: enable iommu before attaching devices
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Chris Wright <[email protected]>
commit 75f66533bc883f761a7adcab3281fe3323efbc90 upstream.
Hit another kdump problem as reported by Neil Horman. When initializaing the IOMMU, we attach devices to their domains before the IOMMU is fully (re)initialized. Attaching a device will issue some important invalidations. In the context of the newly kexec'd kdump kernel, the IOMMU may have stale cached data from the original kernel. Because we do the attach too early, the invalidation commands are placed in the new command buffer before the IOMMU is updated w/ that buffer. This leaves the stale entries in the kdump context and can renders device unusable. Simply enable the IOMMU before we do the attach.
--- arch/x86/kernel/amd_iommu_init.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/x86/kernel/amd_iommu_init.c +3 -2
@@ -1288,6 +1288,8 @@ static int __init amd_iommu_init(void)if (ret) goto free; +enable_iommus (); +if (iommu_pass_through) ret =amd_iommu_init_passthrough ();else
@@ -1300,8 +1302,6 @@ static int __init amd_iommu_init(void)amd_iommu_init_notifier (); -enable_iommus (); -if (iommu_pass_through) goto out;
@@ -1315,6 +1315,7 @@ out:return ret; free: +disable_iommus ();amd_iommu_uninit_devices ();
PATCH 75/139 Revert "x86: disable IOMMUs on kernel crash"
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Chris Wright <[email protected]>
commit 8f9f55e83e939724490d7cde3833c4883c6d1310 upstream.
This effectively reverts commit 61d047be99757fd9b0af900d7abce9a13a337488.
Disabling the IOMMU can potetially allow DMA transactions to complete without being translated. Leave it enabled, and allow crash kernel to do the IOMMU reinitialization properly.
--- arch/x86/kernel/crash.c | 6 ------ 1 file changed, 6 deletions(-)
arch/x86/kernel/crash.c +0 -6
@@ -27,7 +27,6 @@#include <asm/cpu.h> #include <asm/reboot.h> #include <asm/virtext.h> -#include <asm/x86_init.h> #if defined(CONFIG_SMP ) && defined(CONFIG_X86_LOCAL_APIC )
@@ -103,10 +102,5 @@ void native_machine_crash_shutdown(struc#ifdef CONFIG_HPET_TIMER hpet_disable ();#endif - -#ifdef CONFIG_X86_64 - x86_platform.iommu_shutdown (); -#endif -crash_save_cpu (regs,safe_smp_processor_id ()); }
PATCH 76/139 x86, lib: Add wbinvd smp helpers
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Borislav Petkov <[email protected]>
commit a7b480e7f30b3813353ec009f10f2ac7a6669f3b upstream.
Add wbinvd_on_cpu and wbinvd_on_all_cpus stubs for executing wbinvd on a particular CPU.
[ hpa: renamed lib/smp.c to lib/cache-smp.c ]
[ hpa: wbinvd_on_all_cpus() returns int, but wbinvd() returns
void. Thus, the former cannot be a macro for the latter, replace with an inline function. ]
LKML-Reference: <[email protected]>
--- arch/x86/include/asm/smp.h | 9 +++++++++ arch/x86/lib/Makefile | 2 +- arch/x86/lib/cache-smp.c | 19 +++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-)
arch/x86/include/asm/smp.h +9 -0
@@ -135,6 +135,8 @@ int native_cpu_disable(void);void native_cpu_die (unsigned int cpu);void native_play_dead (void );void play_dead_common (void ); +void wbinvd_on_cpu (int cpu); +int wbinvd_on_all_cpus (void );void native_send_call_func_ipi (const struct cpumask *mask);void native_send_call_func_single_ipi (int cpu);
@@ -147,6 +149,13 @@ static inline int num_booting_cpus(void) {return cpumask_weight (cpu_callout_mask); } +#else /* !CONFIG_SMP */ +#define wbinvd_on_cpu (cpu) wbinvd() +static inline int wbinvd_on_all_cpus (void ) +{ +wbinvd (); +return 0 ; +}#endif /* CONFIG_SMP */ extern unsigned disabled_cpus__cpuinitdata ;
arch/x86/lib/Makefile +1 -1
@@ -14,7 +14,7 @@ $(obj)/inat.o: $(obj)/inat-tables.c clean-files := inat-tables.c -obj-$(CONFIG_SMP) += msr-smp.o +obj-$(CONFIG_SMP) += msr-smp.o cache-smp.o lib-y := delay.o lib-y += thunk_$(BITS).o
arch/x86/lib/cache-smp.c new file +19 -0
@@ -0,0 +1,19 @@ +#include <linux/smp.h> +#include <linux/module.h> + +static void __wbinvd (void *dummy) +{ +wbinvd (); +} + +void wbinvd_on_cpu (int cpu) +{ +smp_call_function_single (cpu, __wbinvd,NULL ,1 ); +} +EXPORT_SYMBOL (wbinvd_on_cpu); + +int wbinvd_on_all_cpus (void ) +{ +return on_each_cpu (__wbinvd,NULL ,1 ); +} +EXPORT_SYMBOL (wbinvd_on_all_cpus);
PATCH 77/139 x86, cacheinfo: Fix disabling of L3 cache indices
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Borislav Petkov <[email protected]>
commit dcf39daf3d6d97f8741e82f0b9fb7554704ed2d1 upstream.
* Correct the masks used for writing the cache index disable indices.
* Do not turn off L3 scrubber - it is not necessary.
* Make sure wbinvd is executed on the same node where the L3 is.
* Check for out-of-bounds values written to the registers.
* Make show_cache_disable hex values unambiguous
* Check for Erratum #388
LKML-Reference: <[email protected]>
--- arch/x86/kernel/cpu/intel_cacheinfo.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-)
arch/x86/kernel/cpu/intel_cacheinfo.c +21 -13
@@ -18,6 +18,7 @@#include <asm/processor.h> #include <linux/smp.h> #include <asm/k8.h> +#include <asm/smp.h> #define LVL_1_INST 1#define LVL_1_DATA 2
@@ -299,8 +300,10 @@ amd_check_l3_disable(int index, struct _if (boot_cpu_data.x86 ==0x11 )return ; -/* see erratum #382 */ -if ((boot_cpu_data.x86 ==0x10 ) && (boot_cpu_data.x86_model <0x8 )) +/* see errata #382 and #388 */ +if ((boot_cpu_data.x86 ==0x10 ) && + ((boot_cpu_data.x86_model <0x9 ) || + (boot_cpu_data.x86_mask <0x1 )))return ; this_leaf->can_disable =1 ;
@@ -726,12 +729,12 @@ static ssize_t show_cache_disable(structreturn -EINVAL ;pci_read_config_dword (dev,0x1BC + index *4 , ®); -return sprintf (buf,"%x\n" , reg); +return sprintf (buf,"0x%08x\n" , reg); }#define SHOW_CACHE_DISABLE (index) \ static ssize_t \ -show_cache_disable_##index(struct _cpuid4_info *this_leaf, char *buf) \ +show_cache_disable_##index(struct _cpuid4_info *this_leaf, char *buf) \ { \ return show_cache_disable(this_leaf, buf, index); \ }
@@ -745,7 +748,9 @@ static ssize_t store_cache_disable(strucint node =cpu_to_node (cpu);struct pci_dev *dev =node_to_k8_nb_misc (node);unsigned long val =0 ; -unsigned int scrubber =0 ; + +#define SUBCACHE_MASK (3UL << 20) +#define SUBCACHE_INDEX 0xfffif (!this_leaf->can_disable)return -EINVAL ;
@@ -759,21 +764,24 @@ static ssize_t store_cache_disable(strucif (strict_strtoul (buf,10 , &val) <0 )return -EINVAL ; - val |=0xc0000000 ; - -pci_read_config_dword (dev,0x58 , &scrubber); - scrubber &= ~0x1f000000 ; -pci_write_config_dword (dev,0x58 , scrubber); +/* do not allow writes outside of allowed bits */ +if (val & ~(SUBCACHE_MASK |SUBCACHE_INDEX )) +return -EINVAL ; -pci_write_config_dword (dev,0x1BC + index *4 , val & ~0x40000000 ); -wbinvd (); + val |=BIT (30 );pci_write_config_dword (dev,0x1BC + index *4 , val); +/* +* We need to WBINVD on a core on the node containing the L3 cache which +* indices we disable therefore a simple wbinvd() is not sufficient. +*/ +wbinvd_on_cpu (cpu); +pci_write_config_dword (dev,0x1BC + index *4 , val |BIT (31 ));return count; }#define STORE_CACHE_DISABLE (index) \ static ssize_t \ -store_cache_disable_##index(struct _cpuid4_info *this_leaf, \ +store_cache_disable_##index(struct _cpuid4_info *this_leaf, \ const char *buf, size_t count) \ { \ return store_cache_disable(this_leaf, buf, count, index); \
PATCH 78/139 intel-agp: Switch to wbinvd_on_all_cpus
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Borislav Petkov <[email protected]>
commit 48a719c238bcbb72d6da79de9c5b3b93ab472107 upstream.
Simplify if-statement while at it.
[ hpa: we need to #include <asm/smp.h> ]
LKML-Reference: <[email protected]>
--- drivers/char/agp/intel-agp.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)
drivers/char/agp/intel-agp.c +4 -11
@@ -8,6 +8,7 @@#include <linux/kernel.h> #include <linux/pagemap.h> #include <linux/agp_backend.h> +#include <asm/smp.h> #include "agp.h" /*
@@ -815,12 +816,6 @@ static void intel_i830_setup_flush(void)intel_i830_fini_flush (); } -static void -do_wbinvd (void *null) -{ -wbinvd (); -} -/* The chipset_flush interface needs to get data that has already been * flushed out of the CPU all the way out to main memory, because the GPU * doesn't snoop those buffers.
@@ -837,12 +832,10 @@ static void intel_i830_chipset_flush(strmemset (pg,0 ,1024 ); -if (cpu_has_clflush) { +if (cpu_has_clflush)clflush_cache_range (pg,1024 ); - }else { -if (on_each_cpu (do_wbinvd,NULL ,1 ) !=0 ) -printk (KERN_ERR "Timed out waiting for cache flush.\n" ); - } +else if (wbinvd_on_all_cpus () !=0 ) +printk (KERN_ERR "Timed out waiting for cache flush.\n" ); }/* The intel i830 automatically initializes the agp aperture during POST.
PATCH 79/139 x86, cacheinfo: Add cache index disable sysfs attrs only to L3 caches
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Borislav Petkov <[email protected]>
commit 897de50e08937663912c86fb12ad7f708af2386c upstream.
The cache_disable_[01] attribute in
/sys/devices/system/cpu/cpu?/cache/index[0-3]/
is enabled on all cache levels although only L3 supports it. Add it only to the cache level that actually supports it.
LKML-Reference: <[email protected]>
--- arch/x86/kernel/cpu/intel_cacheinfo.c | 35 +++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-)
arch/x86/kernel/cpu/intel_cacheinfo.c +26 -9
@@ -814,16 +814,24 @@ static struct _cache_attr cache_disable_static struct _cache_attr cache_disable_1 =__ATTR (cache_disable_1,0644 , show_cache_disable_1, store_cache_disable_1); +#define DEFAULT_SYSFS_CACHE_ATTRS \ + &type.attr, \ + &level.attr, \ + &coherency_line_size.attr, \ + &physical_line_partition.attr, \ + &ways_of_associativity.attr, \ + &number_of_sets.attr, \ + &size.attr, \ + &shared_cpu_map.attr, \ + &shared_cpu_list.attr +static struct attribute *default_attrs[] = { - &type.attr, - &level.attr, - &coherency_line_size.attr, - &physical_line_partition.attr, - &ways_of_associativity.attr, - &number_of_sets.attr, - &size.attr, - &shared_cpu_map.attr, - &shared_cpu_list.attr, +DEFAULT_SYSFS_CACHE_ATTRS , +NULL +}; + +static struct attribute *default_l3_attrs[] = { +DEFAULT_SYSFS_CACHE_ATTRS , &cache_disable_0.attr, &cache_disable_1.attr,NULL
@@ -916,6 +924,7 @@ static int __cpuinit cache_add_dev(strucunsigned int cpu = sys_dev->id;unsigned long i, j;struct _index_kobject *this_object; +struct _cpuid4_info *this_leaf;int retval; retval =cpuid4_cache_sysfs_init (cpu);
@@ -934,6 +943,14 @@ static int __cpuinit cache_add_dev(struc this_object =INDEX_KOBJECT_PTR (cpu, i); this_object->cpu = cpu; this_object->index = i; + + this_leaf =CPUID4_INFO_IDX (cpu, i); + +if (this_leaf->can_disable) + ktype_cache.default_attrs = default_l3_attrs; +else + ktype_cache.default_attrs = default_attrs; + retval = kobject_init_and_add(&(this_object->kobj), &ktype_cache, per_cpu(ici_cache_kobject, cpu),
PATCH 80/139 x86, cacheinfo: Calculate L3 indices
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Borislav Petkov <[email protected]>
commit 048a8774ca43488d78605031f11cc206d7a2682a upstream.
We need to know the valid L3 indices interval when disabling them over /sysfs. Do that when the core is brought online and add boundary checks to the sysfs .store attribute.
LKML-Reference: <[email protected]>
--- arch/x86/kernel/cpu/intel_cacheinfo.c | 35 ++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-)
arch/x86/kernel/cpu/intel_cacheinfo.c +31 -4
@@ -151,7 +151,8 @@ struct _cpuid4_info {union _cpuid4_leaf_ebx ebx;union _cpuid4_leaf_ecx ecx;unsigned long size; -unsigned long can_disable; +bool can_disable; +unsigned int l3_indices;DECLARE_BITMAP (shared_cpu_map,NR_CPUS ); };
@@ -161,7 +162,8 @@ struct _cpuid4_info_regs {union _cpuid4_leaf_ebx ebx;union _cpuid4_leaf_ecx ecx;unsigned long size; -unsigned long can_disable; +bool can_disable; +unsigned int l3_indices; };unsigned short num_cache_leaves;
@@ -291,6 +293,29 @@ amd_cpuid4(int leaf, union _cpuid4_leaf_ (ebx->split.ways_of_associativity +1 ) -1 ; } +static unsigned int __cpuinit amd_calc_l3_indices (void ) +{ +/* +* We're called over smp_call_function_single() and therefore +* are on the correct cpu. +*/ +int cpu =smp_processor_id (); +int node =cpu_to_node (cpu); +struct pci_dev *dev =node_to_k8_nb_misc (node); +unsigned int sc0, sc1, sc2, sc3; +u32 val; + +pci_read_config_dword (dev,0x1C4 , &val); + +/* calculate subcache sizes */ + sc0 = !(val &BIT (0 )); + sc1 = !(val &BIT (4 )); + sc2 = !(val &BIT (8 )) + !(val &BIT (9 )); + sc3 = !(val &BIT (12 )) + !(val &BIT (13 )); + +return (max (max (max (sc0, sc1), sc2), sc3) <<10 ) -1 ; +} +static void __cpuinit amd_check_l3_disable (int index,struct _cpuid4_info_regs *this_leaf) {
@@ -306,7 +331,8 @@ amd_check_l3_disable(int index, struct _ (boot_cpu_data.x86_mask < 0x1)))return ; - this_leaf->can_disable =1 ; + this_leaf->can_disable = true; + this_leaf->l3_indices =amd_calc_l3_indices (); } static int
@@ -765,7 +791,8 @@ static ssize_t store_cache_disable(strucreturn -EINVAL ;/* do not allow writes outside of allowed bits */ -if (val & ~(SUBCACHE_MASK |SUBCACHE_INDEX )) +if ((val & ~(SUBCACHE_MASK |SUBCACHE_INDEX )) || + ((val &SUBCACHE_INDEX ) > this_leaf->l3_indices))return -EINVAL ; val |=BIT (30 );
PATCH 81/139 x86, cacheinfo: Remove NUMA dependency, fix for AMD Fam10h rev D1
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Borislav Petkov <[email protected]>
commit f619b3d8427eb57f0134dab75b0d217325c72411 upstream.
The show/store_cache_disable routines depend unnecessarily on NUMA's cpu_to_node and the disabling of cache indices broke when !CONFIG_NUMA. Remove that dependency by using a helper which is always correct.
While at it, enable L3 Cache Index disable on rev D1 Istanbuls which sport the feature too.
LKML-Reference: <20100218184339.GG20473@aftab>
--- arch/x86/kernel/cpu/intel_cacheinfo.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/kernel/cpu/intel_cacheinfo.c +3 -3
@@ -327,7 +327,7 @@ amd_check_l3_disable(int index, struct _/* see errata #382 and #388 */ if ((boot_cpu_data.x86 ==0x10 ) && - ((boot_cpu_data.x86_model <0x9 ) || + ((boot_cpu_data.x86_model <0x8 ) || (boot_cpu_data.x86_mask <0x1 )))return ;
@@ -744,7 +744,7 @@ static ssize_t show_cache_disable(struct unsigned int index) {int cpu =cpumask_first (to_cpumask (this_leaf->shared_cpu_map)); -int node =cpu_to_node (cpu); +int node =amd_get_nb_id (cpu);struct pci_dev *dev =node_to_k8_nb_misc (node);unsigned int reg =0 ;
@@ -771,7 +771,7 @@ static ssize_t store_cache_disable(struc const char *buf, size_t count, unsigned int index) { int cpu = cpumask_first(to_cpumask(this_leaf->shared_cpu_map)); -int node =cpu_to_node (cpu); +int node =amd_get_nb_id (cpu);struct pci_dev *dev =node_to_k8_nb_misc (node);unsigned long val =0 ;
PATCH 82/139 x86, cacheinfo: Enable L3 CID only on AMD
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Borislav Petkov <[email protected]>
commit cb19060abfdecac0d1eb2d2f0e7d6b7a3f8bc4f4 upstream.
Final stage linking can fail with
arch/x86/built-in.o: In function `store_cache_disable':
intel_cacheinfo.c:(.text+0xc509): undefined reference to amd_get_nb_id' arch/x86/built-in.o: In function show_cache_disable':
intel_cacheinfo.c:(.text+0xc7d3): undefined reference to `amd_get_nb_id'
when CONFIG_CPU_SUP_AMD is not enabled because the amd_get_nb_id helper is defined in AMD-specific code but also used in generic code (intel_cacheinfo.c). Reorganize the L3 cache index disable code under CONFIG_CPU_SUP_AMD since it is AMD-only anyway.
LKML-Reference: <20100218184210.GF20473@aftab>
--- arch/x86/kernel/cpu/intel_cacheinfo.c | 186 +++++++++++++++++----------------- 1 file changed, 98 insertions(+), 88 deletions(-)
arch/x86/kernel/cpu/intel_cacheinfo.c +98 -88
@@ -293,6 +293,13 @@ amd_cpuid4(int leaf, union _cpuid4_leaf_ (ebx->split.ways_of_associativity +1 ) -1 ; } +struct _cache_attr { +struct attribute attr; +ssize_t (*show)(struct _cpuid4_info *,char *); +ssize_t (*store)(struct _cpuid4_info *,const char *,size_t count); +}; + +#ifdef CONFIG_CPU_SUP_AMD static unsigned int __cpuinit amd_calc_l3_indices (void ) {/*
@@ -303,7 +310,7 @@ static unsigned int __cpuinit amd_calc_lint node =cpu_to_node (cpu);struct pci_dev *dev =node_to_k8_nb_misc (node);unsigned int sc0, sc1, sc2, sc3; -u32 val; +u32 val =0 ;pci_read_config_dword (dev,0x1C4 , &val);
@@ -335,6 +342,94 @@ amd_check_l3_disable(int index, struct _ this_leaf->l3_indices =amd_calc_l3_indices (); } +static ssize_t show_cache_disable (struct _cpuid4_info *this_leaf,char *buf, +unsigned int index) +{ +int cpu =cpumask_first (to_cpumask (this_leaf->shared_cpu_map)); +int node =amd_get_nb_id (cpu); +struct pci_dev *dev =node_to_k8_nb_misc (node); +unsigned int reg =0 ; + +if (!this_leaf->can_disable) +return -EINVAL ; + +if (!dev) +return -EINVAL ; + +pci_read_config_dword (dev,0x1BC + index *4 , ®); +return sprintf (buf,"0x%08x\n" , reg); +} + +#define SHOW_CACHE_DISABLE (index) \ +static ssize_t \ +show_cache_disable_##index(struct _cpuid4_info *this_leaf, char *buf) \ +{ \ + return show_cache_disable(this_leaf, buf, index); \ +} +SHOW_CACHE_DISABLE(0) +SHOW_CACHE_DISABLE(1) + +static ssize_t store_cache_disable (struct _cpuid4_info *this_leaf, +const char *buf,size_t count,unsigned int index) +{ +int cpu =cpumask_first (to_cpumask (this_leaf->shared_cpu_map)); +int node =amd_get_nb_id (cpu); +struct pci_dev *dev =node_to_k8_nb_misc (node); +unsigned long val =0 ; + +#define SUBCACHE_MASK (3UL << 20) +#define SUBCACHE_INDEX 0xfff + +if (!this_leaf->can_disable) +return -EINVAL ; + +if (!capable (CAP_SYS_ADMIN )) +return -EPERM ; + +if (!dev) +return -EINVAL ; + +if (strict_strtoul (buf,10 , &val) <0 ) +return -EINVAL ; + +/* do not allow writes outside of allowed bits */ +if ((val & ~(SUBCACHE_MASK |SUBCACHE_INDEX )) || + ((val &SUBCACHE_INDEX ) > this_leaf->l3_indices)) +return -EINVAL ; + + val |=BIT (30 ); +pci_write_config_dword (dev,0x1BC + index *4 , val); +/* +* We need to WBINVD on a core on the node containing the L3 cache which +* indices we disable therefore a simple wbinvd() is not sufficient. +*/ +wbinvd_on_cpu (cpu); +pci_write_config_dword (dev,0x1BC + index *4 , val |BIT (31 )); +return count; +} + +#define STORE_CACHE_DISABLE (index) \ +static ssize_t \ +store_cache_disable_##index(struct _cpuid4_info *this_leaf, \ + const char *buf, size_t count) \ +{ \ + return store_cache_disable(this_leaf, buf, count, index); \ +} +STORE_CACHE_DISABLE(0) +STORE_CACHE_DISABLE(1) + +static struct _cache_attr cache_disable_0 =__ATTR (cache_disable_0,0644 , + show_cache_disable_0, store_cache_disable_0); +static struct _cache_attr cache_disable_1 =__ATTR (cache_disable_1,0644 , + show_cache_disable_1, store_cache_disable_1); + +#else /* CONFIG_CPU_SUP_AMD */ +static void __cpuinit +amd_check_l3_disable (int index,struct _cpuid4_info_regs *this_leaf) +{ +}; +#endif /* CONFIG_CPU_SUP_AMD */ +static int __cpuinit cpuid4_cache_lookup_regs (int index,struct _cpuid4_info_regs *this_leaf)
@@ -740,88 +835,6 @@ static ssize_t show_type(struct _cpuid4_#define to_object (k) container_of(k, struct _index_kobject, kobj)#define to_attr (a) container_of(a, struct _cache_attr, attr) -static ssize_t show_cache_disable (struct _cpuid4_info *this_leaf,char *buf, -unsigned int index) -{ -int cpu =cpumask_first (to_cpumask (this_leaf->shared_cpu_map)); -int node =amd_get_nb_id (cpu); -struct pci_dev *dev =node_to_k8_nb_misc (node); -unsigned int reg =0 ; - -if (!this_leaf->can_disable) -return -EINVAL ; - -if (!dev) -return -EINVAL ; - -pci_read_config_dword (dev,0x1BC + index *4 , ®); -return sprintf (buf,"0x%08x\n" , reg); -} - -#define SHOW_CACHE_DISABLE (index) \ -static ssize_t \ -show_cache_disable_##index(struct _cpuid4_info *this_leaf, char *buf) \ -{ \ - return show_cache_disable(this_leaf, buf, index); \ -} -SHOW_CACHE_DISABLE(0) -SHOW_CACHE_DISABLE(1) - -static ssize_t store_cache_disable (struct _cpuid4_info *this_leaf, -const char *buf,size_t count,unsigned int index) -{ -int cpu =cpumask_first (to_cpumask (this_leaf->shared_cpu_map)); -int node =amd_get_nb_id (cpu); -struct pci_dev *dev =node_to_k8_nb_misc (node); -unsigned long val =0 ; - -#define SUBCACHE_MASK (3UL << 20) -#define SUBCACHE_INDEX 0xfff - -if (!this_leaf->can_disable) -return -EINVAL ; - -if (!capable (CAP_SYS_ADMIN )) -return -EPERM ; - -if (!dev) -return -EINVAL ; - -if (strict_strtoul (buf,10 , &val) <0 ) -return -EINVAL ; - -/* do not allow writes outside of allowed bits */ -if ((val & ~(SUBCACHE_MASK |SUBCACHE_INDEX )) || - ((val &SUBCACHE_INDEX ) > this_leaf->l3_indices)) -return -EINVAL ; - - val |=BIT (30 ); -pci_write_config_dword (dev,0x1BC + index *4 , val); -/* -* We need to WBINVD on a core on the node containing the L3 cache which -* indices we disable therefore a simple wbinvd() is not sufficient. -*/ -wbinvd_on_cpu (cpu); -pci_write_config_dword (dev,0x1BC + index *4 , val |BIT (31 )); -return count; -} - -#define STORE_CACHE_DISABLE (index) \ -static ssize_t \ -store_cache_disable_##index(struct _cpuid4_info *this_leaf, \ - const char *buf, size_t count) \ -{ \ - return store_cache_disable(this_leaf, buf, count, index); \ -} -STORE_CACHE_DISABLE(0) -STORE_CACHE_DISABLE(1) - -struct _cache_attr { -struct attribute attr; -ssize_t (*show)(struct _cpuid4_info *,char *); -ssize_t (*store)(struct _cpuid4_info *,const char *,size_t count); -}; -#define define_one_ro (_name) \ static struct _cache_attr _name = \ __ATTR(_name, 0444, show_##_name, NULL)
@@ -836,11 +849,6 @@ define_one_ro(size);define_one_ro (shared_cpu_map);define_one_ro (shared_cpu_list); -static struct _cache_attr cache_disable_0 =__ATTR (cache_disable_0,0644 , - show_cache_disable_0, store_cache_disable_0); -static struct _cache_attr cache_disable_1 =__ATTR (cache_disable_1,0644 , - show_cache_disable_1, store_cache_disable_1); -#define DEFAULT_SYSFS_CACHE_ATTRS \ &type.attr, \ &level.attr, \
@@ -859,8 +867,10 @@ static struct attribute *default_attrs[]static struct attribute *default_l3_attrs[] = {DEFAULT_SYSFS_CACHE_ATTRS , +#ifdef CONFIG_CPU_SUP_AMD &cache_disable_0.attr, &cache_disable_1.attr, +#endifNULL };
PATCH 83/139 dm ioctl: introduce flag indicating uevent was generated
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Peter Rajnoha <[email protected]>
commit 3abf85b5b5851b5f28d3d8a920ebb844edd08352 upstream.
Set a new DM_UEVENT_GENERATED_FLAG when returning from ioctls to indicate that a uevent was actually generated. This tells the userspace caller that it may need to wait for the event to be processed.
--- drivers/md/dm-ioctl.c | 19 ++++++++++++------- drivers/md/dm.c | 7 ++++--- drivers/md/dm.h | 4 ++-- include/linux/dm-ioctl.h | 9 +++++++-- 4 files changed, 25 insertions(+), 14 deletions(-)
drivers/md/dm-ioctl.c +12 -7
@@ -285,7 +285,8 @@ retry:up_write (&_hash_lock); } -static int dm_hash_rename (uint32_t cookie,const char *old,const char *new) +static int dm_hash_rename (uint32_t cookie,uint32_t *flags,const char *old, +const char *new) {char *new_name, *old_name;struct hash_cell *hc;
@@ -344,7 +345,8 @@ static int dm_hash_rename(uint32_t cookidm_table_put (table); } -dm_kobject_uevent (hc->md,KOBJ_CHANGE , cookie); +if (!dm_kobject_uevent (hc->md,KOBJ_CHANGE , cookie)) + *flags |=DM_UEVENT_GENERATED_FLAG ;dm_put (hc->md);up_write (&_hash_lock);
@@ -736,10 +738,10 @@ static int dev_remove(struct dm_ioctl *p__hash_remove (hc);up_write (&_hash_lock); -dm_kobject_uevent (md,KOBJ_REMOVE , param->event_nr); +if (!dm_kobject_uevent (md,KOBJ_REMOVE , param->event_nr)) + param->flags |=DM_UEVENT_GENERATED_FLAG ;dm_put (md); - param->data_size =0 ;return 0 ; }
@@ -773,7 +775,9 @@ static int dev_rename(struct dm_ioctl *preturn r; param->data_size =0 ; -return dm_hash_rename (param->event_nr, param->name, new_name); + +return dm_hash_rename (param->event_nr, ¶m->flags, param->name, + new_name); }static int dev_set_geometry (struct dm_ioctl *param,size_t param_size)
@@ -899,8 +903,8 @@ static int do_resume(struct dm_ioctl *paif (dm_suspended_md (md)) { r =dm_resume (md); -if (!r) -dm_kobject_uevent (md,KOBJ_CHANGE , param->event_nr); +if (!r && !dm_kobject_uevent (md,KOBJ_CHANGE , param->event_nr)) + param->flags |=DM_UEVENT_GENERATED_FLAG ; }if (old_map)
@@ -1477,6 +1481,7 @@ static int validate_params(uint cmd, str {/* Always clear this flag */ param->flags &= ~DM_BUFFER_FULL_FLAG ; + param->flags &= ~DM_UEVENT_GENERATED_FLAG ;/* Ignores parameters */ if (cmd == DM_REMOVE_ALL_CMD ||
drivers/md/dm.c +4 -3
@@ -2618,18 +2618,19 @@ out:/*----------------------------------------------------------------- * Event notification. *---------------------------------------------------------------*/ -void dm_kobject_uevent (struct mapped_device *md,enum kobject_action action, +int dm_kobject_uevent (struct mapped_device *md,enum kobject_action action,unsigned cookie) {char udev_cookie[DM_COOKIE_LENGTH ];char *envp[] = { udev_cookie,NULL };if (!cookie) -kobject_uevent (&disk_to_dev (md->disk)->kobj, action); +return kobject_uevent (&disk_to_dev (md->disk)->kobj, action);else {snprintf (udev_cookie,DM_COOKIE_LENGTH ,"%s=%u" ,DM_COOKIE_ENV_VAR_NAME , cookie); -kobject_uevent_env (&disk_to_dev (md->disk)->kobj, action, envp); +return kobject_uevent_env (&disk_to_dev (md->disk)->kobj, + action, envp); } }
drivers/md/dm.h +2 -2
@@ -125,8 +125,8 @@ void dm_stripe_exit(void);int dm_open_count (struct mapped_device *md);int dm_lock_for_deletion (struct mapped_device *md); -void dm_kobject_uevent (struct mapped_device *md,enum kobject_action action, -unsigned cookie); +int dm_kobject_uevent (struct mapped_device *md,enum kobject_action action, +unsigned cookie);int dm_io_init (void );void dm_io_exit (void );
include/linux/dm-ioctl.h +7 -2
@@ -266,9 +266,9 @@ enum {#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)#define DM_VERSION_MAJOR 4 -#define DM_VERSION_MINOR 16 +#define DM_VERSION_MINOR 17#define DM_VERSION_PATCHLEVEL 0 -#define DM_VERSION_EXTRA "-ioctl (2009-11-05)" +#define DM_VERSION_EXTRA "-ioctl (2010-03-05)"/* Status bits */ #define DM_READONLY_FLAG (1 << 0)/* In/Out */
@@ -316,4 +316,9 @@ enum {*/ #define DM_QUERY_INACTIVE_TABLE_FLAG (1 << 12)/* In */ +/* +* If set, a uevent was generated for which the caller may need to wait. +*/ +#define DM_UEVENT_GENERATED_FLAG (1 << 13)/* Out */ +#endif /* _LINUX_DM_IOCTL_H */
PATCH 84/139 x86-32: clean up rwsem inline asm statements
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Linus Torvalds <[email protected]>
commit 59c33fa7791e9948ba467c2b83e307a0d087ab49 upstream.
This makes gcc use the right register names and instruction operand sizes automatically for the rwsem inline asm statements.
So instead of using "(%%eax)" to specify the memory address that is the semaphore, we use "(%1)" or similar. And instead of forcing the operation to always be 32-bit, we use "%z0", taking the size from the actual semaphore data structure itself.
This doesn't actually matter on x86-32, but if we want to use the same inline asm for x86-64, we'll need to have the compiler generate the proper 64-bit names for the registers (%rax instead of %eax), and if we want to use a 64-bit counter too (in order to avoid the 15-bit limit on the write counter that limits concurrent users to 32767 threads), we'll need to be able to generate instructions with "q" accesses rather than "l".
Since this header currently isn't enabled on x86-64, none of that matters, but we do want to use the xadd version of the semaphores rather than have to take spinlocks to do a rwsem. The mm->mmap_sem can be heavily contended when you have lots of threads all taking page faults, and the fallback rwsem code that uses a spinlock performs abysmally badly in that case.
[ hpa: modified the patch to skip size suffixes entirely when they are
redundant due to register operands. ]
LKML-Reference: <[email protected]>
--- arch/x86/include/asm/rwsem.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)
arch/x86/include/asm/rwsem.h +15 -15
@@ -105,7 +105,7 @@ do { \static inline void __down_read (struct rw_semaphore *sem) { asmvolatile ("# beginning down_read\n\t" -LOCK_PREFIX " incl (%%eax)\n\t" +LOCK_PREFIX " inc%z0 (%1)\n\t" /* adds 0x00000001, returns the old value */ " jns 1f\n" " call call_rwsem_down_read_failed\n"
@@ -123,12 +123,12 @@ static inline int __down_read_trylock(st {__s32 result, tmp; asmvolatile ("# beginning __down_read_trylock\n\t" -" movl %0,%1\n\t" +" mov %0,%1\n\t" "1:\n\t" -" movl %1,%2\n\t" -" addl %3,%2\n\t" +" mov %1,%2\n\t" +" add %3,%2\n\t" " jle 2f\n\t" -LOCK_PREFIX " cmpxchgl %2,%0\n\t" +LOCK_PREFIX " cmpxchg %2,%0\n\t" " jnz 1b\n\t" "2:\n\t" "# ending __down_read_trylock\n\t"
@@ -147,9 +147,9 @@ static inline void __down_write_nested(s tmp =RWSEM_ACTIVE_WRITE_BIAS ; asmvolatile ("# beginning down_write\n\t" -LOCK_PREFIX " xadd %%edx,(%%eax)\n\t" +LOCK_PREFIX " xadd %1,(%2)\n\t" /* subtract 0x0000ffff, returns the old value */ -" testl %%edx,%%edx\n\t" +" test %1,%1\n\t" /* was the count 0 before? */ " jz 1f\n" " call call_rwsem_down_write_failed\n"
@@ -185,7 +185,7 @@ static inline void __up_read(struct rw_s {__s32 tmp = -RWSEM_ACTIVE_READ_BIAS ; asmvolatile ("# beginning __up_read\n\t" -LOCK_PREFIX " xadd %%edx,(%%eax)\n\t" +LOCK_PREFIX " xadd %1,(%2)\n\t" /* subtracts 1, returns the old value */ " jns 1f\n\t" " call call_rwsem_wake\n"
@@ -201,18 +201,18 @@ static inline void __up_read(struct rw_s*/ static inline void __up_write (struct rw_semaphore *sem) { +unsigned long tmp; asmvolatile ("# beginning __up_write\n\t" -" movl %2,%%edx\n\t" -LOCK_PREFIX " xaddl %%edx,(%%eax)\n\t" +LOCK_PREFIX " xadd %1,(%2)\n\t" /* tries to transition 0xffff0001 -> 0x00000000 */ " jz 1f\n" " call call_rwsem_wake\n" "1:\n\t" "# ending __up_write\n" - :"+m" (sem->count) - :"a" (sem),"i" (-RWSEM_ACTIVE_WRITE_BIAS ) - :"memory" ,"cc" ,"edx" ); + :"+m" (sem->count),"=d" (tmp) + :"a" (sem),"1" (-RWSEM_ACTIVE_WRITE_BIAS ) + :"memory" ,"cc" ); }/*
@@ -221,7 +221,7 @@ static inline void __up_write(struct rw_static inline void __downgrade_write (struct rw_semaphore *sem) { asmvolatile ("# beginning __downgrade_write\n\t" -LOCK_PREFIX " addl %2,(%%eax)\n\t" +LOCK_PREFIX " add%z0 %2,(%1)\n\t" /* transitions 0xZZZZ0001 -> 0xYYYY0001 */ " jns 1f\n\t" " call call_rwsem_downgrade_wake\n"
@@ -237,7 +237,7 @@ static inline void __downgrade_write(str*/ static inline void rwsem_atomic_add (int delta,struct rw_semaphore *sem) { - asmvolatile (LOCK_PREFIX "addl %1,%0" + asmvolatile (LOCK_PREFIX "add%z0 %1,%0" :"+m" (sem->count) :"ir" (delta)); }
PATCH 85/139 x86: clean up rwsem type system
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Linus Torvalds <[email protected]>
commit 5d0b7235d83eefdafda300656e97d368afcafc9a upstream.
The fast version of the rwsems (the code that uses xadd) has traditionally only worked on x86-32, and as a result it mixes different kinds of types wildly - they just all happen to be 32-bit. We have "long", we have "__s32", and we have "int".
To make it work on x86-64, the types suddenly matter a lot more. It can be either a 32-bit or 64-bit signed type, and both work (with the caveat that a 32-bit counter will only have 15 bits of effective write counters, so it's limited to 32767 users). But whatever type you choose, it needs to be used consistently.
This makes a new 'rwsem_counter_t', that is a 32-bit signed type. For a 64-bit type, you'd need to also update the BIAS values.
LKML-Reference: <[email protected]>
--- arch/x86/include/asm/rwsem.h | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-)
arch/x86/include/asm/rwsem.h +15 -10
@@ -55,6 +55,9 @@ extern asmregparm struct rw_semaphore */* * the semaphore definition +* +* The bias values and the counter type needs to be extended to 64 bits +* if we want to have more than 32767 potential readers/writers */ #define RWSEM_UNLOCKED_VALUE 0x00000000
@@ -64,8 +67,10 @@ extern asmregparm struct rw_semaphore *#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) +typedef signed int rwsem_count_t ; +struct rw_semaphore { -signed long count; +rwsem_count_t count;spinlock_t wait_lock;struct list_head wait_list;#ifdef CONFIG_DEBUG_LOCK_ALLOC
@@ -121,7 +126,7 @@ static inline void __down_read(struct rw*/ static inline int __down_read_trylock (struct rw_semaphore *sem) { -__s32 result, tmp; +rwsem_count_t result, tmp; asmvolatile ("# beginning __down_read_trylock\n\t" " mov %0,%1\n\t" "1:\n\t"
@@ -143,7 +148,7 @@ static inline int __down_read_trylock(st*/ static inline void __down_write_nested (struct rw_semaphore *sem,int subclass) { -int tmp; +rwsem_count_t tmp; tmp =RWSEM_ACTIVE_WRITE_BIAS ; asm volatile("# beginning down_write\n\t"
@@ -170,9 +175,9 @@ static inline void __down_write(struct r*/ static inline int __down_write_trylock (struct rw_semaphore *sem) { -signed long ret =cmpxchg (&sem->count, -RWSEM_UNLOCKED_VALUE , -RWSEM_ACTIVE_WRITE_BIAS ); +rwsem_count_t ret =cmpxchg (&sem->count, +RWSEM_UNLOCKED_VALUE , +RWSEM_ACTIVE_WRITE_BIAS );if (ret ==RWSEM_UNLOCKED_VALUE )return 1 ;return 0 ;
@@ -183,7 +188,7 @@ static inline int __down_write_trylock(s*/ static inline void __up_read (struct rw_semaphore *sem) { -__s32 tmp = -RWSEM_ACTIVE_READ_BIAS ; +rwsem_count_t tmp = -RWSEM_ACTIVE_READ_BIAS ; asmvolatile ("# beginning __up_read\n\t" LOCK_PREFIX " xadd %1,(%2)\n\t" /* subtracts 1, returns the old value */
@@ -201,7 +206,7 @@ static inline void __up_read(struct rw_s*/ static inline void __up_write (struct rw_semaphore *sem) { -unsigned long tmp; +rwsem_count_t tmp; asmvolatile ("# beginning __up_write\n\t" LOCK_PREFIX " xadd %1,(%2)\n\t" /* tries to transition
@@ -245,9 +250,9 @@ static inline void rwsem_atomic_add(int/* * implement exchange and add functionality */ -static inline int rwsem_atomic_update (int delta,struct rw_semaphore *sem) +static inline rwsem_count_t rwsem_atomic_update (int delta,struct rw_semaphore *sem) { -int tmp = delta; +rwsem_count_t tmp = delta; asmvolatile (LOCK_PREFIX "xadd %0,%1" : "+r" (tmp), "+m" (sem->count)
PATCH 86/139 x86-64, rwsem: 64-bit xadd rwsem implementation
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: H. Peter Anvin <[email protected]>
commit 1838ef1d782f7527e6defe87e180598622d2d071 upstream.
For x86-64, 32767 threads really is not enough. Change rwsem_count_t to a signed long, so that it is 64 bits on x86-64.
This required the following changes to the assembly code:
a) %z0 doesn't work on all versions of gcc! At least gcc 4.4.2 as shipped with Fedora 12 emits "ll" not "q" for 64 bits, even for integer operands. Newer gccs apparently do this correctly, but avoid this problem by using the _ASM_ macros instead of %z.
b) 64 bits immediates are only allowed in "movq $imm,%reg" constructs... no others. Change some of the constraints to "e", and fix the one case where we would have had to use an invalid immediate -- in that case, we only care about the upper half anyway, so just access the upper half.
LKML-Reference: <[email protected]>
--- arch/x86/include/asm/rwsem.h | 53 ++++++++++++++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 13 deletions(-)
arch/x86/include/asm/rwsem.h +40 -13
@@ -41,6 +41,7 @@#include <linux/list.h> #include <linux/spinlock.h> #include <linux/lockdep.h> +#include <asm/asm.h> struct rwsem_waiter ;
@@ -56,18 +57,24 @@ extern asmregparm struct rw_semaphore */* * the semaphore definition * -* The bias values and the counter type needs to be extended to 64 bits -* if we want to have more than 32767 potential readers/writers +* The bias values and the counter type limits the number of +* potential readers/writers to 32767 for 32 bits and 2147483647 +* for 64 bits. */ -#define RWSEM_UNLOCKED_VALUE 0x00000000 -#define RWSEM_ACTIVE_BIAS 0x00000001 -#define RWSEM_ACTIVE_MASK 0x0000ffff -#define RWSEM_WAITING_BIAS (-0x00010000) +#ifdef CONFIG_X86_64 +# define RWSEM_ACTIVE_MASK 0xffffffffL +#else +# define RWSEM_ACTIVE_MASK 0x0000ffffL +#endif + +#define RWSEM_UNLOCKED_VALUE 0x00000000L +#define RWSEM_ACTIVE_BIAS 0x00000001L +#define RWSEM_WAITING_BIAS (-RWSEM_ACTIVE_MASK-1)#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) -typedef signed int rwsem_count_t ; +typedef signed long rwsem_count_t ;struct rw_semaphore {rwsem_count_t count;
@@ -110,7 +117,7 @@ do { \static inline void __down_read (struct rw_semaphore *sem) { asmvolatile ("# beginning down_read\n\t" -LOCK_PREFIX " inc%z0 (%1)\n\t" +LOCK_PREFIX _ASM_INC"(%1)\n\t" /* adds 0x00000001, returns the old value */ " jns 1f\n" " call call_rwsem_down_read_failed\n"
@@ -225,8 +232,25 @@ static inline void __up_write(struct rw_*/ static inline void __downgrade_write (struct rw_semaphore *sem) { +#ifdef CONFIG_X86_64 +# if RWSEM_WAITING_BIAS !=-0x100000000 +# error "This code assumes RWSEM_WAITING_BIAS == -2^32" +# endif + +/* 64-bit immediates are special and expensive, and not needed here */ + asmvolatile ("# beginning __downgrade_write\n\t" +LOCK_PREFIX "incl 4(%1)\n\t" +/* transitions 0xZZZZZZZZ00000001 -> 0xYYYYYYYY00000001 */ +" jns 1f\n\t" +" call call_rwsem_downgrade_wake\n" +"1:\n\t" +"# ending __downgrade_write\n" + :"+m" (sem->count) + :"a" (sem) + :"memory" ,"cc" ); +#else asmvolatile ("# beginning __downgrade_write\n\t" -LOCK_PREFIX " add%z0 %2,(%1)\n\t" +LOCK_PREFIX _ASM_ADD"%2,(%1)\n\t" /* transitions 0xZZZZ0001 -> 0xYYYY0001 */ " jns 1f\n\t" " call call_rwsem_downgrade_wake\n"
@@ -235,22 +259,25 @@ static inline void __downgrade_write(str : "+m" (sem->count) : "a" (sem), "i" (-RWSEM_WAITING_BIAS) : "memory", "cc"); +#endif }/* * implement atomic add functionality */ -static inline void rwsem_atomic_add (int delta,struct rw_semaphore *sem) +static inline void rwsem_atomic_add (rwsem_count_t delta, +struct rw_semaphore *sem) { - asmvolatile (LOCK_PREFIX "add%z0 %1,%0" + asm volatile(LOCK_PREFIX _ASM_ADD "%1,%0" :"+m" (sem->count) - :"ir" (delta)); + :"er" (delta)); }/* * implement exchange and add functionality */ -static inline rwsem_count_t rwsem_atomic_update (int delta,struct rw_semaphore *sem) +static inline rwsem_count_t rwsem_atomic_update (rwsem_count_t delta, +struct rw_semaphore *sem) {rwsem_count_t tmp = delta;
PATCH 87/139 x86-64: support native xadd rwsem implementation
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Linus Torvalds <[email protected]>
commit bafaecd11df15ad5b1e598adc7736afcd38ee13d upstream.
This one is much faster than the spinlock based fallback rwsem code, with certain artifical benchmarks having shown 300%+ improvement on threaded page faults etc.
Again, note the 32767-thread limit here. So this really does need that whole "make rwsem_count_t be 64-bit and fix the BIAS values to match" extension on top of it, but that is conceptually a totally independent issue.
NOT TESTED! The original patch that this all was based on were tested by KAMEZAWA Hiroyuki, but maybe I screwed up something when I created the cleaned-up series, so caveat emptor..
Also note that it _may_ be a good idea to mark some more registers clobbered on x86-64 in the inline asms instead of saving/restoring them. They are inline functions, but they are only used in places where there are not a lot of live registers _anyway_, so doing for example the clobbers of %r8-%r11 in the asm wouldn't make the fast-path code any worse, and would make the slow-path code smaller.
(Not that the slow-path really matters to that degree. Saving a few unnecessary registers is the _least_ of our problems when we hit the slow path. The instruction/cycle counting really only matters in the fast path).
LKML-Reference: <[email protected]>
--- arch/x86/Kconfig.cpu | 2 - arch/x86/lib/Makefile | 1 arch/x86/lib/rwsem_64.S | 81 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+), 1 deletion(-)
arch/x86/Kconfig.cpu +1 -1
@@ -319,7 +319,7 @@ config X86_L1_CACHE_SHIFT config X86_XADD def_bool y - depends on X86_32 && !M386 + depends on X86_64 || !M386 config X86_PPRO_FENCE bool "PentiumPro memory ordering errata workaround"
arch/x86/lib/Makefile +1 -0
@@ -39,4 +39,5 @@ else lib-y += thunk_64.o clear_page_64.o copy_page_64.o lib-y += memmove_64.o memset_64.o lib-y += copy_user_64.o rwlock_64.o copy_user_nocache_64.o + lib-$(CONFIG_RWSEM_XCHGADD_ALGORITHM) += rwsem_64.o endif
arch/x86/lib/rwsem_64.S new file +81 -0
81 lines not on this page · raw message
PATCH 88/139 x86: Fix breakage of UML from the changes in the rwsem system
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Linus Torvalds <[email protected]>
commit 4126faf0ab7417fbc6eb99fb0fd407e01e9e9dfe upstream.
The patches 5d0b7235d83eefdafda300656e97d368afcafc9a and bafaecd11df15ad5b1e598adc7736afcd38ee13d broke the UML build:
Quoted 14 lines · Ingo Molnar
FYI, -tip testing found that these changes break the UML build:
kernel/built-in.o: In function `__up_read':/home/mingo/tip/arch/x86/include/asm/rwsem.h:192: undefined reference tocall_rwsem_wake' kernel/built-in.o: In function__up_write':/home/mingo/tip/arch/x86/include/asm/rwsem.h:210: undefined reference tocall_rwsem_wake' kernel/built-in.o: In function__downgrade_write':/home/mingo/tip/arch/x86/include/asm/rwsem.h:228: undefined reference tocall_rwsem_downgrade_wake' kernel/built-in.o: In function__down_read':/home/mingo/tip/arch/x86/include/asm/rwsem.h:112: undefined reference tocall_rwsem_down_read_failed' kernel/built-in.o: In function__down_write_nested':/home/mingo/tip/arch/x86/include/asm/rwsem.h:154: undefined reference to `call_rwsem_down_write_failed'
collect2: ld returned 1 exit status
Add lib/rwsem_64.o to the UML subarch objects to fix.
LKML-Reference: <[email protected]>
--- arch/um/sys-x86_64/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/um/sys-x86_64/Makefile +2 -1
@@ -8,7 +8,8 @@ obj-y = bug.o bugs.o delay.o fault.o ldt setjmp.o signal.o stub.o stub_segv.o syscalls.o syscall_table.o \ sysrq.o ksyms.o tls.o -subarch-obj-y = lib/csum-partial_64.o lib/memcpy_64.o lib/thunk_64.o +subarch-obj-y = lib/csum-partial_64.o lib/memcpy_64.o lib/thunk_64.o \ + lib/rwsem_64.o subarch-obj-$(CONFIG_MODULES) += kernel/module.o ldt-y = ../sys-i386/ldt.o
PATCH 89/139 x86-64, rwsem: Avoid store forwarding hazard in __downgrade_write
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Avi Kivity <[email protected]>
commit 0d1622d7f526311d87d7da2ee7dd14b73e45d3fc upstream.
The Intel Architecture Optimization Reference Manual states that a short load that follows a long store to the same object will suffer a store forwading penalty, particularly if the two accesses use different addresses. Trivially, a long load that follows a short store will also suffer a penalty.
__downgrade_write() in rwsem incurs both penalties: the increment operation will not be able to reuse a recently-loaded rwsem value, and its result will not be reused by any recently-following rwsem operation.
A comment in the code states that this is because 64-bit immediates are special and expensive; but while they are slightly special (only a single instruction allows them), they aren't expensive: a test shows that two loops, one loading a 32-bit immediate and one loading a 64-bit immediate, both take 1.5 cycles per iteration.
Fix this by changing __downgrade_write to use the same add instruction on i386 and on x86_64, so that it uses the same operand size as all the other rwsem functions.
LKML-Reference: <[email protected]>
--- arch/x86/include/asm/rwsem.h | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-)
arch/x86/include/asm/rwsem.h +5 -20
@@ -232,34 +232,19 @@ static inline void __up_write(struct rw_*/ static inline void __downgrade_write (struct rw_semaphore *sem) { -#ifdef CONFIG_X86_64 -# if RWSEM_WAITING_BIAS !=-0x100000000 -# error "This code assumes RWSEM_WAITING_BIAS == -2^32" -# endif - -/* 64-bit immediates are special and expensive, and not needed here */ - asmvolatile ("# beginning __downgrade_write\n\t" -LOCK_PREFIX "incl 4(%1)\n\t" -/* transitions 0xZZZZZZZZ00000001 -> 0xYYYYYYYY00000001 */ -" jns 1f\n\t" -" call call_rwsem_downgrade_wake\n" -"1:\n\t" -"# ending __downgrade_write\n" - :"+m" (sem->count) - :"a" (sem) - :"memory" ,"cc" ); -#else asmvolatile ("# beginning __downgrade_write\n\t" LOCK_PREFIX _ASM_ADD"%2,(%1)\n\t" -/* transitions 0xZZZZ0001 -> 0xYYYY0001 */ +/* +* transitions 0xZZZZ0001 -> 0xYYYY0001 (i386) +* 0xZZZZZZZZ00000001 -> 0xYYYYYYYY00000001 (x86_64) +*/ " jns 1f\n\t" " call call_rwsem_downgrade_wake\n" "1:\n\t" "# ending __downgrade_write\n" :"+m" (sem->count) - :"a" (sem),"i" (-RWSEM_WAITING_BIAS ) + :"a" (sem),"er" (-RWSEM_WAITING_BIAS ) :"memory" ,"cc" ); -#endif }/*
PATCH 90/139 fix NFS4 handling of mountpoint stat
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Al Viro <[email protected]>
commit 462d60577a997aa87c935ae4521bd303733a9f2b upstream.
RFC says we need to follow the chain of mounts if there's more than one stacked on that point.
--- fs/nfsd/nfs4xdr.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
fs/nfsd/nfs4xdr.c +9 -3
@@ -2121,9 +2121,15 @@ out_acl:* and this is the root of a cross-mounted filesystem. */ if (ignore_crossmnt ==0 && - exp->ex_path.mnt->mnt_root->d_inode == dentry->d_inode) { - err =vfs_getattr (exp->ex_path.mnt->mnt_parent, - exp->ex_path.mnt->mnt_mountpoint, &stat); + dentry == exp->ex_path.mnt->mnt_root) { +struct path path = exp->ex_path; +path_get (&path); +while (follow_up (&path)) { +if (path.dentry != path.mnt->mnt_root) +break ; + } + err =vfs_getattr (path.mnt, path.dentry, &stat); +path_put (&path);if (err) goto out_nfserr; }
PATCH 91/139 quota: Fix possible dq_flags corruption
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Andrew Perepechko <[email protected]>
commit 08261673cb6dc638c39f44d69b76fffb57b92a8b upstream.
dq_flags are modified non-atomically in do_set_dqblk via __set_bit calls and atomically for example in mark_dquot_dirty or clear_dquot_dirty. Hence a change done by an atomic operation can be overwritten by a change done by a non-atomic one. Fix the problem by using atomic bitops even in do_set_dqblk.
--- fs/quota/dquot.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
fs/quota/dquot.c +6 -6
@@ -2321,34 +2321,34 @@ static int do_set_dqblk(struct dquot *dqif (di->dqb_valid &QIF_SPACE ) { dm->dqb_curspace = di->dqb_curspace - dm->dqb_rsvspace; check_blim =1 ; -__set_bit (DQ_LASTSET_B +QIF_SPACE_B , &dquot->dq_flags); +set_bit (DQ_LASTSET_B +QIF_SPACE_B , &dquot->dq_flags); }if (di->dqb_valid &QIF_BLIMITS ) { dm->dqb_bsoftlimit =qbtos (di->dqb_bsoftlimit); dm->dqb_bhardlimit =qbtos (di->dqb_bhardlimit); check_blim =1 ; -__set_bit (DQ_LASTSET_B +QIF_BLIMITS_B , &dquot->dq_flags); +set_bit (DQ_LASTSET_B +QIF_BLIMITS_B , &dquot->dq_flags); }if (di->dqb_valid &QIF_INODES ) { dm->dqb_curinodes = di->dqb_curinodes; check_ilim =1 ; -__set_bit (DQ_LASTSET_B +QIF_INODES_B , &dquot->dq_flags); +set_bit (DQ_LASTSET_B +QIF_INODES_B , &dquot->dq_flags); }if (di->dqb_valid &QIF_ILIMITS ) { dm->dqb_isoftlimit = di->dqb_isoftlimit; dm->dqb_ihardlimit = di->dqb_ihardlimit; check_ilim =1 ; -__set_bit (DQ_LASTSET_B +QIF_ILIMITS_B , &dquot->dq_flags); +set_bit (DQ_LASTSET_B +QIF_ILIMITS_B , &dquot->dq_flags); }if (di->dqb_valid &QIF_BTIME ) { dm->dqb_btime = di->dqb_btime; check_blim =1 ; -__set_bit (DQ_LASTSET_B +QIF_BTIME_B , &dquot->dq_flags); +set_bit (DQ_LASTSET_B +QIF_BTIME_B , &dquot->dq_flags); }if (di->dqb_valid &QIF_ITIME ) { dm->dqb_itime = di->dqb_itime; check_ilim =1 ; -__set_bit (DQ_LASTSET_B +QIF_ITIME_B , &dquot->dq_flags); +set_bit (DQ_LASTSET_B +QIF_ITIME_B , &dquot->dq_flags); }if (check_blim) {
PATCH 92/139 ocfs2: set i_mode on disk during acl operations
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Mark Fasheh <[email protected]>
commit fcefd25ac89239cb57fa198f125a79ff85468c75 upstream.
ocfs2_set_acl() and ocfs2_init_acl() were setting i_mode on the in-memory inode, but never setting it on the disk copy. Thus, acls were some times not getting propagated between nodes. This patch fixes the issue by adding a helper function ocfs2_acl_set_mode() which does this the right way. ocfs2_set_acl() and ocfs2_init_acl() are then updated to call ocfs2_acl_set_mode().
--- fs/ocfs2/acl.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 72 insertions(+), 5 deletions(-)
fs/ocfs2/acl.c +72 -5
@@ -30,6 +30,8 @@#include "alloc.h" #include "dlmglue.h" #include "file.h" +#include "inode.h" +#include "journal.h" #include "ocfs2_fs.h" #include "xattr.h"
@@ -166,6 +168,60 @@ static struct posix_acl *ocfs2_get_acl(s }/* +* Helper function to set i_mode in memory and disk. Some call paths +* will not have di_bh or a journal handle to pass, in which case it +* will create it's own. +*/ +static int ocfs2_acl_set_mode (struct inode *inode,struct buffer_head *di_bh, +handle_t *handle,umode_t new_mode) +{ +int ret, commit_handle =0 ; +struct ocfs2_dinode *di; + +if (di_bh ==NULL ) { + ret =ocfs2_read_inode_block (inode, &di_bh); +if (ret) { +mlog_errno (ret); + goto out; + } + }else +get_bh (di_bh); + +if (handle ==NULL ) { + handle =ocfs2_start_trans (OCFS2_SB (inode->i_sb), +OCFS2_INODE_UPDATE_CREDITS ); +if (IS_ERR (handle)) { + ret =PTR_ERR (handle); +mlog_errno (ret); + goto out_brelse; + } + + commit_handle =1 ; + } + + di = (struct ocfs2_dinode *)di_bh->b_data; + ret =ocfs2_journal_access_di (handle,INODE_CACHE (inode), di_bh, +OCFS2_JOURNAL_ACCESS_WRITE ); +if (ret) { +mlog_errno (ret); + goto out_commit; + } + + inode->i_mode = new_mode; + di->i_mode =cpu_to_le16 (inode->i_mode); + +ocfs2_journal_dirty (handle, di_bh); + +out_commit: +if (commit_handle) +ocfs2_commit_trans (OCFS2_SB (inode->i_sb), handle); +out_brelse: +brelse (di_bh); +out: +return ret; +} + +/* * Set the access or default ACL of an inode. */ static int ocfs2_set_acl(handle_t *handle,
@@ -193,9 +249,14 @@ static int ocfs2_set_acl(handle_t *handlif (ret <0 )return ret;else { - inode->i_mode = mode;if (ret ==0 ) acl =NULL ; + + ret =ocfs2_acl_set_mode (inode, di_bh, + handle, mode); +if (ret) +return ret; + } }break ;
@@ -283,6 +344,7 @@ int ocfs2_init_acl(handle_t *handle,struct ocfs2_super *osb =OCFS2_SB (inode->i_sb);struct posix_acl *acl =NULL ;int ret =0 ; +mode_t mode;if (!S_ISLNK (inode->i_mode)) {if (osb->s_mount_opt &OCFS2_MOUNT_POSIX_ACL ) {
@@ -291,12 +353,17 @@ int ocfs2_init_acl(handle_t *handle,if (IS_ERR (acl))return PTR_ERR (acl); } -if (!acl) - inode->i_mode &= ~current_umask (); +if (!acl) { + mode = inode->i_mode & ~current_umask (); + ret =ocfs2_acl_set_mode (inode, di_bh, handle, mode); +if (ret) { +mlog_errno (ret); + goto cleanup; + } + } }if ((osb->s_mount_opt &OCFS2_MOUNT_POSIX_ACL ) && acl) {struct posix_acl *clone; -mode_t mode;if (S_ISDIR (inode->i_mode)) { ret = ocfs2_set_acl(handle, inode, di_bh,
@@ -313,7 +380,7 @@ int ocfs2_init_acl(handle_t *handle, mode = inode->i_mode; ret =posix_acl_create_masq (clone, &mode);if (ret >=0 ) { - inode->i_mode = mode; + ret =ocfs2_acl_set_mode (inode, di_bh, handle, mode);if (ret >0 ) { ret = ocfs2_set_acl(handle, inode, di_bh, ACL_TYPE_ACCESS,
PATCH 93/139 ocfs2: Change bg_chain check for ocfs2_validate_gd_parent.
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Tao Ma <[email protected]>
commit 78c37eb0d5e6a9727b12ea0f1821795ffaa66cfe upstream.
In ocfs2_validate_gd_parent, we check bg_chain against the cl_next_free_rec of the dinode. Actually in resize, we have the chance of bg_chain == cl_next_free_rec. So add some additional condition check for it.
I also rename paramter "clean_error" to "resize", since the old one is not clearly enough to indicate that we should only meet with this case in resize.
btw, the correpsonding bug is
http://oss.oracle.com/bugzilla/show_bug.cgi?id=1230.
--- fs/ocfs2/suballoc.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
fs/ocfs2/suballoc.c +8 -5
@@ -152,7 +152,7 @@ static u32 ocfs2_bits_per_group(struct o#define do_error (fmt, ...) \ do{ \ - if (clean_error) \ + if (resize) \ mlog(ML_ERROR, fmt "\n", ##__VA_ARGS__); \ else \ ocfs2_error(sb, fmt, ##__VA_ARGS__); \
@@ -160,7 +160,7 @@ static u32 ocfs2_bits_per_group(struct ostatic int ocfs2_validate_gd_self (struct super_block *sb,struct buffer_head *bh, -int clean_error) +int resize) {struct ocfs2_group_desc *gd = (struct ocfs2_group_desc *)bh->b_data;
@@ -211,7 +211,7 @@ static int ocfs2_validate_gd_self(structstatic int ocfs2_validate_gd_parent (struct super_block *sb,struct ocfs2_dinode *di,struct buffer_head *bh, -int clean_error) +int resize) {unsigned int max_bits;struct ocfs2_group_desc *gd = (struct ocfs2_group_desc *)bh->b_data;
@@ -233,8 +233,11 @@ static int ocfs2_validate_gd_parent(strureturn -EINVAL ; } -if (le16_to_cpu (gd->bg_chain) >= -le16_to_cpu (di->id2.i_chain.cl_next_free_rec)) { +/* In resize, we may meet the case bg_chain == cl_next_free_rec. */ +if ((le16_to_cpu (gd->bg_chain) > +le16_to_cpu (di->id2.i_chain.cl_next_free_rec)) || + ((le16_to_cpu (gd->bg_chain) == +le16_to_cpu (di->id2.i_chain.cl_next_free_rec)) && !resize)) {do_error ("Group descriptor #%llu has bad chain %u" , (unsigned long long )bh->b_blocknr,le16_to_cpu (gd->bg_chain));
PATCH 94/139 9p: Skip check for mandatory locks when unlocking
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Sachin Prabhu <[email protected]>
commit f78233dd44a110c574fe760ad6f9c1e8741a0d00 upstream.
While investigating a bug, I came across a possible bug in v9fs. The problem is similar to the one reported for NFS by ASANO Masahiro in
http://lkml.org/lkml/2005/12/21/334.
v9fs_file_lock() will skip locks on file which has mode set to 02666. This is a problem in cases where the mode of the file is changed after a process has obtained a lock on the file. Such a lock will be skipped during unlock and the machine will end up with a BUG in locks_remove_flock().
v9fs_file_lock() should skip the check for mandatory locks when unlocking a file.
--- fs/9p/vfs_file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/9p/vfs_file.c +1 -1
@@ -114,7 +114,7 @@ static int v9fs_file_lock(struct file *fP9_DPRINTK (P9_DEBUG_VFS ,"filp: %p lock: %p\n" , filp, fl);/* No mandatory locks */ -if (__mandatory_lock (inode)) +if (__mandatory_lock (inode) && fl->fl_type !=F_UNLCK )return -ENOLCK ;if ((IS_SETLK (cmd) ||IS_SETLKW (cmd)) && fl->fl_type !=F_UNLCK ) {
PATCH 95/139 pci: Update pci_set_vga_state() to call arch functions
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Mike Travis <[email protected]>
commit 95a8b6efc5d07103583f706c8a5889437d537939 upstream.
Update pci_set_vga_state to call arch dependent functions to enable Legacy VGA I/O transactions to be redirected to correct target.
LKML-Reference: <[email protected]>
--- drivers/pci/pci.c | 25 ++++++++++++++++++++++++- include/linux/pci.h | 5 +++++ 2 files changed, 29 insertions(+), 1 deletion(-)
drivers/pci/pci.c +24 -1
@@ -2612,6 +2612,23 @@ int pci_resource_bar(struct pci_dev *devreturn 0 ; } +/* Some architectures require additional programming to enable VGA */ +static arch_set_vga_state_t arch_set_vga_state; + +void __init pci_register_set_vga_state (arch_set_vga_state_t func) +{ + arch_set_vga_state = func;/* NULL disables */ +} + +static int pci_set_vga_state_arch (struct pci_dev *dev,bool decode, +unsigned int command_bits,bool change_bridge) +{ +if (arch_set_vga_state) +return arch_set_vga_state (dev, decode, command_bits, + change_bridge); +return 0 ; +} +/** * pci_set_vga_state - set VGA decode state on device and parents if requested * @dev: the PCI device
@@ -2625,9 +2642,15 @@ int pci_set_vga_state(struct pci_dev *destruct pci_bus *bus;struct pci_dev *bridge;u16 cmd; +int rc;WARN_ON (command_bits & ~(PCI_COMMAND_IO |PCI_COMMAND_MEMORY )); +/* ARCH specific VGA enables */ + rc =pci_set_vga_state_arch (dev, decode, command_bits, change_bridge); +if (rc) +return rc; +pci_read_config_word (dev,PCI_COMMAND , &cmd);if (decode == true) cmd |= command_bits;
@@ -2842,6 +2865,7 @@ EXPORT_SYMBOL(pcim_pin_device);EXPORT_SYMBOL (pci_disable_device);EXPORT_SYMBOL (pci_find_capability);EXPORT_SYMBOL (pci_bus_find_capability); +EXPORT_SYMBOL (pci_register_set_vga_state);EXPORT_SYMBOL (pci_release_regions);EXPORT_SYMBOL (pci_request_regions);EXPORT_SYMBOL (pci_request_regions_exclusive);
@@ -2874,4 +2898,3 @@ EXPORT_SYMBOL(pci_target_state);EXPORT_SYMBOL (pci_prepare_to_sleep);EXPORT_SYMBOL (pci_back_from_sleep);EXPORT_SYMBOL_GPL (pci_set_pcie_reset_state); -
include/linux/pci.h +5 -0
@@ -959,6 +959,11 @@ static inline int pci_proc_domain(struct }#endif /* CONFIG_PCI_DOMAINS */ +/* some architectures require additional setup to direct VGA traffic */ +typedef int (*arch_set_vga_state_t )(struct pci_dev *pdev,bool decode, +unsigned int command_bits,bool change_bridge); +extern void pci_register_set_vga_state (arch_set_vga_state_t func); +#else /* CONFIG_PCI is not enabled */ /*
PATCH 96/139 PCI: kill off pci_register_set_vga_state() symbol export.
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Paul Mundt <[email protected]>
commit ded1d8f29b4d315a2093cafc3ee17ac870a87972 upstream.
When pci_register_set_vga_state() was made __init, the EXPORT_SYMBOL() was retained, which now leaves us with a section mismatch.
--- drivers/pci/pci.c | 1 - 1 file changed, 1 deletion(-)
drivers/pci/pci.c +0 -1
@@ -2865,7 +2865,6 @@ EXPORT_SYMBOL(pcim_pin_device);EXPORT_SYMBOL (pci_disable_device);EXPORT_SYMBOL (pci_find_capability);EXPORT_SYMBOL (pci_bus_find_capability); -EXPORT_SYMBOL (pci_register_set_vga_state);EXPORT_SYMBOL (pci_release_regions);EXPORT_SYMBOL (pci_request_regions);EXPORT_SYMBOL (pci_request_regions_exclusive);
PATCH 97/139 IPoIB: Fix TX queue lockup with mixed UD/CM traffic
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Eli Cohen <[email protected]>
commit f0dc117abdfa9a0e96c3d013d836460ef3cd08c7 upstream.
The IPoIB UD QP reports send completions to priv->send_cq, which is usually left unarmed; it only gets armed when the number of outstanding send requests reaches the size of the TX queue. This arming is done only in the send path for the UD QP. However, when sending CM packets, the net queue may be stopped for the same reasons but no measures are taken to recover the UD path from a lockup.
Consider this scenario: a host sends high rate of both CM and UD packets, with a TX queue length of N. If at some time the number of outstanding UD packets is more than N/2 and the overall outstanding packets is N-1, and CM sends a packet (making the number of outstanding sends equal N), the TX queue will be stopped. When all the CM packets complete, the number of outstanding packets will still be higher than N/2 so the TX queue will not be restarted.
Fix this by calling ib_req_notify_cq() when the queue is stopped in the CM path.
--- drivers/infiniband/ulp/ipoib/ipoib_cm.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/ulp/ipoib/ipoib_cm.c +2 -0
@@ -752,6 +752,8 @@ void ipoib_cm_send(struct net_device *deif (++priv->tx_outstanding == ipoib_sendq_size) {ipoib_dbg (priv,"TX ring 0x%x full, stopping kernel net queue\n" , tx->qp->qp_num); +if (ib_req_notify_cq (priv->send_cq,IB_CQ_NEXT_COMP )) +ipoib_warn (priv,"request notify on send CQ failed\n" );netif_stop_queue (dev); } }
PATCH 98/139 x86/PCI: irq and pci_ids patch for Intel Cougar Point DeviceIDs
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Seth Heasley <[email protected]>
commit 93da6202264ce1256b04db8008a43882ae62d060 upstream.
This patch adds the Intel Cougar Point (PCH) LPC and SMBus Controller DeviceIDs.
--- arch/x86/pci/irq.c | 2 ++ include/linux/pci_ids.h | 3 +++ 2 files changed, 5 insertions(+)
arch/x86/pci/irq.c +2 -0
@@ -590,6 +590,8 @@ static __init int intel_router_probe(strcase PCI_DEVICE_ID_INTEL_ICH10_1 :case PCI_DEVICE_ID_INTEL_ICH10_2 :case PCI_DEVICE_ID_INTEL_ICH10_3 : +case PCI_DEVICE_ID_INTEL_CPT_LPC1 : +case PCI_DEVICE_ID_INTEL_CPT_LPC2 : r->name ="PIIX/ICH" ; r->get = pirq_piix_get; r->set = pirq_piix_set;
include/linux/pci_ids.h +3 -0
@@ -2417,6 +2417,9 @@#define PCI_DEVICE_ID_INTEL_82840_HB 0x1a21#define PCI_DEVICE_ID_INTEL_82845_HB 0x1a30#define PCI_DEVICE_ID_INTEL_IOAT 0x1a38 +#define PCI_DEVICE_ID_INTEL_CPT_SMBUS 0x1c22 +#define PCI_DEVICE_ID_INTEL_CPT_LPC1 0x1c42 +#define PCI_DEVICE_ID_INTEL_CPT_LPC2 0x1c43#define PCI_DEVICE_ID_INTEL_82801AA_0 0x2410#define PCI_DEVICE_ID_INTEL_82801AA_1 0x2411#define PCI_DEVICE_ID_INTEL_82801AA_3 0x2413
PATCH 99/139 ALSA: hda_intel: ALSA HD Audio patch for Intel Cougar Point DeviceIDs
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Seth Heasley <[email protected]>
commit d2f2fcd2541bae004db7f4798ffd9d2cb75ae817 upstream.
This patch adds the Intel Cougar Point (PCH) HD Audio Controller DeviceIDs.
--- sound/pci/hda/hda_intel.c | 3 +++ 1 file changed, 3 insertions(+)
sound/pci/hda/hda_intel.c +3 -0
@@ -125,6 +125,7 @@ MODULE_SUPPORTED_DEVICE("{{Intel, ICH6},"{Intel, ICH9}," "{Intel, ICH10}," "{Intel, PCH}," +"{Intel, CPT}," "{Intel, SCH}," "{ATI, SB450}," "{ATI, SB600},"
@@ -2711,6 +2712,8 @@ static struct pci_device_id azx_ids[] = { PCI_DEVICE(0x8086, 0x3a6e), .driver_data = AZX_DRIVER_ICH }, /* PCH */ { PCI_DEVICE(0x8086, 0x3b56), .driver_data = AZX_DRIVER_ICH }, + /* CPT */ + { PCI_DEVICE(0x8086, 0x1c20), .driver_data = AZX_DRIVER_ICH }, /* SCH */ { PCI_DEVICE(0x8086, 0x811b), .driver_data = AZX_DRIVER_SCH },/* ATI SB 450/600 */
PATCH 100/139 ALSA: hda - enable snoop for Intel Cougar Point
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Seth Heasley <[email protected]>
commit 32679f95cac3b1bdf27dce8b5273e06af186fd91 upstream.
This patch enables snoop, eliminating static during playback. This patch supersedes the previous Cougar Point audio patch.
--- sound/pci/hda/hda_intel.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
sound/pci/hda/hda_intel.c +5 -1
@@ -450,6 +450,7 @@ struct azx {/* driver types */ enum {AZX_DRIVER_ICH , +AZX_DRIVER_PCH ,AZX_DRIVER_SCH ,AZX_DRIVER_ATI ,AZX_DRIVER_ATIHDMI ,
@@ -464,6 +465,7 @@ enum {static char *driver_short_names[]__devinitdata = { [AZX_DRIVER_ICH ] ="HDA Intel" , + [AZX_DRIVER_PCH ] ="HDA Intel PCH" , [AZX_DRIVER_SCH ] ="HDA Intel MID" , [AZX_DRIVER_ATI ] ="HDA ATI SB" , [AZX_DRIVER_ATIHDMI ] ="HDA ATI HDMI" ,
@@ -1066,6 +1068,7 @@ static void azx_init_pci(struct azx *chi 0x01, NVIDIA_HDA_ENABLE_COHBIT);break ;case AZX_DRIVER_SCH : +case AZX_DRIVER_PCH :pci_read_config_word (chip->pci,INTEL_SCH_HDA_DEVC , &snoop);if (snoop &INTEL_SCH_HDA_DEVC_NOSNOOP ) { pci_write_config_word(chip->pci, INTEL_SCH_HDA_DEVC,
@@ -2434,6 +2437,7 @@ static int __devinit azx_create(struct sif (bdl_pos_adj[dev] <0 ) {switch (chip->driver_type) {case AZX_DRIVER_ICH : +case AZX_DRIVER_PCH : bdl_pos_adj[dev] =1 ;break ;default :
@@ -2713,7 +2717,7 @@ static struct pci_device_id azx_ids[] =/* PCH */ { PCI_DEVICE(0x8086, 0x3b56), .driver_data = AZX_DRIVER_ICH }, /* CPT */ - { PCI_DEVICE(0x8086, 0x1c20), .driver_data = AZX_DRIVER_ICH }, + { PCI_DEVICE(0x8086, 0x1c20), .driver_data = AZX_DRIVER_PCH }, /* SCH */ { PCI_DEVICE(0x8086, 0x811b), .driver_data = AZX_DRIVER_SCH },/* ATI SB 450/600 */
PATCH 101/139 ata_piix: IDE Mode SATA patch for Intel Cougar Point DeviceIDs
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Seth Heasley <[email protected]>
commit 88e8201e67aace3d86de9e75122ea525f0e7248e upstream.
--- drivers/ata/ata_piix.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/ata/ata_piix.c +8 -0
@@ -291,6 +291,14 @@ static const struct pci_device_id piix_p { 0x8086, 0x3b2d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },/* SATA Controller IDE (PCH) */ { 0x8086, 0x3b2e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, +/* SATA Controller IDE (CPT) */ + { 0x8086, 0x1c00, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, +/* SATA Controller IDE (CPT) */ + { 0x8086, 0x1c01, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, +/* SATA Controller IDE (CPT) */ + { 0x8086, 0x1c08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, +/* SATA Controller IDE (CPT) */ + { 0x8086, 0x1c09, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, { } /* terminate list */ };
PATCH 102/139 ahci: AHCI and RAID mode SATA patch for Intel Cougar Point DeviceIDs
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Seth Heasley <[email protected]>
commit 5623cab83ea61e0420f2064216d83eab067a24c6 upstream.
--- drivers/ata/ahci.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/ata/ahci.c +6 -0
@@ -570,6 +570,12 @@ static const struct pci_device_id ahci_p { PCI_VDEVICE(INTEL, 0x3b2b), board_ahci }, /* PCH RAID */ { PCI_VDEVICE(INTEL, 0x3b2c), board_ahci }, /* PCH RAID */ { PCI_VDEVICE(INTEL, 0x3b2f), board_ahci }, /* PCH AHCI */ + { PCI_VDEVICE(INTEL, 0x1c02), board_ahci }, /* CPT AHCI */ + { PCI_VDEVICE(INTEL, 0x1c03), board_ahci }, /* CPT AHCI */ + { PCI_VDEVICE(INTEL, 0x1c04), board_ahci }, /* CPT RAID */ + { PCI_VDEVICE(INTEL, 0x1c05), board_ahci }, /* CPT RAID */ + { PCI_VDEVICE(INTEL, 0x1c06), board_ahci }, /* CPT RAID */ + { PCI_VDEVICE(INTEL, 0x1c07), board_ahci }, /* CPT RAID *//* JMicron 360/1/3/5/6, match class to avoid IDE function */ { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
PATCH 103/139 i2c-i801: Add Intel Cougar Point device IDs
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Seth Heasley <[email protected]>
commit 393764340beb595c1ad7dd2d2243c2b6551aaa71 upstream.
Add the Intel Cougar Point (PCH) SMBus controller device IDs.
--- Documentation/i2c/busses/i2c-i801 | 3 ++- drivers/i2c/busses/Kconfig | 5 +++-- drivers/i2c/busses/i2c-i801.c | 5 ++++- 3 files changed, 9 insertions(+), 4 deletions(-)
Documentation/i2c/busses/i2c-i801 +2 -1
@@ -15,7 +15,8 @@ Supported adapters: * Intel 82801I (ICH9) * Intel EP80579 (Tolapai) * Intel 82801JI (ICH10) - * Intel PCH + * Intel 3400/5 Series (PCH) + * Intel Cougar Point (PCH) Datasheets: Publicly available at the Intel website Authors:
drivers/i2c/busses/Kconfig +3 -2
@@ -77,7 +77,7 @@ config I2C_AMD8111 will be called i2c-amd8111. config I2C_I801 - tristate "Intel 82801 (ICH)" + tristate "Intel 82801 (ICH/PCH)" depends on PCI help If you say yes to this option, support will be included for the Intel
@@ -97,7 +97,8 @@ config I2C_I801 ICH9 Tolapai ICH10 - PCH + 3400/5 Series (PCH) + Cougar Point (PCH) This driver can also be built as a module. If so, the module will be called i2c-i801.
drivers/i2c/busses/i2c-i801.c +4 -1
@@ -41,7 +41,8 @@ Tolapai 0x5032 32 hard yes yes yes ICH10 0x3a30 32 hard yes yes yes ICH10 0x3a60 32 hard yes yes yes - PCH 0x3b30 32 hard yes yes yes + 3400/5 Series (PCH) 0x3b30 32 hard yes yes yes + Cougar Point (PCH) 0x1c22 32 hard yes yes yes Features supported by this driver: Software PEC no
@@ -580,6 +581,7 @@ static struct pci_device_id i801_ids[] = { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH10_4) }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH10_5) }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PCH_SMBUS) }, + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CPT_SMBUS) }, { 0, } };
@@ -709,6 +711,7 @@ static int __devinit i801_probe(struct pcase PCI_DEVICE_ID_INTEL_ICH10_4 :case PCI_DEVICE_ID_INTEL_ICH10_5 :case PCI_DEVICE_ID_INTEL_PCH_SMBUS : +case PCI_DEVICE_ID_INTEL_CPT_SMBUS : i801_features |=FEATURE_I2C_BLOCK_READ ;/* fall through */ case PCI_DEVICE_ID_INTEL_82801DB_3 :
PATCH 104/139 b43: Allow PIO mode to be selected at module load
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Larry Finger <[email protected]>
commit b02914af4d7020828ce921a572589dd793517c09 upstream.
If userencounter the "Fatal DMA Problem" with a BCM43XX device, and still wish to use b43 as the driver, their only option is to rebuild the kernel with CONFIG_B43_FORCE_PIO. This patch removes this option and allows PIO mode to be selected with a load-time parameter for the module. Note that the configuration variable CONFIG_B43_PIO is also removed.
Once the DMA problem with the BCM4312 devices is solved, this patch will likely be reverted.
--- drivers/net/wireless/b43/Kconfig | 19 +----------------- drivers/net/wireless/b43/Makefile | 2 - drivers/net/wireless/b43/b43.h | 13 ------------ drivers/net/wireless/b43/dma.c | 2 - drivers/net/wireless/b43/main.c | 9 +++++--- drivers/net/wireless/b43/pio.h | 40 -------------------------------------- 6 files changed, 9 insertions(+), 76 deletions(-)
drivers/net/wireless/b43/Kconfig +2 -17
@@ -3,6 +3,7 @@ config B43 depends on SSB_POSSIBLE && MAC80211 && HAS_DMA select SSB select FW_LOADER + select SSB_BLOCKIO ---help--- b43 is a driver for the Broadcom 43xx series wireless devices.
@@ -78,14 +79,6 @@ config B43_SDIO If unsure, say N. -# Data transfers to the device via PIO -# This is only needed on PCMCIA and SDIO devices. All others can do DMA properly. -config B43_PIO - bool - depends on B43 && (B43_SDIO || B43_PCMCIA || B43_FORCE_PIO) - select SSB_BLOCKIO - default y - config B43_NPHY bool "Pre IEEE 802.11n support (BROKEN)" depends on B43 && EXPERIMENTAL && BROKEN
@@ -137,12 +130,4 @@ config B43_DEBUG for production use. Only say Y, if you are debugging a problem in the b43 driver sourcecode. -config B43_FORCE_PIO - bool "Force usage of PIO instead of DMA" - depends on B43 && B43_DEBUG - ---help--- - This will disable DMA and always enable PIO instead. - - Say N! - This is only for debugging the PIO engine code. You do - _NOT_ want to enable this. +
drivers/net/wireless/b43/Makefile +1 -1
@@ -12,7 +12,7 @@ b43-y += xmit.o b43-y += lo.o b43-y += wa.o b43-y += dma.o -b43-$(CONFIG_B43_PIO) += pio.o +b43-y += pio.o b43-y += rfkill.o b43-$(CONFIG_B43_LEDS) += leds.o b43-$(CONFIG_B43_PCMCIA) += pcmcia.o
drivers/net/wireless/b43/b43.h +0 -13
@@ -822,11 +822,9 @@ struct b43_wl {/* The device LEDs. */ struct b43_leds leds; -#ifdef CONFIG_B43_PIO /* Kmalloc'ed scratch space for PIO TX/RX. Protected by wl->mutex. */ u8 pio_scratchspace[110] __attribute__((__aligned__(8))); u8 pio_tailspace[4] __attribute__((__aligned__(8))); -#endif /* CONFIG_B43_PIO */ };static inline struct b43_wl *hw_to_b43_wl (struct ieee80211_hw *hw)
@@ -877,20 +875,9 @@ static inline void b43_write32(struct b4static inline bool b43_using_pio_transfers (struct b43_wldev *dev) { -#ifdef CONFIG_B43_PIO return dev->__using_pio_transfers; -#else -return 0 ; -#endif } -#ifdef CONFIG_B43_FORCE_PIO -# define B43_FORCE_PIO 1 -#else -# define B43_FORCE_PIO 0 -#endif - -/* Message printing */ void b43info (struct b43_wl *wl,const char *fmt, ...) __attribute__ ((format (printf,2 ,3 )));
drivers/net/wireless/b43/dma.c +0 -2
@@ -1653,7 +1653,6 @@ void b43_dma_tx_resume(struct b43_wldevb43_power_saving_ctl_bits (dev,0 ); } -#ifdef CONFIG_B43_PIO static void direct_fifo_rx (struct b43_wldev *dev,enum b43_dmatype type,u16 mmio_base,bool enable) {
@@ -1687,4 +1686,3 @@ void b43_dma_direct_fifo_rx(struct b43_w mmio_base =b43_dmacontroller_base (type, engine_index);direct_fifo_rx (dev, type, mmio_base, enable); } -#endif /* CONFIG_B43_PIO */
drivers/net/wireless/b43/main.c +6 -3
@@ -102,6 +102,9 @@ int b43_modparam_verbose = B43_VERBOSITYmodule_param_named (verbose, b43_modparam_verbose, int,0644 );MODULE_PARM_DESC (verbose,"Log message verbosity: 0=error, 1=warn, 2=info(default), 3=debug" ); +static int modparam_pio; +module_param_named (pio, modparam_pio, int,0444 ); +MODULE_PARM_DESC (pio,"enable(1) / disable(0) PIO mode" );static const struct ssb_device_id b43_ssb_tbl[] = {SSB_DEVICE (SSB_VENDOR_BROADCOM ,SSB_DEV_80211 ,5 ),
@@ -1790,8 +1793,8 @@ static void b43_do_interrupt_thread(stru dma_reason[4], dma_reason[5]);b43err (dev->wl,"This device does not support DMA " "on your system. Please use PIO instead.\n" ); -b43err (dev->wl,"CONFIG_B43_FORCE_PIO must be set in " -"your kernel configuration.\n" ); +b43err (dev->wl,"Unload the b43 module and reload " +"with 'pio=1'\n" );return ; }if (merged_dma_reason &B43_DMAIRQ_NONFATALMASK ) {
@@ -4358,7 +4361,7 @@ static int b43_wireless_core_init(structif ((dev->dev->bus->bustype ==SSB_BUSTYPE_PCMCIA ) || (dev->dev->bus->bustype ==SSB_BUSTYPE_SDIO ) || -B43_FORCE_PIO ) { + modparam_pio) { dev->__using_pio_transfers =1 ; err =b43_pio_init (dev); }else {
drivers/net/wireless/b43/pio.h +0 -40
@@ -55,8 +55,6 @@#define B43_PIO_MAX_NR_TXPACKETS 32 -#ifdef CONFIG_B43_PIO -struct b43_pio_txpacket {/* Pointer to the TX queue we belong to. */ struct b43_pio_txqueue *queue;
@@ -169,42 +167,4 @@ void b43_pio_rx(struct b43_pio_rxqueue *void b43_pio_tx_suspend (struct b43_wldev *dev);void b43_pio_tx_resume (struct b43_wldev *dev); - -#else /* CONFIG_B43_PIO */ - - -static inline int b43_pio_init (struct b43_wldev *dev) -{ -return 0 ; -} -static inline void b43_pio_free (struct b43_wldev *dev) -{ -} -static inline void b43_pio_stop (struct b43_wldev *dev) -{ -} -static inline int b43_pio_tx (struct b43_wldev *dev, -struct sk_buff *skb) -{ -return 0 ; -} -static inline void b43_pio_handle_txstatus (struct b43_wldev *dev, -const struct b43_txstatus *status) -{ -} -static inline void b43_pio_get_tx_stats (struct b43_wldev *dev, -struct ieee80211_tx_queue_stats *stats) -{ -} -static inline void b43_pio_rx (struct b43_pio_rxqueue *q) -{ -} -static inline void b43_pio_tx_suspend (struct b43_wldev *dev) -{ -} -static inline void b43_pio_tx_resume (struct b43_wldev *dev) -{ -} - -#endif /* CONFIG_B43_PIO */ #endif /* B43_PIO_H_ */
PATCH 105/139 b43: fall back gracefully to PIO mode after fatal DMA errors
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Linus Torvalds <[email protected]>
commit 9e3bd9190800e8209b4a3e1d724c35f0738dcad2 upstream.
This makes the b43 driver just automatically fall back to PIO mode when DMA doesn't work.
The driver already told the user to do it, so rather than have the user reload the module with a new flag, just make the driver do it automatically. We keep the message as an indication that something is wrong, but now just automatically fall back to the hopefully working PIO case.
(Some post-2.6.33 merge fixups by Larry Finger <[email protected]> and yours truly... -- JWL)
--- drivers/net/wireless/b43/Kconfig | 19 +++++++++++++++++-- drivers/net/wireless/b43/b43.h | 7 +++++++ drivers/net/wireless/b43/main.c | 14 ++++++++------ 3 files changed, 32 insertions(+), 8 deletions(-)
drivers/net/wireless/b43/Kconfig +17 -2
@@ -3,7 +3,6 @@ config B43 depends on SSB_POSSIBLE && MAC80211 && HAS_DMA select SSB select FW_LOADER - select SSB_BLOCKIO ---help--- b43 is a driver for the Broadcom 43xx series wireless devices.
@@ -79,6 +78,14 @@ config B43_SDIO If unsure, say N. +#Data transfers to the device via PIO. We want it as a fallback even +# if we can do DMA. +config B43_PIO + bool + depends on B43 + select SSB_BLOCKIO + default y + config B43_NPHY bool "Pre IEEE 802.11n support (BROKEN)" depends on B43 && EXPERIMENTAL && BROKEN
@@ -130,4 +137,12 @@ config B43_DEBUG for production use. Only say Y, if you are debugging a problem in the b43 driver sourcecode. - +config B43_FORCE_PIO + bool "Force usage of PIO instead of DMA" + depends on B43 && B43_DEBUG + ---help--- + This will disable DMA and always enable PIO instead. + + Say N! + This is only for debugging the PIO engine code. You do + _NOT_ want to enable this.
drivers/net/wireless/b43/b43.h +7 -0
@@ -694,6 +694,7 @@ struct b43_wldev {bool radio_hw_enable;/* saved state of radio hardware enabled state */ bool qos_enabled;/* TRUE, if QoS is used. */ bool hwcrypto_enabled;/* TRUE, if HW crypto acceleration is enabled. */ +bool use_pio;/* TRUE if next init should use PIO */ /* PHY/Radio device. */ struct b43_phy phy;
@@ -878,6 +879,12 @@ static inline bool b43_using_pio_transfereturn dev->__using_pio_transfers; } +#ifdef CONFIG_B43_FORCE_PIO +# define B43_PIO_DEFAULT 1 +#else +# define B43_PIO_DEFAULT 0 +#endif +/* Message printing */ void b43info (struct b43_wl *wl,const char *fmt, ...) __attribute__ ((format (printf,2 ,3 )));
drivers/net/wireless/b43/main.c +8 -6
@@ -102,9 +102,9 @@ int b43_modparam_verbose = B43_VERBOSITYmodule_param_named (verbose, b43_modparam_verbose, int,0644 );MODULE_PARM_DESC (verbose,"Log message verbosity: 0=error, 1=warn, 2=info(default), 3=debug" ); -static int modparam_pio; -module_param_named (pio, modparam_pio, int,0444 ); -MODULE_PARM_DESC (pio,"enable(1) / disable(0) PIO mode" ); +int b43_modparam_pio =B43_PIO_DEFAULT ; +module_param_named (pio, b43_modparam_pio, int,0644 ); +MODULE_PARM_DESC (pio,"Use PIO accesses by default: 0=DMA, 1=PIO" );static const struct ssb_device_id b43_ssb_tbl[] = {SSB_DEVICE (SSB_VENDOR_BROADCOM ,SSB_DEV_80211 ,5 ),
@@ -1793,8 +1793,9 @@ static void b43_do_interrupt_thread(stru dma_reason[4], dma_reason[5]);b43err (dev->wl,"This device does not support DMA " "on your system. Please use PIO instead.\n" ); -b43err (dev->wl,"Unload the b43 module and reload " -"with 'pio=1'\n" ); +/* Fall back to PIO transfers if we get fatal DMA errors! */ + dev->use_pio =1 ; +b43_controller_restart (dev,"DMA error" );return ; }if (merged_dma_reason &B43_DMAIRQ_NONFATALMASK ) {
@@ -4361,7 +4362,7 @@ static int b43_wireless_core_init(structif ((dev->dev->bus->bustype ==SSB_BUSTYPE_PCMCIA ) || (dev->dev->bus->bustype ==SSB_BUSTYPE_SDIO ) || - modparam_pio) { + dev->use_pio) { dev->__using_pio_transfers =1 ; err =b43_pio_init (dev); }else {
@@ -4829,6 +4830,7 @@ static int b43_one_core_attach(struct ssif (!wldev) goto out; + wldev->use_pio = b43_modparam_pio; wldev->dev = dev; wldev->wl = wl;b43_set_status (wldev,B43_STAT_UNINIT );
PATCH 106/139 ALSA: hda - Add position_fix quirk for Biostar mobo
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Takashi Iwai <[email protected]>
commit 8815cd030fdd73932a791d1f06194c8db807cde7 upstream.
The Biostar mobo seems to give a wrong DMA position, resulting in stuttering or skipping sounds on 2.6.34. Since the commit 7b3a177b0d4f92b3431b8dca777313a07533a710, "ALSA: pcm_lib: fix "something must be really wrong" condition", makes the position check more strictly, the DMA position problem is revealed more clearly now.
The fix is to use only LPIB for obtaining the position, i.e. passing position_fix=1. This patch adds a static quirk to achieve it as default.
--- sound/pci/hda/hda_intel.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/hda_intel.c +1 -0
@@ -2272,6 +2272,7 @@ static struct snd_pci_quirk position_fixSND_PCI_QUIRK (0x1458 ,0xa022 ,"ga-ma770-ud3" ,POS_FIX_LPIB ),SND_PCI_QUIRK (0x1462 ,0x1002 ,"MSI Wind U115" ,POS_FIX_LPIB ),SND_PCI_QUIRK (0x1565 ,0x820f ,"Biostar Microtech" ,POS_FIX_LPIB ), +SND_PCI_QUIRK (0x1565 ,0x8218 ,"Biostar Microtech" ,POS_FIX_LPIB ), SND_PCI_QUIRK(0x8086, 0xd601, "eMachines T5212", POS_FIX_LPIB), {} };
PATCH 107/139 ecryptfs: fix use with tmpfs by removing d_drop from ecryptfs_destroy_inode
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jeff Mahoney <[email protected]>
commit 133b8f9d632cc23715c6d72d1c5ac449e054a12a upstream.
Since tmpfs has no persistent storage, it pins all its dentries in memory so they have d_count=1 when other file systems would have d_count=0. ->lookup is only used to create new dentries. If the caller doesn't instantiate it, it's freed immediately at dput(). ->readdir reads directly from the dcache and depends on the dentries being hashed.
When an ecryptfs mount is mounted, it associates the lower file and dentry with the ecryptfs files as they're accessed. When it's umounted and destroys all the in-memory ecryptfs inodes, it fput's the lower_files and d_drop's the lower_dentries. Commit 4981e081 added this and a d_delete in 2008 and several months later commit caeeeecf removed the d_delete. I believe the d_drop() needs to be removed as well.
The d_drop effectively hides any file that has been accessed via ecryptfs from the underlying tmpfs since it depends on it being hashed for it to be accessible. I've removed the d_drop on my development node and see no ill effects with basic testing on both tmpfs and persistent storage.
As a side effect, after ecryptfs d_drops the dentries on tmpfs, tmpfs BUGs on umount. This is due to the dentries being unhashed. tmpfs->kill_sb is kill_litter_super which calls d_genocide to drop the reference pinning the dentry. It skips unhashed and negative dentries, but shrink_dcache_for_umount_subtree doesn't. Since those dentries still have an elevated d_count, we get a BUG().
This patch removes the d_drop call and fixes both issues.
This issue was reported at:
https://bugzilla.novell.com/show_bug.cgi?id=567887
--- fs/ecryptfs/super.c | 1 - 1 file changed, 1 deletion(-)
fs/ecryptfs/super.c +0 -1
@@ -85,7 +85,6 @@ static void ecryptfs_destroy_inode(strucif (lower_dentry->d_inode) {fput (inode_info->lower_file); inode_info->lower_file =NULL ; -d_drop (lower_dentry); } }ecryptfs_destroy_crypt_stat (&inode_info->crypt_stat);
PATCH 108/139 eCryptfs: Decrypt symlink target for stat size
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Tyler Hicks <[email protected]>
commit 3a60a1686f0d51c99bd0df8ac93050fb6dfce647 upstream.
Create a getattr handler for eCryptfs symlinks that is capable of reading the lower target and decrypting its path. Prior to this patch, a stat's st_size field would represent the strlen of the encrypted path, while readlink() would return the strlen of the decrypted path. This could lead to confusion in some userspace applications, since the two values should be equal.
https://bugs.launchpad.net/bugs/524919
--- fs/ecryptfs/inode.c | 100 +++++++++++++++++++++++++++------------------------- 1 file changed, 52 insertions(+), 48 deletions(-)
fs/ecryptfs/inode.c +52 -48
@@ -647,38 +647,17 @@ out_lock:return rc; } -static int -ecryptfs_readlink (struct dentry *dentry,char __user *buf,int bufsiz) +static int ecryptfs_readlink_lower (struct dentry *dentry,char **buf, +size_t *bufsiz) { +struct dentry *lower_dentry =ecryptfs_dentry_to_lower (dentry);char *lower_buf; -size_t lower_bufsiz; -struct dentry *lower_dentry; -struct ecryptfs_mount_crypt_stat *mount_crypt_stat; -char *plaintext_name; -size_t plaintext_name_size; +size_t lower_bufsiz =PATH_MAX ;mm_segment_t old_fs;int rc; - lower_dentry =ecryptfs_dentry_to_lower (dentry); -if (!lower_dentry->d_inode->i_op->readlink) { - rc = -EINVAL ; - goto out; - } - mount_crypt_stat = &ecryptfs_superblock_to_private ( - dentry->d_sb)->mount_crypt_stat; -/* -* If the lower filename is encrypted, it will result in a significantly -* longer name. If needed, truncate the name after decode and decrypt. -*/ -if (mount_crypt_stat->flags &ECRYPTFS_GLOBAL_ENCRYPT_FILENAMES ) - lower_bufsiz =PATH_MAX ; -else - lower_bufsiz = bufsiz; -/* Released in this function */ lower_buf =kmalloc (lower_bufsiz,GFP_KERNEL ); -if (lower_buf ==NULL ) { -printk (KERN_ERR "%s: Out of memory whilst attempting to " -"kmalloc [%zd] bytes\n" , __func__, lower_bufsiz); +if (!lower_buf) { rc = -ENOMEM ; goto out; }
@@ -688,29 +667,31 @@ ecryptfs_readlink(struct dentry *dentry, (char __user *)lower_buf, lower_bufsiz);set_fs (old_fs); -if (rc >=0 ) { - rc =ecryptfs_decode_and_decrypt_filename (&plaintext_name, - &plaintext_name_size, - dentry, lower_buf, - rc); -if (rc) { -printk (KERN_ERR "%s: Error attempting to decode and " -"decrypt filename; rc = [%d]\n" , __func__, - rc); - goto out_free_lower_buf; - } -/* Check for bufsiz <= 0 done in sys_readlinkat() */ - rc =copy_to_user (buf, plaintext_name, -min ((size_t ) bufsiz, plaintext_name_size)); -if (rc) - rc = -EFAULT ; -else - rc = plaintext_name_size; -kfree (plaintext_name); -fsstack_copy_attr_atime (dentry->d_inode, lower_dentry->d_inode); - } -out_free_lower_buf: +if (rc <0 ) + goto out; + lower_bufsiz = rc; + rc =ecryptfs_decode_and_decrypt_filename (buf, bufsiz, dentry, + lower_buf, lower_bufsiz); +out:kfree (lower_buf); +return rc; +} + +static int +ecryptfs_readlink (struct dentry *dentry,char __user *buf,int bufsiz) +{ +char *kbuf; +size_t kbufsiz, copied; +int rc; + + rc =ecryptfs_readlink_lower (dentry, &kbuf, &kbufsiz); +if (rc) + goto out; + copied =min_t (size_t, bufsiz, kbufsiz); + rc =copy_to_user (buf, kbuf, copied) ? -EFAULT : copied; +kfree (kbuf); +fsstack_copy_attr_atime (dentry->d_inode, +ecryptfs_dentry_to_lower (dentry)->d_inode); out:return rc; }
@@ -1015,6 +996,28 @@ out:return rc; } +int ecryptfs_getattr_link (struct vfsmount *mnt,struct dentry *dentry, +struct kstat *stat) +{ +struct ecryptfs_mount_crypt_stat *mount_crypt_stat; +int rc =0 ; + + mount_crypt_stat = &ecryptfs_superblock_to_private ( + dentry->d_sb)->mount_crypt_stat; +generic_fillattr (dentry->d_inode, stat); +if (mount_crypt_stat->flags &ECRYPTFS_GLOBAL_ENCRYPT_FILENAMES ) { +char *target; +size_t targetsiz; + + rc =ecryptfs_readlink_lower (dentry, &target, &targetsiz); +if (!rc) { +kfree (target); + stat->size = targetsiz; + } + } +return rc; +} +int ecryptfs_getattr (struct vfsmount *mnt,struct dentry *dentry,struct kstat *stat) {
@@ -1132,6 +1135,7 @@ const struct inode_operations ecryptfs_s .put_link = ecryptfs_put_link, .permission = ecryptfs_permission, .setattr = ecryptfs_setattr, + .getattr = ecryptfs_getattr_link, .setxattr = ecryptfs_setxattr, .getxattr = ecryptfs_getxattr, .listxattr = ecryptfs_listxattr,
PATCH 109/139 ecryptfs: fix error code for missing xattrs in lower fs
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Christian Pulvermacher <[email protected]>
commit cfce08c6bdfb20ade979284e55001ca1f100ed51 upstream.
If the lower file system driver has extended attributes disabled, ecryptfs' own access functions return -ENOSYS instead of -EOPNOTSUPP. This breaks execution of programs in the ecryptfs mount, since the kernel expects the latter error when checking for security capabilities in xattrs.
--- fs/ecryptfs/inode.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/ecryptfs/inode.c +4 -4
@@ -1042,7 +1042,7 @@ ecryptfs_setxattr(struct dentry *dentry, lower_dentry =ecryptfs_dentry_to_lower (dentry);if (!lower_dentry->d_inode->i_op->setxattr) { - rc = -ENOSYS ; + rc = -EOPNOTSUPP ; goto out; }mutex_lock (&lower_dentry->d_inode->i_mutex);
@@ -1060,7 +1060,7 @@ ecryptfs_getxattr_lower(struct dentry *lint rc =0 ;if (!lower_dentry->d_inode->i_op->getxattr) { - rc = -ENOSYS ; + rc = -EOPNOTSUPP ; goto out; }mutex_lock (&lower_dentry->d_inode->i_mutex);
@@ -1087,7 +1087,7 @@ ecryptfs_listxattr(struct dentry *dentry lower_dentry =ecryptfs_dentry_to_lower (dentry);if (!lower_dentry->d_inode->i_op->listxattr) { - rc = -ENOSYS ; + rc = -EOPNOTSUPP ; goto out; }mutex_lock (&lower_dentry->d_inode->i_mutex);
@@ -1104,7 +1104,7 @@ static int ecryptfs_removexattr(struct d lower_dentry =ecryptfs_dentry_to_lower (dentry);if (!lower_dentry->d_inode->i_op->removexattr) { - rc = -ENOSYS ; + rc = -EOPNOTSUPP ; goto out; }mutex_lock (&lower_dentry->d_inode->i_mutex);
PATCH 110/139 USB: cdc-acm: Update to new autopm API
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Oliver Neukum <[email protected]>
commit 97d35f95552c9a0ee4777a7f04431a9fd1260478 upstream.
Update cdc-acm to the async methods eliminating the workqueue
[This fixes a reported lockup for the cdc-acm driver - gregkh]
--- drivers/usb/class/cdc-acm.c | 43 ++++++++++++++++++++++--------------------- drivers/usb/class/cdc-acm.h | 1 - 2 files changed, 22 insertions(+), 22 deletions(-)
drivers/usb/class/cdc-acm.c +22 -21
@@ -170,6 +170,7 @@ static void acm_write_done(struct acm *a { wb->use =0 ; acm->transmitting--; +usb_autopm_put_interface_async (acm->control); }/*
@@ -211,9 +212,12 @@ static int acm_write_start(struct acm *a }dbg ("%s susp_count: %d" , __func__, acm->susp_count); +usb_autopm_get_interface_async (acm->control);if (acm->susp_count) { - acm->delayed_wb = wb; -schedule_work (&acm->waker); +if (!acm->delayed_wb) + acm->delayed_wb = wb; +else +usb_autopm_put_interface_async (acm->control);spin_unlock_irqrestore (&acm->write_lock, flags);return 0 ;/* A white lie */ }
@@ -534,23 +538,6 @@ static void acm_softint(struct work_strutty_kref_put (tty); } -static void acm_waker (struct work_struct *waker) -{ - struct acm *acm = container_of(waker, struct acm, waker); -int rv; - - rv =usb_autopm_get_interface (acm->control); -if (rv <0 ) { -dev_err (&acm->dev->dev,"Autopm failure in %s\n" , __func__); -return ; - } -if (acm->delayed_wb) { -acm_start_wb (acm, acm->delayed_wb); - acm->delayed_wb =NULL ; - } -usb_autopm_put_interface (acm->control); -} -/* * TTY handlers */
@@ -1178,7 +1165,6 @@ made_compressed_probe: acm->urb_task.func = acm_rx_tasklet; acm->urb_task.data = (unsigned long ) acm;INIT_WORK (&acm->work, acm_softint); -INIT_WORK (&acm->waker, acm_waker);init_waitqueue_head (&acm->drain_wait);spin_lock_init (&acm->throttle_lock);spin_lock_init (&acm->write_lock);
@@ -1343,7 +1329,6 @@ static void stop_data_traffic(struct acmtasklet_enable (&acm->urb_task);cancel_work_sync (&acm->work); -cancel_work_sync (&acm->waker); }static void acm_disconnect (struct usb_interface *intf)
@@ -1435,6 +1420,7 @@ static int acm_suspend(struct usb_interfstatic int acm_resume (struct usb_interface *intf) {struct acm *acm =usb_get_intfdata (intf); +struct acm_wb *wb;int rv =0 ;int cnt;
@@ -1449,6 +1435,21 @@ static int acm_resume(struct usb_interfamutex_lock (&acm->mutex);if (acm->port.count) { rv =usb_submit_urb (acm->ctrlurb,GFP_NOIO ); + +spin_lock_irq (&acm->write_lock); +if (acm->delayed_wb) { + wb = acm->delayed_wb; + acm->delayed_wb =NULL ; +spin_unlock_irq (&acm->write_lock); +acm_start_wb (acm, acm->delayed_wb); + }else { +spin_unlock_irq (&acm->write_lock); + } + +/* +* delayed error checking because we must +* do the write path at all cost +*/ if (rv <0 ) goto err_out;
drivers/usb/class/cdc-acm.h +0 -1
@@ -112,7 +112,6 @@ struct acm {struct mutex mutex;struct usb_cdc_line_coding line;/* bits, stop, parity */ struct work_struct work;/* work queue entry for line discipline waking up */ -struct work_struct waker;wait_queue_head_t drain_wait;/* close processing */ struct tasklet_struct urb_task;/* rx processing */ spinlock_t throttle_lock;/* synchronize throtteling and read callback */
PATCH 111/139 USB: cdc-acm: Fix stupid NULL pointer in resume()
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Oliver Neukum <[email protected]>
commit f0730924e9e32bb8935c60040a26d94179355088 upstream.
Stupid logic bug passing a just nulled pointer
--- drivers/usb/class/cdc-acm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/class/cdc-acm.c +1 -1
@@ -1441,7 +1441,7 @@ static int acm_resume(struct usb_interfa wb = acm->delayed_wb; acm->delayed_wb =NULL ;spin_unlock_irq (&acm->write_lock); -acm_start_wb (acm, acm->delayed_wb); +acm_start_wb (acm, wb); }else {spin_unlock_irq (&acm->write_lock); }
PATCH 112/139 iwlwifi: clear all tx queues when firmware ready
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Wey-Yi Guy <[email protected]>
commit dff010ac8e57e43669518a14c0e945dfeb80c2a7 upstream.
Reset and clear all the tx queues when finished downloading runtime uCode and ready to go into operation mode.
--- drivers/net/wireless/iwlwifi/iwl-4965.c | 2 ++ drivers/net/wireless/iwlwifi/iwl-5000.c | 2 ++ 2 files changed, 4 insertions(+)
drivers/net/wireless/iwlwifi/iwl-4965.c +2 -0
@@ -581,6 +581,8 @@ static int iwl4965_alive_notify(struct iiwl4965_set_wr_ptrs (priv,IWL_CMD_QUEUE_NUM ,0 ); +/* reset to 0 to enable all the queue first */ + priv->txq_ctx_active_msk =0 ;/* Map each Tx/cmd queue to its corresponding fifo */ for (i =0 ; i <ARRAY_SIZE (default_queue_to_tx_fifo); i++) {int ac = default_queue_to_tx_fifo[i];
drivers/net/wireless/iwlwifi/iwl-5000.c +2 -0
@@ -657,6 +657,8 @@ int iwl5000_alive_notify(struct iwl_priviwl5000_set_wr_ptrs (priv,IWL_CMD_QUEUE_NUM ,0 ); +/* reset to 0 to enable all the queue first */ + priv->txq_ctx_active_msk =0 ;/* map qos queues to fifos one-to-one */ for (i =0 ; i <ARRAY_SIZE (iwl5000_default_queue_to_tx_fifo); i++) {int ac = iwl5000_default_queue_to_tx_fifo[i];
PATCH 113/139 iwlwifi: fix scan race
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Reinette Chatre <[email protected]>
commit bbcbb9ef9735c67da303d30bd6beb9e699f0f508 upstream.
There is a problem if an "internal short scan" is in progress when a mac80211 requested scan arrives. If this new scan request arrives within the "next_scan_jiffies" period then driver will immediately return success and complete the scan. The problem here is that the scan has not been fully initialized at this time (is_internal_short_scan is still set to true because of the currently running scan), which results in the scan completion never to be sent to mac80211. At this time also, evan though the internal short scan is still running the state (is_internal_short_scan) will be set to false, so when the internal scan does complete then mac80211 will receive a scan completion.
Fix this by checking right away if a scan is in progress when a scan request arrives from mac80211.
--- drivers/net/wireless/iwlwifi/iwl-scan.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-)
drivers/net/wireless/iwlwifi/iwl-scan.c +12 -15
@@ -404,21 +404,6 @@ EXPORT_SYMBOL(iwl_init_scan_params);static int iwl_scan_initiate (struct iwl_priv *priv) { -if (!iwl_is_ready_rf (priv)) { -IWL_DEBUG_SCAN (priv,"Aborting scan due to not ready.\n" ); -return -EIO ; - } - -if (test_bit (STATUS_SCANNING , &priv->status)) { -IWL_DEBUG_SCAN (priv,"Scan already in progress.\n" ); -return -EAGAIN ; - } - -if (test_bit (STATUS_SCAN_ABORTING , &priv->status)) { -IWL_DEBUG_SCAN (priv,"Scan request while abort pending\n" ); -return -EAGAIN ; - } -IWL_DEBUG_INFO (priv,"Starting scan...\n" );set_bit (STATUS_SCANNING , &priv->status); priv->scan_start = jiffies;
@@ -449,6 +434,18 @@ int iwl_mac_hw_scan(struct ieee80211_hw goto out_unlock; } +if (test_bit (STATUS_SCANNING , &priv->status)) { +IWL_DEBUG_SCAN (priv,"Scan already in progress.\n" ); + ret = -EAGAIN ; + goto out_unlock; + } + +if (test_bit (STATUS_SCAN_ABORTING , &priv->status)) { +IWL_DEBUG_SCAN (priv,"Scan request while abort pending\n" ); + ret = -EAGAIN ; + goto out_unlock; + } +/* We don't schedule scan within next_scan_jiffies period. * Avoid scanning during possible EAPOL exchange, return * success immediately.
PATCH 114/139 e1000e: stop cleaning when we reach tx_ring->next_to_use
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Terry Loftin <[email protected]>
commit dac876193cd79ced36d0462749ea47c05844fb49 upstream.
Tx ring buffers after tx_ring->next_to_use are volatile and could change, possibly causing a crash. Stop cleaning when we hit tx_ring->next_to_use.
--- drivers/net/e1000e/netdev.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/e1000e/netdev.c +2 -0
@@ -660,6 +660,8 @@ static bool e1000_clean_tx_irq(struct e1 i =0 ; } +if (i == tx_ring->next_to_use) +break ; eop = tx_ring->buffer_info[i].next_to_watch; eop_desc =E1000_TX_DESC (*tx_ring, eop); }
PATCH 115/139 perf_events, x86: Implement Intel Westmere/Nehalem-EX support
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Peter Zijlstra <[email protected]>
original patch commit ids: 452a339a976e7f782c786eb3f73080401e2fa3a6 and 134fbadf028a5977a1b06b0253d3ee33e6f0c642
perf_events, x86: Implement Intel Westmere support
The new Intel documentation includes Westmere arch specific event maps that are significantly different from the Nehalem ones. Add support for this generation.
Found the CPUID model numbers on wikipedia.
Also ammend some Nehalem constraints, spotted those when looking for the differences between Nehalem and Westmere.
LKML-Reference: <[email protected]>
perf, x86: Enable Nehalem-EX support
According to Intel Software Devel Manual Volume 3B, the Nehalem-EX PMU is just like regular Nehalem (except for the uncore support, which is completely different).
LKML-Reference: <[email protected]>
---
--- arch/x86/kernel/cpu/perf_event.c | 104 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 103 insertions(+), 1 deletion(-)
arch/x86/kernel/cpu/perf_event.c +103 -1
@@ -245,6 +245,97 @@ static u64 __read_mostly hw_cache_event_ [PERF_COUNT_HW_CACHE_OP_MAX ] [PERF_COUNT_HW_CACHE_RESULT_MAX ]; +static const u64 westmere_hw_cache_event_ids + [PERF_COUNT_HW_CACHE_MAX ] + [PERF_COUNT_HW_CACHE_OP_MAX ] + [PERF_COUNT_HW_CACHE_RESULT_MAX ] = +{ + [C (L1D ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =0x010b ,/* MEM_INST_RETIRED.LOADS */ + [C (RESULT_MISS ) ] =0x0151 ,/* L1D.REPL */ + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =0x020b ,/* MEM_INST_RETURED.STORES */ + [C (RESULT_MISS ) ] =0x0251 ,/* L1D.M_REPL */ + }, + [C (OP_PREFETCH ) ] = { + [C (RESULT_ACCESS ) ] =0x014e ,/* L1D_PREFETCH.REQUESTS */ + [C (RESULT_MISS ) ] =0x024e ,/* L1D_PREFETCH.MISS */ + }, + }, + [C (L1I ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =0x0380 ,/* L1I.READS */ + [C (RESULT_MISS ) ] =0x0280 ,/* L1I.MISSES */ + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =-1 , + [C (RESULT_MISS ) ] =-1 , + }, + [C (OP_PREFETCH ) ] = { + [C (RESULT_ACCESS ) ] =0x0 , + [C (RESULT_MISS ) ] =0x0 , + }, + }, + [C (LL ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =0x0324 ,/* L2_RQSTS.LOADS */ + [C (RESULT_MISS ) ] =0x0224 ,/* L2_RQSTS.LD_MISS */ + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =0x0c24 ,/* L2_RQSTS.RFOS */ + [C (RESULT_MISS ) ] =0x0824 ,/* L2_RQSTS.RFO_MISS */ + }, + [C (OP_PREFETCH ) ] = { + [C (RESULT_ACCESS ) ] =0x4f2e ,/* LLC Reference */ + [C (RESULT_MISS ) ] =0x412e ,/* LLC Misses */ + }, + }, + [C (DTLB ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =0x010b ,/* MEM_INST_RETIRED.LOADS */ + [C (RESULT_MISS ) ] =0x0108 ,/* DTLB_LOAD_MISSES.ANY */ + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =0x020b ,/* MEM_INST_RETURED.STORES */ + [C (RESULT_MISS ) ] =0x010c ,/* MEM_STORE_RETIRED.DTLB_MISS */ + }, + [C (OP_PREFETCH ) ] = { + [C (RESULT_ACCESS ) ] =0x0 , + [C (RESULT_MISS ) ] =0x0 , + }, + }, + [C (ITLB ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =0x01c0 ,/* INST_RETIRED.ANY_P */ + [C (RESULT_MISS ) ] =0x0185 ,/* ITLB_MISSES.ANY */ + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =-1 , + [C (RESULT_MISS ) ] =-1 , + }, + [C (OP_PREFETCH ) ] = { + [C (RESULT_ACCESS ) ] =-1 , + [C (RESULT_MISS ) ] =-1 , + }, + }, + [C (BPU ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =0x00c4 ,/* BR_INST_RETIRED.ALL_BRANCHES */ + [C (RESULT_MISS ) ] =0x03e8 ,/* BPU_CLEARS.ANY */ + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =-1 , + [C (RESULT_MISS ) ] =-1 , + }, + [C (OP_PREFETCH ) ] = { + [C (RESULT_ACCESS ) ] =-1 , + [C (RESULT_MISS ) ] =-1 , + }, + }, +}; +static __initconst u64 nehalem_hw_cache_event_ids [PERF_COUNT_HW_CACHE_MAX ] [PERF_COUNT_HW_CACHE_OP_MAX ]
@@ -2118,6 +2209,7 @@ static __init int intel_pmu_init(void)* Install the hw-cache-events table: */ switch (boot_cpu_data.x86_model) { +case 15 :/* original 65 nm celeron/pentium/core2/xeon, "Merom"/"Conroe" */ case 22 :/* single-core 65 nm celeron/core2solo "Merom-L"/"Conroe-L" */ case 23 :/* current 45 nm celeron/core2/xeon "Penryn"/"Wolfdale" */
@@ -2129,7 +2221,9 @@ static __init int intel_pmu_init(void) event_constraints = intel_core_event_constraints;break ;default : -case 26 : +case 26 :/* 45 nm nehalem, "Bloomfield" */ +case 30 :/* 45 nm nehalem, "Lynnfield" */ +case 46 :/* 45 nm nehalem-ex, "Beckton" */ memcpy (hw_cache_event_ids, nehalem_hw_cache_event_ids,sizeof (hw_cache_event_ids));
@@ -2142,6 +2236,14 @@ static __init int intel_pmu_init(void)pr_cont ("Atom events, " );break ; + +case 37 :/* 32 nm nehalem, "Clarkdale" */ +case 44 :/* 32 nm nehalem, "Gulftown" */ +memcpy (hw_cache_event_ids, westmere_hw_cache_event_ids, +sizeof (hw_cache_event_ids)); + +pr_cont ("Westmere events, " ); +break ; }return 0 ; }
PATCH 116/139 xfs: Non-blocking inode locking in IO completion
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Dave Chinner <[email protected]>
commit 77d7a0c2eeb285c9069e15396703d0cb9690ac50 upstream.
The introduction of barriers to loop devices has created a new IO order completion dependency that XFS does not handle. The loop device implements barriers using fsync and so turns a log IO in the XFS filesystem on the loop device into a data IO in the backing filesystem. That is, the completion of log IOs in the loop filesystem are now dependent on completion of data IO in the backing filesystem.
This can cause deadlocks when a flush daemon issues a log force with an inode locked because the IO completion of IO on the inode is blocked by the inode lock. This in turn prevents further data IO completion from occuring on all XFS filesystems on that CPU (due to the shared nature of the completion queues). This then prevents the log IO from completing because the log is waiting for data IO completion as well.
The fix for this new completion order dependency issue is to make the IO completion inode locking non-blocking. If the inode lock can't be grabbed, simply requeue the IO completion back to the work queue so that it can be processed later. This prevents the completion queue from being blocked and allows data IO completion on other inodes to proceed, hence avoiding completion order dependent deadlocks.
--- fs/xfs/linux-2.6/xfs_aops.c | 93 ++++++++++++++++++++++++++------------------ 1 file changed, 56 insertions(+), 37 deletions(-)
fs/xfs/linux-2.6/xfs_aops.c +56 -37
@@ -163,14 +163,17 @@ xfs_ioend_new_eof( }/* -* Update on-disk file size now that data has been written to disk. -* The current in-memory file size is i_size. If a write is beyond -* eof i_new_size will be the intended file size until i_size is -* updated. If this write does not extend all the way to the valid -* file size then restrict this update to the end of the write. +* Update on-disk file size now that data has been written to disk. The +* current in-memory file size is i_size. If a write is beyond eof i_new_size +* will be the intended file size until i_size is updated. If this write does +* not extend all the way to the valid file size then restrict this update to +* the end of the write. +* +* This function does not block as blocking on the inode lock in IO completion +* can lead to IO completion order dependency deadlocks.. If it can't get the +* inode ilock it will return EAGAIN. Callers must handle this. */ - -STATIC void +STATIC intxfs_setfilesize (xfs_ioend_t *ioend) {
@@ -181,9 +184,11 @@ xfs_setfilesize(ASSERT (ioend->io_type !=IOMAP_READ );if (unlikely (ioend->io_error)) -return ; +return 0 ; + +if (!xfs_ilock_nowait (ip,XFS_ILOCK_EXCL )) +return EAGAIN ; -xfs_ilock (ip,XFS_ILOCK_EXCL ); isize =xfs_ioend_new_eof (ioend);if (isize) { ip->i_d.di_size = isize;
@@ -191,6 +196,28 @@ xfs_setfilesize( }xfs_iunlock (ip,XFS_ILOCK_EXCL ); +return 0 ; +} + +/* +* Schedule IO completion handling on a xfsdatad if this was +* the final hold on this ioend. If we are asked to wait, +* flush the workqueue. +*/ +STATIC void +xfs_finish_ioend ( +xfs_ioend_t *ioend, +int wait) +{ +if (atomic_dec_and_test (&ioend->io_remaining)) { +struct workqueue_struct *wq; + + wq = (ioend->io_type ==IOMAP_UNWRITTEN ) ? + xfsconvertd_workqueue : xfsdatad_workqueue; +queue_work (wq, &ioend->io_work); +if (wait) +flush_workqueue (wq); + } }/*
@@ -198,11 +225,11 @@ xfs_setfilesize(*/ STATIC voidxfs_end_io ( -struct work_struct *work) +struct work_struct *work) { -xfs_ioend_t *ioend = -container_of (work, xfs_ioend_t, io_work); -struct xfs_inode *ip =XFS_I (ioend->io_inode); +xfs_ioend_t *ioend =container_of (work, xfs_ioend_t, io_work); +struct xfs_inode *ip =XFS_I (ioend->io_inode); +int error;/* * For unwritten extents we need to issue transactions to convert a
@@ -210,7 +237,6 @@ xfs_end_io(*/ if (ioend->io_type ==IOMAP_UNWRITTEN &&likely (!ioend->io_error && !XFS_FORCED_SHUTDOWN (ip->i_mount))) { -int error; error =xfs_iomap_write_unwritten (ip, ioend->io_offset, ioend->io_size);
@@ -222,30 +248,23 @@ xfs_end_io(* We might have to update the on-disk file size after extending * writes. */ -if (ioend->io_type !=IOMAP_READ ) -xfs_setfilesize (ioend); -xfs_destroy_ioend (ioend); -} - -/* -* Schedule IO completion handling on a xfsdatad if this was -* the final hold on this ioend. If we are asked to wait, -* flush the workqueue. -*/ -STATIC void -xfs_finish_ioend ( -xfs_ioend_t *ioend, -int wait) -{ -if (atomic_dec_and_test (&ioend->io_remaining)) { -struct workqueue_struct *wq; - - wq = (ioend->io_type ==IOMAP_UNWRITTEN ) ? - xfsconvertd_workqueue : xfsdatad_workqueue; -queue_work (wq, &ioend->io_work); -if (wait) -flush_workqueue (wq); +if (ioend->io_type !=IOMAP_READ ) { + error =xfs_setfilesize (ioend); +ASSERT (!error || error ==EAGAIN ); } + +/* +* If we didn't complete processing of the ioend, requeue it to the +* tail of the workqueue for another attempt later. Otherwise destroy +* it. +*/ +if (error ==EAGAIN ) { +atomic_inc (&ioend->io_remaining); +xfs_finish_ioend (ioend,0 ); +/* ensure we don't spin on blocked ioends */ +delay (1 ); + }else +xfs_destroy_ioend (ioend); }/*
PATCH 117/139 xfs: fix locking for inode cache radix tree tag updates
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Christoph Hellwig <[email protected]>
commit f1f724e4b523d444c5a598d74505aefa3d6844d2 upstream.
The radix-tree code requires it's users to serialize tag updates against other updates to the tree. While XFS protects tag updates against each other it does not serialize them against updates of the tree contents, which can lead to tag corruption. Fix the inode cache to always take pag_ici_lock in exclusive mode when updating radix tree tags.
--- fs/xfs/linux-2.6/xfs_sync.c | 4 ++-- fs/xfs/xfs_iget.c | 19 +++++++++++++------ 2 files changed, 15 insertions(+), 8 deletions(-)
fs/xfs/linux-2.6/xfs_sync.c +2 -2
@@ -693,12 +693,12 @@ xfs_inode_set_reclaim_tag(xfs_mount_t *mp = ip->i_mount;xfs_perag_t *pag =xfs_get_perag (mp, ip->i_ino); -read_lock (&pag->pag_ici_lock); +write_lock (&pag->pag_ici_lock);spin_lock (&ip->i_flags_lock);__xfs_inode_set_reclaim_tag (pag, ip);__xfs_iflags_set (ip,XFS_IRECLAIMABLE );spin_unlock (&ip->i_flags_lock); -read_unlock (&pag->pag_ici_lock); +write_unlock (&pag->pag_ici_lock);xfs_put_perag (mp, pag); }
fs/xfs/xfs_iget.c +13 -6
@@ -190,13 +190,12 @@ xfs_iget_cache_hit(trace_xfs_iget_reclaim (ip);/* -* We need to set XFS_INEW atomically with clearing the -* reclaimable tag so that we do have an indicator of the -* inode still being initialized. +* We need to set XFS_IRECLAIM to prevent xfs_reclaim_inode +* from stomping over us while we recycle the inode. We can't +* clear the radix tree reclaimable tag yet as it requires +* pag_ici_lock to be held exclusive. */ - ip->i_flags |=XFS_INEW ; - ip->i_flags &= ~XFS_IRECLAIMABLE ; -__xfs_inode_clear_reclaim_tag (mp, pag, ip); + ip->i_flags |=XFS_IRECLAIM ;spin_unlock (&ip->i_flags_lock);read_unlock (&pag->pag_ici_lock);
@@ -216,7 +215,15 @@ xfs_iget_cache_hit(trace_xfs_iget_reclaim (ip); goto out_error; } + +write_lock (&pag->pag_ici_lock); +spin_lock (&ip->i_flags_lock); + ip->i_flags &= ~(XFS_IRECLAIMABLE |XFS_IRECLAIM ); + ip->i_flags |=XFS_INEW ; +__xfs_inode_clear_reclaim_tag (mp, pag, ip); inode->i_state =I_NEW ; +spin_unlock (&ip->i_flags_lock); +write_unlock (&pag->pag_ici_lock); }else {/* If the VFS inode is being torn down, pause and try again. */ if (!igrab (inode)) {
PATCH 118/139 xfs: check for more work before sleeping in xfssyncd
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Dave Chinner <[email protected]>
commit 20f6b2c785cf187445f126321638ab8ba7aa7494 upstream.
xfssyncd processes a queue of work by detaching the queue and then iterating over all the work items. It then sleeps for a time period or until new work comes in. If new work is queued while xfssyncd is actively processing the detached work queue, it will not process that new work until after a sleep timeout or the next work event queued wakes it.
Fix this by checking the work queue again before going to sleep.
--- fs/xfs/linux-2.6/xfs_sync.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/xfs/linux-2.6/xfs_sync.c +3 -3
@@ -613,7 +613,8 @@ xfssyncd(set_freezable (); timeleft = xfs_syncd_centisecs *msecs_to_jiffies (10 );for (;;) { - timeleft =schedule_timeout_interruptible (timeleft); +if (list_empty (&mp->m_sync_list)) + timeleft =schedule_timeout_interruptible (timeleft);/* swsusp */ try_to_freeze ();if (kthread_should_stop () &&list_empty (&mp->m_sync_list))
@@ -633,8 +634,7 @@ xfssyncd(list_add_tail (&mp->m_sync_work.w_list, &mp->m_sync_list); } -list_for_each_entry_safe (work, n, &mp->m_sync_list, w_list) -list_move (&work->w_list, &tmp); +list_splice_init (&mp->m_sync_list, &tmp);spin_unlock (&mp->m_sync_lock);list_for_each_entry_safe (work, n, &tmp, w_list) {
PATCH 119/139 ACPI: EC: Allow multibyte access to EC
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alexey Starikovskiy <[email protected]>
commit dadf28a10c3eb29421837a2e413ab869ebd upstream
http://bugzilla.kernel.org/show_bug.cgi?id=14667
[bwh: Backport to 2.6.32; same applies to 2.6.33]
--- drivers/acpi/acpica/exprep.c | 12 ++++++++++++ drivers/acpi/ec.c | 35 +++++++++-------------------------- 2 files changed, 21 insertions(+), 26 deletions(-)
drivers/acpi/acpica/exprep.c +12 -0
@@ -468,6 +468,18 @@ acpi_status acpi_ex_prep_field_value(stracpi_ut_add_reference (obj_desc->field.region_obj); +/* allow full data read from EC address space */ +if (obj_desc->field.region_obj->region.space_id == +ACPI_ADR_SPACE_EC ) { +if (obj_desc->common_field.bit_length >8 ) + obj_desc->common_field.access_bit_width = +ACPI_ROUND_UP (obj_desc->common_field. + bit_length,8 ); + obj_desc->common_field.access_byte_width = +ACPI_DIV_8 (obj_desc->common_field. + access_bit_width); + } + ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, "RegionField: BitOff %X, Off %X, Gran %X, Region %p\n", obj_desc->field.start_field_bit_offset,
drivers/acpi/ec.c +9 -26
@@ -589,12 +589,12 @@ static u32 acpi_ec_gpe_handler(void *datstatic acpi_status acpi_ec_space_handler (u32 function,acpi_physical_address address, -u32 bits,acpi_integer *value, +u32 bits,acpi_integer *value64,void *handler_context,void *region_context) {struct acpi_ec *ec = handler_context; -int result =0 , i; -u8 temp =0 ; +int result =0 , i, bytes = bits /8 ; +u8 *value = (u8 *)value64;if ((address >0xFF ) || !value || !handler_context)return AE_BAD_PARAMETER ;
@@ -602,32 +602,15 @@ acpi_ec_space_handler(u32 function, acpiif (function !=ACPI_READ && function !=ACPI_WRITE )return AE_BAD_PARAMETER ; -if (bits !=8 && acpi_strict) -return AE_BAD_PARAMETER ; - -if (EC_FLAGS_MSI ) +if (EC_FLAGS_MSI || bits >8 )acpi_ec_burst_enable (ec); -if (function ==ACPI_READ ) { - result =acpi_ec_read (ec, address, &temp); - *value = temp; - }else { - temp =0xff & (*value); - result =acpi_ec_write (ec, address, temp); - } - -for (i =8 ;unlikely (bits - i >0 ); i +=8 ) { - ++address; -if (function ==ACPI_READ ) { - result =acpi_ec_read (ec, address, &temp); - (*value) |= ((acpi_integer )temp) << i; - }else { - temp =0xff & ((*value) >> i); - result =acpi_ec_write (ec, address, temp); - } - } +for (i =0 ; i < bytes; ++i, ++address, ++value) + result = (function ==ACPI_READ ) ? +acpi_ec_read (ec, address, value) : +acpi_ec_write (ec, address, *value); -if (EC_FLAGS_MSI ) +if (EC_FLAGS_MSI || bits >8 )acpi_ec_burst_disable (ec);switch (result) {
PATCH 120/139 md/raid5: allow for more than 2^31 chunks.
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: NeilBrown <[email protected]>
commit 35f2a591192d0a5d9f7fc696869c76f0b8e49c3d upstream.
With many large drives and small chunk sizes it is possible to create a RAID5 with more than 2^31 chunks. Make sure this works.
--- drivers/md/raid5.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-)
drivers/md/raid5.c +7 -12
@@ -1649,8 +1649,8 @@ static sector_t raid5_compute_sector(rai int previous, int *dd_idx, struct stripe_head *sh) { - long stripe; -unsigned long chunk_number; + sector_t stripe; +sector_t chunk_number;unsigned int chunk_offset;int pd_idx, qd_idx;int ddf_layout =0 ;
@@ -1670,17 +1670,12 @@ static sector_t raid5_compute_sector(rai*/ chunk_offset =sector_div (r_sector, sectors_per_chunk); chunk_number = r_sector; -BUG_ON (r_sector != chunk_number);/* * Compute the stripe number */ - stripe = chunk_number / data_disks; - -/* -* Compute the data disk and parity disk indexes inside the stripe -*/ - *dd_idx = chunk_number % data_disks; + stripe = chunk_number; + *dd_idx =sector_div (stripe, data_disks);/* * Select the parity disk based on the user selected algorithm.
@@ -1869,14 +1864,14 @@ static sector_t compute_blocknr(struct s : conf->algorithm;sector_t stripe;int chunk_offset; -int chunk_number, dummy1, dd_idx = i; +sector_t chunk_number; +int dummy1, dd_idx = i;sector_t r_sector;struct stripe_head sh2; chunk_offset =sector_div (new_sector, sectors_per_chunk); stripe = new_sector; -BUG_ON (new_sector != stripe);if (i == sh->pd_idx)return 0 ;
@@ -1969,7 +1964,7 @@ static sector_t compute_blocknr(struct s } chunk_number = stripe * data_disks + i; - r_sector = (sector_t )chunk_number * sectors_per_chunk + chunk_offset; + r_sector = chunk_number * sectors_per_chunk + chunk_offset; check =raid5_compute_sector (conf, r_sector, previous, &dummy1, &sh2);
PATCH 121/139 ACPI: EC: Limit burst to 64 bits
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alexey Starikovskiy <[email protected]>
commit 2060c44576c79086ff24718878d7edaa7384a985 upstream.
access_bit_width field is u8 in ACPICA, thus 256 value written to it becomes 0, causing divide by zero later.
Proper fix would be to remove access_bit_width at all, just because we already have access_byte_width, which is access_bit_width / 8. Limit access width to 64 bit for now.
https://bugzilla.kernel.org/show_bug.cgi?id=15749
fixes regression caused by the fix for:
https://bugzilla.kernel.org/show_bug.cgi?id=14667
--- drivers/acpi/acpica/exprep.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/acpi/acpica/exprep.c +11 -6
@@ -471,13 +471,18 @@ acpi_status acpi_ex_prep_field_value(str/* allow full data read from EC address space */ if (obj_desc->field.region_obj->region.space_id ==ACPI_ADR_SPACE_EC ) { -if (obj_desc->common_field.bit_length >8 ) - obj_desc->common_field.access_bit_width = -ACPI_ROUND_UP (obj_desc->common_field. - bit_length,8 ); +if (obj_desc->common_field.bit_length >8 ) { +unsigned width = +ACPI_ROUND_BITS_UP_TO_BYTES ( + obj_desc->common_field.bit_length); +// access_bit_width is u8, don't overflow it +if (width >8 ) + width =8 ; obj_desc->common_field.access_byte_width = -ACPI_DIV_8 (obj_desc->common_field. - access_bit_width); + width; + obj_desc->common_field.access_bit_width = +8 * width; + } } ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
PATCH 122/139 modules: fix incorrect percpu usage
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Mathieu Desnoyers <[email protected]>
Mainline does not need this fix, as commit 259354deaaf03d49a02dbb9975d6ec2a54675672 fixed the problem by refactoring.
Should use per_cpu_ptr() to obfuscate the per cpu pointers (RELOC_HIDE is needed for per cpu pointers).
Introduced by commit:
module.c: commit 6b588c18f8dacfa6d7957c33c5ff832096e752d3
This patch should be queued for the stable branch, for kernels 2.6.29.x to 2.6.33.x. (tested on 2.6.33.1 x86_64)
--- kernel/module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/module.c +1 -1
@@ -405,7 +405,7 @@ static void percpu_modcopy(void *pcpudesint cpu;for_each_possible_cpu (cpu) - memcpy(pcpudest + per_cpu_offset(cpu), from, size); + memcpy(per_cpu_ptr(pcpudest, cpu), from, size); }#else /* ... !CONFIG_SMP */
PATCH 123/139 lockdep: fix incorrect percpu usage
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Mathieu Desnoyers <[email protected]>
The mainline kernel as of 2.6.34-rc5 is not affected by this problem because commit 10fad5e46f6c7bdfb01b1a012380a38e3c6ab346 fixed it by refactoring.
lockdep fix incorrect percpu usage
Should use per_cpu_ptr() to obfuscate the per cpu pointers (RELOC_HIDE is needed for per cpu pointers).
git blame points to commit:
lockdep.c: commit 8e18257d29238311e82085152741f0c3aa18b74d
But it's really just moving the code around. But it's enough to say that the problems appeared before Jul 19 01:48:54 2007, which brings us back to 2.6.23.
It should be applied to stable 2.6.23.x to 2.6.33.x (or whichever of these stable branches are still maintained).
(tested on 2.6.33.1 x86_64)
--- kernel/lockdep.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/lockdep.c +3 -3
@@ -600,9 +600,9 @@ static int static_obj(void *obj)* percpu var? */ for_each_possible_cpu (i) { - start = (unsigned long ) &__per_cpu_start +per_cpu_offset (i); - end = (unsigned long ) &__per_cpu_start +PERCPU_ENOUGH_ROOM - +per_cpu_offset (i); + start = (unsigned long )per_cpu_ptr (&__per_cpu_start, i); + end = (unsigned long )per_cpu_ptr (&__per_cpu_start + +PERCPU_ENOUGH_ROOM , i);if ((addr >= start) && (addr < end))return 1 ;
PATCH 124/139 module: fix __module_ref_addr()
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Mathieu Desnoyers <[email protected]>
The __module_ref_addr() problem disappears in 2.6.34-rc kernels because these percpu accesses were re-factored.
__module_ref_addr() should use per_cpu_ptr() to obfuscate the pointer (RELOC_HIDE is needed for per cpu pointers).
This non-standard per-cpu pointer use has been introduced by commit 720eba31f47aeade8ec130ca7f4353223c49170f
It causes a NULL pointer exception on some configurations when CONFIG_TRACING is enabled on 2.6.33. This patch fixes the problem (acknowledged by Randy who reported the bug).
It did not appear to hurt previously because most of the accesses were done through local_inc, which probably obfuscated the access enough that no compiler optimizations were done. But with local_read() done when CONFIG_TRACING is active, this becomes a problem. Non-CONFIG_TRACING is probably affected as well (module.c contains local_set and local_read that use __module_ref_addr()), but I guess nobody noticed because we've been lucky enough that the compiler did not generate the inappropriate optimization pattern there.
This patch should be queued for the 2.6.29.x through 2.6.33.x stable branches. (tested on 2.6.33.1 x86_64)
--- include/linux/module.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/module.h +1 -1
@@ -457,7 +457,7 @@ void symbol_put_addr(void *addr);static inline local_t *__module_ref_addr (struct module *mod,int cpu) {#ifdef CONFIG_SMP -return (local_t *) (mod->refptr +per_cpu_offset (cpu)); +return (local_t *)per_cpu_ptr (mod->refptr, cpu);#else return &mod->ref;#endif
PATCH 125/139 md: deal with merge_bvec_fn in component devices better.
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: NeilBrown <[email protected]>
commit 627a2d3c29427637f4c5d31ccc7fcbd8d312cd71 upstream.
If a component device has a merge_bvec_fn then as we never call it we must ensure we never need to. Currently this is done by setting max_sector to 1 PAGE, however this does not stop a bio being created with several sub-page iovecs that would violate the merge_bvec_fn.
So instead set max_phys_segments to 1 and set the segment boundary to the same as a page boundary to ensure there is only ever one single-page segment of IO requested at a time.
This can particularly be an issue when 'xen' is used as it is known to submit multiple small buffers in a single bio.
--- drivers/md/linear.c | 12 +++++++----- drivers/md/multipath.c | 20 ++++++++++++-------- drivers/md/raid0.c | 13 +++++++------ drivers/md/raid10.c | 28 +++++++++++++++++----------- 4 files changed, 43 insertions(+), 30 deletions(-)
drivers/md/linear.c +7 -5
@@ -172,12 +172,14 @@ static linear_conf_t *linear_conf(mddev_disk_stack_limits (mddev->gendisk, rdev->bdev, rdev->data_offset <<9 );/* as we don't honour merge_bvec_fn, we must never risk -* violating it, so limit ->max_sector to one PAGE, as -* a one page request is never in violation. +* violating it, so limit max_phys_segments to 1 lying within +* a single page. */ -if (rdev->bdev->bd_disk->queue->merge_bvec_fn && -queue_max_sectors (mddev->queue) > (PAGE_SIZE >>9 )) -blk_queue_max_sectors (mddev->queue,PAGE_SIZE >>9 ); +if (rdev->bdev->bd_disk->queue->merge_bvec_fn) { +blk_queue_max_phys_segments (mddev->queue,1 ); +blk_queue_segment_boundary (mddev->queue, +PAGE_CACHE_SIZE -1 ); + } conf->array_sectors += rdev->sectors; cnt++;
drivers/md/multipath.c +12 -8
@@ -301,14 +301,16 @@ static int multipath_add_disk(mddev_t *m rdev->data_offset << 9);/* as we don't honour merge_bvec_fn, we must never risk -* violating it, so limit ->max_sector to one PAGE, as -* a one page request is never in violation. +* violating it, so limit ->max_phys_segments to one, lying +* within a single page. * (Note: it is very unlikely that a device with * merge_bvec_fn will be involved in multipath.) */ -if (q->merge_bvec_fn && -queue_max_sectors (q) > (PAGE_SIZE >>9 )) -blk_queue_max_sectors (mddev->queue,PAGE_SIZE >>9 ); +if (q->merge_bvec_fn) { +blk_queue_max_phys_segments (mddev->queue,1 ); +blk_queue_segment_boundary (mddev->queue, +PAGE_CACHE_SIZE -1 ); + } conf->working_disks++; mddev->degraded--;
@@ -476,9 +478,11 @@ static int multipath_run (mddev_t *mddev/* as we don't honour merge_bvec_fn, we must never risk * violating it, not that we ever expect a device with * a merge_bvec_fn to be involved in multipath */ -if (rdev->bdev->bd_disk->queue->merge_bvec_fn && -queue_max_sectors (mddev->queue) > (PAGE_SIZE >>9 )) -blk_queue_max_sectors (mddev->queue,PAGE_SIZE >>9 ); +if (rdev->bdev->bd_disk->queue->merge_bvec_fn) { +blk_queue_max_phys_segments (mddev->queue,1 ); +blk_queue_segment_boundary (mddev->queue, +PAGE_CACHE_SIZE -1 ); + }if (!test_bit (Faulty, &rdev->flags)) conf->working_disks++;
drivers/md/raid0.c +7 -6
@@ -176,14 +176,15 @@ static int create_strip_zones(mddev_t *mdisk_stack_limits (mddev->gendisk, rdev1->bdev, rdev1->data_offset <<9 );/* as we don't honour merge_bvec_fn, we must never risk -* violating it, so limit ->max_sector to one PAGE, as -* a one page request is never in violation. +* violating it, so limit ->max_phys_segments to 1, lying within +* a single page. */ -if (rdev1->bdev->bd_disk->queue->merge_bvec_fn && -queue_max_sectors (mddev->queue) > (PAGE_SIZE >>9 )) -blk_queue_max_sectors (mddev->queue,PAGE_SIZE >>9 ); - +if (rdev1->bdev->bd_disk->queue->merge_bvec_fn) { +blk_queue_max_phys_segments (mddev->queue,1 ); +blk_queue_segment_boundary (mddev->queue, +PAGE_CACHE_SIZE -1 ); + }if (!smallest || (rdev1->sectors < smallest->sectors)) smallest = rdev1; cnt++;
drivers/md/raid10.c +17 -11
@@ -1155,13 +1155,17 @@ static int raid10_add_disk(mddev_t *mddedisk_stack_limits (mddev->gendisk, rdev->bdev, rdev->data_offset <<9 ); -/* as we don't honour merge_bvec_fn, we must never risk -* violating it, so limit ->max_sector to one PAGE, as -* a one page request is never in violation. +/* as we don't honour merge_bvec_fn, we must +* never risk violating it, so limit +* ->max_phys_segments to one lying with a single +* page, as a one page request is never in +* violation. */ -if (rdev->bdev->bd_disk->queue->merge_bvec_fn && -queue_max_sectors (mddev->queue) > (PAGE_SIZE >>9 )) -blk_queue_max_sectors (mddev->queue,PAGE_SIZE >>9 ); +if (rdev->bdev->bd_disk->queue->merge_bvec_fn) { +blk_queue_max_phys_segments (mddev->queue,1 ); +blk_queue_segment_boundary (mddev->queue, +PAGE_CACHE_SIZE -1 ); + } p->head_position =0 ; rdev->raid_disk = mirror;
@@ -2255,12 +2259,14 @@ static int run(mddev_t *mddev)disk_stack_limits (mddev->gendisk, rdev->bdev, rdev->data_offset <<9 );/* as we don't honour merge_bvec_fn, we must never risk -* violating it, so limit ->max_sector to one PAGE, as -* a one page request is never in violation. +* violating it, so limit max_phys_segments to 1 lying +* within a single page. */ -if (rdev->bdev->bd_disk->queue->merge_bvec_fn && -queue_max_sectors (mddev->queue) > (PAGE_SIZE >>9 )) -blk_queue_max_sectors (mddev->queue,PAGE_SIZE >>9 ); +if (rdev->bdev->bd_disk->queue->merge_bvec_fn) { +blk_queue_max_phys_segments (mddev->queue,1 ); +blk_queue_segment_boundary (mddev->queue, +PAGE_CACHE_SIZE -1 ); + } disk->head_position =0 ; }
PATCH 126/139 powerpc: Fix SMP build with disabled CPU hotplugging.
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Adam Lackorzynski <[email protected]>
commit 5b72d74ce2fccca2a301de60f31b16ddf5c93984 upstream.
Compiling 2.6.33 with SMP enabled and HOTPLUG_CPU disabled gives me the following link errors:
LD init/built-in.o
LD .tmp_vmlinux1arch/powerpc/platforms/built-in.o: In function `.smp_xics_setup_cpu':
smp.c:(.devinit.text+0x88): undefined reference to .set_cpu_current_state' smp.c:(.devinit.text+0x94): undefined reference to .set_default_offline_state' arch/powerpc/platforms/built-in.o: In function `.smp_pSeries_kick_cpu':
smp.c:(.devinit.text+0x13c): undefined reference to .set_preferred_offline_state' smp.c:(.devinit.text+0x148): undefined reference to .get_cpu_current_state' smp.c:(.devinit.text+0x1a8): undefined reference to `.get_cpu_current_state'
make: *** [.tmp_vmlinux1] Error 1
The following change fixes that for me and seems to work as expected.
--- arch/powerpc/platforms/pseries/offline_states.h | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
arch/powerpc/platforms/pseries/offline_states.h +21 -1
@@ -9,10 +9,30 @@ enum cpu_state_vals {CPU_MAX_OFFLINE_STATES }; +#ifdef CONFIG_HOTPLUG_CPU extern enum cpu_state_vals get_cpu_current_state (int cpu);extern void set_cpu_current_state (int cpu,enum cpu_state_vals state); -extern enum cpu_state_vals get_preferred_offline_state (int cpu);extern void set_preferred_offline_state (int cpu,enum cpu_state_vals state);extern void set_default_offline_state (int cpu); +#else +static inline enum cpu_state_vals get_cpu_current_state (int cpu) +{ +return CPU_STATE_ONLINE ; +} + +static inline void set_cpu_current_state (int cpu,enum cpu_state_vals state) +{ +} + +static inline void set_preferred_offline_state (int cpu,enum cpu_state_vals state) +{ +} + +static inline void set_default_offline_state (int cpu) +{ +} +#endif + +extern enum cpu_state_vals get_preferred_offline_state (int cpu);extern int start_secondary (void );#endif
PATCH 127/139 ext4: fix async i/o writes beyond 4GB to a sparse file
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Eric Sandeen <[email protected]>
commit a1de02dccf906faba2ee2d99cac56799bda3b96a upstream.
The "offset" member in ext4_io_end holds bytes, not blocks, so ext4_lblk_t is wrong - and too small (u32).
This caused the async i/o writes to sparse files beyond 4GB to fail when they wrapped around to 0.
Also fix up the type of arguments to ext4_convert_unwritten_extents(), it gets ssize_t from ext4_end_aio_dio_nolock() and ext4_ext_direct_IO().
--- fs/ext4/ext4.h | 6 +++--- fs/ext4/extents.c | 2 +- fs/ext4/inode.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)
fs/ext4/ext4.h +3 -3
@@ -139,8 +139,8 @@ typedef struct ext4_io_end {struct inode *inode;/* file being written to */ unsigned int flag;/* unwritten or not */ int error;/* I/O error code */ -ext4_lblk_t offset;/* offset in the file */ -size_t size;/* size of the extent */ +loff_t offset;/* offset in the file */ +ssize_t size;/* size of the extent */ struct work_struct work;/* data work queue */ } ext4_io_end_t;
@@ -1744,7 +1744,7 @@ extern void ext4_ext_release(struct supeextern long ext4_fallocate (struct inode *inode,int mode,loff_t offset,loff_t len);extern int ext4_convert_unwritten_extents (struct inode *inode,loff_t offset, -loff_t len); +ssize_t len);extern int ext4_get_blocks (handle_t *handle,struct inode *inode,sector_t block,unsigned int max_blocks,struct buffer_head *bh,int flags);
fs/ext4/extents.c +1 -1
@@ -3603,7 +3603,7 @@ retry:* Returns 0 on success. */ int ext4_convert_unwritten_extents (struct inode *inode,loff_t offset, -loff_t len) +ssize_t len) {handle_t *handle;ext4_lblk_t block;
fs/ext4/inode.c +1 -1
@@ -3551,7 +3551,7 @@ static int ext4_end_aio_dio_nolock(ext4_ {struct inode *inode = io->inode;loff_t offset = io->offset; -size_t size = io->size; +ssize_t size = io->size;int ret =0 ; ext4_debug("end_aio_dio_onlock: io 0x%p from inode %lu,list->next 0x%p,"
PATCH 128/139 sched: Use proper type in sched_getaffinity()
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: KOSAKI Motohiro <[email protected]>
commit 8bc037fb89bb3104b9ae290d18c877624cd7d9cc upstream.
Using the proper type fixes the following compiler warning:
kernel/sched.c:4850: warning: comparison of distinct pointer types lacks a cast
LKML-Reference: <[email protected]>
--- kernel/sched.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched.c +1 -1
@@ -6727,7 +6727,7 @@ SYSCALL_DEFINE3(sched_getaffinity, pid_t ret =sched_getaffinity (pid, mask);if (ret ==0 ) { -int retlen =min (len,cpumask_size ()); +size_t retlen =min_t (size_t, len,cpumask_size ());if (copy_to_user (user_mask_ptr, mask, retlen)) ret = -EFAULT ;
PATCH 129/139 KVM: VMX: Update instruction length on intercepted BP
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jan Kiszka <[email protected]>
(Cherry-picked from commit c573cd22939e54fc1b8e672054a505048987a7cb)
We intercept #BP while in guest debugging mode. As VM exits due to intercepted exceptions do not necessarily come with valid idt_vectoring, we have to update event_exit_inst_len explicitly in such cases. At least in the absence of migration, this ensures that re-injections of #BP will find and use the correct instruction length.
--- arch/x86/kvm/vmx.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
arch/x86/kvm/vmx.c +13 -0
@@ -2719,6 +2719,12 @@ static int handle_rmode_exception(structkvm_queue_exception (vcpu, vec);return 1 ;case BP_VECTOR : +/* +* Update instruction length as we may reinject the exception +* from user space while in guest debugging mode. +*/ +to_vmx (vcpu)->vcpu.arch.event_exit_inst_len = +vmcs_read32 (VM_EXIT_INSTRUCTION_LEN );if (vcpu->guest_debug &KVM_GUESTDBG_USE_SW_BP )return 0 ;/* fall through */
@@ -2841,6 +2847,13 @@ static int handle_exception(struct kvm_v kvm_run->debug.arch.dr7 =vmcs_readl (GUEST_DR7 );/* fall through */ case BP_VECTOR : +/* +* Update instruction length as we may reinject #BP from +* user space while in guest debugging mode. Reading it for +* #DB as well causes no harm, it is not used in that case. +*/ + vmx->vcpu.arch.event_exit_inst_len = +vmcs_read32 (VM_EXIT_INSTRUCTION_LEN ); kvm_run->exit_reason =KVM_EXIT_DEBUG ; kvm_run->debug.arch.pc =vmcs_readl (GUEST_CS_BASE ) + rip; kvm_run->debug.arch.exception = ex_no;
PATCH 130/139 KVM: SVM: Fix memory leaks that happen when svm_create_vcpu() fails
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Takuya Yoshikawa <[email protected]>
(Cherry-picked from commit b7af40433870aa0636932ad39b0c48a0cb319057)
svm_create_vcpu() does not free the pages allocated during the creation when it fails to complete the allocations. This patch fixes it.
--- arch/x86/kvm/svm.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-)
arch/x86/kvm/svm.c +15 -10
@@ -698,29 +698,28 @@ static struct kvm_vcpu *svm_create_vcpu(if (err) goto free_svm; + err = -ENOMEM ; page =alloc_page (GFP_KERNEL ); -if (!page) { - err = -ENOMEM ; +if (!page) goto uninit; - } - err = -ENOMEM ; msrpm_pages =alloc_pages (GFP_KERNEL ,MSRPM_ALLOC_ORDER );if (!msrpm_pages) - goto uninit; + goto free_page1; nested_msrpm_pages =alloc_pages (GFP_KERNEL ,MSRPM_ALLOC_ORDER );if (!nested_msrpm_pages) - goto uninit; - - svm->msrpm =page_address (msrpm_pages); -svm_vcpu_init_msrpm (svm->msrpm); + goto free_page2; hsave_page =alloc_page (GFP_KERNEL );if (!hsave_page) - goto uninit; + goto free_page3; + svm->nested.hsave =page_address (hsave_page); + svm->msrpm =page_address (msrpm_pages); +svm_vcpu_init_msrpm (svm->msrpm); + svm->nested.msrpm =page_address (nested_msrpm_pages); svm->vmcb =page_address (page);
@@ -737,6 +736,12 @@ static struct kvm_vcpu *svm_create_vcpu(return &svm->vcpu; +free_page3: +__free_pages (nested_msrpm_pages,MSRPM_ALLOC_ORDER ); +free_page2: +__free_pages (msrpm_pages,MSRPM_ALLOC_ORDER ); +free_page1: +__free_page (page); uninit:kvm_vcpu_uninit (&svm->vcpu); free_svm:
PATCH 131/139 KVM: Dont spam kernel log when injecting exceptions due to bad cr writes
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Avi Kivity <[email protected]>
(Cherry-picked from commit d6a23895aa82353788a1cc5a1d9a1c963465463e)
These are guest-triggerable.
--- arch/x86/kvm/x86.c | 27 --------------------------- 1 file changed, 27 deletions(-)
arch/x86/kvm/x86.c +0 -27
@@ -384,21 +384,16 @@ out:void kvm_set_cr0 (struct kvm_vcpu *vcpu,unsigned long cr0) {if (cr0 &CR0_RESERVED_BITS ) { -printk (KERN_DEBUG "set_cr0: 0x%lx #GP, reserved bits 0x%lx\n" , - cr0, vcpu->arch.cr0);kvm_inject_gp (vcpu,0 );return ; }if ((cr0 &X86_CR0_NW ) && !(cr0 &X86_CR0_CD )) { -printk (KERN_DEBUG "set_cr0: #GP, CD == 0 && NW == 1\n" );kvm_inject_gp (vcpu,0 );return ; }if ((cr0 &X86_CR0_PG ) && !(cr0 &X86_CR0_PE )) { -printk (KERN_DEBUG "set_cr0: #GP, set PG flag " -"and a clear PE flag\n" );kvm_inject_gp (vcpu,0 );return ; }
@@ -409,15 +404,11 @@ void kvm_set_cr0(struct kvm_vcpu *vcpu,int cs_db, cs_l;if (!is_pae (vcpu)) { -printk (KERN_DEBUG "set_cr0: #GP, start paging " -"in long mode while PAE is disabled\n" );kvm_inject_gp (vcpu,0 );return ; } kvm_x86_ops->get_cs_db_l_bits (vcpu, &cs_db, &cs_l);if (cs_l) { -printk (KERN_DEBUG "set_cr0: #GP, start paging " -"in long mode while CS.L == 1\n" );kvm_inject_gp (vcpu,0 );return ;
@@ -425,8 +416,6 @@ void kvm_set_cr0(struct kvm_vcpu *vcpu, } else#endif if (is_pae (vcpu) && !load_pdptrs (vcpu, vcpu->arch.cr3)) { -printk (KERN_DEBUG "set_cr0: #GP, pdptrs " -"reserved bits\n" );kvm_inject_gp (vcpu,0 );return ; }
@@ -453,28 +442,23 @@ void kvm_set_cr4(struct kvm_vcpu *vcpu,unsigned long pdptr_bits =X86_CR4_PGE |X86_CR4_PSE |X86_CR4_PAE ;if (cr4 &CR4_RESERVED_BITS ) { -printk (KERN_DEBUG "set_cr4: #GP, reserved bits\n" );kvm_inject_gp (vcpu,0 );return ; }if (is_long_mode (vcpu)) {if (!(cr4 &X86_CR4_PAE )) { -printk (KERN_DEBUG "set_cr4: #GP, clearing PAE while " -"in long mode\n" );kvm_inject_gp (vcpu,0 );return ; } }else if (is_paging (vcpu) && (cr4 &X86_CR4_PAE ) && ((cr4 ^ old_cr4) & pdptr_bits) && !load_pdptrs (vcpu, vcpu->arch.cr3)) { -printk (KERN_DEBUG "set_cr4: #GP, pdptrs reserved bits\n" );kvm_inject_gp (vcpu,0 );return ; }if (cr4 &X86_CR4_VMXE ) { -printk (KERN_DEBUG "set_cr4: #GP, setting VMXE\n" );kvm_inject_gp (vcpu,0 );return ; }
@@ -495,21 +479,16 @@ void kvm_set_cr3(struct kvm_vcpu *vcpu,if (is_long_mode (vcpu)) {if (cr3 &CR3_L_MODE_RESERVED_BITS ) { -printk (KERN_DEBUG "set_cr3: #GP, reserved bits\n" );kvm_inject_gp (vcpu,0 );return ; } }else {if (is_pae (vcpu)) {if (cr3 &CR3_PAE_RESERVED_BITS ) { -printk (KERN_DEBUG -"set_cr3: #GP, reserved bits\n" );kvm_inject_gp (vcpu,0 );return ; }if (is_paging (vcpu) && !load_pdptrs (vcpu, cr3)) { -printk (KERN_DEBUG "set_cr3: #GP, pdptrs " -"reserved bits\n" );kvm_inject_gp (vcpu,0 );return ; }
@@ -541,7 +520,6 @@ EXPORT_SYMBOL_GPL(kvm_set_cr3);void kvm_set_cr8 (struct kvm_vcpu *vcpu,unsigned long cr8) {if (cr8 &CR8_RESERVED_BITS ) { -printk (KERN_DEBUG "set_cr8: #GP, reserved bits 0x%lx\n" , cr8);kvm_inject_gp (vcpu,0 );return ; }
@@ -595,15 +573,12 @@ static u32 emulated_msrs[] = {static void set_efer (struct kvm_vcpu *vcpu,u64 efer) {if (efer & efer_reserved_bits) { -printk (KERN_DEBUG "set_efer: 0x%llx #GP, reserved bits\n" , - efer);kvm_inject_gp (vcpu,0 );return ; }if (is_paging (vcpu) && (vcpu->arch.shadow_efer &EFER_LME ) != (efer &EFER_LME )) { -printk (KERN_DEBUG "set_efer: #GP, change LME while paging\n" );kvm_inject_gp (vcpu,0 );return ; }
@@ -613,7 +588,6 @@ static void set_efer(struct kvm_vcpu *vc feat =kvm_find_cpuid_entry (vcpu,0x80000001 ,0 );if (!feat || !(feat->edx &bit (X86_FEATURE_FXSR_OPT ))) { -printk (KERN_DEBUG "set_efer: #GP, enable FFXSR w/o CPUID capability\n" );kvm_inject_gp (vcpu,0 );return ; }
@@ -624,7 +598,6 @@ static void set_efer(struct kvm_vcpu *vc feat =kvm_find_cpuid_entry (vcpu,0x80000001 ,0 );if (!feat || !(feat->ecx &bit (X86_FEATURE_SVM ))) { -printk (KERN_DEBUG "set_efer: #GP, enable SVM w/o SVM\n" );kvm_inject_gp (vcpu,0 );return ; }
PATCH 132/139 KVM: allow bit 10 to be cleared in MSR_IA32_MC4_CTL
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Andre Przywara <[email protected]>
(Cherry-picked from commit 114be429c8cd44e57f312af2bbd6734e5a185b0d)
There is a quirk for AMD K8 CPUs in many Linux kernels (see arch/x86/kernel/cpu/mcheck/mce.c:__mcheck_cpu_apply_quirks()) that clears bit 10 in that MCE related MSR. KVM can only cope with all zeros or all ones, so it will inject a #GP into the guest, which will let it panic.
So lets add a quirk to the quirk and ignore this single cleared bit. This fixes -cpu kvm64 on all machines and -cpu host on K8 machines with some guest Linux kernels.
--- arch/x86/kvm/x86.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
arch/x86/kvm/x86.c +6 -2
@@ -886,9 +886,13 @@ static int set_msr_mce(struct kvm_vcpu *if (msr >=MSR_IA32_MC0_CTL && msr <MSR_IA32_MC0_CTL +4 * bank_num) {u32 offset = msr -MSR_IA32_MC0_CTL ; -/* only 0 or all 1s can be written to IA32_MCi_CTL */ +/* only 0 or all 1s can be written to IA32_MCi_CTL +* some Linux kernels though clear bit 10 in bank 4 to +* workaround a BIOS/GART TBL issue on AMD K8s, ignore +* this to avoid an uncatched #GP in the guest +*/ if ((offset &0x3 ) ==0 && - data !=0 && data != ~(u64 )0 ) + data !=0 && (data | (1 <<10 )) != ~(u64 )0 )return -1 ; vcpu->arch.mce_banks[offset] = data;break ;
PATCH 133/139 KVM: VMX: Save/restore rflags.vm correctly in real mode
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Avi Kivity <[email protected]>
(Cherry-picked from commit 78ac8b47c566dd6177a3b9b291b756ccb70670b7)
Currently we set eflags.vm unconditionally when entering real mode emulation through virtual-8086 mode, and clear it unconditionally when we enter protected mode. The means that the following sequence
KVM_SET_REGS (rflags.vm=1)
KVM_SET_SREGS (cr0.pe=1)
Ends up with rflags.vm clear due to KVM_SET_SREGS triggering enter_pmode().
Fix by shadowing rflags.vm (and rflags.iopl) correctly while in real mode:
reads and writes to those bits access a shadow register instead of the actual register.
--- arch/x86/kvm/vmx.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-)
arch/x86/kvm/vmx.c +15 -9
@@ -61,6 +61,8 @@ module_param_named(unrestricted_guest,static int __read_mostly emulate_invalid_guest_state =0 ;module_param (emulate_invalid_guest_state, bool,S_IRUGO ); +#define RMODE_GUEST_OWNED_EFLAGS_BITS (~(X86_EFLAGS_IOPL | X86_EFLAGS_VM)) +/* * These 2 parameters are used to config the controls for Pause-Loop Exiting: * ple_gap: upper bound on the amount of time between two successive
@@ -115,7 +117,7 @@ struct vcpu_vmx { } host_state;struct {int vm86_active; -u8 save_iopl; +ulong save_rflags;struct kvm_save_segment {u16 selector;unsigned long base;
@@ -787,18 +789,23 @@ static void vmx_fpu_deactivate(struct kvstatic unsigned long vmx_get_rflags (struct kvm_vcpu *vcpu) { -unsigned long rflags; +unsigned long rflags, save_rflags; rflags =vmcs_readl (GUEST_RFLAGS ); -if (to_vmx (vcpu)->rmode.vm86_active) - rflags &= ~(unsigned long )(X86_EFLAGS_IOPL |X86_EFLAGS_VM ); +if (to_vmx (vcpu)->rmode.vm86_active) { + rflags &=RMODE_GUEST_OWNED_EFLAGS_BITS ; + save_rflags =to_vmx (vcpu)->rmode.save_rflags; + rflags |= save_rflags & ~RMODE_GUEST_OWNED_EFLAGS_BITS ; + }return rflags; }static void vmx_set_rflags (struct kvm_vcpu *vcpu,unsigned long rflags) { -if (to_vmx (vcpu)->rmode.vm86_active) +if (to_vmx (vcpu)->rmode.vm86_active) { +to_vmx (vcpu)->rmode.save_rflags = rflags; rflags |=X86_EFLAGS_IOPL |X86_EFLAGS_VM ; + }vmcs_writel (GUEST_RFLAGS , rflags); }
@@ -1431,8 +1438,8 @@ static void enter_pmode(struct kvm_vcpuvmcs_write32 (GUEST_TR_AR_BYTES , vmx->rmode.tr.ar); flags =vmcs_readl (GUEST_RFLAGS ); - flags &= ~(X86_EFLAGS_IOPL |X86_EFLAGS_VM ); - flags |= (vmx->rmode.save_iopl <<IOPL_SHIFT ); + flags &=RMODE_GUEST_OWNED_EFLAGS_BITS ; + flags |= vmx->rmode.save_rflags & ~RMODE_GUEST_OWNED_EFLAGS_BITS ;vmcs_writel (GUEST_RFLAGS , flags); vmcs_writel(GUEST_CR4, (vmcs_readl(GUEST_CR4) & ~X86_CR4_VME) |
@@ -1501,8 +1508,7 @@ static void enter_rmode(struct kvm_vcpuvmcs_write32 (GUEST_TR_AR_BYTES ,0x008b ); flags =vmcs_readl (GUEST_RFLAGS ); - vmx->rmode.save_iopl - = (flags &X86_EFLAGS_IOPL ) >>IOPL_SHIFT ; + vmx->rmode.save_rflags = flags; flags |=X86_EFLAGS_IOPL |X86_EFLAGS_VM ;
PATCH 134/139 KVM: MMU: fix kvm_mmu_zap_page() and its calling path
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Xiao Guangrong <[email protected]>
(Cherry-picked from commit 77662e0028c7c63e34257fda03ff9625c59d939d)
This patch fix:
- calculate zapped page number properly in mmu_zap_unsync_children()
- calculate freeed page number properly kvm_mmu_change_mmu_pages()
- if zapped children page it shoud restart hlist walking
KVM-Stable-Tag.
--- arch/x86/kvm/mmu.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
arch/x86/kvm/mmu.c +7 -4
@@ -1502,8 +1502,8 @@ static int mmu_zap_unsync_children(strucfor_each_sp (pages, sp, parents, i) {kvm_mmu_zap_page (kvm, sp);mmu_pages_clear_parents (&parents); + zapped++; } - zapped += pages.nr;kvm_mmu_pages_init (parent, &parents, &pages); }
@@ -1554,14 +1554,16 @@ void kvm_mmu_change_mmu_pages(struct kvm*/ if (used_pages > kvm_nr_mmu_pages) { -while (used_pages > kvm_nr_mmu_pages) { +while (used_pages > kvm_nr_mmu_pages && + !list_empty (&kvm->arch.active_mmu_pages)) {struct kvm_mmu_page *page; page =container_of (kvm->arch.active_mmu_pages.prev, struct kvm_mmu_page, link); -kvm_mmu_zap_page (kvm, page); + used_pages -=kvm_mmu_zap_page (kvm, page); used_pages--; } + kvm_nr_mmu_pages = used_pages; kvm->arch.n_free_mmu_pages =0 ; }else
@@ -1608,7 +1610,8 @@ static void mmu_unshadow(struct kvm *kvm && !sp->role.invalid) {pgprintk ("%s: zap %lx %x\n" , __func__, gfn, sp->role.word); -kvm_mmu_zap_page (kvm, sp); +if (kvm_mmu_zap_page (kvm, sp)) + nn = bucket->first; } } }
PATCH 135/139 KVM: fix the handling of dirty bitmaps to avoid overflows
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Takuya Yoshikawa <[email protected]>
(Cherry-picked from commit 87bf6e7de1134f48681fd2ce4b7c1ec45458cb6d)
Int is not long enough to store the size of a dirty bitmap.
This patch fixes this problem with the introduction of a wrapper function to calculate the sizes of dirty bitmaps.
Note: in mark_page_dirty(), we have to consider the fact that
__set_bit() takes the offset as int, not long.
--- arch/ia64/kvm/kvm-ia64.c | 9 +++++---- arch/powerpc/kvm/book3s.c | 5 +++-- arch/x86/kvm/x86.c | 4 ++-- include/linux/kvm_host.h | 5 +++++ virt/kvm/kvm_main.c | 13 ++++++++----- 5 files changed, 23 insertions(+), 13 deletions(-)
arch/ia64/kvm/kvm-ia64.c +5 -4
@@ -1794,7 +1794,8 @@ static int kvm_ia64_sync_dirty_log(struc {struct kvm_memory_slot *memslot;int r, i; -long n, base; +long base; +unsigned long n;unsigned long *dirty_bitmap = (unsigned long *)(kvm->arch.vm_base + offsetof(struct kvm_vm_data , kvm_mem_dirty_log));
@@ -1807,7 +1808,7 @@ static int kvm_ia64_sync_dirty_log(strucif (!memslot->dirty_bitmap) goto out; - n =ALIGN (memslot->npages,BITS_PER_LONG ) /8 ; + n =kvm_dirty_bitmap_bytes (memslot); base = memslot->base_gfn /BITS_PER_LONG ;for (i =0 ; i < n/sizeof (long ); ++i) {
@@ -1823,7 +1824,7 @@ int kvm_vm_ioctl_get_dirty_log(struct kv struct kvm_dirty_log *log) {int r; -int n; +unsigned long n;struct kvm_memory_slot *memslot;int is_dirty =0 ;
@@ -1841,7 +1842,7 @@ int kvm_vm_ioctl_get_dirty_log(struct kvif (is_dirty) {kvm_flush_remote_tlbs (kvm); memslot = &kvm->memslots[log->slot]; - n =ALIGN (memslot->npages,BITS_PER_LONG ) /8 ; + n =kvm_dirty_bitmap_bytes (memslot);memset (memslot->dirty_bitmap,0 , n); } r =0 ;
arch/powerpc/kvm/book3s.c +3 -2
@@ -848,7 +848,8 @@ int kvm_vm_ioctl_get_dirty_log(struct kvstruct kvm_vcpu *vcpu;ulong ga, ga_end;int is_dirty =0 ; -int r, n; +int r; +unsigned long n;down_write (&kvm->slots_lock);
@@ -866,7 +867,7 @@ int kvm_vm_ioctl_get_dirty_log(struct kvkvm_for_each_vcpu (n, vcpu, kvm)kvmppc_mmu_pte_pflush (vcpu, ga, ga_end); - n =ALIGN (memslot->npages,BITS_PER_LONG ) /8 ; + n =kvm_dirty_bitmap_bytes (memslot);memset (memslot->dirty_bitmap,0 , n); }
arch/x86/kvm/x86.c +2 -2
@@ -2343,7 +2343,7 @@ int kvm_vm_ioctl_get_dirty_log(struct kv struct kvm_dirty_log *log) {int r; -int n; +unsigned long n;struct kvm_memory_slot *memslot;int is_dirty =0 ;
@@ -2359,7 +2359,7 @@ int kvm_vm_ioctl_get_dirty_log(struct kvkvm_mmu_slot_remove_write_access (kvm, log->slot);spin_unlock (&kvm->mmu_lock); memslot = &kvm->memslots[log->slot]; - n =ALIGN (memslot->npages,BITS_PER_LONG ) /8 ; + n =kvm_dirty_bitmap_bytes (memslot);memset (memslot->dirty_bitmap,0 , n); } r =0 ;
include/linux/kvm_host.h +5 -0
@@ -116,6 +116,11 @@ struct kvm_memory_slot {int user_alloc; }; +static inline unsigned long kvm_dirty_bitmap_bytes (struct kvm_memory_slot *memslot) +{ +return ALIGN (memslot->npages,BITS_PER_LONG ) /8 ; +} +struct kvm_kernel_irq_routing_entry {u32 gsi;u32 type;
virt/kvm/kvm_main.c +8 -5
@@ -636,7 +636,7 @@ skip_lpage:/* Allocate page dirty bitmap if needed */ if ((new.flags &KVM_MEM_LOG_DIRTY_PAGES ) && !new.dirty_bitmap) { -unsigned dirty_bytes =ALIGN (npages,BITS_PER_LONG ) /8 ; +unsigned long dirty_bytes =kvm_dirty_bitmap_bytes (&new); new.dirty_bitmap =vmalloc (dirty_bytes);if (!new.dirty_bitmap)
@@ -719,7 +719,7 @@ int kvm_get_dirty_log(struct kvm *kvm, {struct kvm_memory_slot *memslot;int r, i; -int n; +unsigned long n;unsigned long any =0 ; r = -EINVAL ;
@@ -731,7 +731,7 @@ int kvm_get_dirty_log(struct kvm *kvm,if (!memslot->dirty_bitmap) goto out; - n =ALIGN (memslot->npages,BITS_PER_LONG ) /8 ; + n =kvm_dirty_bitmap_bytes (memslot);for (i =0 ; !any && i < n/sizeof (long ); ++i) any = memslot->dirty_bitmap[i];
@@ -1073,10 +1073,13 @@ void mark_page_dirty(struct kvm *kvm, gf memslot =gfn_to_memslot_unaliased (kvm, gfn);if (memslot && memslot->dirty_bitmap) {unsigned long rel_gfn = gfn - memslot->base_gfn; +unsigned long *p = memslot->dirty_bitmap + + rel_gfn /BITS_PER_LONG ; +int offset = rel_gfn %BITS_PER_LONG ;/* avoid RMW */ -if (!generic_test_le_bit (rel_gfn, memslot->dirty_bitmap)) -generic___set_le_bit (rel_gfn, memslot->dirty_bitmap); +if (!generic_test_le_bit (offset, p)) +generic___set_le_bit (offset, p); } }
PATCH 136/139 KVM: Increase NR_IOBUS_DEVS limit to 200
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Sridhar Samudrala <[email protected]>
(Cherry-picked from commit e80e2a60ff7914dae691345a976c80bbbff3ec74)
This patch increases the current hardcoded limit of NR_IOBUS_DEVS from 6 to 200. We are hitting this limit when creating a guest with more than 1 virtio-net device using vhost-net backend. Each virtio-net device requires 2 such devices to service notifications from rx/tx queues.
--- include/linux/kvm_host.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/kvm_host.h +1 -1
@@ -53,7 +53,7 @@ extern struct kmem_cache *kvm_vcpu_cache*/ struct kvm_io_bus {int dev_count; -#define NR_IOBUS_DEVS 6 +#define NR_IOBUS_DEVS 200struct kvm_io_device *devs[NR_IOBUS_DEVS ]; };
PATCH 137/139 KVM: x86: Fix TSS size check for 16-bit tasks
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jan Kiszka <[email protected]>
(Cherry-picked from commit e8861cfe2c75bdce36655b64d7ce02c2b31b604d)
A 16-bit TSS is only 44 bytes long. So make sure to test for the correct size on task switch.
--- arch/x86/kvm/x86.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/x86/kvm/x86.c +5 -1
@@ -4576,6 +4576,7 @@ int kvm_task_switch(struct kvm_vcpu *vcpint ret =0 ;u32 old_tss_base =get_segment_base (vcpu,VCPU_SREG_TR );u16 old_tss_sel =get_segment_selector (vcpu,VCPU_SREG_TR ); +u32 desc_limit; old_tss_base = vcpu->arch.mmu.gva_to_gpa (vcpu, old_tss_base);
@@ -4598,7 +4599,10 @@ int kvm_task_switch(struct kvm_vcpu *vcp } } -if (!nseg_desc.p ||get_desc_limit (&nseg_desc) <0x67 ) { + desc_limit =get_desc_limit (&nseg_desc); +if (!nseg_desc.p || + ((desc_limit <0x67 && (nseg_desc.type &8 )) || + desc_limit <0x2b )) {kvm_queue_exception_e (vcpu,TS_VECTOR , tss_selector &0xfffc );return 1 ; }
PATCH 138/139 x86/gart: Disable GART explicitly before initialization
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Joerg Roedel <[email protected]>
commit 4b83873d3da0704987cb116833818ed96214ee29 upstream.
If we boot into a crash-kernel the gart might still be enabled and its caches might be dirty. This can result in undefined behavior later. Fix it by explicitly disabling the gart hardware before initialization and flushing the caches after enablement.
--- arch/x86/kernel/aperture_64.c | 15 ++++++++++++++- arch/x86/kernel/pci-gart_64.c | 3 +++ 2 files changed, 17 insertions(+), 1 deletion(-)
arch/x86/kernel/aperture_64.c +14 -1
@@ -394,6 +394,7 @@ void __init gart_iommu_hole_init(void)for (i =0 ; i <ARRAY_SIZE (bus_dev_ranges); i++) {int bus;int dev_base, dev_limit; +u32 ctl; bus = bus_dev_ranges[i].bus; dev_base = bus_dev_ranges[i].dev_base;
@@ -407,7 +408,19 @@ void __init gart_iommu_hole_init(void) gart_iommu_aperture =1 ; x86_init.iommu.iommu_init = gart_iommu_init; - aper_order = (read_pci_config (bus, slot,3 ,AMD64_GARTAPERTURECTL ) >>1 ) &7 ; + ctl =read_pci_config (bus, slot,3 , +AMD64_GARTAPERTURECTL ); + +/* +* Before we do anything else disable the GART. It may +* still be enabled if we boot into a crash-kernel here. +* Reconfiguring the GART while it is enabled could have +* unknown side-effects. +*/ + ctl &= ~GARTEN ; +write_pci_config (bus, slot,3 ,AMD64_GARTAPERTURECTL , ctl); + + aper_order = (ctl >>1 ) &7 ; aper_size = (32 *1024 *1024 ) << aper_order; aper_base =read_pci_config (bus, slot,3 ,AMD64_GARTAPERTUREBASE ) &0x7fff ; aper_base <<=25 ;
arch/x86/kernel/pci-gart_64.c +3 -0
@@ -564,6 +564,9 @@ static void enable_gart_translations(voienable_gart_translation (dev,__pa (agp_gatt_table)); } + +/* Flush the GART-TLB to remove stale entries */ +k8_flush_garts (); }/*
PATCH 139/139 MIPS: Sibyte: Fix M3 TLB exception handler workaround.
In reply to Greg KH2.6.33-stable review patch. If anyone has any objections, please let us know.
------------------
From: Ralf Baechle <[email protected]>
commit 3d45285dd1ff4d4a1361b95e2d6508579a4402b5 upstream.
The M3 workaround needs to cmpare the region and VPN2 fields only.
--- arch/mips/mm/tlbex.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-)
arch/mips/mm/tlbex.c +16 -6
@@ -741,10 +741,15 @@ static void __cpuinit build_r4000_tlb_re* create the plain linear handler */ if (bcm1250_m3_war ()) { -UASM_i_MFC0 (&p,K0 ,C0_BADVADDR ); -UASM_i_MFC0 (&p,K1 ,C0_ENTRYHI ); +unsigned int segbits =44 ; + +uasm_i_dmfc0 (&p,K0 ,C0_BADVADDR ); +uasm_i_dmfc0 (&p,K1 ,C0_ENTRYHI );uasm_i_xor (&p,K0 ,K0 ,K1 ); -UASM_i_SRL (&p,K0 ,K0 ,PAGE_SHIFT +1 ); +uasm_i_dsrl32 (&p,K1 ,K0 ,62 -32 ); +uasm_i_dsrl (&p,K0 ,K0 ,12 +1 ); +uasm_i_dsll32 (&p,K0 ,K0 ,64 +12 +1 - segbits -32 ); +uasm_i_or (&p,K0 ,K0 ,K1 );uasm_il_bnez (&p, &r,K0 , label_leave);/* No need for uasm_i_nop */ }
@@ -1260,10 +1265,15 @@ static void __cpuinit build_r4000_tlb_lomemset (relocs,0 ,sizeof (relocs));if (bcm1250_m3_war ()) { -UASM_i_MFC0 (&p,K0 ,C0_BADVADDR ); -UASM_i_MFC0 (&p,K1 ,C0_ENTRYHI ); +unsigned int segbits =44 ; + +uasm_i_dmfc0 (&p,K0 ,C0_BADVADDR ); +uasm_i_dmfc0 (&p,K1 ,C0_ENTRYHI );uasm_i_xor (&p,K0 ,K0 ,K1 ); -UASM_i_SRL (&p,K0 ,K0 ,PAGE_SHIFT +1 ); +uasm_i_dsrl32 (&p,K1 ,K0 ,62 -32 ); +uasm_i_dsrl (&p,K0 ,K0 ,12 +1 ); +uasm_i_dsll32 (&p,K0 ,K0 ,64 +12 +1 - segbits -32 ); +uasm_i_or (&p,K0 ,K0 ,K1 );uasm_il_bnez (&p, &r,K0 , label_leave);/* No need for uasm_i_nop */ }
Re: [139/139] MIPS: Sibyte: Fix M3 TLB exception handler workaround.
Quoted 1 line · * Greg KH | 2010-04-22 12:55:16 [-0700]:
2.6.33-stable review patch. If anyone has any objections, please let us know.
Greg, you picked this patch without "MIPS: uasm: Add OR instruction" Please drop it _or_ add both. This patch alone will break compilation of the whole MIPS tree.
Sebastian
Quoted 11 lines · Greg KH
This is the start of the stable review cycle for the 2.6.33.3 release. There are 139 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Saturday, April 24, 15:00:00 UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v2.6/stable-review/patch-2.6.33.3-rc1.gzand the diffstat can be found below.
A -rc2 patch is now out at:
kernel.org/pub/linux/kernel/v2.6/stable-review/patch-2.6.33.3-rc2.gz
that fixes some build errors.
thanks,
greg k-h