From 2943362a92ddecdd45d3e7fa6bf0586c48db3b9b Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 23 Apr 2012 11:58:55 -0700 Subject: [PATCH] 3.0-stable patches added patches: davinci_mdio-fix-mdio-timeout-check.patch usb-yurex-fix-missing-urb_no_transfer_dma_map-flag-in-urb.patch usb-yurex-remove-allocation-of-coherent-buffer-for-setup-packet-buffer.patch uwb-fix-error-handling.patch uwb-fix-use-of-del_timer_sync-in-interrupt.patch xen-gntdev-do-not-set-vm_pfnmap.patch xen-xenbus-add-quirk-to-deal-with-misconfigured-backends.patch --- .../davinci_mdio-fix-mdio-timeout-check.patch | 42 +++++ queue-3.0/series | 7 + ...-urb_no_transfer_dma_map-flag-in-urb.patch | 31 ++++ ...erent-buffer-for-setup-packet-buffer.patch | 44 ++++++ queue-3.0/uwb-fix-error-handling.patch | 31 ++++ ...x-use-of-del_timer_sync-in-interrupt.patch | 61 ++++++++ .../xen-gntdev-do-not-set-vm_pfnmap.patch | 35 +++++ ...-to-deal-with-misconfigured-backends.patch | 148 ++++++++++++++++++ 8 files changed, 399 insertions(+) create mode 100644 queue-3.0/davinci_mdio-fix-mdio-timeout-check.patch create mode 100644 queue-3.0/usb-yurex-fix-missing-urb_no_transfer_dma_map-flag-in-urb.patch create mode 100644 queue-3.0/usb-yurex-remove-allocation-of-coherent-buffer-for-setup-packet-buffer.patch create mode 100644 queue-3.0/uwb-fix-error-handling.patch create mode 100644 queue-3.0/uwb-fix-use-of-del_timer_sync-in-interrupt.patch create mode 100644 queue-3.0/xen-gntdev-do-not-set-vm_pfnmap.patch create mode 100644 queue-3.0/xen-xenbus-add-quirk-to-deal-with-misconfigured-backends.patch diff --git a/queue-3.0/davinci_mdio-fix-mdio-timeout-check.patch b/queue-3.0/davinci_mdio-fix-mdio-timeout-check.patch new file mode 100644 index 00000000000..4e0f5fc3930 --- /dev/null +++ b/queue-3.0/davinci_mdio-fix-mdio-timeout-check.patch @@ -0,0 +1,42 @@ +From 5b76d0600b2b08eef77f8e9226938b7b6bde3099 Mon Sep 17 00:00:00 2001 +From: Christian Riesch +Date: Mon, 16 Apr 2012 04:35:25 +0000 +Subject: davinci_mdio: Fix MDIO timeout check + +From: Christian Riesch + +commit 5b76d0600b2b08eef77f8e9226938b7b6bde3099 upstream. + +Under heavy load (flood ping) it is possible for the MDIO timeout to +expire before the loop checks the GO bit again. This patch adds an +additional check whether the operation was done before actually +returning -ETIMEDOUT. + +To reproduce this bug, flood ping the device, e.g., ping -f -l 1000 +After some time, a "timed out waiting for user access" warning +may appear. And even worse, link may go down since the PHY reported a +timeout. + +Signed-off-by: Christian Riesch +Cc: Cyril Chemparathy +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/davinci_mdio.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/drivers/net/davinci_mdio.c ++++ b/drivers/net/davinci_mdio.c +@@ -181,6 +181,11 @@ static inline int wait_for_user_access(s + __davinci_mdio_reset(data); + return -EAGAIN; + } ++ ++ reg = __raw_readl(®s->user[0].access); ++ if ((reg & USERACCESS_GO) == 0) ++ return 0; ++ + dev_err(data->dev, "timed out waiting for user access\n"); + return -ETIMEDOUT; + } diff --git a/queue-3.0/series b/queue-3.0/series index 999ecd934d0..82ab2db56f6 100644 --- a/queue-3.0/series +++ b/queue-3.0/series @@ -3,3 +3,10 @@ crypto-sha512-fix-byte-counter-overflow-in-sha-512.patch hwmon-fam15h_power-fix-bogus-values-with-current-bioses.patch alsa-hda-conexant-don-t-set-hp-pin-control-bit.patch arm-clps711x-serial-driver-hungs-are-a-result-of-call-disable_irq-within-isr.patch +xen-gntdev-do-not-set-vm_pfnmap.patch +xen-xenbus-add-quirk-to-deal-with-misconfigured-backends.patch +usb-yurex-remove-allocation-of-coherent-buffer-for-setup-packet-buffer.patch +usb-yurex-fix-missing-urb_no_transfer_dma_map-flag-in-urb.patch +uwb-fix-use-of-del_timer_sync-in-interrupt.patch +uwb-fix-error-handling.patch +davinci_mdio-fix-mdio-timeout-check.patch diff --git a/queue-3.0/usb-yurex-fix-missing-urb_no_transfer_dma_map-flag-in-urb.patch b/queue-3.0/usb-yurex-fix-missing-urb_no_transfer_dma_map-flag-in-urb.patch new file mode 100644 index 00000000000..de968dc42d3 --- /dev/null +++ b/queue-3.0/usb-yurex-fix-missing-urb_no_transfer_dma_map-flag-in-urb.patch @@ -0,0 +1,31 @@ +From 532f17b5d59bf0deb6f1ff9bc1fb27d5b5011c09 Mon Sep 17 00:00:00 2001 +From: Tomoki Sekiyama +Date: Fri, 30 Mar 2012 08:51:36 +0900 +Subject: USB: yurex: Fix missing URB_NO_TRANSFER_DMA_MAP flag in urb + +From: Tomoki Sekiyama + +commit 532f17b5d59bf0deb6f1ff9bc1fb27d5b5011c09 upstream. + +Current probing code is setting URB_NO_TRANSFER_DMA_MAP flag into a wrong urb +structure, and this causes BUG_ON with some USB host implementations. +This patch fixes the issue. + +Signed-off-by: Tomoki Sekiyama +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/misc/yurex.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/usb/misc/yurex.c ++++ b/drivers/usb/misc/yurex.c +@@ -282,7 +282,7 @@ static int yurex_probe(struct usb_interf + usb_rcvintpipe(dev->udev, dev->int_in_endpointAddr), + dev->int_buffer, YUREX_BUF_SIZE, yurex_interrupt, + dev, 1); +- dev->cntl_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; ++ dev->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; + if (usb_submit_urb(dev->urb, GFP_KERNEL)) { + retval = -EIO; + err("Could not submitting URB"); diff --git a/queue-3.0/usb-yurex-remove-allocation-of-coherent-buffer-for-setup-packet-buffer.patch b/queue-3.0/usb-yurex-remove-allocation-of-coherent-buffer-for-setup-packet-buffer.patch new file mode 100644 index 00000000000..690412ea4e5 --- /dev/null +++ b/queue-3.0/usb-yurex-remove-allocation-of-coherent-buffer-for-setup-packet-buffer.patch @@ -0,0 +1,44 @@ +From 523fc5c14f6cad283e5a266eba0e343aed6e73d5 Mon Sep 17 00:00:00 2001 +From: Tomoki Sekiyama +Date: Fri, 30 Mar 2012 08:51:28 +0900 +Subject: USB: yurex: Remove allocation of coherent buffer for setup-packet buffer + +From: Tomoki Sekiyama + +commit 523fc5c14f6cad283e5a266eba0e343aed6e73d5 upstream. + +Removes allocation of coherent buffer for the control-request setup-packet +buffer from the yurex driver. Using coherent buffers for setup-packet is +obsolete and does not work with some USB host implementations. + +Signed-off-by: Tomoki Sekiyama +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/misc/yurex.c | 8 ++------ + 1 file changed, 2 insertions(+), 6 deletions(-) + +--- a/drivers/usb/misc/yurex.c ++++ b/drivers/usb/misc/yurex.c +@@ -99,9 +99,7 @@ static void yurex_delete(struct kref *kr + usb_put_dev(dev->udev); + if (dev->cntl_urb) { + usb_kill_urb(dev->cntl_urb); +- if (dev->cntl_req) +- usb_free_coherent(dev->udev, YUREX_BUF_SIZE, +- dev->cntl_req, dev->cntl_urb->setup_dma); ++ kfree(dev->cntl_req); + if (dev->cntl_buffer) + usb_free_coherent(dev->udev, YUREX_BUF_SIZE, + dev->cntl_buffer, dev->cntl_urb->transfer_dma); +@@ -234,9 +232,7 @@ static int yurex_probe(struct usb_interf + } + + /* allocate buffer for control req */ +- dev->cntl_req = usb_alloc_coherent(dev->udev, YUREX_BUF_SIZE, +- GFP_KERNEL, +- &dev->cntl_urb->setup_dma); ++ dev->cntl_req = kmalloc(YUREX_BUF_SIZE, GFP_KERNEL); + if (!dev->cntl_req) { + err("Could not allocate cntl_req"); + goto error; diff --git a/queue-3.0/uwb-fix-error-handling.patch b/queue-3.0/uwb-fix-error-handling.patch new file mode 100644 index 00000000000..0de2e8b6340 --- /dev/null +++ b/queue-3.0/uwb-fix-error-handling.patch @@ -0,0 +1,31 @@ +From 5bd7b419ef2eb4989b207753e088c3437159618a Mon Sep 17 00:00:00 2001 +From: Oliver Neukum +Date: Wed, 18 Apr 2012 10:05:55 +0200 +Subject: uwb: fix error handling + +From: Oliver Neukum + +commit 5bd7b419ef2eb4989b207753e088c3437159618a upstream. + +Fatal errors such as a device disconnect must not trigger +error handling. The error returns must be checked. + +Signed-off-by: Oliver Neukum +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/uwb/hwa-rc.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/uwb/hwa-rc.c ++++ b/drivers/uwb/hwa-rc.c +@@ -645,7 +645,8 @@ void hwarc_neep_cb(struct urb *urb) + dev_err(dev, "NEEP: URB error %d\n", urb->status); + } + result = usb_submit_urb(urb, GFP_ATOMIC); +- if (result < 0) { ++ if (result < 0 && result != -ENODEV && result != -EPERM) { ++ /* ignoring unrecoverable errors */ + dev_err(dev, "NEEP: Can't resubmit URB (%d) resetting device\n", + result); + goto error; diff --git a/queue-3.0/uwb-fix-use-of-del_timer_sync-in-interrupt.patch b/queue-3.0/uwb-fix-use-of-del_timer_sync-in-interrupt.patch new file mode 100644 index 00000000000..d5757744a9b --- /dev/null +++ b/queue-3.0/uwb-fix-use-of-del_timer_sync-in-interrupt.patch @@ -0,0 +1,61 @@ +From 9426cd05682745d1024dbabdec5631309bd2f480 Mon Sep 17 00:00:00 2001 +From: Oliver Neukum +Date: Mon, 16 Apr 2012 15:28:28 +0200 +Subject: uwb: fix use of del_timer_sync() in interrupt + +From: Oliver Neukum + +commit 9426cd05682745d1024dbabdec5631309bd2f480 upstream. + +del_timer_sync() cannot be used in interrupt. +Replace it with del_timer() and a flag + +Signed-off-by: Oliver Neukum +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/uwb/neh.c | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +--- a/drivers/uwb/neh.c ++++ b/drivers/uwb/neh.c +@@ -106,6 +106,7 @@ struct uwb_rc_neh { + u8 evt_type; + __le16 evt; + u8 context; ++ u8 completed; + uwb_rc_cmd_cb_f cb; + void *arg; + +@@ -408,6 +409,7 @@ static void uwb_rc_neh_grok_event(struct + struct device *dev = &rc->uwb_dev.dev; + struct uwb_rc_neh *neh; + struct uwb_rceb *notif; ++ unsigned long flags; + + if (rceb->bEventContext == 0) { + notif = kmalloc(size, GFP_ATOMIC); +@@ -421,7 +423,11 @@ static void uwb_rc_neh_grok_event(struct + } else { + neh = uwb_rc_neh_lookup(rc, rceb); + if (neh) { +- del_timer_sync(&neh->timer); ++ spin_lock_irqsave(&rc->neh_lock, flags); ++ /* to guard against a timeout */ ++ neh->completed = 1; ++ del_timer(&neh->timer); ++ spin_unlock_irqrestore(&rc->neh_lock, flags); + uwb_rc_neh_cb(neh, rceb, size); + } else + dev_warn(dev, "event 0x%02x/%04x/%02x (%zu bytes): nobody cared\n", +@@ -567,6 +573,10 @@ static void uwb_rc_neh_timer(unsigned lo + unsigned long flags; + + spin_lock_irqsave(&rc->neh_lock, flags); ++ if (neh->completed) { ++ spin_unlock_irqrestore(&rc->neh_lock, flags); ++ return; ++ } + if (neh->context) + __uwb_rc_neh_rm(rc, neh); + else diff --git a/queue-3.0/xen-gntdev-do-not-set-vm_pfnmap.patch b/queue-3.0/xen-gntdev-do-not-set-vm_pfnmap.patch new file mode 100644 index 00000000000..86ebf4f8107 --- /dev/null +++ b/queue-3.0/xen-gntdev-do-not-set-vm_pfnmap.patch @@ -0,0 +1,35 @@ +From e8e937be971d706061dc56220ff3605ab77622a7 Mon Sep 17 00:00:00 2001 +From: Stefano Stabellini +Date: Tue, 3 Apr 2012 18:05:47 +0100 +Subject: xen/gntdev: do not set VM_PFNMAP + +From: Stefano Stabellini + +commit e8e937be971d706061dc56220ff3605ab77622a7 upstream. + +Since we are using the m2p_override we do have struct pages +corresponding to the user vma mmap'ed by gntdev. + +Removing the VM_PFNMAP flag makes get_user_pages work on that vma. +An example test case would be using a Xen userspace block backend +(QDISK) on a file on NFS using O_DIRECT. + +Signed-off-by: Stefano Stabellini +Signed-off-by: Konrad Rzeszutek Wilk +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/xen/gntdev.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/xen/gntdev.c ++++ b/drivers/xen/gntdev.c +@@ -664,7 +664,7 @@ static int gntdev_mmap(struct file *flip + vma->vm_flags |= VM_RESERVED|VM_DONTEXPAND; + + if (use_ptemod) +- vma->vm_flags |= VM_DONTCOPY|VM_PFNMAP; ++ vma->vm_flags |= VM_DONTCOPY; + + vma->vm_private_data = map; + diff --git a/queue-3.0/xen-xenbus-add-quirk-to-deal-with-misconfigured-backends.patch b/queue-3.0/xen-xenbus-add-quirk-to-deal-with-misconfigured-backends.patch new file mode 100644 index 00000000000..026ce94878e --- /dev/null +++ b/queue-3.0/xen-xenbus-add-quirk-to-deal-with-misconfigured-backends.patch @@ -0,0 +1,148 @@ +From 3066616ce23aad5719c23a0f21f32676402cb44b Mon Sep 17 00:00:00 2001 +From: Konrad Rzeszutek Wilk +Date: Tue, 17 Apr 2012 22:21:38 -0400 +Subject: xen/xenbus: Add quirk to deal with misconfigured backends. + +From: Konrad Rzeszutek Wilk + +commit 3066616ce23aad5719c23a0f21f32676402cb44b upstream. + +A rather annoying and common case is when booting a PVonHVM guest +and exposing the PV KBD and PV VFB - as broken toolstacks don't +always initialize the backends correctly. + +Normally The HVM guest is using the VGA driver and the emulated +keyboard for this (though upstream version of QEMU implements +PV KBD, but still uses a VGA driver). We provide a very basic +two-stage wait mechanism - where we wait for 30 seconds for all +devices, and then for 270 for all them except the two mentioned. + +That allows us to wait for the essential devices, like network +or disk for the full 6 minutes. + +To trigger this, put this in your guest config: + +vfb = [ 'vnc=1, vnclisten=0.0.0.0 ,vncunused=1'] + +instead of this: +vnc=1 +vnclisten="0.0.0.0" + +Acked-by: Stefano Stabellini +[v3: Split delay in non-essential (30 seconds) and essential + devices per Ian and Stefano suggestion] +[v4: Added comments per Stefano suggestion] +Signed-off-by: Konrad Rzeszutek Wilk +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/xen/xenbus/xenbus_probe_frontend.c | 69 ++++++++++++++++++++++------- + 1 file changed, 53 insertions(+), 16 deletions(-) + +--- a/drivers/xen/xenbus/xenbus_probe_frontend.c ++++ b/drivers/xen/xenbus/xenbus_probe_frontend.c +@@ -132,7 +132,7 @@ static int read_backend_details(struct x + return xenbus_read_otherend_details(xendev, "backend-id", "backend"); + } + +-static int is_device_connecting(struct device *dev, void *data) ++static int is_device_connecting(struct device *dev, void *data, bool ignore_nonessential) + { + struct xenbus_device *xendev = to_xenbus_device(dev); + struct device_driver *drv = data; +@@ -149,16 +149,41 @@ static int is_device_connecting(struct d + if (drv && (dev->driver != drv)) + return 0; + ++ if (ignore_nonessential) { ++ /* With older QEMU, for PVonHVM guests the guest config files ++ * could contain: vfb = [ 'vnc=1, vnclisten=0.0.0.0'] ++ * which is nonsensical as there is no PV FB (there can be ++ * a PVKB) running as HVM guest. */ ++ ++ if ((strncmp(xendev->nodename, "device/vkbd", 11) == 0)) ++ return 0; ++ ++ if ((strncmp(xendev->nodename, "device/vfb", 10) == 0)) ++ return 0; ++ } + xendrv = to_xenbus_driver(dev->driver); + return (xendev->state < XenbusStateConnected || + (xendev->state == XenbusStateConnected && + xendrv->is_ready && !xendrv->is_ready(xendev))); + } ++static int essential_device_connecting(struct device *dev, void *data) ++{ ++ return is_device_connecting(dev, data, true /* ignore PV[KBB+FB] */); ++} ++static int non_essential_device_connecting(struct device *dev, void *data) ++{ ++ return is_device_connecting(dev, data, false); ++} + +-static int exists_connecting_device(struct device_driver *drv) ++static int exists_essential_connecting_device(struct device_driver *drv) + { + return bus_for_each_dev(&xenbus_frontend.bus, NULL, drv, +- is_device_connecting); ++ essential_device_connecting); ++} ++static int exists_non_essential_connecting_device(struct device_driver *drv) ++{ ++ return bus_for_each_dev(&xenbus_frontend.bus, NULL, drv, ++ non_essential_device_connecting); + } + + static int print_device_status(struct device *dev, void *data) +@@ -189,6 +214,23 @@ static int print_device_status(struct de + /* We only wait for device setup after most initcalls have run. */ + static int ready_to_wait_for_devices; + ++static bool wait_loop(unsigned long start, unsigned int max_delay, ++ unsigned int *seconds_waited) ++{ ++ if (time_after(jiffies, start + (*seconds_waited+5)*HZ)) { ++ if (!*seconds_waited) ++ printk(KERN_WARNING "XENBUS: Waiting for " ++ "devices to initialise: "); ++ *seconds_waited += 5; ++ printk("%us...", max_delay - *seconds_waited); ++ if (*seconds_waited == max_delay) ++ return true; ++ } ++ ++ schedule_timeout_interruptible(HZ/10); ++ ++ return false; ++} + /* + * On a 5-minute timeout, wait for all devices currently configured. We need + * to do this to guarantee that the filesystems and / or network devices +@@ -212,19 +254,14 @@ static void wait_for_devices(struct xenb + if (!ready_to_wait_for_devices || !xen_domain()) + return; + +- while (exists_connecting_device(drv)) { +- if (time_after(jiffies, start + (seconds_waited+5)*HZ)) { +- if (!seconds_waited) +- printk(KERN_WARNING "XENBUS: Waiting for " +- "devices to initialise: "); +- seconds_waited += 5; +- printk("%us...", 300 - seconds_waited); +- if (seconds_waited == 300) +- break; +- } +- +- schedule_timeout_interruptible(HZ/10); +- } ++ while (exists_non_essential_connecting_device(drv)) ++ if (wait_loop(start, 30, &seconds_waited)) ++ break; ++ ++ /* Skips PVKB and PVFB check.*/ ++ while (exists_essential_connecting_device(drv)) ++ if (wait_loop(start, 270, &seconds_waited)) ++ break; + + if (seconds_waited) + printk("\n"); -- 2.47.3