2.6.32.50-longterm review
Subsystems (24)
cover 2.6.32.50-longterm review
This is the start of the longterm review cycle for the 2.6.32.50 release. There are 27 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 us know. If anyone is a maintainer of the proper subsystem, and wants to add a Signed-off-by: line to the patch, please respond with it.
Responses should be made by Friday, December 9, 2011, 17: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/longterm-review/patch-2.6.32.19-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
Makefile | 2 +- arch/arm/Kconfig | 12 +++++ arch/arm/kernel/process.c | 3 + arch/x86/include/asm/timer.h | 23 ++++++++++- arch/x86/kernel/mpparse.c | 2 +- arch/x86/oprofile/init.c | 7 ++- drivers/i2c/algos/i2c-algo-bit.c | 4 +- drivers/net/wireless/p54/p54spi.c | 5 +- drivers/pci/hotplug/shpchp_core.c | 4 +- drivers/pci/hotplug/shpchp_hpc.c | 4 +- drivers/scsi/scsi_lib.c | 12 ++++-- drivers/staging/comedi/comedi_fops.c | 75 +++++++++++++++++++++++++--------- drivers/staging/usbip/vhci_rx.c | 10 +++-- drivers/usb/host/whci/qset.c | 2 +- drivers/usb/serial/ftdi_sio.c | 1 + drivers/usb/serial/ftdi_sio_ids.h | 1 + drivers/usb/serial/option.c | 1 + drivers/usb/storage/unusual_devs.h | 7 +++ fs/cifs/misc.c | 3 + fs/ecryptfs/crypto.c | 4 +- kernel/irq/manage.c | 5 ++- kernel/time/clockevents.c | 1 + kernel/time/tick-broadcast.c | 2 +- kernel/time/timekeeping.c | 4 ++ net/core/dev.c | 1 + net/sunrpc/xprtsock.c | 3 +- net/wireless/nl80211.c | 4 +- sound/pci/lx6464es/lx_core.c | 16 +++++-- 28 files changed, 164 insertions(+), 54 deletions(-)
PATCH 1/27 i2c-algo-bit: Generate correct i2c address sequence for 10-bit target
2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: "Jeffrey (Sheng-Hui) Chu" <[email protected]>
commit cc6bcf7d2ec2234e7b41770185e4dc826390185e upstream.
The wrong bits were put on the wire, fix that.
This fixes kernel bug #42562.
--- drivers/i2c/algos/i2c-algo-bit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/i2c/algos/i2c-algo-bit.c +2 -2
@@ -471,7 +471,7 @@ static int bit_doAddress(struct i2c_adapif (flags &I2C_M_TEN ) {/* a ten bit address */ - addr =0xf0 | ((msg->addr >>7 ) &0x03 ); + addr =0xf0 | ((msg->addr >>7 ) &0x06 );bit_dbg (2 , &i2c_adap->dev,"addr0: %d\n" , addr);/* try extended address code...*/ ret =try_address (i2c_adap, addr, retries);
@@ -481,7 +481,7 @@ static int bit_doAddress(struct i2c_adapreturn -EREMOTEIO ; }/* the remaining 8 bit address */ - ret =i2c_outb (i2c_adap, msg->addr &0x7f ); + ret =i2c_outb (i2c_adap, msg->addr &0xff );if ((ret !=1 ) && !nak_ok) {/* the chip did not ack / xmission error occurred */ dev_err (&i2c_adap->dev,"died at 2nd address code\n" );
PATCH 2/27 eCryptfs: Extend array bounds for all filename chars
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Tyler Hicks <[email protected]>
commit 0f751e641a71157aa584c2a2e22fda52b52b8a56 upstream.
Quoted 1 line
Quoted 1 line
From mhalcrow's original commit message:
Characters with ASCII values greater than the size of filename_rev_map[] are valid filename characters. ecryptfs_decode_from_filename() will access kernel memory beyond that array, and ecryptfs_parse_tag_70_packet() will then decrypt those characters. The attacker, using the FNEK of the crafted file, can then re-encrypt the characters to reveal the kernel memory past the end of the filename_rev_map[] array. I expect low security impact since this array is statically allocated in the text area, and the amount of memory past the array that is accessible is limited by the largest possible ASCII filename character.
This patch solves the issue reported by mhalcrow but with an implementation suggested by Linus to simply extend the length of filename_rev_map[] to 256. Characters greater than 0x7A are mapped to 0x00, which is how invalid characters less than 0x7A were previously being handled.
--- fs/ecryptfs/crypto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ecryptfs/crypto.c +2 -2
@@ -1934,7 +1934,7 @@ static unsigned char *portable_filename_/* We could either offset on every reverse map or just pad some 0x00's * at the front here */ -static const unsigned char filename_rev_map[] = { +static const unsigned char filename_rev_map[256 ] = {0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,/* 7 */ 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,/* 15 */ 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,/* 23 */
@@ -1950,7 +1950,7 @@ static const unsigned char filename_rev_0x00 ,0x26 ,0x27 ,0x28 ,0x29 ,0x2A ,0x2B ,0x2C ,/* 103 */ 0x2D ,0x2E ,0x2F ,0x30 ,0x31 ,0x32 ,0x33 ,0x34 ,/* 111 */ 0x35 ,0x36 ,0x37 ,0x38 ,0x39 ,0x3A ,0x3B ,0x3C ,/* 119 */ -0x3D ,0x3E ,0x3F +0x3D ,0x3E ,0x3F /* 123 - 255 initialized to 0x00 */ };/**
PATCH 3/27 PCI hotplug: shpchp: dont blindly claim non-AMD 0x7450 device IDs
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Bjorn Helgaas <[email protected]>
commit 4cac2eb158c6da0c761689345c6cc5df788a6292 upstream.
Previously we claimed device ID 0x7450, regardless of the vendor, which is clearly wrong. Now we'll claim that device ID only for AMD.
I suspect this was just a typo in the original code, but it's possible this change will break shpchp on non-7450 AMD bridges. If so, we'll have to fix them as we find them.
Reference: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=638863
--- drivers/pci/hotplug/shpchp_core.c | 4 ++-- drivers/pci/hotplug/shpchp_hpc.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/pci/hotplug/shpchp_core.c +2 -2
@@ -312,8 +312,8 @@ static int get_cur_bus_speed (struct hotstatic int is_shpc_capable (struct pci_dev *dev) { -if ((dev->vendor ==PCI_VENDOR_ID_AMD ) || (dev->device == -PCI_DEVICE_ID_AMD_GOLAM_7450 )) +if (dev->vendor ==PCI_VENDOR_ID_AMD && + dev->device ==PCI_DEVICE_ID_AMD_GOLAM_7450 )return 1 ;if (!pci_find_capability (dev,PCI_CAP_ID_SHPC ))return 0 ;
drivers/pci/hotplug/shpchp_hpc.c +2 -2
@@ -951,8 +951,8 @@ int shpc_init(struct controller *ctrl, s ctrl->pci_dev = pdev;/* pci_dev of the P2P bridge */ ctrl_dbg (ctrl,"Hotplug Controller:\n" ); -if ((pdev->vendor ==PCI_VENDOR_ID_AMD ) || (pdev->device == -PCI_DEVICE_ID_AMD_GOLAM_7450 )) { +if (pdev->vendor ==PCI_VENDOR_ID_AMD && + pdev->device ==PCI_DEVICE_ID_AMD_GOLAM_7450 ) {/* amd shpc driver doesn't use Base Offset; assume 0 */ ctrl->mmio_base =pci_resource_start (pdev,0 ); ctrl->mmio_size =pci_resource_len (pdev,0 );
PATCH 4/27 ARM: 7161/1: errata: no automatic store buffer drain
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit 11ed0ba1754841316d4095478944300acf19acc3 upstream.
This patch implements a workaround for PL310 erratum 769419. On revisions of the PL310 prior to r3p2, the Store Buffer does not automatically drain. This can cause normal, non-cacheable writes to be retained when the memory system is idle, leading to suboptimal I/O performance for drivers using coherent DMA.
This patch adds an optional wmb() call to the cpu_idle loop. On systems with an outer cache, this causes an explicit flush of the store buffer.
--- arch/arm/Kconfig | 12 ++++++++++++ arch/arm/kernel/process.c | 3 +++ 2 files changed, 15 insertions(+)
arch/arm/Kconfig +12 -0
@@ -1332,6 +1332,18 @@ config ATAGS_PROC Should the atags used to boot the kernel be exported in an "atags" file in procfs. Useful with kexec. +config PL310_ERRATA_769419 + bool "PL310 errata: no automatic Store Buffer drain" + depends on CACHE_L2X0 + help + On revisions of the PL310 prior to r3p2, the Store Buffer does + not automatically drain. This can cause normal, non-cacheable + writes to be retained when the memory system is idle, leading + to suboptimal I/O performance for drivers using coherent DMA. + This option adds a write barrier to the cpu_idle loop so that, + on systems with an outer cache, the store buffer is drained + explicitly. + endmenu menu "CPU Power Management"
arch/arm/kernel/process.c +3 -0
@@ -156,6 +156,9 @@ void cpu_idle(void)#endif local_irq_disable (); +#ifdef CONFIG_PL310_ERRATA_769419 +wmb (); +#endif if (hlt_counter) {local_irq_enable ();cpu_relax ();
PATCH 5/27 ALSA: lx6464es - fix device communication via command bus
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Tim Blechmann <[email protected]>
commit a29878553a9a7b4c06f93c7e383527cf014d4ceb upstream.
commit 6175ddf06b6172046a329e3abfd9c901a43efd2e optimized the mem*io functions that have been used to send commands to the device. these optimizations somehow corrupted the communication with the lx6464es, that resulted the device to be unusable with kernels after 2.6.33.
this patch emulates the memcpy_*_io functions via a loop to avoid these problems.
LKML-Reference: <[email protected]>
--- sound/pci/lx6464es/lx_core.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
sound/pci/lx6464es/lx_core.c +12 -4
@@ -80,8 +80,12 @@ unsigned long lx_dsp_reg_read(struct lx6void lx_dsp_reg_readbuf (struct lx6464es *chip,int port,u32 *data,u32 len) { -void __iomem *address =lx_dsp_register (chip, port); -memcpy_fromio (data, address, len*sizeof (u32)); +u32 __iomem *address =lx_dsp_register (chip, port); +int i; + +/* we cannot use memcpy_fromio */ +for (i =0 ; i != len; ++i) + data[i] =ioread32 (address + i); }
@@ -94,8 +98,12 @@ void lx_dsp_reg_write(struct lx6464es *cvoid lx_dsp_reg_writebuf (struct lx6464es *chip,int port,const u32 *data,u32 len) { -void __iomem *address =lx_dsp_register (chip, port); -memcpy_toio (address, data, len*sizeof (u32)); +u32 __iomem *address =lx_dsp_register (chip, port); +int i; + +/* we cannot use memcpy_to */ +for (i =0 ; i != len; ++i) +iowrite32 (data[i], address + i); }
Re: [05/27] ALSA: lx6464es - fix device communication via command bus
it is not really necessary to apply this patch to 2.6.32, as the problem was introduced by a change to the memcpy_*_io functions that was introduced in 2.6.34.
otoh, it doesn't harm, either.
Quoted 56 lines · On Wednesday 07 December 2011 08:54:38 Greg KH wrote:
2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Tim Blechmann <[email protected]>
commit
a29878553a9a7b4c06f93c7e383527cf014d4cebupstream.commit
6175ddf06b6172046a329e3abfd9c901a43efd2eoptimized the mem*io functions that have been used to send commands to the device. these optimizations somehow corrupted the communication with the lx6464es, that resulted the device to be unusable with kernels after 2.6.33.this patch emulates the memcpy_*_io functions via a loop to avoid these problems.
Signed-off-by Tim Blechmann <[email protected]>LKML-Reference: <[email protected]>
Signed-off-by Takashi Iwai <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- sound/pci/lx6464es/lx_core.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)sound/pci/lx6464es/lx_core.c +12
-4@@ -80,8 +80,12 @@ unsigned long lx_dsp_reg_read(struct lx6void lx_dsp_reg_readbuf (struct lx6464es *chip,int port,u32 *data,u32 len) { -void __iomem *address =lx_dsp_register (chip, port); -memcpy_fromio (data, address, len*sizeof (u32)); +u32 __iomem *address =lx_dsp_register (chip, port); +int i; + +/* we cannot use memcpy_fromio */ +for (i =0 ; i != len; ++i) + data[i] =ioread32 (address + i); }@@ -94,8 +98,12 @@ void lx_dsp_reg_write(struct lx6464es *cvoid lx_dsp_reg_writebuf (struct lx6464es *chip,int port,const u32 *data,u32 len) { -void __iomem *address =lx_dsp_register (chip, port); -memcpy_toio (address, data, len*sizeof (u32)); +u32 __iomem *address =lx_dsp_register (chip, port); +int i; + +/* we cannot use memcpy_to */ +for (i =0 ; i != len; ++i) +iowrite32 (data[i], address + i); }
PATCH 6/27 SUNRPC: Ensure we return EAGAIN in xs_nospace if congestion is cleared
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit 24ca9a847791fd53d9b217330b15f3c285827a18 upstream.
By returning '0' instead of 'EAGAIN' when the tests in xs_nospace() fail to find evidence of socket congestion, we are making the RPC engine believe that the message was incorrectly sent and so it disconnects the socket instead of just retrying.
The bug appears to have been introduced by commit 5e3771ce2d6a69e10fcc870cdf226d121d868491 (SUNRPC: Ensure that xs_nospace return values are propagated).
--- net/sunrpc/xprtsock.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/sunrpc/xprtsock.c +1 -2
@@ -493,7 +493,7 @@ static int xs_nospace(struct rpc_task *tstruct rpc_rqst *req = task->tk_rqstp;struct rpc_xprt *xprt = req->rq_xprt; struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); -int ret =0 ; +int ret = -EAGAIN ; dprintk("RPC: %5u xmit incomplete (%u left of %u)\n", task->tk_pid, req->rq_slen - req->rq_bytes_sent,
@@ -505,7 +505,6 @@ static int xs_nospace(struct rpc_task *t/* Don't race with disconnect */ if (xprt_connected (xprt)) {if (test_bit (SOCK_ASYNC_NOSPACE , &transport->sock->flags)) { - ret = -EAGAIN ;/* * Notify TCP that we're limited by the application * window size
PATCH 7/27 timekeeping: add arch_offset hook to ktime_get functions
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Hector Palacios <[email protected]>
commit d004e024058a0eaca097513ce62cbcf978913e0a upstream.
ktime_get and ktime_get_ts were calling timekeeping_get_ns() but later they were not calling arch_gettimeoffset() so architectures using this mechanism returned 0 ns when calling these functions.
This happened for example when running Busybox's ping which calls syscall(__NR_clock_gettime, CLOCK_MONOTONIC, ts) which eventually calls ktime_get. As a result the returned ping travel time was zero.
--- kernel/time/timekeeping.c | 4 ++++ 1 file changed, 4 insertions(+)
kernel/time/timekeeping.c +4 -0
@@ -264,6 +264,8 @@ ktime_t ktime_get(void) secs = xtime.tv_sec + wall_to_monotonic.tv_sec; nsecs = xtime.tv_nsec + wall_to_monotonic.tv_nsec; nsecs +=timekeeping_get_ns (); +/* If arch requires, add in gettimeoffset() */ + nsecs +=arch_gettimeoffset (); }while (read_seqretry (&xtime_lock, seq));/*
@@ -295,6 +297,8 @@ void ktime_get_ts(struct timespec *ts) *ts = xtime; tomono = wall_to_monotonic; nsecs =timekeeping_get_ns (); +/* If arch requires, add in gettimeoffset() */ + nsecs +=arch_gettimeoffset (); }while (read_seqretry (&xtime_lock, seq));
PATCH 8/27 p54spi: Add missing spin_lock_init
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: =?UTF-8?q?Michael=20B=C3=BCsch?= <[email protected]>
commit 32d3a3922d617a5a685a5e2d24b20d0e88f192a9 upstream.
The tx_lock is not initialized properly. Add spin_lock_init().
--- drivers/net/wireless/p54/p54spi.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/p54/p54spi.c +1 -0
@@ -650,6 +650,7 @@ static int __devinit p54spi_probe(structinit_completion (&priv->fw_comp);INIT_LIST_HEAD (&priv->tx_pending);mutex_init (&priv->mutex); +spin_lock_init (&priv->tx_lock);SET_IEEE80211_DEV (hw, &spi->dev); priv->common.open = p54spi_op_start; priv->common.stop = p54spi_op_stop;
PATCH 9/27 p54spi: Fix workqueue deadlock
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: =?UTF-8?q?Michael=20B=C3=BCsch?= <[email protected]>
commit 2d1618170eb493d18f66f2ac03775409a6fb97c6 upstream.
priv->work must not be synced while priv->mutex is locked, because the mutex is taken in the work handler.
Move cancel_work_sync down to after the device shutdown code. This is safe, because the work handler checks fw_state and bails out early in case of a race.
--- drivers/net/wireless/p54/p54spi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/p54/p54spi.c +2 -2
@@ -581,8 +581,6 @@ static void p54spi_op_stop(struct ieee80WARN_ON (priv->fw_state !=FW_STATE_READY ); -cancel_work_sync (&priv->work); -p54spi_power_off (priv);spin_lock_irqsave (&priv->tx_lock, flags);INIT_LIST_HEAD (&priv->tx_pending);
@@ -590,6 +588,8 @@ static void p54spi_op_stop(struct ieee80 priv->fw_state =FW_STATE_OFF ;mutex_unlock (&priv->mutex); + +cancel_work_sync (&priv->work); }static int __devinit p54spi_probe (struct spi_device *spi)
PATCH 10/27 nl80211: fix MAC address validation
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Eliad Peller <[email protected]>
commit e007b857e88097c96c45620bf3b04a4e309053d1 upstream.
MAC addresses have a fixed length. The current policy allows passing < ETH_ALEN bytes, which might result in reading beyond the buffer.
--- net/wireless/nl80211.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/wireless/nl80211.c +2 -2
@@ -74,8 +74,8 @@ static struct nla_policy nl80211_policy[ [NL80211_ATTR_IFINDEX] = { .type = NLA_U32 }, [NL80211_ATTR_IFNAME] = { .type = NLA_NUL_STRING, .len = IFNAMSIZ-1 }, - [NL80211_ATTR_MAC] = { .type = NLA_BINARY, .len = ETH_ALEN }, - [NL80211_ATTR_PREV_BSSID] = { .type = NLA_BINARY, .len = ETH_ALEN }, + [NL80211_ATTR_MAC] = { .len = ETH_ALEN }, + [NL80211_ATTR_PREV_BSSID] = { .len = ETH_ALEN }, [NL80211_ATTR_KEY] = { .type = NLA_NESTED, }, [NL80211_ATTR_KEY_DATA] = { .type = NLA_BINARY,
PATCH 11/27 gro: reset vlan_tci on reuse
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
This one liner is part of upstream
commit 3701e51382a026cba10c60b03efabe534fba4ca4
Author: Jesse Gross <[email protected]>
vlan: Centralize handling of hardware acceleration.
The bulk of that commit is a rework of the hardware assisted vlan tagging driver interface, and as such doesn't classify for -stable inclusion. The fix that is needed is a part of that commit but can work independently of the rest.
This patch can avoid panics on the 2.6.32.y -stable kernels and is in the same spirit as mainline commits
66c46d7 gro: Reset dev pointer on reuse
6d152e2 gro: reset skb_iif on reuse
which are already in -stable.
For drivers using the vlan_gro_frags() interface, a packet with an invalid tci leads to GRO_DROP and napi_reuse_skb(). The skb has to be sanitized before being reused or we may send an skb with an invalid vlan_tci field up the stack where it is not expected.
--- net/core/dev.c | 1 + 1 file changed, 1 insertion(+)
net/core/dev.c +1 -0
@@ -2614,6 +2614,7 @@ void napi_reuse_skb(struct napi_struct * {__skb_pull (skb,skb_headlen (skb));skb_reserve (skb,NET_IP_ALIGN -skb_headroom (skb)); + skb->vlan_tci =0 ; skb->dev = napi->dev; skb->iif =0 ;
PATCH 12/27 staging: usbip: bugfix for deadlock
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Bart Westgeest <[email protected]>
commit 438957f8d4a84daa7fa5be6978ad5897a2e9e5e5 upstream.
Interrupts must be disabled prior to calling usb_hcd_unlink_urb_from_ep. If interrupts are not disabled, it can potentially lead to a deadlock. The deadlock is readily reproduceable on a slower (ARM based) device such as the TI Pandaboard.
--- drivers/staging/usbip/vhci_rx.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/staging/usbip/vhci_rx.c +6 -4
@@ -67,6 +67,7 @@ static void vhci_recv_ret_submit(struct {struct usbip_device *ud = &vdev->ud;struct urb *urb; +unsigned long flags;spin_lock (&vdev->priv_lock);
@@ -107,9 +108,9 @@ static void vhci_recv_ret_submit(structusbip_dbg_vhci_rx ("now giveback urb %p\n" , urb); -spin_lock (&the_controller->lock); +spin_lock_irqsave (&the_controller->lock, flags);usb_hcd_unlink_urb_from_ep (vhci_to_hcd (the_controller), urb); -spin_unlock (&the_controller->lock); +spin_unlock_irqrestore (&the_controller->lock, flags);usb_hcd_giveback_urb (vhci_to_hcd (the_controller), urb, urb->status);
@@ -150,6 +151,7 @@ static void vhci_recv_ret_unlink(struct {struct vhci_unlink *unlink;struct urb *urb; +unsigned long flags;usbip_dump_header (pdu);
@@ -181,9 +183,9 @@ static void vhci_recv_ret_unlink(struct urb->status = pdu->u.ret_unlink.status;usbip_uinfo ("%d\n" , urb->status); -spin_lock (&the_controller->lock); +spin_lock_irqsave (&the_controller->lock, flags);usb_hcd_unlink_urb_from_ep (vhci_to_hcd (the_controller), urb); -spin_unlock (&the_controller->lock); +spin_unlock_irqrestore (&the_controller->lock, flags);usb_hcd_giveback_urb (vhci_to_hcd (the_controller), urb, urb->status);
PATCH 13/27 staging: comedi: fix oops for USB DAQ devices.
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Bernd Porr <[email protected]>
commit 3ffab428f40849ed5f21bcfd7285bdef7902f9ca upstream.
This fixes kernel oops when an USB DAQ device is plugged out while it's communicating with the userspace software.
--- drivers/staging/comedi/comedi_fops.c | 73 +++++++++++++++++++++++++---------- 1 file changed, 54 insertions(+), 19 deletions(-)
drivers/staging/comedi/comedi_fops.c +54 -19
@@ -1396,9 +1396,6 @@ static struct vm_operations_struct comedstatic int comedi_mmap (struct file *file,struct vm_area_struct *vma) {const unsigned minor =iminor (file->f_dentry->d_inode); -struct comedi_device_file_info *dev_file_info = -comedi_get_device_file_info (minor); -struct comedi_device *dev = dev_file_info->device;struct comedi_async *async =NULL ;unsigned long start = vma->vm_start;unsigned long size;
@@ -1406,6 +1403,15 @@ static int comedi_mmap(struct file *fileint i;int retval;struct comedi_subdevice *s; +struct comedi_device_file_info *dev_file_info; +struct comedi_device *dev; + + dev_file_info =comedi_get_device_file_info (minor); +if (dev_file_info ==NULL ) +return -ENODEV ; + dev = dev_file_info->device; +if (dev ==NULL ) +return -ENODEV ;mutex_lock (&dev->mutex);if (!dev->attached) {
@@ -1472,11 +1478,17 @@ static unsigned int comedi_poll(struct f {unsigned int mask =0 ;const unsigned minor =iminor (file->f_dentry->d_inode); -struct comedi_device_file_info *dev_file_info = -comedi_get_device_file_info (minor); -struct comedi_device *dev = dev_file_info->device;struct comedi_subdevice *read_subdev;struct comedi_subdevice *write_subdev; +struct comedi_device_file_info *dev_file_info; +struct comedi_device *dev; + dev_file_info =comedi_get_device_file_info (minor); + +if (dev_file_info ==NULL ) +return -ENODEV ; + dev = dev_file_info->device; +if (dev ==NULL ) +return -ENODEV ;mutex_lock (&dev->mutex);if (!dev->attached) {
@@ -1522,9 +1534,15 @@ static ssize_t comedi_write(struct fileint n, m, count =0 , retval =0 ;DECLARE_WAITQUEUE (wait, current);const unsigned minor =iminor (file->f_dentry->d_inode); -struct comedi_device_file_info *dev_file_info = -comedi_get_device_file_info (minor); -struct comedi_device *dev = dev_file_info->device; +struct comedi_device_file_info *dev_file_info; +struct comedi_device *dev; + dev_file_info =comedi_get_device_file_info (minor); + +if (dev_file_info ==NULL ) +return -ENODEV ; + dev = dev_file_info->device; +if (dev ==NULL ) +return -ENODEV ;if (!dev->attached) {DPRINTK ("no driver configured on comedi%i\n" , dev->minor);
@@ -1624,9 +1642,15 @@ static ssize_t comedi_read(struct file *int n, m, count =0 , retval =0 ;DECLARE_WAITQUEUE (wait, current);const unsigned minor =iminor (file->f_dentry->d_inode); -struct comedi_device_file_info *dev_file_info = -comedi_get_device_file_info (minor); -struct comedi_device *dev = dev_file_info->device; +struct comedi_device_file_info *dev_file_info; +struct comedi_device *dev; + dev_file_info =comedi_get_device_file_info (minor); + +if (dev_file_info ==NULL ) +return -ENODEV ; + dev = dev_file_info->device; +if (dev ==NULL ) +return -ENODEV ;if (!dev->attached) {DPRINTK ("no driver configured on comedi%i\n" , dev->minor);
@@ -1819,11 +1843,17 @@ ok:static int comedi_close (struct inode *inode,struct file *file) {const unsigned minor =iminor (inode); -struct comedi_device_file_info *dev_file_info = -comedi_get_device_file_info (minor); -struct comedi_device *dev = dev_file_info->device;struct comedi_subdevice *s =NULL ;int i; +struct comedi_device_file_info *dev_file_info; +struct comedi_device *dev; + dev_file_info =comedi_get_device_file_info (minor); + +if (dev_file_info ==NULL ) +return -ENODEV ; + dev = dev_file_info->device; +if (dev ==NULL ) +return -ENODEV ;mutex_lock (&dev->mutex);
@@ -1857,10 +1887,15 @@ static int comedi_close(struct inode *instatic int comedi_fasync (int fd,struct file *file,int on) {const unsigned minor =iminor (file->f_dentry->d_inode); -struct comedi_device_file_info *dev_file_info = -comedi_get_device_file_info (minor); - -struct comedi_device *dev = dev_file_info->device; +struct comedi_device_file_info *dev_file_info; +struct comedi_device *dev; + dev_file_info =comedi_get_device_file_info (minor); + +if (dev_file_info ==NULL ) +return -ENODEV ; + dev = dev_file_info->device; +if (dev ==NULL ) +return -ENODEV ;return fasync_helper (fd, file, on, &dev->async_queue); }
PATCH 14/27 Staging: comedi: fix signal handling in read and write
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Federico Vaga <[email protected]>
commit 6a9ce6b654e491981f6ef7e214cbd4f63e033848 upstream.
After sleeping on a wait queue, signal_pending(current) should be checked (not before sleeping).
--- drivers/staging/comedi/comedi_fops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/comedi/comedi_fops.c +2 -2
@@ -1599,11 +1599,11 @@ static ssize_t comedi_write(struct file retval = -EAGAIN ;break ; } +schedule ();if (signal_pending (current)) { retval = -ERESTARTSYS ;break ; } -schedule ();if (!s->busy)break ;if (s->busy != file) {
@@ -1706,11 +1706,11 @@ static ssize_t comedi_read(struct file * retval = -EAGAIN ;break ; } +schedule ();if (signal_pending (current)) { retval = -ERESTARTSYS ;break ; } -schedule ();if (!s->busy) { retval =0 ;break ;
PATCH 15/27 USB: whci-hcd: fix endian conversion in qset_clear()
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 8746c83d538cab273d335acb2be226d096f4a5af upstream.
qset->qh.link is an __le64 field and we should be using cpu_to_le64() to fill it.
--- drivers/usb/host/whci/qset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/whci/qset.c +1 -1
@@ -104,7 +104,7 @@ void qset_clear(struct whc *whc, struct { qset->td_start = qset->td_end = qset->ntds =0 ; - qset->qh.link =cpu_to_le32 (QH_LINK_NTDS (8 ) |QH_LINK_T ); + qset->qh.link =cpu_to_le64 (QH_LINK_NTDS (8 ) |QH_LINK_T ); qset->qh.status = qset->qh.status &QH_STATUS_SEQ_MASK ; qset->qh.err_count =0 ; qset->qh.scratch[0 ] =0 ;
PATCH 16/27 usb: ftdi_sio: add PID for Propox ISPcable III
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Marcin Kościelnicki <[email protected]>
commit 307369b0ca06b27b511b61714e335ddfccf19c4f upstream.
--- drivers/usb/serial/ftdi_sio.c | 1 + drivers/usb/serial/ftdi_sio_ids.h | 1 + 2 files changed, 2 insertions(+)
drivers/usb/serial/ftdi_sio.c +1 -0
@@ -739,6 +739,7 @@ static struct usb_device_id id_table_com { USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) }, { USB_DEVICE(FTDI_VID, FTDI_ELSTER_UNICOM_PID) }, { USB_DEVICE(FTDI_VID, FTDI_PROPOX_JTAGCABLEII_PID) }, + { USB_DEVICE(FTDI_VID, FTDI_PROPOX_ISPCABLEIII_PID) }, { USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_PID), .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, { USB_DEVICE(FIC_VID, FIC_NEO1973_DEBUG_PID),
drivers/usb/serial/ftdi_sio_ids.h +1 -0
@@ -111,6 +111,7 @@/* Propox devices */ #define FTDI_PROPOX_JTAGCABLEII_PID 0xD738 +#define FTDI_PROPOX_ISPCABLEIII_PID 0xD739/* Lenz LI-USB Computer Interface. */ #define FTDI_LENZ_LIUSB_PID 0xD780
PATCH 17/27 usb: option: add SIMCom SIM5218
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Veli-Pekka Peltola <[email protected]>
commit ec0cd94d881ca89cc9fb61d00d0f4b2b52e605b3 upstream.
Tested with SIM5218EVB-KIT evaluation kit.
--- drivers/usb/serial/option.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/serial/option.c +1 -0
@@ -578,6 +578,7 @@ static struct usb_device_id option_ids[] { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) }, { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6000)}, /* ZTE AC8700 */ { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ + { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */ { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6280) }, /* BP3-USB & BP3-EXT HSDPA */ { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6008) }, { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864E) },
PATCH 18/27 USB: usb-storage: unusual_devs entry for Kingston DT 101 G2
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Qinglin Ye <[email protected]>
commit cec28a5428793b6bc64e56687fb239759d6da74e upstream.
Kingston DT 101 G2 replies a wrong tag while transporting, add an unusal_devs entry to ignore the tag validation.
--- drivers/usb/storage/unusual_devs.h | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/usb/storage/unusual_devs.h +7 -0
@@ -1857,6 +1857,13 @@ UNUSUAL_DEV( 0x1370, 0x6828, 0x0110, 0x US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_IGNORE_RESIDUE ), +/* Reported by Qinglin Ye <[email protected]> */ +UNUSUAL_DEV (0x13fe ,0x3600 ,0x0100 ,0x0100 , +"Kingston" , +"DT 101 G2" , +US_SC_DEVICE ,US_PR_DEVICE ,NULL , +US_FL_BULK_IGNORE_TAG ), +/* Reported by Francesco Foresti <[email protected]> */ UNUSUAL_DEV( 0x14cd, 0x6600, 0x0201, 0x0201, "Super Top",
PATCH 19/27 SCSI: scsi_lib: fix potential NULL dereference
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Slaby <[email protected]>
commit 03b147083a2f9a2a3fbbd2505fa88ffa3c6ab194 upstream.
Stanse found a potential NULL dereference in scsi_kill_request.
Instead of triggering BUG() in 'if (unlikely(cmd == NULL))' branch, the kernel will Oops earlier on cmd dereference.
Move the dereferences after the if.
--- drivers/scsi/scsi_lib.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/scsi/scsi_lib.c +6 -3
@@ -1370,9 +1370,9 @@ static int scsi_lld_busy(struct request_static void scsi_kill_request (struct request *req,struct request_queue *q) {struct scsi_cmnd *cmd = req->special; -struct scsi_device *sdev = cmd->device; -struct scsi_target *starget =scsi_target (sdev); -struct Scsi_Host *shost = sdev->host; +struct scsi_device *sdev; +struct scsi_target *starget; +struct Scsi_Host *shost;blk_start_request (req);
@@ -1382,6 +1382,9 @@ static void scsi_kill_request(struct reqBUG (); } + sdev = cmd->device; + starget =scsi_target (sdev); + shost = sdev->host;scsi_init_cmd_errh (cmd); cmd->result =DID_NO_CONNECT <<16 ;atomic_inc (&cmd->device->iorequest_cnt);
PATCH 20/27 SCSI: Silencing killing requests for dead queue
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Hannes Reinecke <[email protected]>
commit 745718132c3c7cac98a622b610e239dcd5217f71 upstream.
When we tear down a device we try to flush all outstanding commands in scsi_free_queue(). However the check in scsi_request_fn() is imperfect as it only signals that we _might start_ aborting commands, not that we've actually aborted some.
So move the printk inside the scsi_kill_request function, this will also give us a hint about which commands are aborted.
--- drivers/scsi/scsi_lib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/scsi_lib.c +2 -1
@@ -1382,6 +1382,8 @@ static void scsi_kill_request(struct reqBUG (); } +scmd_printk (KERN_INFO , cmd,"killing request\n" ); + sdev = cmd->device; starget =scsi_target (sdev); shost = sdev->host;
@@ -1468,7 +1470,6 @@ static void scsi_request_fn(struct requestruct request *req;if (!sdev) { -printk ("scsi: killing requests for dead queue\n" );while ((req =blk_peek_request (q)) !=NULL )scsi_kill_request (req, q);return ;
PATCH 21/27 cifs: fix cifs stable patch cifs-fix-oplock-break-handling-try-2.patch
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Suresh Jayaraman <[email protected]>
The stable release 2.6.32.32 added the upstream commit 12fed00de963433128b5366a21a55808fab2f756. However, one of the hunks of the original patch seems missing from the stable backport which can be found here:
http://permalink.gmane.org/gmane.linux.kernel.stable/5676
This hunk corresponds to the change in is_valid_oplock_break() at fs/cifs/misc.c.
This patch backports the missing hunk and is against linux-2.6.32.y stable kernel.
--- fs/cifs/misc.c | 3 +++ 1 file changed, 3 insertions(+)
fs/cifs/misc.c +3 -0
@@ -584,6 +584,9 @@ is_valid_oplock_break(struct smb_hdr *bu pCifsInode->clientCanCacheAll = false;if (pSMB->OplockLevel ==0 ) pCifsInode->clientCanCacheRead = false; +else if (pSMB->OplockLevel) + pCifsInode->clientCanCacheRead = true; + rc =slow_work_enqueue (&netfile->oplock_break);if (rc) { cERROR(1, ("failed to enqueue oplock "
PATCH 22/27 sched, x86: Avoid unnecessary overflow in sched_clock
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Salman Qazi <[email protected]>
commit 4cecf6d401a01d054afc1e5f605bcbfe553cb9b9 upstream.
(Added the missing signed-off-by line)
In hundreds of days, the __cycles_2_ns calculation in sched_clock has an overflow. cyc * per_cpu(cyc2ns, cpu) exceeds 64 bits, causing the final value to become zero. We can solve this without losing any precision.
We can decompose TSC into quotient and remainder of division by the scale factor, and then use this to convert TSC into nanoseconds.
--- arch/x86/include/asm/timer.h | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-)
arch/x86/include/asm/timer.h +22 -1
@@ -38,6 +38,22 @@ extern int no_timer_check;* ([email protected]) * * [email protected] "math is hard, lets go shopping!" +* +* In: +* +* ns = cycles * cyc2ns_scale / SC +* +* Although we may still have enough bits to store the value of ns, +* in some cases, we may not have enough bits to store cycles * cyc2ns_scale, +* leading to an incorrect result. +* +* To avoid this, we can decompose 'cycles' into quotient and remainder +* of division by SC. Then, +* +* ns = (quot * SC + rem) * cyc2ns_scale / SC +* = quot * cyc2ns_scale + (rem * cyc2ns_scale) / SC +* +* - [email protected] */ DECLARE_PER_CPU(unsigned long, cyc2ns);
@@ -47,9 +63,14 @@ DECLARE_PER_CPU(unsigned long long, cyc2static inline unsigned long long __cycles_2_ns (unsigned long long cyc) { +unsigned long long quot; +unsigned long long rem;int cpu =smp_processor_id ();unsigned long long ns =per_cpu (cyc2ns_offset, cpu); - ns += cyc *per_cpu (cyc2ns, cpu) >>CYC2NS_SCALE_FACTOR ; + quot = (cyc >>CYC2NS_SCALE_FACTOR ); + rem = cyc & ((1ULL <<CYC2NS_SCALE_FACTOR ) -1 ); + ns += quot *per_cpu (cyc2ns, cpu) + + ((rem *per_cpu (cyc2ns, cpu)) >>CYC2NS_SCALE_FACTOR );return ns; }
PATCH 23/27 x86/mpparse: Account for bus types other than ISA and PCI
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Bjorn Helgaas <[email protected]>
commit 9e6866686bdf2dcf3aeb0838076237ede532dcc8 upstream.
In commit f8924e770e04 ("x86: unify mp_bus_info"), the 32-bit and 64-bit versions of MP_bus_info were rearranged to match each other better. Unfortunately it introduced a regression: prior to that change we used to always set the mp_bus_not_pci bit, then clear it if we found a PCI bus. After it, we set mp_bus_not_pci for ISA buses, clear it for PCI buses, and leave it alone otherwise.
In the cases of ISA and PCI, there's not much difference. But ISA is not the only non-PCI bus, so it's better to always set mp_bus_not_pci and clear it only for PCI.
Without this change, Dan's Dell PowerEdge 4200 panics on boot with a log indicating interrupt routing trouble unless the "noapic" option is supplied. With this change, the machine boots reliably without "noapic".
Fixes http://bugs.debian.org/586494
--- arch/x86/kernel/mpparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/mpparse.c +1 -1
@@ -94,8 +94,8 @@ static void __init MP_bus_info(struct mp }#endif +set_bit (m->busid, mp_bus_not_pci);if (strncmp (str,BUSTYPE_ISA ,sizeof (BUSTYPE_ISA ) -1 ) ==0 ) { -set_bit (m->busid, mp_bus_not_pci);#if defined(CONFIG_EISA ) || defined(CONFIG_MCA ) mp_bus_id_to_type[m->busid] =MP_BUS_ISA ;#endif
PATCH 24/27 oprofile, x86: Fix crash when unloading module (nmi timer mode)
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Robert Richter <[email protected]>
commit 97f7f8189fe54e3cfe324ef9ad35064f3d2d3bff upstream.
If oprofile uses the nmi timer interrupt there is a crash while unloading the module. The bug can be triggered with oprofile build as module and kernel parameter nolapic set. This patch fixes this.
oprofile: using NMI timer interrupt.
BUG: unable to handle kernel NULL pointer dereference at 0000000000000008 IP: [<ffffffff8123c226>] unregister_syscore_ops+0x41/0x58 PGD 42dbca067 PUD 41da6a067 PMD 0 Oops: 0002 [#1] PREEMPT SMP CPU 5 Modules linked in: oprofile(-) [last unloaded: oprofile]
Pid: 2518, comm: modprobe Not tainted 3.1.0-rc7-00019-gb2fb49d #19 Advanced Micro Device Anaheim/Anaheim
RIP: 0010:[<ffffffff8123c226>] [<ffffffff8123c226>] unregister_syscore_ops+0x41/0x58 RSP: 0018:ffff88041ef71e98 EFLAGS: 00010296 RAX: 0000000000000000 RBX: ffffffffa0017100 RCX: dead000000200200 RDX: 0000000000000000 RSI: dead000000100100 RDI: ffffffff8178c620 RBP: ffff88041ef71ea8 R08: 0000000000000001 R09: 0000000000000082 R10: 0000000000000000 R11: ffff88041ef71de8 R12: 0000000000000080 R13: fffffffffffffff5 R14: 0000000000000001 R15: 0000000000610210 FS: 00007fc902f20700(0000) GS:ffff88042fd40000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b CR2: 0000000000000008 CR3: 000000041cdb6000 CR4: 00000000000006e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 Process modprobe (pid: 2518, threadinfo ffff88041ef70000, task ffff88041d348040) Stack: ffff88041ef71eb8 ffffffffa0017790 ffff88041ef71eb8 ffffffffa0013532 ffff88041ef71ec8 ffffffffa00132d6 ffff88041ef71ed8 ffffffffa00159b2 ffff88041ef71f78 ffffffff81073115 656c69666f72706f 0000000000610200 Call Trace: [<ffffffffa0013532>] op_nmi_exit+0x15/0x17 [oprofile] [<ffffffffa00132d6>] oprofile_arch_exit+0xe/0x10 [oprofile] [<ffffffffa00159b2>] oprofile_exit+0x1e/0x20 [oprofile] [<ffffffff81073115>] sys_delete_module+0x1c3/0x22f [<ffffffff811bf09e>] ? trace_hardirqs_on_thunk+0x3a/0x3f [<ffffffff8148070b>] system_call_fastpath+0x16/0x1b Code: 20 c6 78 81 e8 c5 cc 23 00 48 8b 13 48 8b 43 08 48 be 00 01 10 00 00 00 ad de 48 b9 00 02 20 00 00 00 ad de 48 c7 c7 20 c6 78 81 89 42 08 48 89 10 48 89 33 48 89 4b 08 e8 a6 c0 23 00 5a 5b RIP [<ffffffff8123c226>] unregister_syscore_ops+0x41/0x58 RSP <ffff88041ef71e98> CR2: 0000000000000008 ---[ end trace 43a541a52956b7b0 ]---
--- arch/x86/oprofile/init.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
arch/x86/oprofile/init.c +5 -2
@@ -21,6 +21,7 @@ extern int op_nmi_timer_init(struct oproextern void op_nmi_exit (void );extern void x86_backtrace (struct pt_regs *const regs,unsigned int depth); +static int nmi_timer;int __init oprofile_arch_init (struct oprofile_operations *ops) {
@@ -31,8 +32,9 @@ int __init oprofile_arch_init(struct opr#ifdef CONFIG_X86_LOCAL_APIC ret =op_nmi_init (ops);#endif + nmi_timer = (ret !=0 );#ifdef CONFIG_X86_IO_APIC -if (ret <0 ) +if (nmi_timer) ret =op_nmi_timer_init (ops);#endif ops->backtrace = x86_backtrace;
@@ -44,6 +46,7 @@ int __init oprofile_arch_init(struct oprvoid oprofile_arch_exit (void ) {#ifdef CONFIG_X86_LOCAL_APIC -op_nmi_exit (); +if (!nmi_timer) +op_nmi_exit ();#endif }
PATCH 25/27 genirq: Fix race condition when stopping the irq thread
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Ido Yariv <[email protected]>
commit 550acb19269d65f32e9ac4ddb26c2b2070e37f1c upstream.
In irq_wait_for_interrupt(), the should_stop member is verified before setting the task's state to TASK_INTERRUPTIBLE and calling schedule(). In case kthread_stop sets should_stop and wakes up the process after should_stop is checked by the irq thread but before the task's state is changed, the irq thread might never exit:
kthread_stop irq_wait_for_interrupt
------------ ----------------------
...
... while (!kthread_should_stop()) {kthread->should_stop = 1;wake_up_process(k);wait_for_completion(&kthread->exited);
...
set_current_state(TASK_INTERRUPTIBLE);
...
schedule();
}Fix this by checking if the thread should stop after modifying the task's state.
[ tglx: Simplified it a bit ]
--- kernel/irq/manage.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
kernel/irq/manage.c +4 -1
@@ -475,8 +475,9 @@ static irqreturn_t irq_nested_primary_hastatic int irq_wait_for_interrupt (struct irqaction *action) { +set_current_state (TASK_INTERRUPTIBLE ); +while (!kthread_should_stop ()) { -set_current_state (TASK_INTERRUPTIBLE );if (test_and_clear_bit (IRQTF_RUNTHREAD , &action->thread_flags)) {
@@ -484,7 +485,9 @@ static int irq_wait_for_interrupt(structreturn 0 ; }schedule (); +set_current_state (TASK_INTERRUPTIBLE ); } +__set_current_state (TASK_RUNNING );return -1 ; }
PATCH 26/27 tick-broadcast: Stop active broadcast device when replacing it
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit c1be84309c58b1e7c6d626e28fba41a22b364c3d upstream.
When a better rated broadcast device is installed, then the current active device is not disabled, which results in two running broadcast devices.
--- kernel/time/tick-broadcast.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/time/tick-broadcast.c +1 -1
@@ -72,7 +72,7 @@ int tick_check_broadcast_device(struct c (dev->features & CLOCK_EVT_FEAT_C3STOP))return 0 ; -clockevents_exchange_device (NULL , dev); +clockevents_exchange_device (tick_broadcast_device.evtdev, dev); tick_broadcast_device.evtdev = dev;if (!cpumask_empty (tick_get_broadcast_mask ()))tick_broadcast_start_periodic (dev);
PATCH 27/27 clockevents: Set noop handler in clockevents_exchange_device()
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit de28f25e8244c7353abed8de0c7792f5f883588c upstream.
If a device is shutdown, then there might be a pending interrupt, which will be processed after we reenable interrupts, which causes the original handler to be run. If the old handler is the (broadcast) periodic handler the shutdown state might hang the kernel completely.
--- kernel/time/clockevents.c | 1 + 1 file changed, 1 insertion(+)
kernel/time/clockevents.c +1 -0
@@ -221,6 +221,7 @@ void clockevents_exchange_device(struct* released list and do a notify add later. */ if (old) { + old->event_handler = clockevents_handle_noop;clockevents_set_mode (old,CLOCK_EVT_MODE_UNUSED );list_del (&old->list);list_add (&old->list, &clockevents_released);
Re: [27/27] clockevents: Set noop handler in clockevents_exchange_device()
Hi Greg,
Quoted 7 lines · Greg KH
2.6.32-longterm review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit
de28f25e8244c7353abed8de0c7792f5f883588cupstream.
[...]
kernel/time/clockevents.c void clockevents_exchange_device(struct · line 225
Quoted 8 lines
kernel/time/clockevents.c +1
-0@@ -221,6 +221,7 @@ void clockevents_exchange_device(struct* released list and do a notify add later. */ if (old) { + old->event_handler = clockevents_handle_noop;clockevents_set_mode (old,CLOCK_EVT_MODE_UNUSED );
This is basically the reverse of 7c1e768974 (clockevents: prevent clockevent event_handler ending up handler_noop, 2008-09-03). The rationale for the latter still applies. People have been reporting the analagous patch to this one causing hangs on resume in 3.1.y and 3.2 release candidates:
- http://thread.gmane.org/gmane.linux.kernel/1233033
- http://thread.gmane.org/gmane.linux.kernel/1233389
- http://thread.gmane.org/gmane.linux.kernel/1233159
- http://thread.gmane.org/gmane.linux.kernel/1227868/focus=1230877
So please consider reverting it for now.
Thanks,
Jonathan
Re: [27/27] clockevents: Set noop handler in clockevents_exchange_device()
Quoted 4 lines · Jonathan Nieder
This is basically the reverse of
7c1e768974(clockevents: prevent clockeventevent_handlerending uphandler_noop, 2008-09-03). �The rationale for the latter still applies.
Hmm. You seem to be right. Instead of applying this to stable, it looks like we should revert it from mainline.
Quoted 10 lines
�People have been reporting
the analagous patch to this one causing hangs on resume in 3.1.y and 3.2 release candidates:�- http://thread.gmane.org/gmane.linux.kernel/1233033
�- http://thread.gmane.org/gmane.linux.kernel/1233389
�- http://thread.gmane.org/gmane.linux.kernel/1233159
�- http://thread.gmane.org/gmane.linux.kernel/1227868/focus=1230877So please consider reverting it for now.
Thomas? It does seem to be broken and there do seem to be regression reports about it.
Should I revert it, or do you have alternative fixes?
Linus
Re: [27/27] clockevents: Set noop handler in clockevents_exchange_device()
Quoted 20 lines · Linus Torvalds
Quoted 4 lines · Jonathan Nieder
This is basically the reverse of
7c1e768974(clockevents: prevent clockeventevent_handlerending uphandler_noop, 2008-09-03). The rationale for the latter still applies.Hmm. You seem to be right. Instead of applying this to stable, it looks like we should revert it from mainline.
Quoted 10 lines
People have been reporting
the analagous patch to this one causing hangs on resume in 3.1.y and 3.2 release candidates:- http://thread.gmane.org/gmane.linux.kernel/1233033
- http://thread.gmane.org/gmane.linux.kernel/1233389
- http://thread.gmane.org/gmane.linux.kernel/1233159
- http://thread.gmane.org/gmane.linux.kernel/1227868/focus=1230877So please consider reverting it for now.
Quoted 7 lines
Thomas? It does seem to be broken and there do seem to be regression reports about it.
Should I revert it, or do you have alternative fixes?
Linus
--
We (Ubuntu) are seeing this issue as well in both 3.0.13 and 3.2-rc6:
https://lkml.org/lkml/2011/12/24/33
Reverting that single patch alleviates the resume regression.
rtg
Signature · 1 line
Tim Gardner [email protected]
A message that is not in the archive (sent off-list or not yet received): CA++bM2uqcWFM6=WdmrusmugQw2nH_KDyySKH+1qyr8GK0Cq14A@mail.gmail.com
Re: [27/27] clockevents: Set noop handler in clockevents_exchange_device()
Hi Tim and all,
Quoted 46 lines
From: Tim Gardner <[email protected]>
Date: 2011/12/30
Subject: Re: [27/27] clockevents: Set noop handler inclockevents_exchange_device()
To: Linus Torvalds <[email protected]>
抄送: Jonathan Nieder <[email protected]>, Thomas Gleixner <[email protected]>, Greg KH <[email protected]>, [email protected], [email protected], [email protected], Alan Cox <[email protected]>, Phil Miller <[email protected]>Quoted 24 lines · Linus Torvalds
Quoted 5 lines · Jonathan Nieder
This is basically the reverse of
7c1e768974(clockevents: prevent clockeventevent_handlerending uphandler_noop, 2008-09-03). The rationale for the latter still applies.Hmm. You seem to be right. Instead of applying this to stable, it looks like we should revert it from mainline.
Quoted 10 lines
People have been reporting
the analagous patch to this one causing hangs on resume in 3.1.y and 3.2 release candidates:- http://thread.gmane.org/gmane.linux.kernel/1233033
- http://thread.gmane.org/gmane.linux.kernel/1233389
- http://thread.gmane.org/gmane.linux.kernel/1233159
- http://thread.gmane.org/gmane.linux.kernel/1227868/focus=1230877So please consider reverting it for now.
Quoted 7 lines
Thomas? It does seem to be broken and there do seem to be regression reports about it.
Should I revert it, or do you have alternative fixes?
Linus
--
Quoted 5 lines
We (Ubuntu) are seeing this issue as well in both 3.0.13 and 3.2-rc6:
https://lkml.org/lkml/2011/12/24/33
Reverting that single patch alleviates the resume regression.
I had a Dell Studio XPS machine which see the same hang issue. Per my track, the root cause of the hang should be:
The machine has 8 CPUs and several Hpets, and it use one hpet as its broadcast tick device, and 5 hpets as per-cpu tick device for CPU 0-4, 3 Lapics as per-cpu tick device for CPU 5-7.
During the resume cycle, for CPU0-4, the per-cpu tick device setup is a little complex, a lapic will be assigned as the per-cpu tick first, and then there will be a switch from lapic to hpet, and problem happens here during the switch:
tick_check_new_device()
->clockevents_exchange_device(): set the noop handler to lapic tick
->tick_setup_device(): pass the lapic's handler(noop handler) to hpetSo after the resume, 5 per-cpu hpet device's handler will be all noop handler instead of hrtimer_interrupt, which will hang the resuming.
Following is a patch which fix the problem on my side, could you please review and try?
-------------------------------------------------------------------------
include/linux/clockchips.h +4 -0
@@ -101,6 +101,10 @@ struct clock_event_device {int irq;const struct cpumask *cpumask;struct list_head list; + +#ifdef CONFIG_GENERIC_CLOCKEVENTS +struct tick_device *td; +#endif }____cacheline_aligned ;/*
include/linux/tick.h +1 -0
@@ -17,6 +17,7 @@ enum tick_device_mode {struct tick_device {struct clock_event_device *evtdev; +void (*last_event_handler)(struct clock_event_device *);enum tick_device_mode mode; };
kernel/time/clockevents.c +9 -0
@@ -286,6 +286,15 @@ void clockevents_exchange_device(struct clock_event_device *old,* released list and do a notify add later. */ if (old) { +/* +* If the old device is the per-cpu tick device, then we +* need to record its event handler, so that it could be +* passed to the new tick device in tick_setup_device() +*/ +if (old->td) { + old->td->last_event_handler = old->event_handler; + old->td =NULL ; + } old->event_handler = clockevents_handle_noop;clockevents_set_mode (old,CLOCK_EVT_MODE_UNUSED );list_del (&old->list);
kernel/time/tick-common.c +2 -2
@@ -173,12 +173,12 @@ static void tick_setup_device(struct tick_device *td,*/ td->mode =TICKDEV_MODE_PERIODIC ; }else { - handler = td->evtdev->event_handler; + handler = td->last_event_handler; next_event = td->evtdev->next_event; - td->evtdev->event_handler = clockevents_handle_noop; } td->evtdev = newdev; + newdev->td = td;/* * When the device is not per cpu, pin the interrupt to the
Quoted 10 lines
rtg
--
Tim Gardner [email protected]--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Re: [27/27] clockevents: Set noop handler in clockevents_exchange_device()
In reply to Linus TorvaldsQuoted 18 lines · Linus Torvalds
Quoted 4 lines · Jonathan Nieder
This is basically the reverse of
7c1e768974(clockevents: prevent clockeventevent_handlerending uphandler_noop, 2008-09-03). �The rationale for the latter still applies.Hmm. You seem to be right. Instead of applying this to stable, it looks like we should revert it from mainline.
Quoted 9 lines
�People have been reporting
the analagous patch to this one causing hangs on resume in 3.1.y and 3.2 release candidates:�- http://thread.gmane.org/gmane.linux.kernel/1233033
�- http://thread.gmane.org/gmane.linux.kernel/1233389
�- http://thread.gmane.org/gmane.linux.kernel/1233159
�- http://thread.gmane.org/gmane.linux.kernel/1227868/focus=1230877
Quoted 6 lines
Quoted 1 line
So please consider reverting it for now.
Thomas? It does seem to be broken and there do seem to be regression reports about it.
Should I revert it, or do you have alternative fixes?
Hmm. I have no idea what broke. Will have a look.
Thanks,
tglx