2011-03-30 21:05:37

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [0/275] 2.6.35.12 longterm review


This is the start of the longterm review cycle for the 2.6.35.12 release.
There are a large number of 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. 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.

The full quilt queue can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/longterm/longterm-queue-2.6.35

Responses should be made within 48 hours.

-Andi


2011-03-30 21:05:38

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [1/275] perf session: Invalidate last_match when removing threads from rb_tree

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Arnaldo Carvalho de Melo <[email protected]>

[ upstream commit 70597f21f128b7dd6a2490078bea99d704b6f8c3 ]

If we receive two PERF_RECORD_EXIT for the same thread, we can end up
reusing session->last_match and trying to remove the thread twice from
the rb_tree, causing a segfault, so invalidade last_match in
perf_session__remove_thread.

Receiving two PERF_RECORD_EXIT for the same thread is a bug, but its a
harmless one if we make the tool more robust, like this patch does.

Cc: Frederic Weisbecker <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Stephane Eranian <[email protected]>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
tools/perf/util/session.c | 1 +
1 file changed, 1 insertion(+)

Index: linux-2.6.35.y/tools/perf/util/session.c
===================================================================
--- linux-2.6.35.y.orig/tools/perf/util/session.c 2011-03-29 22:52:06.578019604 -0700
+++ linux-2.6.35.y/tools/perf/util/session.c 2011-03-29 23:02:58.140347711 -0700
@@ -134,6 +134,7 @@

void perf_session__remove_thread(struct perf_session *self, struct thread *th)
{
+ self->last_match = NULL;
rb_erase(&th->rb_node, &self->threads);
/*
* We may have references to this thread, for instance in some hist_entry

2011-03-30 21:05:43

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [4/275] thinkpad-acpi: Add KEY_CAMERA (Fn-F6) for Lenovo keyboards

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Jens Taprogge <[email protected]>

[ upstream commit 2b75426282a8eb29d0a004ef0d289b0491c719be ]

On the T410s and most likely other current models, Fn-F6 is labeled as
Camera/Headphone key. Report key presses as KEY_CAMERA.

Signed-off-by: Jens Taprogge <[email protected]>
Acked-by: Jerone Young <[email protected]>
Acked-by: Henrique de Moraes Holschuh <[email protected]>
Signed-off-by: Matthew Garrett <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/platform/x86/thinkpad_acpi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.35.y/drivers/platform/x86/thinkpad_acpi.c
===================================================================
--- linux-2.6.35.y.orig/drivers/platform/x86/thinkpad_acpi.c 2011-03-29 23:02:58.181346706 -0700
+++ linux-2.6.35.y/drivers/platform/x86/thinkpad_acpi.c 2011-03-29 23:55:36.863523932 -0700
@@ -3173,7 +3173,7 @@
[TPACPI_KEYMAP_LENOVO_GENERIC] = {
/* Scan Codes 0x00 to 0x0B: ACPI HKEY FN+F1..F12 */
KEY_FN_F1, KEY_COFFEE, KEY_BATTERY, KEY_SLEEP,
- KEY_WLAN, KEY_FN_F6, KEY_SWITCHVIDEOMODE, KEY_FN_F8,
+ KEY_WLAN, KEY_CAMERA, KEY_SWITCHVIDEOMODE, KEY_FN_F8,
KEY_FN_F9, KEY_FN_F10, KEY_FN_F11, KEY_SUSPEND,

/* Scan codes 0x0C to 0x1F: Other ACPI HKEY hot keys */

2011-03-30 21:05:56

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [14/275] USB: CP210x Removed incorrect device ID

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Craig Shelley <[email protected]>

commit 9926c0df7b31b2128eebe92e0e2b052f380ea464 upstream.

Device ID removed 0x10C4/0x8149 for West Mountain Radio Computerized
Battery Analyzer. This device is actually based on a SiLabs C8051Fxxx,
see http://www.etheus.net/SiUSBXp_Linux_Driver for further info.

Signed-off-by: Craig Shelley <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/usb/serial/cp210x.c | 1 -
1 file changed, 1 deletion(-)

Index: linux-2.6.35.y/drivers/usb/serial/cp210x.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/serial/cp210x.c 2011-03-29 23:02:58.505338415 -0700
+++ linux-2.6.35.y/drivers/usb/serial/cp210x.c 2011-03-29 23:02:58.523337954 -0700
@@ -85,7 +85,6 @@
{ USB_DEVICE(0x10C4, 0x8115) }, /* Arygon NFC/Mifare Reader */
{ USB_DEVICE(0x10C4, 0x813D) }, /* Burnside Telecom Deskmobile */
{ USB_DEVICE(0x10C4, 0x813F) }, /* Tams Master Easy Control */
- { USB_DEVICE(0x10C4, 0x8149) }, /* West Mountain Radio Computerized Battery Analyzer */
{ USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */
{ USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */
{ USB_DEVICE(0x10C4, 0x8156) }, /* B&G H3000 link cable */

2011-03-30 21:06:01

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [18/275] USB: usb-storage: unusual_devs entry for Coby MP3 player

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Alan Stern <[email protected]>

commit 3ea3c9b5a8464ec8223125f95e5dddb3bfd02a39 upstream.

This patch (as1444) adds an unusual_devs entry for an MP3 player from
Coby electronics. The device has two nasty bugs.

Signed-off-by: Alan Stern <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Tested-by: Jasper Mackenzie <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
drivers/usb/storage/unusual_devs.h | 7 +++++++
1 file changed, 7 insertions(+)

Index: linux-2.6.35.y/drivers/usb/storage/unusual_devs.h
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/storage/unusual_devs.h 2011-03-29 23:02:58.578336548 -0700
+++ linux-2.6.35.y/drivers/usb/storage/unusual_devs.h 2011-03-29 23:55:29.557710869 -0700
@@ -1884,6 +1884,13 @@
US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_IGNORE_RESIDUE | US_FL_SANE_SENSE ),

+/* Reported by Jasper Mackenzie <[email protected]> */
+UNUSUAL_DEV( 0x1e74, 0x4621, 0x0000, 0x0000,
+ "Coby Electronics",
+ "MP3 Player",
+ US_SC_DEVICE, US_PR_DEVICE, NULL,
+ US_FL_BULK_IGNORE_TAG | US_FL_MAX_SECTORS_64 ),
+
UNUSUAL_DEV( 0x2116, 0x0320, 0x0001, 0x0001,
"ST",
"2A",

2011-03-30 21:05:51

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [10/275] ALSA: snd-usb-us122l: Fix missing NULL checks

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Karsten Wiese <[email protected]>

commit cdce2db74e156fbd9a2dc3c7b246166f8b70955b upstream.

Fix missing NULL checks in usb_stream_hwdep_poll() and usb_stream_hwdep_ioctl().
Wake up poll waiters before returning from usb_stream_hwdep_ioctl().

Signed-off-by: Karsten Wiese <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
sound/usb/usx2y/us122l.c | 41 ++++++++++++++++++++---------------------
1 file changed, 20 insertions(+), 21 deletions(-)

Index: linux-2.6.35.y/sound/usb/usx2y/us122l.c
===================================================================
--- linux-2.6.35.y.orig/sound/usb/usx2y/us122l.c 2011-03-29 22:52:03.697093319 -0700
+++ linux-2.6.35.y/sound/usb/usx2y/us122l.c 2011-03-29 23:02:58.442340027 -0700
@@ -273,29 +273,26 @@
struct file *file, poll_table *wait)
{
struct us122l *us122l = hw->private_data;
- struct usb_stream *s = us122l->sk.s;
unsigned *polled;
unsigned int mask;

poll_wait(file, &us122l->sk.sleep, wait);

- switch (s->state) {
- case usb_stream_ready:
- if (us122l->first == file)
- polled = &s->periods_polled;
- else
- polled = &us122l->second_periods_polled;
- if (*polled != s->periods_done) {
- *polled = s->periods_done;
- mask = POLLIN | POLLOUT | POLLWRNORM;
- break;
+ mask = POLLIN | POLLOUT | POLLWRNORM | POLLERR;
+ if (mutex_trylock(&us122l->mutex)) {
+ struct usb_stream *s = us122l->sk.s;
+ if (s && s->state == usb_stream_ready) {
+ if (us122l->first == file)
+ polled = &s->periods_polled;
+ else
+ polled = &us122l->second_periods_polled;
+ if (*polled != s->periods_done) {
+ *polled = s->periods_done;
+ mask = POLLIN | POLLOUT | POLLWRNORM;
+ } else
+ mask = 0;
}
- /* Fall through */
- mask = 0;
- break;
- default:
- mask = POLLIN | POLLOUT | POLLWRNORM | POLLERR;
- break;
+ mutex_unlock(&us122l->mutex);
}
return mask;
}
@@ -381,6 +378,7 @@
{
struct usb_stream_config *cfg;
struct us122l *us122l = hw->private_data;
+ struct usb_stream *s;
unsigned min_period_frames;
int err = 0;
bool high_speed;
@@ -426,18 +424,18 @@
snd_power_wait(hw->card, SNDRV_CTL_POWER_D0);

mutex_lock(&us122l->mutex);
+ s = us122l->sk.s;
if (!us122l->master)
us122l->master = file;
else if (us122l->master != file) {
- if (memcmp(cfg, &us122l->sk.s->cfg, sizeof(*cfg))) {
+ if (!s || memcmp(cfg, &s->cfg, sizeof(*cfg))) {
err = -EIO;
goto unlock;
}
us122l->slave = file;
}
- if (!us122l->sk.s ||
- memcmp(cfg, &us122l->sk.s->cfg, sizeof(*cfg)) ||
- us122l->sk.s->state == usb_stream_xrun) {
+ if (!s || memcmp(cfg, &s->cfg, sizeof(*cfg)) ||
+ s->state == usb_stream_xrun) {
us122l_stop(us122l);
if (!us122l_start(us122l, cfg->sample_rate, cfg->period_frames))
err = -EIO;
@@ -448,6 +446,7 @@
mutex_unlock(&us122l->mutex);
free:
kfree(cfg);
+ wake_up_all(&us122l->sk.sleep);
return err;
}

2011-03-30 21:06:21

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [26/275] USB: Storage: Add unusual_devs entry for VTech Kidizoom

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Nick Holloway <[email protected]>

commit c25f6b1591b158f7ae3b9132367d0fa6d632e70e upstream.

This device suffers from the off-by-one error when reporting the capacity,
so add entry with US_FL_FIX_CAPACITY.

Signed-off-by: Nick Holloway <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/usb/storage/unusual_devs.h | 7 +++++++
1 file changed, 7 insertions(+)

Index: linux-2.6.35.y/drivers/usb/storage/unusual_devs.h
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/storage/unusual_devs.h 2011-03-29 23:02:58.597336061 -0700
+++ linux-2.6.35.y/drivers/usb/storage/unusual_devs.h 2011-03-29 23:02:58.746332249 -0700
@@ -1396,6 +1396,13 @@
US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_IGNORE_RESIDUE ),

+/* Submitted by Nick Holloway */
+UNUSUAL_DEV( 0x0f88, 0x042e, 0x0100, 0x0100,
+ "VTech",
+ "Kidizoom",
+ US_SC_DEVICE, US_PR_DEVICE, NULL,
+ US_FL_FIX_CAPACITY ),
+
/* Reported by Michael Stattmann <[email protected]> */
UNUSUAL_DEV( 0x0fce, 0xd008, 0x0000, 0x0000,
"Sony Ericsson",

2011-03-30 21:06:41

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [59/275] i2c: Unregister dummy devices last on adapter removal

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Jean Delvare <[email protected]>

commit 5219bf884b6e2b54e734ca1799b6f0014bb2b4b7 upstream.

Remove real devices first and dummy devices last. This gives device
driver which instantiated dummy devices themselves a chance to clean
them up before we do.

Signed-off-by: Jean Delvare <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Tested-by: Hans Verkuil <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
drivers/i2c/i2c-core.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)

Index: linux-2.6.35.y/drivers/i2c/i2c-core.c
===================================================================
--- linux-2.6.35.y.orig/drivers/i2c/i2c-core.c 2011-03-29 22:51:46.201540988 -0700
+++ linux-2.6.35.y/drivers/i2c/i2c-core.c 2011-03-29 23:02:59.377316103 -0700
@@ -923,6 +923,14 @@
static int __unregister_client(struct device *dev, void *dummy)
{
struct i2c_client *client = i2c_verify_client(dev);
+ if (client && strcmp(client->name, "dummy"))
+ i2c_unregister_device(client);
+ return 0;
+}
+
+static int __unregister_dummy(struct device *dev, void *dummy)
+{
+ struct i2c_client *client = i2c_verify_client(dev);
if (client)
i2c_unregister_device(client);
return 0;
@@ -977,8 +985,12 @@
i2c_unlock_adapter(adap);

/* Detach any active clients. This can't fail, thus we do not
- checking the returned value. */
+ * check the returned value. This is a two-pass process, because
+ * we can't remove the dummy devices during the first pass: they
+ * could have been instantiated by real devices wishing to clean
+ * them up properly, so we give them a chance to do that first. */
res = device_for_each_child(&adap->dev, NULL, __unregister_client);
+ res = device_for_each_child(&adap->dev, NULL, __unregister_dummy);

#ifdef CONFIG_I2C_COMPAT
class_compat_remove_link(i2c_adapter_compat_class, &adap->dev,

2011-03-30 21:06:37

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [55/275] PCI: pci-stub: ignore zero-length id parameters

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Tejun Heo <[email protected]>

commit 99a0fadf561e1f553c08f0a29f8b2578f55dd5f0 upstream.

pci-stub uses strsep() to separate list of ids and generates a warning
message when it fails to parse an id. However, not specifying the
parameter results in ids set to an empty string. strsep() happily
returns the empty string as the first token and thus triggers the
warning message spuriously.

Make the tokner ignore zero length ids.

Reported-by: Chris Wright <[email protected]>
Reported-by: Prasad Joshi <[email protected]>
Signed-off-by: Jesse Barnes <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/pci/pci-stub.c | 3 +++
1 file changed, 3 insertions(+)

Index: linux-2.6.35.y/drivers/pci/pci-stub.c
===================================================================
--- linux-2.6.35.y.orig/drivers/pci/pci-stub.c 2011-03-29 22:51:47.688502940 -0700
+++ linux-2.6.35.y/drivers/pci/pci-stub.c 2011-03-29 23:02:59.304317971 -0700
@@ -54,6 +54,9 @@
subdevice = PCI_ANY_ID, class=0, class_mask=0;
int fields;

+ if (!strlen(id))
+ continue;
+
fields = sscanf(id, "%x:%x:%x:%x:%x:%x",
&vendor, &device, &subvendor, &subdevice,
&class, &class_mask);

2011-03-30 21:06:44

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [62/275] x86, mtrr: Avoid MTRR reprogramming on BP during boot on UP platforms

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Suresh Siddha <[email protected]>

commit f7448548a9f32db38f243ccd4271617758ddfe2c upstream.

Markus Kohn ran into a hard hang regression on an acer aspire
1310, when acpi is enabled. git bisect showed the following
commit as the bad one that introduced the boot regression.

commit d0af9eed5aa91b6b7b5049cae69e5ea956fd85c3
Author: Suresh Siddha <[email protected]>
Date: Wed Aug 19 18:05:36 2009 -0700

x86, pat/mtrr: Rendezvous all the cpus for MTRR/PAT init

Because of the UP configuration of that platform,
native_smp_prepare_cpus() bailed out (in smp_sanity_check())
before doing the set_mtrr_aps_delayed_init()

Further down the boot path, native_smp_cpus_done() will call the
delayed MTRR initialization for the AP's (mtrr_aps_init()) with
mtrr_aps_delayed_init not set. This resulted in the boot
processor reprogramming its MTRR's to the values seen during the
start of the OS boot. While this is not needed ideally, this
shouldn't have caused any side-effects. This is because the
reprogramming of MTRR's (set_mtrr_state() that gets called via
set_mtrr()) will check if the live register contents are
Signed-off-by: Andi Kleen <[email protected]>

different from what is being asked to write and will do the actual
write only if they are different.

BP's mtrr state is read during the start of the OS boot and
typically nothing would have changed when we ask to reprogram it
on BP again because of the above scenario on an UP platform. So
on a normal UP platform no reprogramming of BP MTRR MSR's
happens and all is well.

However, on this platform, bios seems to be modifying the fixed
mtrr range registers between the start of OS boot and when we
double check the live registers for reprogramming BP MTRR
registers. And as the live registers are modified, we end up
reprogramming the MTRR's to the state seen during the start of
the OS boot.

During ACPI initialization, something in the bios (probably smi
handler?) don't like this fact and results in a hard lockup.

We didn't see this boot hang issue on this platform before the
commit d0af9eed5aa91b6b7b5049cae69e5ea956fd85c3, because only
the AP's (if any) will program its MTRR's to the value that BP
had at the start of the OS boot.

Fix this issue by checking mtrr_aps_delayed_init before
continuing further in the mtrr_aps_init(). Now, only AP's (if
any) will program its MTRR's to the BP values during boot.

Addresses https://bugzilla.novell.com/show_bug.cgi?id=623393

[ By the way, this behavior of the bios modifying MTRR's after the start
of the OS boot is not common and the kernel is not prepared to
handle this situation well. Irrespective of this issue, during
suspend/resume, linux kernel will try to reprogram the BP's MTRR values
to the values seen during the start of the OS boot. So suspend/resume might
be already broken on this platform for all linux kernel versions. ]

Reported-and-bisected-by: Markus Kohn <[email protected]>
Tested-by: Markus Kohn <[email protected]>
Signed-off-by: Suresh Siddha <[email protected]>
Cc: Thomas Renninger <[email protected]>
Cc: Rafael Wysocki <[email protected]>
Cc: Venkatesh Pallipadi <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
arch/x86/kernel/cpu/mtrr/main.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

Index: linux-2.6.35.y/arch/x86/kernel/cpu/mtrr/main.c
===================================================================
--- linux-2.6.35.y.orig/arch/x86/kernel/cpu/mtrr/main.c 2011-03-29 22:51:45.075569797 -0700
+++ linux-2.6.35.y/arch/x86/kernel/cpu/mtrr/main.c 2011-03-29 23:02:59.481313441 -0700
@@ -793,13 +793,21 @@
}

/*
- * MTRR initialization for all AP's
+ * Delayed MTRR initialization for all AP's
*/
void mtrr_aps_init(void)
{
if (!use_intel())
return;

+ /*
+ * Check if someone has requested the delay of AP MTRR initialization,
+ * by doing set_mtrr_aps_delayed_init(), prior to this point. If not,
+ * then we are done.
+ */
+ if (!mtrr_aps_delayed_init)
+ return;
+
set_mtrr(~0U, 0, 0, 0);
mtrr_aps_delayed_init = false;
}

2011-03-30 21:06:53

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [69/275] hostap_cs: fix sleeping function called from invalid context

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Stanislaw Gruszka <[email protected]>

commit 4e5518ca53be29c1ec3c00089c97bef36bfed515 upstream.

pcmcia_request_irq() and pcmcia_enable_device() are intended
to be called from process context (first function allocate memory
with GFP_KERNEL, second take a mutex). We can not take spin lock
and call them.

It's safe to move spin lock after pcmcia_enable_device() as we
still hold off IRQ until dev->base_addr is 0 and driver will
not proceed with interrupts when is not ready.

Patch resolves:
https://bugzilla.redhat.com/show_bug.cgi?id=643758

Reported-and-tested-by: [email protected]
Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>


---
drivers/net/wireless/hostap/hostap_cs.c | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)

Index: linux-2.6.35.y/drivers/net/wireless/hostap/hostap_cs.c
===================================================================
--- linux-2.6.35.y.orig/drivers/net/wireless/hostap/hostap_cs.c 2011-03-29 22:51:42.422637681 -0700
+++ linux-2.6.35.y/drivers/net/wireless/hostap/hostap_cs.c 2011-03-29 23:02:59.610310141 -0700
@@ -626,15 +626,9 @@
local->hw_priv = hw_priv;
hw_priv->link = link;

- /*
- * Make sure the IRQ handler cannot proceed until at least
- * dev->base_addr is initialized.
- */
- spin_lock_irqsave(&local->irq_init_lock, flags);
-
ret = pcmcia_request_irq(link, prism2_interrupt);
if (ret)
- goto failed_unlock;
+ goto failed;

/*
* This actually configures the PCMCIA socket -- setting up
@@ -643,11 +637,12 @@
*/
ret = pcmcia_request_configuration(link, &link->conf);
if (ret)
- goto failed_unlock;
+ goto failed;

+ /* IRQ handler cannot proceed until at dev->base_addr is initialized */
+ spin_lock_irqsave(&local->irq_init_lock, flags);
dev->irq = link->irq;
dev->base_addr = link->io.BasePort1;
-
spin_unlock_irqrestore(&local->irq_init_lock, flags);

/* Finally, report what we've done */
@@ -676,8 +671,6 @@

return ret;

- failed_unlock:
- spin_unlock_irqrestore(&local->irq_init_lock, flags);
failed:
kfree(hw_priv);
prism2_release((u_long)link);

2011-03-30 21:06:58

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [75/275] SELinux: do not compute transition labels on mountpoint labeled filesystems

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Eric Paris <[email protected]>

commit 415103f9932d45f7927f4b17e3a9a13834cdb9a1 upstream.

selinux_inode_init_security computes transitions sids even for filesystems
that use mount point labeling. It shouldn't do that. It should just use
the mount point label always and no matter what.

This causes 2 problems. 1) it makes file creation slower than it needs to be
since we calculate the transition sid and 2) it allows files to be created
with a different label than the mount point!

# id -Z
staff_u:sysadm_r:sysadm_t:s0-s0:c0.c1023
# sesearch --type --class file --source sysadm_t --target tmp_t
Found 1 semantic te rules:
type_transition sysadm_t tmp_t : file user_tmp_t;

# mount -o loop,context="system_u:object_r:tmp_t:s0" /tmp/fs /mnt/tmp

# ls -lZ /mnt/tmp
drwx------. root root system_u:object_r:tmp_t:s0 lost+found
# touch /mnt/tmp/file1
# ls -lZ /mnt/tmp
-rw-r--r--. root root staff_u:object_r:user_tmp_t:s0 file1
drwx------. root root system_u:object_r:tmp_t:s0 lost+found

Whoops, we have a mount point labeled filesystem tmp_t with a user_tmp_t
labeled file!

Signed-off-by: Eric Paris <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Reviewed-by: Reviewed-by: James Morris <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
security/selinux/hooks.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

Index: linux-2.6.35.y/security/selinux/hooks.c
===================================================================
--- linux-2.6.35.y.orig/security/selinux/hooks.c 2011-03-29 22:51:40.067697937 -0700
+++ linux-2.6.35.y/security/selinux/hooks.c 2011-03-29 23:54:51.592682299 -0700
@@ -2573,7 +2573,10 @@
sid = tsec->sid;
newsid = tsec->create_sid;

- if (!newsid || !(sbsec->flags & SE_SBLABELSUPP)) {
+ if ((sbsec->flags & SE_SBINITIALIZED) &&
+ (sbsec->behavior == SECURITY_FS_USE_MNTPOINT))
+ newsid = sbsec->mntpoint_sid;
+ else if (!newsid || !(sbsec->flags & SE_SBLABELSUPP)) {
rc = security_transition_sid(sid, dsec->sid,
inode_mode_to_security_class(inode->i_mode),
&newsid);

2011-03-30 21:07:13

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [82/275] drm/radeon: remove 0x4243 pci id

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Alex Deucher <[email protected]>

commit 63a507800c8aca5a1891d598ae13f829346e8e39 upstream.

0x4243 is a PCI bridge, not a GPU.

Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=33815

Signed-off-by: Alex Deucher <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
include/drm/drm_pciids.h | 1 -
1 file changed, 1 deletion(-)

Index: linux-2.6.35.y/include/drm/drm_pciids.h
===================================================================
--- linux-2.6.35.y.orig/include/drm/drm_pciids.h 2011-03-29 22:51:37.391766406 -0700
+++ linux-2.6.35.y/include/drm/drm_pciids.h 2011-03-29 23:02:59.854303898 -0700
@@ -28,7 +28,6 @@
{0x1002, 0x4156, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV350}, \
{0x1002, 0x4237, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS200|RADEON_IS_IGP}, \
{0x1002, 0x4242, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R200}, \
- {0x1002, 0x4243, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R200}, \
{0x1002, 0x4336, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS100|RADEON_IS_IGP|RADEON_IS_MOBILITY}, \
{0x1002, 0x4337, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS200|RADEON_IS_IGP|RADEON_IS_MOBILITY}, \
{0x1002, 0x4437, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS200|RADEON_IS_IGP|RADEON_IS_MOBILITY}, \

2011-03-30 21:07:15

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [81/275] drm/radeon/kms: add pll debugging output

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Alex Deucher <[email protected]>

commit 51d4bf840a27fe02c883ddc6d9708af056773769 upstream.

Signed-off-by: Alex Deucher <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/gpu/drm/radeon/radeon_display.c | 4 ++++
1 file changed, 4 insertions(+)

Index: linux-2.6.35.y/drivers/gpu/drm/radeon/radeon_display.c
===================================================================
--- linux-2.6.35.y.orig/drivers/gpu/drm/radeon/radeon_display.c 2011-03-29 22:51:37.786756301 -0700
+++ linux-2.6.35.y/drivers/gpu/drm/radeon/radeon_display.c 2011-03-29 23:02:59.836304359 -0700
@@ -619,6 +619,10 @@
*frac_fb_div_p = best_frac_feedback_div;
*ref_div_p = best_ref_div;
*post_div_p = best_post_div;
+ DRM_DEBUG_KMS("%d %d, pll dividers - fb: %d.%d ref: %d, post %d\n",
+ freq, best_freq / 1000, best_feedback_div, best_frac_feedback_div,
+ best_ref_div, best_post_div);
+
}

static bool

2011-03-30 21:07:52

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [121/275] CRED: Fix memory and refcount leaks upon security_prepare_creds() failure

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Tetsuo Handa <[email protected]>

commit fb2b2a1d37f80cc818fd4487b510f4e11816e5e1 upstream.

In prepare_kernel_cred() since 2.6.29, put_cred(new) is called without
assigning new->usage when security_prepare_creds() returned an error. As a
result, memory for new and refcount for new->{user,group_info,tgcred} are
leaked because put_cred(new) won't call __put_cred() unless old->usage == 1.

Fix these leaks by assigning new->usage (and new->subscribers which was added
in 2.6.32) before calling security_prepare_creds().

Signed-off-by: Tetsuo Handa <[email protected]>
Signed-off-by: David Howells <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
kernel/cred.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6.35.y/kernel/cred.c
===================================================================
--- linux-2.6.35.y.orig/kernel/cred.c 2011-03-29 23:03:00.710281996 -0700
+++ linux-2.6.35.y/kernel/cred.c 2011-03-29 23:03:00.732281432 -0700
@@ -663,6 +663,8 @@
validate_creds(old);

*new = *old;
+ atomic_set(&new->usage, 1);
+ set_cred_subscribers(new, 0);
get_uid(new->user);
get_group_info(new->group_info);

@@ -680,8 +682,6 @@
if (security_prepare_creds(new, old, GFP_KERNEL) < 0)
goto error;

- atomic_set(&new->usage, 1);
- set_cred_subscribers(new, 0);
put_cred(old);
validate_creds(new);
return new;

2011-03-30 21:07:55

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [131/275] ALSA: caiaq - Fix possible string-buffer overflow

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Takashi Iwai <[email protected]>

commit eaae55dac6b64c0616046436b294e69fc5311581 upstream.

Use strlcpy() to assure not to overflow the string array sizes by
too long USB device name string.

Reported-by: Rafa <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
sound/usb/caiaq/audio.c | 2 +-
sound/usb/caiaq/midi.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6.35.y/sound/usb/caiaq/audio.c
===================================================================
--- linux-2.6.35.y.orig/sound/usb/caiaq/audio.c 2011-03-29 22:51:15.343330571 -0700
+++ linux-2.6.35.y/sound/usb/caiaq/audio.c 2011-03-29 23:03:01.006274422 -0700
@@ -640,7 +640,7 @@
}

dev->pcm->private_data = dev;
- strcpy(dev->pcm->name, dev->product_name);
+ strlcpy(dev->pcm->name, dev->product_name, sizeof(dev->pcm->name));

memset(dev->sub_playback, 0, sizeof(dev->sub_playback));
memset(dev->sub_capture, 0, sizeof(dev->sub_capture));
Index: linux-2.6.35.y/sound/usb/caiaq/midi.c
===================================================================
--- linux-2.6.35.y.orig/sound/usb/caiaq/midi.c 2011-03-29 22:51:15.342330597 -0700
+++ linux-2.6.35.y/sound/usb/caiaq/midi.c 2011-03-29 23:03:01.007274396 -0700
@@ -136,7 +136,7 @@
if (ret < 0)
return ret;

- strcpy(rmidi->name, device->product_name);
+ strlcpy(rmidi->name, device->product_name, sizeof(rmidi->name));

rmidi->info_flags = SNDRV_RAWMIDI_INFO_DUPLEX;
rmidi->private_data = device;

2011-03-30 21:08:19

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [150/275] epoll: prevent creating circular epoll structures

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Davide Libenzi <[email protected]>

commit 22bacca48a1755f79b7e0f192ddb9fbb7fc6e64e upstream.

In several places, an epoll fd can call another file's ->f_op->poll()
method with ep->mtx held. This is in general unsafe, because that other
file could itself be an epoll fd that contains the original epoll fd.

The code defends against this possibility in its own ->poll() method using
ep_call_nested, but there are several other unsafe calls to ->poll
elsewhere that can be made to deadlock. For example, the following simple
program causes the call in ep_insert recursively call the original fd's
->poll, leading to deadlock:

#include <unistd.h>
#include <sys/epoll.h>

int main(void) {
int e1, e2, p[2];
struct epoll_event evt = {
.events = EPOLLIN
};

e1 = epoll_create(1);
e2 = epoll_create(2);
pipe(p);

epoll_ctl(e2, EPOLL_CTL_ADD, e1, &evt);
epoll_ctl(e1, EPOLL_CTL_ADD, p[0], &evt);
write(p[1], p, sizeof p);
epoll_ctl(e1, EPOLL_CTL_ADD, e2, &evt);

return 0;
}

On insertion, check whether the inserted file is itself a struct epoll,
and if so, do a recursive walk to detect whether inserting this file would
create a loop of epoll structures, which could lead to deadlock.

[[email protected]: Use epmutex to serialize concurrent inserts]
Signed-off-by: Davide Libenzi <[email protected]>
Signed-off-by: Nelson Elhage <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Reported-by: Nelson Elhage <[email protected]>
Tested-by: Nelson Elhage <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
fs/eventpoll.c | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 95 insertions(+)

Index: linux-2.6.35.y/fs/eventpoll.c
===================================================================
--- linux-2.6.35.y.orig/fs/eventpoll.c 2011-03-29 22:51:06.355560545 -0700
+++ linux-2.6.35.y/fs/eventpoll.c 2011-03-29 23:03:01.379264879 -0700
@@ -63,6 +63,13 @@
* cleanup path and it is also acquired by eventpoll_release_file()
* if a file has been pushed inside an epoll set and it is then
* close()d without a previous call toepoll_ctl(EPOLL_CTL_DEL).
+ * It is also acquired when inserting an epoll fd onto another epoll
+ * fd. We do this so that we walk the epoll tree and ensure that this
+ * insertion does not create a cycle of epoll file descriptors, which
+ * could lead to deadlock. We need a global mutex to prevent two
+ * simultaneous inserts (A into B and B into A) from racing and
+ * constructing a cycle without either insert observing that it is
+ * going to.
* It is possible to drop the "ep->mtx" and to use the global
* mutex "epmutex" (together with "ep->lock") to have it working,
* but having "ep->mtx" will make the interface more scalable.
@@ -227,6 +234,9 @@
*/
static DEFINE_MUTEX(epmutex);

+/* Used to check for epoll file descriptor inclusion loops */
+static struct nested_calls poll_loop_ncalls;
+
/* Used for safe wake up implementation */
static struct nested_calls poll_safewake_ncalls;

@@ -1181,6 +1191,62 @@
return res;
}

+/**
+ * ep_loop_check_proc - Callback function to be passed to the @ep_call_nested()
+ * API, to verify that adding an epoll file inside another
+ * epoll structure, does not violate the constraints, in
+ * terms of closed loops, or too deep chains (which can
+ * result in excessive stack usage).
+ *
+ * @priv: Pointer to the epoll file to be currently checked.
+ * @cookie: Original cookie for this call. This is the top-of-the-chain epoll
+ * data structure pointer.
+ * @call_nests: Current dept of the @ep_call_nested() call stack.
+ *
+ * Returns: Returns zero if adding the epoll @file inside current epoll
+ * structure @ep does not violate the constraints, or -1 otherwise.
+ */
+static int ep_loop_check_proc(void *priv, void *cookie, int call_nests)
+{
+ int error = 0;
+ struct file *file = priv;
+ struct eventpoll *ep = file->private_data;
+ struct rb_node *rbp;
+ struct epitem *epi;
+
+ mutex_lock(&ep->mtx);
+ for (rbp = rb_first(&ep->rbr); rbp; rbp = rb_next(rbp)) {
+ epi = rb_entry(rbp, struct epitem, rbn);
+ if (unlikely(is_file_epoll(epi->ffd.file))) {
+ error = ep_call_nested(&poll_loop_ncalls, EP_MAX_NESTS,
+ ep_loop_check_proc, epi->ffd.file,
+ epi->ffd.file->private_data, current);
+ if (error != 0)
+ break;
+ }
+ }
+ mutex_unlock(&ep->mtx);
+
+ return error;
+}
+
+/**
+ * ep_loop_check - Performs a check to verify that adding an epoll file (@file)
+ * another epoll file (represented by @ep) does not create
+ * closed loops or too deep chains.
+ *
+ * @ep: Pointer to the epoll private data structure.
+ * @file: Pointer to the epoll file to be checked.
+ *
+ * Returns: Returns zero if adding the epoll @file inside current epoll
+ * structure @ep does not violate the constraints, or -1 otherwise.
+ */
+static int ep_loop_check(struct eventpoll *ep, struct file *file)
+{
+ return ep_call_nested(&poll_loop_ncalls, EP_MAX_NESTS,
+ ep_loop_check_proc, file, ep, current);
+}
+
/*
* Open an eventpoll file descriptor.
*/
@@ -1229,6 +1295,7 @@
struct epoll_event __user *, event)
{
int error;
+ int did_lock_epmutex = 0;
struct file *file, *tfile;
struct eventpoll *ep;
struct epitem *epi;
@@ -1270,6 +1337,25 @@
*/
ep = file->private_data;

+ /*
+ * When we insert an epoll file descriptor, inside another epoll file
+ * descriptor, there is the change of creating closed loops, which are
+ * better be handled here, than in more critical paths.
+ *
+ * We hold epmutex across the loop check and the insert in this case, in
+ * order to prevent two separate inserts from racing and each doing the
+ * insert "at the same time" such that ep_loop_check passes on both
+ * before either one does the insert, thereby creating a cycle.
+ */
+ if (unlikely(is_file_epoll(tfile) && op == EPOLL_CTL_ADD)) {
+ mutex_lock(&epmutex);
+ did_lock_epmutex = 1;
+ error = -ELOOP;
+ if (ep_loop_check(ep, tfile) != 0)
+ goto error_tgt_fput;
+ }
+
+
mutex_lock(&ep->mtx);

/*
@@ -1305,6 +1391,9 @@
mutex_unlock(&ep->mtx);

error_tgt_fput:
+ if (unlikely(did_lock_epmutex))
+ mutex_unlock(&epmutex);
+
fput(tfile);
error_fput:
fput(file);
@@ -1423,6 +1512,12 @@
max_user_watches = (((si.totalram - si.totalhigh) / 25) << PAGE_SHIFT) /
EP_ITEM_COST;

+ /*
+ * Initialize the structure used to perform epoll file descriptor
+ * inclusion loops checks.
+ */
+ ep_nested_calls_init(&poll_loop_ncalls);
+
/* Initialize the structure used to perform safe poll wait head wake ups */
ep_nested_calls_init(&poll_safewake_ncalls);

2011-03-30 21:08:14

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [137/275] platform: x86: asus_acpi: world-writable procfs files

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Vasiliy Kulikov <[email protected]>

commit 8040835760adf0ef66876c063d47f79f015fb55d upstream.

Don't allow everybody to change ACPI settings. The comment says that it
is done deliberatelly, however, the comment before disp_proc_write()
says that at least one of these setting is experimental.

Signed-off-by: Vasiliy Kulikov <[email protected]>
Signed-off-by: Matthew Garrett <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/platform/x86/asus_acpi.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)

Index: linux-2.6.35.y/drivers/platform/x86/asus_acpi.c
===================================================================
--- linux-2.6.35.y.orig/drivers/platform/x86/asus_acpi.c 2011-03-29 22:51:12.619400270 -0700
+++ linux-2.6.35.y/drivers/platform/x86/asus_acpi.c 2011-03-29 23:03:01.117271582 -0700
@@ -1079,14 +1079,8 @@
struct proc_dir_entry *proc;
mode_t mode;

- /*
- * If parameter uid or gid is not changed, keep the default setting for
- * our proc entries (-rw-rw-rw-) else, it means we care about security,
- * and then set to -rw-rw----
- */
-
if ((asus_uid == 0) && (asus_gid == 0)) {
- mode = S_IFREG | S_IRUGO | S_IWUGO;
+ mode = S_IFREG | S_IRUGO | S_IWUSR | S_IWGRP;
} else {
mode = S_IFREG | S_IRUSR | S_IRGRP | S_IWUSR | S_IWGRP;
printk(KERN_WARNING " asus_uid and asus_gid parameters are "

2011-03-30 21:08:30

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [155/275] xhci: Clarify some expressions in the TRB math

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Paul Zimmerman <[email protected]>

commit a2490187011cc2263117626615a581927d19f1d3 upstream.

This makes it easier to spot some problems, which will be fixed by the
next patch in the series. Also change dev_dbg to dev_err in
check_trb_math(), so any math errors will be visible even when running
with debug disabled.

Note: This patch changes the expressions containing
"((1 << TRB_MAX_BUFF_SHIFT) - 1)" to use the equivalent
"(TRB_MAX_BUFF_SIZE - 1)". No change in behavior is intended for
those expressions.

This patch should be queued for stable kernels back to 2.6.31.

Signed-off-by: Paul Zimmerman <[email protected]>
Signed-off-by: Sarah Sharp <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/usb/host/xhci-ring.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)

Index: linux-2.6.35.y/drivers/usb/host/xhci-ring.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/host/xhci-ring.c 2011-03-29 23:03:01.466262652 -0700
+++ linux-2.6.35.y/drivers/usb/host/xhci-ring.c 2011-03-29 23:54:34.753113182 -0700
@@ -1890,7 +1890,7 @@

/* Scatter gather list entries may cross 64KB boundaries */
running_total = TRB_MAX_BUFF_SIZE -
- (sg_dma_address(sg) & ((1 << TRB_MAX_BUFF_SHIFT) - 1));
+ (sg_dma_address(sg) & (TRB_MAX_BUFF_SIZE - 1));
if (running_total != 0)
num_trbs++;

@@ -1920,11 +1920,11 @@
static void check_trb_math(struct urb *urb, int num_trbs, int running_total)
{
if (num_trbs != 0)
- dev_dbg(&urb->dev->dev, "%s - ep %#x - Miscalculated number of "
+ dev_err(&urb->dev->dev, "%s - ep %#x - Miscalculated number of "
"TRBs, %d left\n", __func__,
urb->ep->desc.bEndpointAddress, num_trbs);
if (running_total != urb->transfer_buffer_length)
- dev_dbg(&urb->dev->dev, "%s - ep %#x - Miscalculated tx length, "
+ dev_err(&urb->dev->dev, "%s - ep %#x - Miscalculated tx length, "
"queued %#x (%d), asked for %#x (%d)\n",
__func__,
urb->ep->desc.bEndpointAddress,
@@ -2051,8 +2051,7 @@
sg = urb->sg;
addr = (u64) sg_dma_address(sg);
this_sg_len = sg_dma_len(sg);
- trb_buff_len = TRB_MAX_BUFF_SIZE -
- (addr & ((1 << TRB_MAX_BUFF_SHIFT) - 1));
+ trb_buff_len = TRB_MAX_BUFF_SIZE - (addr & (TRB_MAX_BUFF_SIZE - 1));
trb_buff_len = min_t(int, trb_buff_len, this_sg_len);
if (trb_buff_len > urb->transfer_buffer_length)
trb_buff_len = urb->transfer_buffer_length;
@@ -2088,7 +2087,7 @@
(unsigned int) (addr + TRB_MAX_BUFF_SIZE) & ~(TRB_MAX_BUFF_SIZE - 1),
(unsigned int) addr + trb_buff_len);
if (TRB_MAX_BUFF_SIZE -
- (addr & ((1 << TRB_MAX_BUFF_SHIFT) - 1)) < trb_buff_len) {
+ (addr & (TRB_MAX_BUFF_SIZE - 1)) < trb_buff_len) {
xhci_warn(xhci, "WARN: sg dma xfer crosses 64KB boundaries!\n");
xhci_dbg(xhci, "Next boundary at %#x, end dma = %#x\n",
(unsigned int) (addr + TRB_MAX_BUFF_SIZE) & ~(TRB_MAX_BUFF_SIZE - 1),
@@ -2132,7 +2131,7 @@
}

trb_buff_len = TRB_MAX_BUFF_SIZE -
- (addr & ((1 << TRB_MAX_BUFF_SHIFT) - 1));
+ (addr & (TRB_MAX_BUFF_SIZE - 1));
trb_buff_len = min_t(int, trb_buff_len, this_sg_len);
if (running_total + trb_buff_len > urb->transfer_buffer_length)
trb_buff_len =
@@ -2171,7 +2170,7 @@
num_trbs = 0;
/* How much data is (potentially) left before the 64KB boundary? */
running_total = TRB_MAX_BUFF_SIZE -
- (urb->transfer_dma & ((1 << TRB_MAX_BUFF_SHIFT) - 1));
+ (urb->transfer_dma & (TRB_MAX_BUFF_SIZE - 1));

/* If there's some data on this 64KB chunk, or we have to send a
* zero-length transfer, we need at least one TRB
@@ -2211,8 +2210,8 @@
/* How much data is in the first TRB? */
addr = (u64) urb->transfer_dma;
trb_buff_len = TRB_MAX_BUFF_SIZE -
- (urb->transfer_dma & ((1 << TRB_MAX_BUFF_SHIFT) - 1));
- if (urb->transfer_buffer_length < trb_buff_len)
+ (urb->transfer_dma & (TRB_MAX_BUFF_SIZE - 1));
+ if (trb_buff_len > urb->transfer_buffer_length)
trb_buff_len = urb->transfer_buffer_length;

first_trb = true;

2011-03-30 21:08:44

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [169/275] r8169: disable ASPM

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Stanislaw Gruszka <[email protected]>

commit ba04c7c93bbcb48ce880cf75b6e9dffcd79d4c7b upstream.

For some time is known that ASPM is causing troubles on r8169, i.e. make
device randomly stop working without any errors in dmesg.

Currently Tomi Leppikangas reports that system with r8169 device hangs
with MCE errors when ASPM is enabled:
https://bugzilla.redhat.com/show_bug.cgi?id=642861#c4

Lets disable ASPM for r8169 devices at all, to avoid problems with
r8169 PCIe devices at least for some users.

Reported-by: Tomi Leppikangas <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/net/r8169.c | 6 ++++++
1 file changed, 6 insertions(+)

Index: linux-2.6.35.y/drivers/net/r8169.c
===================================================================
--- linux-2.6.35.y.orig/drivers/net/r8169.c 2011-03-29 22:50:56.827804337 -0700
+++ linux-2.6.35.y/drivers/net/r8169.c 2011-03-29 23:54:22.174435038 -0700
@@ -24,6 +24,7 @@
#include <linux/init.h>
#include <linux/dma-mapping.h>
#include <linux/pm_runtime.h>
+#include <linux/pci-aspm.h>

#include <asm/system.h>
#include <asm/io.h>
@@ -3040,6 +3041,11 @@
mii->reg_num_mask = 0x1f;
mii->supports_gmii = !!(cfg->features & RTL_FEATURE_GMII);

+ /* disable ASPM completely as that cause random device stop working
+ * problems as well as full system hangs for some PCIe devices users */
+ pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1 |
+ PCIE_LINK_STATE_CLKPM);
+
/* enable device (incl. PCI PM wakeup and hotplug setup) */
rc = pci_enable_device(pdev);
if (rc < 0) {

2011-03-30 21:08:33

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [166/275] p54usb: add Senao NUB-350 usbid

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Christian Lamparter <[email protected]>

commit 2b799a6b25bb9f9fbc478782cd9503e8066ab618 upstream.

Reported-by: Mark Davis
Signed-off-by: Christian Lamparter <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/net/wireless/p54/p54usb.c | 1 +
1 file changed, 1 insertion(+)

Index: linux-2.6.35.y/drivers/net/wireless/p54/p54usb.c
===================================================================
--- linux-2.6.35.y.orig/drivers/net/wireless/p54/p54usb.c 2011-03-29 22:50:58.333765804 -0700
+++ linux-2.6.35.y/drivers/net/wireless/p54/p54usb.c 2011-03-29 23:03:01.707256486 -0700
@@ -97,6 +97,7 @@
{USB_DEVICE(0x1413, 0x5400)}, /* Telsey 802.11g USB2.0 Adapter */
{USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */
{USB_DEVICE(0x1668, 0x1050)}, /* Actiontec 802UIG-1 */
+ {USB_DEVICE(0x1740, 0x1000)}, /* Senao NUB-350 */
{USB_DEVICE(0x2001, 0x3704)}, /* DLink DWL-G122 rev A2 */
{USB_DEVICE(0x2001, 0x3705)}, /* D-Link DWL-G120 rev C1 */
{USB_DEVICE(0x413c, 0x5513)}, /* Dell WLA3310 USB Wireless Adapter */

2011-03-30 21:09:00

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [180/275] nfsd: wrong index used in inner loop

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: roel <[email protected]>

commit 3ec07aa9522e3d5e9d5ede7bef946756e623a0a0 upstream.


Index i was already used in the outer loop

Signed-off-by: Roel Kluin <[email protected]>
Signed-off-by: J. Bruce Fields <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
fs/nfsd/nfs4xdr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6.35.y/fs/nfsd/nfs4xdr.c
===================================================================
--- linux-2.6.35.y.orig/fs/nfsd/nfs4xdr.c 2011-03-29 23:03:00.858278209 -0700
+++ linux-2.6.35.y/fs/nfsd/nfs4xdr.c 2011-03-29 23:53:57.803058641 -0700
@@ -1107,7 +1107,7 @@

u32 dummy;
char *machine_name;
- int i;
+ int i, j;
int nr_secflavs;

READ_BUF(16);
@@ -1180,7 +1180,7 @@
READ_BUF(4);
READ32(dummy);
READ_BUF(dummy * 4);
- for (i = 0; i < dummy; ++i)
+ for (j = 0; j < dummy; ++j)
READ32(dummy);
break;
case RPC_AUTH_GSS:

2011-03-30 21:09:09

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [194/275] ahci: AHCI mode SATA patch for Intel Patsburg SATA RAID controller

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Seth Heasley <[email protected]>

commit 64a3903d0885879ba8706a8bcf71c5e3e7664db2 upstream.

This patch adds an updated SATA RAID DeviceID for the Intel Patsburg PCH.

Signed-off-by: Seth Heasley <[email protected]>
Signed-off-by: Jeff Garzik <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/ata/ahci.c | 1 +
1 file changed, 1 insertion(+)

Index: linux-2.6.35.y/drivers/ata/ahci.c
===================================================================
--- linux-2.6.35.y.orig/drivers/ata/ahci.c 2011-03-29 23:03:02.308241108 -0700
+++ linux-2.6.35.y/drivers/ata/ahci.c 2011-03-29 23:03:02.328240597 -0700
@@ -251,6 +251,7 @@
{ PCI_VDEVICE(INTEL, 0x1d02), board_ahci }, /* PBG AHCI */
{ PCI_VDEVICE(INTEL, 0x1d04), board_ahci }, /* PBG RAID */
{ PCI_VDEVICE(INTEL, 0x1d06), board_ahci }, /* PBG RAID */
+ { PCI_VDEVICE(INTEL, 0x2826), board_ahci }, /* PBG RAID */
{ PCI_VDEVICE(INTEL, 0x2323), board_ahci }, /* DH89xxCC AHCI */

/* JMicron 360/1/3/5/6, match class to avoid IDE function */

2011-03-30 21:09:13

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [203/275] PCI: add more checking to ICH region quirks

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Jiri Slaby <[email protected]>

commit cdb9755849fbaf2bb9c0a009ba5baa817a0f152d upstream.

Per ICH4 and ICH6 specs, ACPI and GPIO regions are valid iff ACPI_EN
and GPIO_EN bits are set to 1. Add checks for these bits into the
quirks prior to the region creation.

While at it, name the constants by macros.

Signed-off-by: Jiri Slaby <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Cc: Bjorn Helgaas <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Thomas Renninger <[email protected]>
Signed-off-by: Jesse Barnes <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
drivers/pci/quirks.c | 49 +++++++++++++++++++++++++++++++++++++++----------
1 file changed, 39 insertions(+), 10 deletions(-)

Index: linux-2.6.35.y/drivers/pci/quirks.c
===================================================================
--- linux-2.6.35.y.orig/drivers/pci/quirks.c 2011-03-29 22:50:38.553271937 -0700
+++ linux-2.6.35.y/drivers/pci/quirks.c 2011-03-29 23:54:11.105718258 -0700
@@ -519,6 +519,17 @@
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3, quirk_piix4_acpi);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443MX_3, quirk_piix4_acpi);

+#define ICH_PMBASE 0x40
+#define ICH_ACPI_CNTL 0x44
+#define ICH4_ACPI_EN 0x10
+#define ICH6_ACPI_EN 0x80
+#define ICH4_GPIOBASE 0x58
+#define ICH4_GPIO_CNTL 0x5c
+#define ICH4_GPIO_EN 0x10
+#define ICH6_GPIOBASE 0x48
+#define ICH6_GPIO_CNTL 0x4c
+#define ICH6_GPIO_EN 0x10
+
/*
* ICH4, ICH4-M, ICH5, ICH5-M ACPI: Three IO regions pointed to by longwords at
* 0x40 (128 bytes of ACPI, GPIO & TCO registers)
@@ -527,12 +538,21 @@
static void __devinit quirk_ich4_lpc_acpi(struct pci_dev *dev)
{
u32 region;
+ u8 enable;

- pci_read_config_dword(dev, 0x40, &region);
- quirk_io_region(dev, region, 128, PCI_BRIDGE_RESOURCES, "ICH4 ACPI/GPIO/TCO");
-
- pci_read_config_dword(dev, 0x58, &region);
- quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES+1, "ICH4 GPIO");
+ pci_read_config_byte(dev, ICH_ACPI_CNTL, &enable);
+ if (enable & ICH4_ACPI_EN) {
+ pci_read_config_dword(dev, ICH_PMBASE, &region);
+ quirk_io_region(dev, region, 128, PCI_BRIDGE_RESOURCES,
+ "ICH4 ACPI/GPIO/TCO");
+ }
+
+ pci_read_config_byte(dev, ICH4_GPIO_CNTL, &enable);
+ if (enable & ICH4_GPIO_EN) {
+ pci_read_config_dword(dev, ICH4_GPIOBASE, &region);
+ quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES + 1,
+ "ICH4 GPIO");
+ }
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AA_0, quirk_ich4_lpc_acpi);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AB_0, quirk_ich4_lpc_acpi);
@@ -548,12 +568,21 @@
static void __devinit ich6_lpc_acpi_gpio(struct pci_dev *dev)
{
u32 region;
+ u8 enable;

- pci_read_config_dword(dev, 0x40, &region);
- quirk_io_region(dev, region, 128, PCI_BRIDGE_RESOURCES, "ICH6 ACPI/GPIO/TCO");
-
- pci_read_config_dword(dev, 0x48, &region);
- quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES+1, "ICH6 GPIO");
+ pci_read_config_byte(dev, ICH_ACPI_CNTL, &enable);
+ if (enable & ICH6_ACPI_EN) {
+ pci_read_config_dword(dev, ICH_PMBASE, &region);
+ quirk_io_region(dev, region, 128, PCI_BRIDGE_RESOURCES,
+ "ICH6 ACPI/GPIO/TCO");
+ }
+
+ pci_read_config_byte(dev, ICH6_GPIO_CNTL, &enable);
+ if (enable & ICH4_GPIO_EN) {
+ pci_read_config_dword(dev, ICH6_GPIOBASE, &region);
+ quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES + 1,
+ "ICH6 GPIO");
+ }
}

static void __devinit ich6_lpc_generic_decode(struct pci_dev *dev, unsigned reg, const char *name, int dynsize)

2011-03-30 21:09:31

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [220/275] hwmon: (sht15) Fix integer overflow in humidity calculation

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Vivien Didelot <[email protected]>

commit ccd32e735de7a941906e093f8dca924bb05c5794 upstream.

An integer overflow occurs in the calculation of RHlinear when the
relative humidity is greater than around 30%. The consequence is a subtle
(but noticeable) error in the resulting humidity measurement.

Signed-off-by: Vivien Didelot <[email protected]>
Signed-off-by: Jean Delvare <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Cc: Jonathan Cameron <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
drivers/hwmon/sht15.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6.35.y/drivers/hwmon/sht15.c
===================================================================
--- linux-2.6.35.y.orig/drivers/hwmon/sht15.c 2011-03-29 22:50:29.011516087 -0700
+++ linux-2.6.35.y/drivers/hwmon/sht15.c 2011-03-29 23:03:02.824227904 -0700
@@ -333,11 +333,11 @@

const int c1 = -4;
const int c2 = 40500; /* x 10 ^ -6 */
- const int c3 = -2800; /* x10 ^ -9 */
+ const int c3 = -28; /* x 10 ^ -7 */

RHlinear = c1*1000
+ c2 * data->val_humid/1000
- + (data->val_humid * data->val_humid * c3)/1000000;
+ + (data->val_humid * data->val_humid * c3) / 10000;
return (temp - 25000) * (10000 + 80 * data->val_humid)
/ 1000000 + RHlinear;
}

2011-03-30 21:09:35

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [224/275] xen: set max_pfn_mapped to the last pfn mapped

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Stefano Stabellini <[email protected]>

commit 14988a4d350ce3b41ecad4f63c4f44c56f5ae34d upstream.

Do not set max_pfn_mapped to the end of the initial memory mappings,
that also contain pages that don't belong in pfn space (like the mfn
list).

Set max_pfn_mapped to the last real pfn mapped in the initial memory
mappings that is the pfn backing _end.

Signed-off-by: Stefano Stabellini <[email protected]>
Acked-by: Konrad Rzeszutek Wilk <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
LKML-Reference: <alpine.DEB.2.00.1103171739050.3382@kaball-desktop>
Signed-off-by: H. Peter Anvin <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
arch/x86/xen/mmu.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

Index: linux-2.6.35.y/arch/x86/xen/mmu.c
===================================================================
--- linux-2.6.35.y.orig/arch/x86/xen/mmu.c 2011-03-29 22:50:26.784573069 -0700
+++ linux-2.6.35.y/arch/x86/xen/mmu.c 2011-03-29 23:03:02.900225961 -0700
@@ -1641,9 +1641,6 @@
for (pteidx = 0; pteidx < PTRS_PER_PTE; pteidx++, pfn++) {
pte_t pte;

- if (pfn > max_pfn_mapped)
- max_pfn_mapped = pfn;
-
if (!pte_none(pte_page[pteidx]))
continue;

@@ -1687,6 +1684,12 @@
pud_t *l3;
pmd_t *l2;

+ /* max_pfn_mapped is the last pfn mapped in the initial memory
+ * mappings. Considering that on Xen after the kernel mappings we
+ * have the mappings of some pages that don't exist in pfn space, we
+ * set max_pfn_mapped to the last real pfn mapped. */
+ max_pfn_mapped = PFN_DOWN(__pa(xen_start_info->mfn_list));
+
/* Zap identity mapping */
init_level4_pgt[0] = __pgd(0);

@@ -1750,9 +1753,7 @@
{
pmd_t *kernel_pmd;

- max_pfn_mapped = PFN_DOWN(__pa(xen_start_info->pt_base) +
- xen_start_info->nr_pt_frames * PAGE_SIZE +
- 512*1024);
+ max_pfn_mapped = PFN_DOWN(__pa(xen_start_info->mfn_list));

kernel_pmd = m2v(pgd[KERNEL_PGD_BOUNDARY].pgd);
memcpy(level2_kernel_pgt, kernel_pmd, sizeof(pmd_t) * PTRS_PER_PMD);

2011-03-30 21:09:40

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [229/275] proc: protect mm start_code/end_code in /proc/pid/stat

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Kees Cook <[email protected]>

commit 5883f57ca0008ffc93e09cbb9847a1928e50c6f3 upstream.

While mm->start_stack was protected from cross-uid viewing (commit
f83ce3e6b02d5 ("proc: avoid information leaks to non-privileged
processes")), the start_code and end_code values were not. This would
allow the text location of a PIE binary to leak, defeating ASLR.

Note that the value "1" is used instead of "0" for a protected value since
"ps", "killall", and likely other readers of /proc/pid/stat, take
start_code of "0" to mean a kernel thread and will misbehave. Thanks to
Brad Spengler for pointing this out.

Addresses CVE-2011-0726

Signed-off-by: Kees Cook <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Cc: Alexey Dobriyan <[email protected]>
Cc: David Howells <[email protected]>
Cc: Eugene Teo <[email protected]>
Cc: Martin Schwidefsky <[email protected]>
Cc: Brad Spengler <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
fs/proc/array.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6.35.y/fs/proc/array.c
===================================================================
--- linux-2.6.35.y.orig/fs/proc/array.c 2011-03-29 23:03:00.892277339 -0700
+++ linux-2.6.35.y/fs/proc/array.c 2011-03-29 23:03:02.997223479 -0700
@@ -489,8 +489,8 @@
vsize,
mm ? get_mm_rss(mm) : 0,
rsslim,
- mm ? mm->start_code : 0,
- mm ? mm->end_code : 0,
+ mm ? (permitted ? mm->start_code : 1) : 0,
+ mm ? (permitted ? mm->end_code : 1) : 0,
(permitted && mm) ? mm->start_stack : 0,
esp,
eip,

2011-03-30 21:09:46

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [233/275] uvcvideo: Fix uvc_fixup_video_ctrl() format search

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Stephan Lachowsky <[email protected]>

commit 38a66824d96de8aeeb915e6f46f0d3fe55828eb1 upstream.

The scheme used to index format in uvc_fixup_video_ctrl() is not robust:
format index is based on descriptor ordering, which does not necessarily
match bFormatIndex ordering. Searching for first matching format will
prevent uvc_fixup_video_ctrl() from using the wrong format/frame to make
adjustments.

Signed-off-by: Stephan Lachowsky <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/media/video/uvc/uvc_video.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)

Index: linux-2.6.35.y/drivers/media/video/uvc/uvc_video.c
===================================================================
--- linux-2.6.35.y.orig/drivers/media/video/uvc/uvc_video.c 2011-03-29 22:50:21.561706709 -0700
+++ linux-2.6.35.y/drivers/media/video/uvc/uvc_video.c 2011-03-29 23:03:03.081221330 -0700
@@ -65,15 +65,19 @@
static void uvc_fixup_video_ctrl(struct uvc_streaming *stream,
struct uvc_streaming_control *ctrl)
{
- struct uvc_format *format;
+ struct uvc_format *format = NULL;
struct uvc_frame *frame = NULL;
unsigned int i;

- if (ctrl->bFormatIndex <= 0 ||
- ctrl->bFormatIndex > stream->nformats)
- return;
+ for (i = 0; i < stream->nformats; ++i) {
+ if (stream->format[i].index == ctrl->bFormatIndex) {
+ format = &stream->format[i];
+ break;
+ }
+ }

- format = &stream->format[ctrl->bFormatIndex - 1];
+ if (format == NULL)
+ return;

for (i = 0; i < format->nframes; ++i) {
if (format->frame[i].bFrameIndex == ctrl->bFrameIndex) {

2011-03-30 21:09:44

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [215/275] smp_call_function_many: handle concurrent clearing of mask

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Milton Miller <[email protected]>

commit 723aae25d5cdb09962901d36d526b44d4be1051c upstream.

Mike Galbraith reported finding a lockup ("perma-spin bug") where the
cpumask passed to smp_call_function_many was cleared by other cpu(s)
while a cpu was preparing its call_data block, resulting in no cpu to
clear the last ref and unlock the block.

Having cpus clear their bit asynchronously could be useful on a mask of
cpus that might have a translation context, or cpus that need a push to
complete an rcu window.

Instead of adding a BUG_ON and requiring yet another cpumask copy, just
detect the race and handle it.

Note: arch_send_call_function_ipi_mask must still handle an empty
cpumask because the data block is globally visible before the that arch
callback is made. And (obviously) there are no guarantees to which cpus
are notified if the mask is changed during the call; only cpus that were
online and had their mask bit set during the whole call are guaranteed
to be called.

Reported-by: Mike Galbraith <[email protected]>
Reported-by: Jan Beulich <[email protected]>
Acked-by: Jan Beulich <[email protected]>
Signed-off-by: Milton Miller <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
kernel/smp.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

Index: linux-2.6.35.y/kernel/smp.c
===================================================================
--- linux-2.6.35.y.orig/kernel/smp.c 2011-03-29 23:03:02.689231360 -0700
+++ linux-2.6.35.y/kernel/smp.c 2011-03-29 23:03:02.732230259 -0700
@@ -427,7 +427,7 @@
{
struct call_function_data *data;
unsigned long flags;
- int cpu, next_cpu, this_cpu = smp_processor_id();
+ int refs, cpu, next_cpu, this_cpu = smp_processor_id();

/*
* Can deadlock when called with interrupts disabled.
@@ -438,7 +438,7 @@
WARN_ON_ONCE(cpu_online(this_cpu) && irqs_disabled()
&& !oops_in_progress);

- /* So, what's a CPU they want? Ignoring this one. */
+ /* Try to fastpath. So, what's a CPU they want? Ignoring this one. */
cpu = cpumask_first_and(mask, cpu_online_mask);
if (cpu == this_cpu)
cpu = cpumask_next_and(cpu, mask, cpu_online_mask);
@@ -496,6 +496,13 @@
/* We rely on the "and" being processed before the store */
cpumask_and(data->cpumask, mask, cpu_online_mask);
cpumask_clear_cpu(this_cpu, data->cpumask);
+ refs = cpumask_weight(data->cpumask);
+
+ /* Some callers race with other cpus changing the passed mask */
+ if (unlikely(!refs)) {
+ csd_unlock(&data->csd);
+ return;
+ }

raw_spin_lock_irqsave(&call_function.lock, flags);
/*
@@ -509,7 +516,7 @@
* to the cpumask before this write to refs, which indicates
* data is on the list and is ready to be processed.
*/
- atomic_set(&data->refs, cpumask_weight(data->cpumask));
+ atomic_set(&data->refs, refs);
raw_spin_unlock_irqrestore(&call_function.lock, flags);

/*

2011-03-30 21:09:59

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [242/275] dcdbas: force SMI to happen when expected

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Stuart Hayes <[email protected]>

commit dd65c736d1b5312c80c88a64bf521db4959eded5 upstream.

The dcdbas driver can do an I/O write to cause a SMI to occur. The SMI handler
looks at certain registers and memory locations, so the SMI needs to happen
immediately. On some systems I/O writes are posted, though, causing the SMI to
happen well after the "outb" occurred, which causes random failures. Following
the "outb" with an "inb" forces the write to go through even if it is posted.

Signed-off-by: Stuart Hayes <[email protected]>
Acked-by: Doug Warzecha <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Cc: Chuck Ebbert <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
drivers/firmware/dcdbas.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

Index: linux-2.6.35.y/drivers/firmware/dcdbas.c
===================================================================
--- linux-2.6.35.y.orig/drivers/firmware/dcdbas.c 2011-03-29 22:50:16.283841755 -0700
+++ linux-2.6.35.y/drivers/firmware/dcdbas.c 2011-03-29 23:03:03.249217032 -0700
@@ -268,8 +268,10 @@
}

/* generate SMI */
+ /* inb to force posted write through and make SMI happen now */
asm volatile (
- "outb %b0,%w1"
+ "outb %b0,%w1\n"
+ "inb %w1"
: /* no output args */
: "a" (smi_cmd->command_code),
"d" (smi_cmd->command_address),

2011-03-30 21:10:21

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [257/275] netfilter: arpt_mangle: fix return values of checkentry

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
In 135367b "netfilter: xtables: change xt_target.checkentry return type",
the type returned by checkentry was changed from boolean to int, but the
return values where not adjusted.

arptables: Input/output error

This broke arptables with the mangle target since it returns true
under success, which is interpreted by xtables as >0, thus
returning EIO.

The following Linux kernels are affected:
* 2.6.35.9
* 2.6.36.4
* 2.6.37.3

Cc: [email protected]
Signed-off-by: Pablo Neira Ayuso <[email protected]>
Signed-off-by: Patrick McHardy <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
(cherry picked from commit 9d0db8b6b1da9e3d4c696ef29449700c58d589db)
---
net/ipv4/netfilter/arpt_mangle.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

Index: linux-2.6.35.y/net/ipv4/netfilter/arpt_mangle.c
===================================================================
--- linux-2.6.35.y.orig/net/ipv4/netfilter/arpt_mangle.c 2011-01-13 09:47:51.000000000 -0800
+++ linux-2.6.35.y/net/ipv4/netfilter/arpt_mangle.c 2011-03-29 23:12:09.451240810 -0700
@@ -60,12 +60,12 @@

if (mangle->flags & ~ARPT_MANGLE_MASK ||
!(mangle->flags & ARPT_MANGLE_MASK))
- return false;
+ return -EINVAL;

if (mangle->target != NF_DROP && mangle->target != NF_ACCEPT &&
mangle->target != ARPT_CONTINUE)
- return false;
- return true;
+ return -EINVAL;
+ return 0;
}

static struct xt_target arpt_mangle_reg __read_mostly = {

2011-03-30 21:10:16

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [250/275] ses: show devices for enclosures with no page 7

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: John Hughes <[email protected]>

commit 877a55979c189c590e819a61cbbe2b7947875f17 upstream.

enclosure page 7 gives us the "pretty" names of the enclosure slots.
Without a page 7, we can still use the enclosure code as long as we
make up numeric names for the slots. Unfortunately, the current code
fails to add any devices because the check for page 10 is in the wrong
place if we have no page 7. Fix it so that devices show up even if
the enclosure has no page 7.

Signed-off-by: James Bottomley <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/scsi/ses.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6.35.y/drivers/scsi/ses.c
===================================================================
--- linux-2.6.35.y.orig/drivers/scsi/ses.c 2011-03-29 22:50:11.521963601 -0700
+++ linux-2.6.35.y/drivers/scsi/ses.c 2011-03-29 23:03:03.484211019 -0700
@@ -390,9 +390,9 @@
len = (desc_ptr[2] << 8) + desc_ptr[3];
/* skip past overall descriptor */
desc_ptr += len + 4;
- if (ses_dev->page10)
- addl_desc_ptr = ses_dev->page10 + 8;
}
+ if (ses_dev->page10)
+ addl_desc_ptr = ses_dev->page10 + 8;
type_ptr = ses_dev->page1 + 12 + ses_dev->page1[11];
components = 0;
for (i = 0; i < types; i++, type_ptr += 4) {

2011-03-30 21:10:26

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [271/275] Revert "KVM: Correct ordering of ldt reload wrt fs/gs reload"

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
This reverts commit d3f813da18f83a31f2678988b450e6a1c94c95ed.
Signed-off-by: Andi Kleen <[email protected]>

---
arch/x86/kvm/svm.c | 2 +-
arch/x86/kvm/vmx.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)

Index: linux-2.6.35.y/arch/x86/kvm/svm.c
===================================================================
--- linux-2.6.35.y.orig/arch/x86/kvm/svm.c 2011-01-13 09:47:51.000000000 -0800
+++ linux-2.6.35.y/arch/x86/kvm/svm.c 2011-03-29 23:53:33.374683701 -0700
@@ -3184,9 +3184,9 @@
vcpu->arch.regs[VCPU_REGS_RSP] = svm->vmcb->save.rsp;
vcpu->arch.regs[VCPU_REGS_RIP] = svm->vmcb->save.rip;

- kvm_load_ldt(ldt_selector);
kvm_load_fs(fs_selector);
kvm_load_gs(gs_selector);
+ kvm_load_ldt(ldt_selector);
load_host_msrs(vcpu);

reload_tss(vcpu);
Index: linux-2.6.35.y/arch/x86/kvm/vmx.c
===================================================================
--- linux-2.6.35.y.orig/arch/x86/kvm/vmx.c 2011-01-13 09:47:51.000000000 -0800
+++ linux-2.6.35.y/arch/x86/kvm/vmx.c 2011-03-29 23:53:33.374683701 -0700
@@ -791,6 +791,8 @@

++vmx->vcpu.stat.host_state_reload;
vmx->host_state.loaded = 0;
+ if (vmx->host_state.fs_reload_needed)
+ kvm_load_fs(vmx->host_state.fs_sel);
if (vmx->host_state.gs_ldt_reload_needed) {
kvm_load_ldt(vmx->host_state.ldt_sel);
/*
@@ -804,8 +806,6 @@
#endif
local_irq_restore(flags);
}
- if (vmx->host_state.fs_reload_needed)
- loadsegment(fs, vmx->host_state.fs_sel);
reload_tss();
#ifdef CONFIG_X86_64
if (is_long_mode(&vmx->vcpu)) {

2011-03-30 21:10:55

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [275/275] Release 2.6.35.12

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
Signed-off-by: Andi Kleen <[email protected]>
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.35.y/Makefile
===================================================================
--- linux-2.6.35.y.orig/Makefile 2011-03-10 08:45:08.000000000 -0800
+++ linux-2.6.35.y/Makefile 2011-03-29 23:58:30.608078326 -0700
@@ -1,7 +1,7 @@
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 35
-EXTRAVERSION = .11
+EXTRAVERSION = .12
NAME = Yokohama

# *DOCUMENTATION*

2011-03-30 21:11:11

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [273/275] KVM: Correct ordering of ldt reload wrt fs/gs reload

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Avi Kivity <[email protected]>

commit 0a77fe4c188e25917799f2356d4aa5e6d80c39a2 upstream.

If fs or gs refer to the ldt, they must be reloaded after the ldt. Reorder
the code to that effect.

Userspace code that uses the ldt with kvm is nonexistent, so this doesn't fix
a user-visible bug.

Signed-off-by: Avi Kivity <[email protected]>
Signed-off-by: Marcelo Tosatti <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
arch/x86/kvm/svm.c | 2 +-
arch/x86/kvm/vmx.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)

Index: linux-2.6.35.y/arch/x86/kvm/svm.c
===================================================================
--- linux-2.6.35.y.orig/arch/x86/kvm/svm.c 2011-03-29 23:53:08.796312600 -0700
+++ linux-2.6.35.y/arch/x86/kvm/svm.c 2011-03-29 23:53:15.697136026 -0700
@@ -3185,6 +3185,7 @@
vcpu->arch.regs[VCPU_REGS_RIP] = svm->vmcb->save.rip;

load_host_msrs(vcpu);
+ kvm_load_ldt(ldt_selector);
loadsegment(fs, fs_selector);
#ifdef CONFIG_X86_64
load_gs_index(gs_selector);
@@ -3192,7 +3193,6 @@
#else
loadsegment(gs, gs_selector);
#endif
- kvm_load_ldt(ldt_selector);

reload_tss(vcpu);

Index: linux-2.6.35.y/arch/x86/kvm/vmx.c
===================================================================
--- linux-2.6.35.y.orig/arch/x86/kvm/vmx.c 2011-03-29 23:53:08.868310757 -0700
+++ linux-2.6.35.y/arch/x86/kvm/vmx.c 2011-03-29 23:53:32.094716453 -0700
@@ -789,8 +789,6 @@

++vmx->vcpu.stat.host_state_reload;
vmx->host_state.loaded = 0;
- if (vmx->host_state.fs_reload_needed)
- loadsegment(fs, vmx->host_state.fs_sel);
if (vmx->host_state.gs_ldt_reload_needed) {
kvm_load_ldt(vmx->host_state.ldt_sel);
#ifdef CONFIG_X86_64
@@ -800,6 +798,8 @@
loadsegment(gs, vmx->host_state.gs_sel);
#endif
}
+ if (vmx->host_state.fs_reload_needed)
+ loadsegment(fs, vmx->host_state.fs_sel);
reload_tss();
#ifdef CONFIG_X86_64
if (is_long_mode(&vmx->vcpu)) {

2011-03-30 21:11:10

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [274/275] KVM: VMX: Fix host userspace gsbase corruption

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
commit c8770e7ba63bb5dd8fe5f9d251275a8fa717fb78 upstream.

We now use load_gs_index() to load gs safely; unfortunately this also
changes MSR_KERNEL_GS_BASE, which we managed separately. This resulted
in confusion and breakage running 32-bit host userspace on a 64-bit kernel.

Fix by
- saving guest MSR_KERNEL_GS_BASE before we we reload the host's gs
- doing the host save/load unconditionally, instead of only when in guest
long mode

Things can be cleaned up further, but this is the minmal fix for now.

Signed-off-by: Avi Kivity <[email protected]>
Signed-off-by: Marcelo Tosatti <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
arch/x86/kvm/vmx.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)

Index: linux-2.6.35.y/arch/x86/kvm/vmx.c
===================================================================
--- linux-2.6.35.y.orig/arch/x86/kvm/vmx.c 2011-03-29 23:53:15.698136001 -0700
+++ linux-2.6.35.y/arch/x86/kvm/vmx.c 2011-03-29 23:53:23.475936985 -0700
@@ -771,10 +771,9 @@
#endif

#ifdef CONFIG_X86_64
- if (is_long_mode(&vmx->vcpu)) {
- rdmsrl(MSR_KERNEL_GS_BASE, vmx->msr_host_kernel_gs_base);
+ rdmsrl(MSR_KERNEL_GS_BASE, vmx->msr_host_kernel_gs_base);
+ if (is_long_mode(&vmx->vcpu))
wrmsrl(MSR_KERNEL_GS_BASE, vmx->msr_guest_kernel_gs_base);
- }
#endif
for (i = 0; i < vmx->save_nmsrs; ++i)
kvm_set_shared_msr(vmx->guest_msrs[i].index,
@@ -789,11 +788,14 @@

++vmx->vcpu.stat.host_state_reload;
vmx->host_state.loaded = 0;
+#ifdef CONFIG_X86_64
+ if (is_long_mode(&vmx->vcpu))
+ rdmsrl(MSR_KERNEL_GS_BASE, vmx->msr_guest_kernel_gs_base);
+#endif
if (vmx->host_state.gs_ldt_reload_needed) {
kvm_load_ldt(vmx->host_state.ldt_sel);
#ifdef CONFIG_X86_64
load_gs_index(vmx->host_state.gs_sel);
- wrmsrl(MSR_KERNEL_GS_BASE, current->thread.gs);
#else
loadsegment(gs, vmx->host_state.gs_sel);
#endif
@@ -802,10 +804,7 @@
loadsegment(fs, vmx->host_state.fs_sel);
reload_tss();
#ifdef CONFIG_X86_64
- if (is_long_mode(&vmx->vcpu)) {
- rdmsrl(MSR_KERNEL_GS_BASE, vmx->msr_guest_kernel_gs_base);
- wrmsrl(MSR_KERNEL_GS_BASE, vmx->msr_host_kernel_gs_base);
- }
+ wrmsrl(MSR_KERNEL_GS_BASE, vmx->msr_host_kernel_gs_base);
#endif
load_gdt(&__get_cpu_var(host_gdt));
}

2011-03-30 21:11:40

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [272/275] KVM: Fix fs/gs reload oops with invalid ldt

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Avi Kivity <[email protected]>

commit 9581d442b9058d3699b4be568b6e5eae38a41493 upstream.

kvm reloads the host's fs and gs blindly, however the underlying segment
descriptors may be invalid due to the user modifying the ldt after loading
them.

Fix by using the safe accessors (loadsegment() and load_gs_index()) instead
of home grown unsafe versions.

This is CVE-2010-3698.

KVM-Stable-Tag.
Signed-off-by: Avi Kivity <[email protected]>
Signed-off-by: Marcelo Tosatti <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
arch/x86/include/asm/kvm_host.h | 24 ------------------------
arch/x86/kvm/svm.c | 15 ++++++++++-----
arch/x86/kvm/vmx.c | 24 +++++++++---------------
3 files changed, 19 insertions(+), 44 deletions(-)

Index: linux-2.6.35.y/arch/x86/include/asm/kvm_host.h
===================================================================
--- linux-2.6.35.y.orig/arch/x86/include/asm/kvm_host.h 2011-03-29 23:47:05.643604770 -0700
+++ linux-2.6.35.y/arch/x86/include/asm/kvm_host.h 2011-03-29 23:53:08.794312651 -0700
@@ -673,20 +673,6 @@
return (struct kvm_mmu_page *)page_private(page);
}

-static inline u16 kvm_read_fs(void)
-{
- u16 seg;
- asm("mov %%fs, %0" : "=g"(seg));
- return seg;
-}
-
-static inline u16 kvm_read_gs(void)
-{
- u16 seg;
- asm("mov %%gs, %0" : "=g"(seg));
- return seg;
-}
-
static inline u16 kvm_read_ldt(void)
{
u16 ldt;
@@ -694,16 +680,6 @@
return ldt;
}

-static inline void kvm_load_fs(u16 sel)
-{
- asm("mov %0, %%fs" : : "rm"(sel));
-}
-
-static inline void kvm_load_gs(u16 sel)
-{
- asm("mov %0, %%gs" : : "rm"(sel));
-}
-
static inline void kvm_load_ldt(u16 sel)
{
asm("lldt %0" : : "rm"(sel));
Index: linux-2.6.35.y/arch/x86/kvm/svm.c
===================================================================
--- linux-2.6.35.y.orig/arch/x86/kvm/svm.c 2011-03-29 23:48:01.816167453 -0700
+++ linux-2.6.35.y/arch/x86/kvm/svm.c 2011-03-29 23:53:32.725700307 -0700
@@ -3096,8 +3096,8 @@
sync_lapic_to_cr8(vcpu);

save_host_msrs(vcpu);
- fs_selector = kvm_read_fs();
- gs_selector = kvm_read_gs();
+ savesegment(fs, fs_selector);
+ savesegment(gs, gs_selector);
ldt_selector = kvm_read_ldt();
svm->vmcb->save.cr2 = vcpu->arch.cr2;
/* required for live migration with NPT */
@@ -3184,10 +3184,15 @@
vcpu->arch.regs[VCPU_REGS_RSP] = svm->vmcb->save.rsp;
vcpu->arch.regs[VCPU_REGS_RIP] = svm->vmcb->save.rip;

- kvm_load_fs(fs_selector);
- kvm_load_gs(gs_selector);
- kvm_load_ldt(ldt_selector);
load_host_msrs(vcpu);
+ loadsegment(fs, fs_selector);
+#ifdef CONFIG_X86_64
+ load_gs_index(gs_selector);
+ wrmsrl(MSR_KERNEL_GS_BASE, current->thread.gs);
+#else
+ loadsegment(gs, gs_selector);
+#endif
+ kvm_load_ldt(ldt_selector);

reload_tss(vcpu);

Index: linux-2.6.35.y/arch/x86/kvm/vmx.c
===================================================================
--- linux-2.6.35.y.orig/arch/x86/kvm/vmx.c 2011-03-29 23:48:01.817167428 -0700
+++ linux-2.6.35.y/arch/x86/kvm/vmx.c 2011-03-29 23:53:32.725700307 -0700
@@ -746,7 +746,7 @@
*/
vmx->host_state.ldt_sel = kvm_read_ldt();
vmx->host_state.gs_ldt_reload_needed = vmx->host_state.ldt_sel;
- vmx->host_state.fs_sel = kvm_read_fs();
+ savesegment(fs, vmx->host_state.fs_sel);
if (!(vmx->host_state.fs_sel & 7)) {
vmcs_write16(HOST_FS_SELECTOR, vmx->host_state.fs_sel);
vmx->host_state.fs_reload_needed = 0;
@@ -754,7 +754,7 @@
vmcs_write16(HOST_FS_SELECTOR, 0);
vmx->host_state.fs_reload_needed = 1;
}
- vmx->host_state.gs_sel = kvm_read_gs();
+ savesegment(gs, vmx->host_state.gs_sel);
if (!(vmx->host_state.gs_sel & 7))
vmcs_write16(HOST_GS_SELECTOR, vmx->host_state.gs_sel);
else {
@@ -784,27 +784,21 @@

static void __vmx_load_host_state(struct vcpu_vmx *vmx)
{
- unsigned long flags;
-
if (!vmx->host_state.loaded)
return;

++vmx->vcpu.stat.host_state_reload;
vmx->host_state.loaded = 0;
if (vmx->host_state.fs_reload_needed)
- kvm_load_fs(vmx->host_state.fs_sel);
+ loadsegment(fs, vmx->host_state.fs_sel);
if (vmx->host_state.gs_ldt_reload_needed) {
kvm_load_ldt(vmx->host_state.ldt_sel);
- /*
- * If we have to reload gs, we must take care to
- * preserve our gs base.
- */
- local_irq_save(flags);
- kvm_load_gs(vmx->host_state.gs_sel);
#ifdef CONFIG_X86_64
- wrmsrl(MSR_GS_BASE, vmcs_readl(HOST_GS_BASE));
+ load_gs_index(vmx->host_state.gs_sel);
+ wrmsrl(MSR_KERNEL_GS_BASE, current->thread.gs);
+#else
+ loadsegment(gs, vmx->host_state.gs_sel);
#endif
- local_irq_restore(flags);
}
reload_tss();
#ifdef CONFIG_X86_64
@@ -2518,8 +2512,8 @@
vmcs_write16(HOST_CS_SELECTOR, __KERNEL_CS); /* 22.2.4 */
vmcs_write16(HOST_DS_SELECTOR, __KERNEL_DS); /* 22.2.4 */
vmcs_write16(HOST_ES_SELECTOR, __KERNEL_DS); /* 22.2.4 */
- vmcs_write16(HOST_FS_SELECTOR, kvm_read_fs()); /* 22.2.4 */
- vmcs_write16(HOST_GS_SELECTOR, kvm_read_gs()); /* 22.2.4 */
+ vmcs_write16(HOST_FS_SELECTOR, 0); /* 22.2.4 */
+ vmcs_write16(HOST_GS_SELECTOR, 0); /* 22.2.4 */
vmcs_write16(HOST_SS_SELECTOR, __KERNEL_DS); /* 22.2.4 */
#ifdef CONFIG_X86_64
rdmsrl(MSR_FS_BASE, a);

2011-03-30 21:11:38

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [268/275] [PATCH 2.6.35] iwl3945: remove plcp check

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
commit c91d01556f52255a31575be0cb1981c92a2a5028 upstream.

Patch fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=654599

Many users report very low speed problem on 3945 devices,
this patch fixes problem, but only for some of them.

For unknown reason, sometimes after hw scanning, device is not able
to receive frames at high rate. Since plcp health check may request
hw scan to "reset radio", performance problem start to be observable
after update kernel to .35, where plcp check was introduced.

Bug reporter confirmed that removing plcp check fixed problem for him.

Reported-and-tested-by: SilvioTO <[email protected]>
Acked-by: Wey-Yi Guy <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/net/wireless/iwlwifi/iwl-3945.c | 1 -
1 file changed, 1 deletion(-)

Index: linux-2.6.35.y/drivers/net/wireless/iwlwifi/iwl-3945.c
===================================================================
--- linux-2.6.35.y.orig/drivers/net/wireless/iwlwifi/iwl-3945.c 2011-01-13 09:47:51.000000000 -0800
+++ linux-2.6.35.y/drivers/net/wireless/iwlwifi/iwl-3945.c 2011-03-29 23:46:19.212792817 -0700
@@ -2837,7 +2837,6 @@
.config_ap = iwl3945_config_ap,
.manage_ibss_station = iwl3945_manage_ibss_station,
.recover_from_tx_stall = iwl_bg_monitor_recover,
- .check_plcp_health = iwl3945_good_plcp_health,

.debugfs_ops = {
.rx_stats_read = iwl3945_ucode_rx_stats_read,

2011-03-30 21:12:05

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [265/275] net: Fix ip link add netns oops

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Eric W. Biederman <[email protected]>

[ upstream commit 13ad17745c2cbd437d9e24b2d97393e0be11c439 ]

Ed Swierk <[email protected]> writes:
> On 2.6.35.7
> ip link add link eth0 netns 9999 type macvlan
> where 9999 is a nonexistent PID triggers an oops and causes all network functions to hang:
> [10663.821898] BUG: unable to handle kernel NULL pointer dereference at 000000000000006d
> [10663.821917] IP: [<ffffffff8149c2fa>] __dev_alloc_name+0x9a/0x170
> [10663.821933] PGD 1d3927067 PUD 22f5c5067 PMD 0
> [10663.821944] Oops: 0000 [#1] SMP
> [10663.821953] last sysfs file: /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
> [10663.821959] CPU 3
> [10663.821963] Modules linked in: macvlan ip6table_filter ip6_tables rfcomm ipt_MASQUERADE binfmt_misc iptable_nat nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack sco ipt_REJECT bnep l2cap xt_tcpudp iptable_filter ip_tables x_tables bridge stp vboxnetadp vboxnetflt vboxdrv kvm_intel kvm parport_pc ppdev snd_hda_codec_intelhdmi snd_hda_codec_conexant arc4 iwlagn iwlcore mac80211 snd_hda_intel snd_hda_codec snd_hwdep snd_pcm snd_seq_midi snd_rawmidi i915 snd_seq_midi_event snd_seq thinkpad_acpi drm_kms_helper btusb tpm_tis nvram uvcvideo snd_timer snd_seq_device bluetooth videodev v4l1_compat v4l2_compat_ioctl32 tpm drm tpm_bios snd cfg80211 psmouse serio_raw intel_ips soundcore snd_page_alloc intel_agp i2c_algo_bit video output netconsole configfs lp parport usbhid hid e1000e sdhci_pci ahci libahci sdhci led_class
> [10663.822155]
> [10663.822161] Pid: 6000, comm: ip Not tainted 2.6.35-23-generic #41-Ubuntu 2901CTO/2901CTO
> [10663.822167] RIP: 0010:[<ffffffff8149c2fa>] [<ffffffff8149c2fa>] __dev_alloc_name+0x9a/0x170
> [10663.822177] RSP: 0018:ffff88014aebf7b8 EFLAGS: 00010286
> [10663.822182] RAX: 00000000fffffff4 RBX: ffff8801ad900800 RCX: 0000000000000000
> [10663.822187] RDX: ffff880000000000 RSI: 0000000000000000 RDI: ffff88014ad63000
> [10663.822191] RBP: ffff88014aebf808 R08: 0000000000000041 R09: 0000000000000041
> [10663.822196] R10: 0000000000000000 R11: dead000000200200 R12: ffff88014aebf818
> [10663.822201] R13: fffffffffffffffd R14: ffff88014aebf918 R15: ffff88014ad62000
> [10663.822207] FS: 00007f00c487f700(0000) GS:ffff880001f80000(0000) knlGS:0000000000000000
> [10663.822212] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [10663.822216] CR2: 000000000000006d CR3: 0000000231f19000 CR4: 00000000000026e0
> [10663.822221] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> [10663.822226] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
> [10663.822231] Process ip (pid: 6000, threadinfo ffff88014aebe000, task ffff88014afb16e0)
> [10663.822236] Stack:
> [10663.822240] ffff88014aebf808 ffffffff814a2bb5 ffff88014aebf7e8 00000000a00ee8d6
> [10663.822251] <0> 0000000000000000 ffffffffa00ef940 ffff8801ad900800 ffff88014aebf818
> [10663.822265] <0> ffff88014aebf918 ffff8801ad900800 ffff88014aebf858 ffffffff8149c413
> [10663.822281] Call Trace:
> [10663.822290] [<ffffffff814a2bb5>] ? dev_addr_init+0x75/0xb0
> [10663.822298] [<ffffffff8149c413>] dev_alloc_name+0x43/0x90
> [10663.822307] [<ffffffff814a85ee>] rtnl_create_link+0xbe/0x1b0
> [10663.822314] [<ffffffff814ab2aa>] rtnl_newlink+0x48a/0x570
> [10663.822321] [<ffffffff814aafcc>] ? rtnl_newlink+0x1ac/0x570
> [10663.822332] [<ffffffff81030064>] ? native_x2apic_icr_read+0x4/0x20
> [10663.822339] [<ffffffff814a8c17>] rtnetlink_rcv_msg+0x177/0x290
> [10663.822346] [<ffffffff814a8aa0>] ? rtnetlink_rcv_msg+0x0/0x290
> [10663.822354] [<ffffffff814c25d9>] netlink_rcv_skb+0xa9/0xd0
> [10663.822360] [<ffffffff814a8a85>] rtnetlink_rcv+0x25/0x40
> [10663.822367] [<ffffffff814c223e>] netlink_unicast+0x2de/0x2f0
> [10663.822374] [<ffffffff814c303e>] netlink_sendmsg+0x1fe/0x2e0
> [10663.822383] [<ffffffff81488533>] sock_sendmsg+0xf3/0x120
> [10663.822391] [<ffffffff815899fe>] ? _raw_spin_lock+0xe/0x20
> [10663.822400] [<ffffffff81168656>] ? __d_lookup+0x136/0x150
> [10663.822406] [<ffffffff815899fe>] ? _raw_spin_lock+0xe/0x20
> [10663.822414] [<ffffffff812b7a0d>] ? _atomic_dec_and_lock+0x4d/0x80
> [10663.822422] [<ffffffff8116ea90>] ? mntput_no_expire+0x30/0x110
> [10663.822429] [<ffffffff81486ff5>] ? move_addr_to_kernel+0x65/0x70
> [10663.822435] [<ffffffff81493308>] ? verify_iovec+0x88/0xe0
> [10663.822442] [<ffffffff81489020>] sys_sendmsg+0x240/0x3a0
> [10663.822450] [<ffffffff8111e2a9>] ? __do_fault+0x479/0x560
> [10663.822457] [<ffffffff815899fe>] ? _raw_spin_lock+0xe/0x20
> [10663.822465] [<ffffffff8116cf4a>] ? alloc_fd+0x10a/0x150
> [10663.822473] [<ffffffff8158d76e>] ? do_page_fault+0x15e/0x350
> [10663.822482] [<ffffffff8100a0f2>] system_call_fastpath+0x16/0x1b
> [10663.822487] Code: 90 48 8d 78 02 be 25 00 00 00 e8 92 1d e2 ff 48 85 c0 75 cf bf 20 00 00 00 e8 c3 b1 c6 ff 49 89 c7 b8 f4 ff ff ff 4d 85 ff 74 bd <4d> 8b 75 70 49 8d 45 70 48 89 45 b8 49 83 ee 58 eb 28 48 8d 55
> [10663.822618] RIP [<ffffffff8149c2fa>] __dev_alloc_name+0x9a/0x170
> [10663.822627] RSP <ffff88014aebf7b8>
> [10663.822631] CR2: 000000000000006d
> [10663.822636] ---[ end trace 3dfd6c3ad5327ca7 ]---

This bug was introduced in:
commit 81adee47dfb608df3ad0b91d230fb3cef75f0060
Author: Eric W. Biederman <[email protected]>
Date: Sun Nov 8 00:53:51 2009 -0800

net: Support specifying the network namespace upon device creation.

There is no good reason to not support userspace specifying the
network namespace during device creation, and it makes it easier
to create a network device and pass it to a child network namespace
with a well known name.

We have to be careful to ensure that the target network namespace
for the new device exists through the life of the call. To keep
that logic clear I have factored out the network namespace grabbing
logic into rtnl_link_get_net.

In addtion we need to continue to pass the source network namespace
to the rtnl_link_ops.newlink method so that we can find the base
device source network namespace.

Signed-off-by: Eric W. Biederman <[email protected]>
Acked-by: Eric Dumazet <[email protected]>

Where apparently I forgot to add error handling to the path where we create
a new network device in a new network namespace, and pass in an invalid pid.

Cc: [email protected]
Reported-by: Ed Swierk <[email protected]>
Signed-off-by: "Eric W. Biederman" <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
net/core/rtnetlink.c | 3 +++
1 file changed, 3 insertions(+)

Index: linux-2.6.35.y/net/core/rtnetlink.c
===================================================================
--- linux-2.6.35.y.orig/net/core/rtnetlink.c 2011-01-13 09:47:51.000000000 -0800
+++ linux-2.6.35.y/net/core/rtnetlink.c 2011-03-29 23:33:28.150522350 -0700
@@ -1545,6 +1545,9 @@
snprintf(ifname, IFNAMSIZ, "%s%%d", ops->kind);

dest_net = rtnl_link_get_net(net, tb);
+ if (IS_ERR(dest_net))
+ return PTR_ERR(dest_net);
+
dev = rtnl_create_link(net, dest_net, ifname, ops, tb);

if (IS_ERR(dev))

2011-03-30 21:12:03

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [267/275] md: Fix - again - partition detection when array becomes active

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: NeilBrown <[email protected]>

[ upstream commit f0b4f7e2f29af678bd9af43422c537dcb6008603 ]

Revert
b821eaa572fd737faaf6928ba046e571526c36c6
and
f3b99be19ded511a1bf05a148276239d9f13eefa

When I wrote the first of these I had a wrong idea about the
lifetime of 'struct block_device'. It can disappear at any time that
the block device is not open if it falls out of the inode cache.

So relying on the 'size' recorded with it to detect when the
device size has changed and so we need to revalidate, is wrong.

Rather, we really do need the 'changed' attribute stored directly in
the mddev and set/tested as appropriate.

Without this patch, a sequence of:
mknod / open / close / unlink

(which can cause a block_device to be created and then destroyed)
will result in a rescan of the partition table and consequence removal
and addition of partitions.
Several of these in a row can get udev racing to create and unlink and
other code can get confused.

With the patch, the rescan is only performed when needed and so there
are no races.

This is suitable for any stable kernel from 2.6.35.

Reported-by: "Wojcik, Krzysztof" <[email protected]>
Signed-off-by: NeilBrown <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Cc: [email protected]

---
drivers/md/md.c | 22 +++++++++++++++++++++-
drivers/md/md.h | 2 ++
2 files changed, 23 insertions(+), 1 deletion(-)

Index: linux-2.6.35.y/drivers/md/md.c
===================================================================
--- linux-2.6.35.y.orig/drivers/md/md.c 2011-03-29 23:03:01.000000000 -0700
+++ linux-2.6.35.y/drivers/md/md.c 2011-03-29 23:45:22.648240160 -0700
@@ -4550,6 +4550,7 @@

set_capacity(mddev->gendisk, mddev->array_sectors);
revalidate_disk(mddev->gendisk);
+ mddev->changed = 1;
kobject_uevent(&disk_to_dev(mddev->gendisk)->kobj, KOBJ_CHANGE);
out:
return err;
@@ -4638,6 +4639,7 @@
mddev->sync_speed_min = mddev->sync_speed_max = 0;
mddev->recovery = 0;
mddev->in_sync = 0;
+ mddev->changed = 0;
mddev->degraded = 0;
mddev->barriers_work = 0;
mddev->safemode = 0;
@@ -4744,6 +4746,7 @@

set_capacity(disk, 0);
revalidate = 1;
+ mddev->changed = 1;

if (mddev->ro)
mddev->ro = 0;
@@ -5930,7 +5933,7 @@
atomic_inc(&mddev->openers);
mutex_unlock(&mddev->open_mutex);

- check_disk_size_change(mddev->gendisk, bdev);
+ check_disk_change(bdev);
out:
return err;
}
@@ -5945,6 +5948,21 @@

return 0;
}
+
+static int md_media_changed(struct gendisk *disk)
+{
+ mddev_t *mddev = disk->private_data;
+
+ return mddev->changed;
+}
+
+static int md_revalidate(struct gendisk *disk)
+{
+ mddev_t *mddev = disk->private_data;
+
+ mddev->changed = 0;
+ return 0;
+}
static const struct block_device_operations md_fops =
{
.owner = THIS_MODULE,
@@ -5955,6 +5973,8 @@
.compat_ioctl = md_compat_ioctl,
#endif
.getgeo = md_getgeo,
+ .media_changed = md_media_changed,
+ .revalidate_disk= md_revalidate,
};

static int md_thread(void * arg)
Index: linux-2.6.35.y/drivers/md/md.h
===================================================================
--- linux-2.6.35.y.orig/drivers/md/md.h 2011-01-13 09:47:51.000000000 -0800
+++ linux-2.6.35.y/drivers/md/md.h 2011-03-29 23:44:32.646519581 -0700
@@ -250,6 +250,8 @@
atomic_t active; /* general refcount */
atomic_t openers; /* number of active opens */

+ int changed; /* True if we might need to
+ * reread partition info */
int degraded; /* whether md should consider
* adding a spare
*/

2011-03-30 21:12:33

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [270/275] KVM: i8259: initialize isr_ack

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Avi Kivity <[email protected]>

commit a0272630bb594b4eac03a79e77957df7dad8eade upstream.

isr_ack is never initialized. So, until the first PIC reset, interrupts
may fail to be injected. This can cause Windows XP to fail to boot, as
reported in the fallout from the fix to
https://bugzilla.kernel.org/show_bug.cgi?id=21962.

Reported-and-tested-by: Nicolas Prochazka <[email protected]>
Signed-off-by: Avi Kivity <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
arch/x86/kvm/i8259.c | 2 ++
1 file changed, 2 insertions(+)

Index: linux-2.6.35.y/arch/x86/kvm/i8259.c
===================================================================
--- linux-2.6.35.y.orig/arch/x86/kvm/i8259.c 2011-01-13 09:47:51.000000000 -0800
+++ linux-2.6.35.y/arch/x86/kvm/i8259.c 2011-03-29 23:47:12.738423232 -0700
@@ -553,6 +553,8 @@
s->irq_request_opaque = kvm;
s->pics[0].pics_state = s;
s->pics[1].pics_state = s;
+ s->pics[0].isr_ack = 0xff;
+ s->pics[1].isr_ack = 0xff;

/*
* Initialize PIO device

2011-03-30 21:12:35

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [264/275] Revert "slab: Fix missing DEBUG_SLAB last user"

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Pekka Enberg <[email protected]>

[ upstream commit 3ff84a7f36554b257cd57325b1a7c1fa4b49fbe3 ]

This reverts commit 5c5e3b33b7cb959a401f823707bee006caadd76e.

The commit breaks ARM thusly:

| Mount-cache hash table entries: 512
| slab error in verify_redzone_free(): cache `idr_layer_cache': memory outside object was overwritten
| Backtrace:
| [<c0227088>] (dump_backtrace+0x0/0x110) from [<c0431afc>] (dump_stack+0x18/0x1c)
| [<c0431ae4>] (dump_stack+0x0/0x1c) from [<c0293304>] (__slab_error+0x28/0x30)
| [<c02932dc>] (__slab_error+0x0/0x30) from [<c0293a74>] (cache_free_debugcheck+0x1c0/0x2b8)
| [<c02938b4>] (cache_free_debugcheck+0x0/0x2b8) from [<c0293f78>] (kmem_cache_free+0x3c/0xc0)
| [<c0293f3c>] (kmem_cache_free+0x0/0xc0) from [<c032b1c8>] (ida_get_new_above+0x19c/0x1c0)
| [<c032b02c>] (ida_get_new_above+0x0/0x1c0) from [<c02af7ec>] (alloc_vfsmnt+0x54/0x144)
| [<c02af798>] (alloc_vfsmnt+0x0/0x144) from [<c0299830>] (vfs_kern_mount+0x30/0xec)
| [<c0299800>] (vfs_kern_mount+0x0/0xec) from [<c0299908>] (kern_mount_data+0x1c/0x20)
| [<c02998ec>] (kern_mount_data+0x0/0x20) from [<c02146c4>] (sysfs_init+0x68/0xc8)
| [<c021465c>] (sysfs_init+0x0/0xc8) from [<c02137d4>] (mnt_init+0x90/0x1b0)
| [<c0213744>] (mnt_init+0x0/0x1b0) from [<c0213388>] (vfs_caches_init+0x100/0x140)
| [<c0213288>] (vfs_caches_init+0x0/0x140) from [<c0208c0c>] (start_kernel+0x2e8/0x368)
| [<c0208924>] (start_kernel+0x0/0x368) from [<c0208034>] (__enable_mmu+0x0/0x2c)
| c0113268: redzone 1:0xd84156c5c032b3ac, redzone 2:0xd84156c5635688c0.
| slab error in cache_alloc_debugcheck_after(): cache `idr_layer_cache': double free, or memory outside object was overwritten
| ...
| c011307c: redzone 1:0x9f91102ffffffff, redzone 2:0x9f911029d74e35b
| slab: Internal list corruption detected in cache 'idr_layer_cache'(24), slabp c0113000(16). Hexdump:
|
| 000: 20 4f 10 c0 20 4f 10 c0 7c 00 00 00 7c 30 11 c0
| 010: 10 00 00 00 10 00 00 00 00 00 c9 17 fe ff ff ff
| 020: fe ff ff ff fe ff ff ff fe ff ff ff fe ff ff ff
| 030: fe ff ff ff fe ff ff ff fe ff ff ff fe ff ff ff
| 040: fe ff ff ff fe ff ff ff fe ff ff ff fe ff ff ff
| 050: fe ff ff ff fe ff ff ff fe ff ff ff 11 00 00 00
| 060: 12 00 00 00 13 00 00 00 14 00 00 00 15 00 00 00
| 070: 16 00 00 00 17 00 00 00 c0 88 56 63
| kernel BUG at /home/rmk/git/linux-2.6-rmk/mm/slab.c:2928!

Reference: https://lkml.org/lkml/2011/2/7/238
Cc: <[email protected]> # 2.6.35.y and later
Reported-and-analyzed-by: Russell King <[email protected]>
Signed-off-by: Pekka Enberg <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
mm/slab.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

Index: linux-2.6.35.y/mm/slab.c
===================================================================
--- linux-2.6.35.y.orig/mm/slab.c 2011-01-13 09:47:51.000000000 -0800
+++ linux-2.6.35.y/mm/slab.c 2011-03-29 23:28:50.113636629 -0700
@@ -2289,8 +2289,8 @@
if (ralign < align) {
ralign = align;
}
- /* disable debug if not aligning with REDZONE_ALIGN */
- if (ralign & (__alignof__(unsigned long long) - 1))
+ /* disable debug if necessary */
+ if (ralign > __alignof__(unsigned long long))
flags &= ~(SLAB_RED_ZONE | SLAB_STORE_USER);
/*
* 4) Store it.
@@ -2316,8 +2316,8 @@
*/
if (flags & SLAB_RED_ZONE) {
/* add space for red zone words */
- cachep->obj_offset += align;
- size += align + sizeof(unsigned long long);
+ cachep->obj_offset += sizeof(unsigned long long);
+ size += 2 * sizeof(unsigned long long);
}
if (flags & SLAB_STORE_USER) {
/* user store requires one word storage behind the end of

2011-03-30 21:13:03

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [269/275] KVM: enlarge number of possible CPUID leaves

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Andre Przywara <[email protected]>

commit 73c1160ce377d8fc6d84cb630ebf9658808bec49 upstream.

Currently the number of CPUID leaves KVM handles is limited to 40.
My desktop machine (AthlonII) already has 35 and future CPUs will
expand this well beyond the limit. Extend the limit to 80 to make
room for future processors.

KVM-Stable-Tag.
Signed-off-by: Andre Przywara <[email protected]>
Signed-off-by: Avi Kivity <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
arch/x86/include/asm/kvm_host.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.35.y/arch/x86/include/asm/kvm_host.h
===================================================================
--- linux-2.6.35.y.orig/arch/x86/include/asm/kvm_host.h 2011-01-13 09:47:51.000000000 -0800
+++ linux-2.6.35.y/arch/x86/include/asm/kvm_host.h 2011-03-29 23:53:33.373683727 -0700
@@ -77,7 +77,7 @@
#define KVM_NUM_MMU_PAGES (1 << KVM_MMU_HASH_SHIFT)
#define KVM_MIN_FREE_MMU_PAGES 5
#define KVM_REFILL_PAGES 25
-#define KVM_MAX_CPUID_ENTRIES 40
+#define KVM_MAX_CPUID_ENTRIES 80
#define KVM_NR_FIXED_MTRR_REGION 88
#define KVM_NR_VAR_MTRR 8

2011-03-30 21:10:19

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [256/275] classmate-laptop: depends on RFKILL or RFKILL=n

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Thadeu Lima de Souza Cascardo <[email protected]>

[ upstream commit f35843ed8d17562f7c5da4b34a4a81b0cc450e9e ]

Randy Dunlap has reported that building classmate-laptop fails when
CONFIG_RFKILL=m and CONFIG_ACPI_CMPC=y. He suggested depending on
RFKILL, but, then, it will not be possible to select classmate-laptop
when RFKILL is off. There's no known problem with building and using
classmate-laptop with RFKILL off. So depend on RFKILL or RFKILL=n.

Signed-off-by: Thadeu Lima de Souza Cascardo <[email protected]>
Signed-off-by: Matthew Garrett <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Reported-by: Randy Dunlap <[email protected]>
Cc: Randy Dunlap <[email protected]>
Cc: [email protected]
Cc: Daniel Oliveira Nascimento <[email protected]>

---
drivers/platform/x86/Kconfig | 1 +
1 file changed, 1 insertion(+)

Index: linux-2.6.35.y/drivers/platform/x86/Kconfig
===================================================================
--- linux-2.6.35.y.orig/drivers/platform/x86/Kconfig 2011-03-29 23:03:58.646799545 -0700
+++ linux-2.6.35.y/drivers/platform/x86/Kconfig 2011-03-29 23:04:02.297706128 -0700
@@ -520,6 +520,7 @@
config ACPI_CMPC
tristate "CMPC Laptop Extras"
depends on X86 && ACPI
+ depends on RFKILL || RFKILL=n
select INPUT
select BACKLIGHT_CLASS_DEVICE
default n

2011-03-30 21:13:19

by Stefan Berger

[permalink] [raw]
Subject: Re: [PATCH] [73/275] tpm_tis: Use timeouts returned from TPM

On 03/30/2011 05:05 PM, Andi Kleen wrote:

Please drop it. It has been rejected previously. A revised patch has
been sent.

Stefab

> 2.6.35-longterm review patch. If anyone has any objections, please let me know.
>
> ------------------
> From: Stefan Berger<[email protected]>
>
> commit 9b29050f8f75916f974a2d231ae5d3cd59792296 upstream.
>
> The current TPM TIS driver in git discards the timeout values returned
> from the TPM. The check of the response packet needs to consider that
> the return_code field is 0 on success and the size of the expected
> packet is equivalent to the header size + u32 length indicator for the
> TPM_GetCapability() result + 3 timeout indicators of type u32.
>
> I am also adding a sysfs entry 'timeouts' showing the timeouts that are
> being used.
>
> Signed-off-by: Stefan Berger<[email protected]>
> Signed-off-by: Andi Kleen<[email protected]>
> Tested-by: Guillaume Chazarain<[email protected]>
> Signed-off-by: Rajiv Andrade<[email protected]>
> Signed-off-by: Greg Kroah-Hartman<[email protected]>
>
> ---
> drivers/char/tpm/tpm.c | 18 ++++++++++++++++--
> drivers/char/tpm/tpm.h | 2 ++
> drivers/char/tpm/tpm_tis.c | 4 +++-
> 3 files changed, 21 insertions(+), 3 deletions(-)
>
> Index: linux-2.6.35.y/drivers/char/tpm/tpm.c
> ===================================================================
> --- linux-2.6.35.y.orig/drivers/char/tpm/tpm.c 2011-03-29 23:02:59.667308683 -0700
> +++ linux-2.6.35.y/drivers/char/tpm/tpm.c 2011-03-29 23:02:59.685308223 -0700
> @@ -567,9 +567,11 @@
> if (rc)
> return;
>
> - if (be32_to_cpu(tpm_cmd.header.out.return_code)
> - != 3 * sizeof(u32))
> + if (be32_to_cpu(tpm_cmd.header.out.return_code) != 0 ||
> + be32_to_cpu(tpm_cmd.header.out.length)
> + != sizeof(tpm_cmd.header.out) + sizeof(u32) + 3 * sizeof(u32))
> return;
> +
> duration_cap =&tpm_cmd.params.getcap_out.cap.duration;
> chip->vendor.duration[TPM_SHORT] =
> usecs_to_jiffies(be32_to_cpu(duration_cap->tpm_short));
> @@ -913,6 +915,18 @@
> }
> EXPORT_SYMBOL_GPL(tpm_show_caps_1_2);
>
> +ssize_t tpm_show_timeouts(struct device *dev, struct device_attribute *attr,
> + char *buf)
> +{
> + struct tpm_chip *chip = dev_get_drvdata(dev);
> +
> + return sprintf(buf, "%d %d %d\n",
> + jiffies_to_usecs(chip->vendor.duration[TPM_SHORT]),
> + jiffies_to_usecs(chip->vendor.duration[TPM_MEDIUM]),
> + jiffies_to_usecs(chip->vendor.duration[TPM_LONG]));
> +}
> +EXPORT_SYMBOL_GPL(tpm_show_timeouts);
> +
> ssize_t tpm_store_cancel(struct device *dev, struct device_attribute *attr,
> const char *buf, size_t count)
> {
> Index: linux-2.6.35.y/drivers/char/tpm/tpm.h
> ===================================================================
> --- linux-2.6.35.y.orig/drivers/char/tpm/tpm.h 2011-03-29 22:51:40.876677237 -0700
> +++ linux-2.6.35.y/drivers/char/tpm/tpm.h 2011-03-29 23:02:59.685308223 -0700
> @@ -56,6 +56,8 @@
> char *);
> extern ssize_t tpm_show_temp_deactivated(struct device *,
> struct device_attribute *attr, char *);
> +extern ssize_t tpm_show_timeouts(struct device *,
> + struct device_attribute *attr, char *);
>
> struct tpm_chip;
>
> Index: linux-2.6.35.y/drivers/char/tpm/tpm_tis.c
> ===================================================================
> --- linux-2.6.35.y.orig/drivers/char/tpm/tpm_tis.c 2011-03-29 22:51:40.877677211 -0700
> +++ linux-2.6.35.y/drivers/char/tpm/tpm_tis.c 2011-03-29 23:02:59.686308198 -0700
> @@ -355,6 +355,7 @@
> NULL);
> static DEVICE_ATTR(caps, S_IRUGO, tpm_show_caps_1_2, NULL);
> static DEVICE_ATTR(cancel, S_IWUSR | S_IWGRP, NULL, tpm_store_cancel);
> +static DEVICE_ATTR(timeouts, S_IRUGO, tpm_show_timeouts, NULL);
>
> static struct attribute *tis_attrs[] = {
> &dev_attr_pubek.attr,
> @@ -364,7 +365,8 @@
> &dev_attr_owned.attr,
> &dev_attr_temp_deactivated.attr,
> &dev_attr_caps.attr,
> - &dev_attr_cancel.attr, NULL,
> + &dev_attr_cancel.attr,
> + &dev_attr_timeouts.attr, NULL,
> };
>
> static struct attribute_group tis_attr_grp = {

2011-03-30 21:13:45

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [266/275] hwmon: (w83627ehf) Driver cleanup

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Guenter Roeck <[email protected]>

[ upstream commit da2e025590cf7038440132d4bbc967a579b11112 ]

- Moved fan pwm register array pointers into per-instance data.
- Only read fan pwm data for installed/supported fans.
- Update fan max output and fan step output information from data in
registers.
- Create max_output and step_output attribute files only if respective
fan pwm registers exist.

Signed-off-by: Guenter Roeck <[email protected]>
Signed-off-by: Jean Delvare <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/hwmon/w83627ehf.c | 59 +++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 56 insertions(+), 3 deletions(-)

Index: linux-2.6.35.y/drivers/hwmon/w83627ehf.c
===================================================================
--- linux-2.6.35.y.orig/drivers/hwmon/w83627ehf.c 2011-01-13 09:47:51.000000000 -0800
+++ linux-2.6.35.y/drivers/hwmon/w83627ehf.c 2011-03-29 23:35:17.169732997 -0700
@@ -277,6 +277,11 @@
struct device *hwmon_dev;
struct mutex lock;

+ const u8 *REG_FAN_START_OUTPUT;
+ const u8 *REG_FAN_STOP_OUTPUT;
+ const u8 *REG_FAN_MAX_OUTPUT;
+ const u8 *REG_FAN_STEP_OUTPUT;
+
struct mutex update_lock;
char valid; /* !=0 if following fields are valid */
unsigned long last_updated; /* In jiffies */
@@ -524,7 +529,10 @@
}
}

- for (i = 0; i < 4; i++) {
+ for (i = 0; i < data->pwm_num; i++) {
+ if (!(data->has_fan & (1 << i)))
+ continue;
+
/* pwmcfg, tolerance mapped for i=0, i=1 to same reg */
if (i != 1) {
pwmcfg = w83627ehf_read_value(data,
@@ -546,6 +554,17 @@
W83627EHF_REG_FAN_STOP_OUTPUT[i]);
data->fan_stop_time[i] = w83627ehf_read_value(data,
W83627EHF_REG_FAN_STOP_TIME[i]);
+
+ if (data->REG_FAN_MAX_OUTPUT[i] != 0xff)
+ data->fan_max_output[i] =
+ w83627ehf_read_value(data,
+ data->REG_FAN_MAX_OUTPUT[i]);
+
+ if (data->REG_FAN_STEP_OUTPUT[i] != 0xff)
+ data->fan_step_output[i] =
+ w83627ehf_read_value(data,
+ data->REG_FAN_STEP_OUTPUT[i]);
+
data->target_temp[i] =
w83627ehf_read_value(data,
W83627EHF_REG_TARGET[i]) &
@@ -1126,7 +1145,7 @@
u32 val = SENSORS_LIMIT(simple_strtoul(buf, NULL, 10), 1, 255); \
mutex_lock(&data->update_lock); \
data->reg[nr] = val; \
- w83627ehf_write_value(data, W83627EHF_REG_##REG[nr], val); \
+ w83627ehf_write_value(data, data->REG_##REG[nr], val); \
mutex_unlock(&data->update_lock); \
return count; \
}
@@ -1206,12 +1225,26 @@
store_fan_stop_output, 1),
SENSOR_ATTR(pwm3_stop_output, S_IWUSR | S_IRUGO, show_fan_stop_output,
store_fan_stop_output, 2),
+};

- /* pwm1 and pwm3 don't support max and step settings */
+
+/*
+ * pwm1 and pwm3 don't support max and step settings on all chips.
+ * Need to check support while generating/removing attribute files.
+ */
+static struct sensor_device_attribute sda_sf3_max_step_arrays[] = {
+ SENSOR_ATTR(pwm1_max_output, S_IWUSR | S_IRUGO, show_fan_max_output,
+ store_fan_max_output, 0),
+ SENSOR_ATTR(pwm1_step_output, S_IWUSR | S_IRUGO, show_fan_step_output,
+ store_fan_step_output, 0),
SENSOR_ATTR(pwm2_max_output, S_IWUSR | S_IRUGO, show_fan_max_output,
store_fan_max_output, 1),
SENSOR_ATTR(pwm2_step_output, S_IWUSR | S_IRUGO, show_fan_step_output,
store_fan_step_output, 1),
+ SENSOR_ATTR(pwm3_max_output, S_IWUSR | S_IRUGO, show_fan_max_output,
+ store_fan_max_output, 2),
+ SENSOR_ATTR(pwm3_step_output, S_IWUSR | S_IRUGO, show_fan_step_output,
+ store_fan_step_output, 2),
};

static ssize_t
@@ -1235,6 +1268,12 @@

for (i = 0; i < ARRAY_SIZE(sda_sf3_arrays); i++)
device_remove_file(dev, &sda_sf3_arrays[i].dev_attr);
+ for (i = 0; i < ARRAY_SIZE(sda_sf3_max_step_arrays); i++) {
+ struct sensor_device_attribute *attr =
+ &sda_sf3_max_step_arrays[i];
+ if (data->REG_FAN_STEP_OUTPUT[attr->index] != 0xff)
+ device_remove_file(dev, &attr->dev_attr);
+ }
for (i = 0; i < ARRAY_SIZE(sda_sf3_arrays_fan4); i++)
device_remove_file(dev, &sda_sf3_arrays_fan4[i].dev_attr);
for (i = 0; i < data->in_num; i++) {
@@ -1352,6 +1391,11 @@
data->in6_skip = !data->temp3_disable;
}

+ data->REG_FAN_START_OUTPUT = W83627EHF_REG_FAN_START_OUTPUT;
+ data->REG_FAN_STOP_OUTPUT = W83627EHF_REG_FAN_STOP_OUTPUT;
+ data->REG_FAN_MAX_OUTPUT = W83627EHF_REG_FAN_MAX_OUTPUT;
+ data->REG_FAN_STEP_OUTPUT = W83627EHF_REG_FAN_STEP_OUTPUT;
+
/* Initialize the chip */
w83627ehf_init_device(data);

@@ -1440,6 +1484,15 @@
&sda_sf3_arrays[i].dev_attr)))
goto exit_remove;

+ for (i = 0; i < ARRAY_SIZE(sda_sf3_max_step_arrays); i++) {
+ struct sensor_device_attribute *attr =
+ &sda_sf3_max_step_arrays[i];
+ if (data->REG_FAN_STEP_OUTPUT[attr->index] != 0xff) {
+ err = device_create_file(dev, &attr->dev_attr);
+ if (err)
+ goto exit_remove;
+ }
+ }
/* if fan4 is enabled create the sf3 files for it */
if ((data->has_fan & (1 << 3)) && data->pwm_num >= 4)
for (i = 0; i < ARRAY_SIZE(sda_sf3_arrays_fan4); i++) {

2011-03-30 21:10:14

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [251/275] ses: Avoid kernel panic when lun 0 is not mapped

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Krishnasamy, Somasundaram <[email protected]>

commit d1e12de804f9d8ad114786ca7c2ce593cba79891 upstream.

During device discovery, scsi mid layer sends INQUIRY command to LUN
0. If the LUN 0 is not mapped to host, it creates a temporary
scsi_device with LUN id 0 and sends REPORT_LUNS command to it. After
the REPORT_LUNS succeeds, it walks through the LUN table and adds each
LUN found to sysfs. At the end of REPORT_LUNS lun table scan, it will
delete the temporary scsi_device of LUN 0.

When scsi devices are added to sysfs, it calls add_dev function of all
the registered class interfaces. If ses driver has been registered,
ses_intf_add() of ses module will be called. This function calls
scsi_device_enclosure() to check the inquiry data for EncServ
bit. Since inquiry was not allocated for temporary LUN 0 scsi_device,
it will cause NULL pointer exception.

To fix the problem, sdev->inquiry is checked for NULL before reading it.

Signed-off-by: Somasundaram Krishnasamy <[email protected]>
Signed-off-by: Babu Moger <[email protected]>
Signed-off-by: James Bottomley <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
include/scsi/scsi_device.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.35.y/include/scsi/scsi_device.h
===================================================================
--- linux-2.6.35.y.orig/include/scsi/scsi_device.h 2011-03-29 22:50:10.926978825 -0700
+++ linux-2.6.35.y/include/scsi/scsi_device.h 2011-03-29 23:03:03.501210582 -0700
@@ -451,7 +451,7 @@
}
static inline int scsi_device_enclosure(struct scsi_device *sdev)
{
- return sdev->inquiry[6] & (1<<6);
+ return sdev->inquiry ? (sdev->inquiry[6] & (1<<6)) : 1;
}

static inline int scsi_device_protection(struct scsi_device *sdev)

2011-03-30 21:14:22

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [263/275] perf: Fix tear-down of inherited group events

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Peter Zijlstra <[email protected]>

[ upstream commit 38b435b16c36b0d863efcf3f07b34a6fac9873fd ]

When destroying inherited events, we need to destroy groups too,
otherwise the event iteration in perf_event_exit_task_context() will
miss group siblings and we leak events with all the consequences.

Reported-and-tested-by: Vince Weaver <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Cc: <[email protected]> # .35+
LKML-Reference: <1300196470.2203.61.camel@twins>
Signed-off-by: Ingo Molnar <[email protected]>

---
kernel/perf_event.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)

Index: linux-2.6.35.y/kernel/perf_event.c
===================================================================
--- linux-2.6.35.y.orig/kernel/perf_event.c 2011-03-29 23:03:03.000000000 -0700
+++ linux-2.6.35.y/kernel/perf_event.c 2011-03-29 23:27:02.487390526 -0700
@@ -5401,17 +5401,20 @@
struct perf_event_context *child_ctx,
struct task_struct *child)
{
- struct perf_event *parent_event;
+ if (child_event->parent) {
+ raw_spin_lock_irq(&child_ctx->lock);
+ perf_group_detach(child_event);
+ raw_spin_unlock_irq(&child_ctx->lock);
+ }

perf_event_remove_from_context(child_event);

- parent_event = child_event->parent;
/*
- * It can happen that parent exits first, and has events
+ * It can happen that the parent exits first, and has events
* that are still around due to the child reference. These
- * events need to be zapped - but otherwise linger.
+ * events need to be zapped.
*/
- if (parent_event) {
+ if (child_event->parent) {
sync_child_event(child_event, child);
free_event(child_event);
}

2011-03-30 21:14:38

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [262/275] xhci: Update internal dequeue pointers after stalls.

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Sarah Sharp <[email protected]>

[ upstream commit bf161e85fb153c0dd5a95faca73fd6a9d237c389 ]

When an endpoint stalls, the xHCI driver must move the endpoint ring's
dequeue pointer past the stalled transfer. To do that, the driver issues
a Set TR Dequeue Pointer command, which will complete some time later.

Takashi was having issues with USB 1.1 audio devices that stalled, and his
analysis of the code was that the old code would not update the xHCI
driver's ring dequeue pointer after the command completes. However, the
dequeue pointer is set in xhci_find_new_dequeue_state(), just before the
set command is issued to the hardware.

Setting the dequeue pointer before the Set TR Dequeue Pointer command
completes is a dangerous thing to do, since the xHCI hardware can fail the
command. Instead, store the new dequeue pointer in the xhci_virt_ep
structure, and update the ring's dequeue pointer when the Set TR dequeue
pointer command completes.

While we're at it, make sure we can't queue another Set TR Dequeue Command
while the first one is still being processed. This just won't work with
the internal xHCI state code. I'm still not sure if this is the right
thing to do, since we might have a case where a driver queues multiple
URBs to a control ring, one of the URBs Stalls, and then the driver tries
to cancel the second URB. There may be a race condition there where the
xHCI driver might try to issue multiple Set TR Dequeue Pointer commands,
but I would have to think very hard about how the Stop Endpoint and
cancellation code works. Keep the fix simple until when/if we run into
that case.

This patch should be queued to kernels all the way back to 2.6.31.

Signed-off-by: Sarah Sharp <[email protected]>
Tested-by: Takashi Iwai <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Cc: [email protected]

---
drivers/usb/host/xhci-ring.c | 29 ++++++++++++++++++++++++++---
drivers/usb/host/xhci.h | 9 +++++++++
2 files changed, 35 insertions(+), 3 deletions(-)

Index: linux-2.6.35.y/drivers/usb/host/xhci-ring.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/host/xhci-ring.c 2011-03-29 23:03:02.000000000 -0700
+++ linux-2.6.35.y/drivers/usb/host/xhci-ring.c 2011-03-29 23:23:25.477943255 -0700
@@ -503,9 +503,6 @@
addr = xhci_trb_virt_to_dma(state->new_deq_seg, state->new_deq_ptr);
xhci_dbg(xhci, "New dequeue pointer = 0x%llx (DMA)\n",
(unsigned long long) addr);
- xhci_dbg(xhci, "Setting dequeue pointer in internal ring state.\n");
- ep_ring->dequeue = state->new_deq_ptr;
- ep_ring->deq_seg = state->new_deq_seg;
}

static void td_to_noop(struct xhci_hcd *xhci, struct xhci_ring *ep_ring,
@@ -924,9 +921,26 @@
} else {
xhci_dbg(xhci, "Successful Set TR Deq Ptr cmd, deq = @%08llx\n",
ep_ctx->deq);
+ if (xhci_trb_virt_to_dma(dev->eps[ep_index].queued_deq_seg,
+ dev->eps[ep_index].queued_deq_ptr) ==
+ (ep_ctx->deq & ~(EP_CTX_CYCLE_MASK))) {
+ /* Update the ring's dequeue segment and dequeue pointer
+ * to reflect the new position.
+ */
+ ep_ring->deq_seg = dev->eps[ep_index].queued_deq_seg;
+ ep_ring->dequeue = dev->eps[ep_index].queued_deq_ptr;
+ } else {
+ xhci_warn(xhci, "Mismatch between completed Set TR Deq "
+ "Ptr command & xHCI internal state.\n");
+ xhci_warn(xhci, "ep deq seg = %p, deq ptr = %p\n",
+ dev->eps[ep_index].queued_deq_seg,
+ dev->eps[ep_index].queued_deq_ptr);
+ }
}

dev->eps[ep_index].ep_state &= ~SET_DEQ_PENDING;
+ dev->eps[ep_index].queued_deq_seg = NULL;
+ dev->eps[ep_index].queued_deq_ptr = NULL;
/* Restart any rings with pending URBs */
ring_doorbell_for_active_rings(xhci, slot_id, ep_index);
}
@@ -2512,6 +2526,7 @@
u32 trb_ep_index = EP_ID_FOR_TRB(ep_index);
u32 trb_stream_id = STREAM_ID_FOR_TRB(stream_id);
u32 type = TRB_TYPE(TRB_SET_DEQ);
+ struct xhci_virt_ep *ep;

addr = xhci_trb_virt_to_dma(deq_seg, deq_ptr);
if (addr == 0) {
@@ -2520,6 +2535,14 @@
deq_seg, deq_ptr);
return 0;
}
+ ep = &xhci->devs[slot_id]->eps[ep_index];
+ if ((ep->ep_state & SET_DEQ_PENDING)) {
+ xhci_warn(xhci, "WARN Cannot submit Set TR Deq Ptr\n");
+ xhci_warn(xhci, "A Set TR Deq Ptr command is pending.\n");
+ return 0;
+ }
+ ep->queued_deq_seg = deq_seg;
+ ep->queued_deq_ptr = deq_ptr;
return queue_command(xhci, lower_32_bits(addr) | cycle_state,
upper_32_bits(addr), trb_stream_id,
trb_slot_id | trb_ep_index | type, false);
Index: linux-2.6.35.y/drivers/usb/host/xhci.h
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/host/xhci.h 2011-01-13 09:47:51.000000000 -0800
+++ linux-2.6.35.y/drivers/usb/host/xhci.h 2011-03-29 23:24:07.639864128 -0700
@@ -641,6 +641,9 @@
#define AVG_TRB_LENGTH_FOR_EP(p) ((p) & 0xffff)
#define MAX_ESIT_PAYLOAD_FOR_EP(p) (((p) & 0xffff) << 16)

+/* deq bitmasks */
+#define EP_CTX_CYCLE_MASK (1 << 0)
+

/**
* struct xhci_input_control_context
@@ -743,6 +746,12 @@
struct timer_list stop_cmd_timer;
int stop_cmds_pending;
struct xhci_hcd *xhci;
+ /* Dequeue pointer and dequeue segment for a submitted Set TR Dequeue
+ * command. We'll need to update the ring's dequeue segment and dequeue
+ * pointer after the command completes.
+ */
+ struct xhci_segment *queued_deq_seg;
+ union xhci_trb *queued_deq_ptr;
};

struct xhci_virt_device {

2011-03-30 21:10:10

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [253/275] eCryptfs: ecryptfs_keyring_auth_tok_for_sig() bug fix

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Roberto Sassu <[email protected]>

commit 1821df040ac3cd6a57518739f345da6d50ea9d3f upstream.

The pointer '(*auth_tok_key)' is set to NULL in case request_key()
fails, in order to prevent its use by functions calling
ecryptfs_keyring_auth_tok_for_sig().

Signed-off-by: Roberto Sassu <[email protected]>
Signed-off-by: Tyler Hicks <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
fs/ecryptfs/keystore.c | 1 +
1 file changed, 1 insertion(+)

Index: linux-2.6.35.y/fs/ecryptfs/keystore.c
===================================================================
--- linux-2.6.35.y.orig/fs/ecryptfs/keystore.c 2011-03-29 22:50:09.722009658 -0700
+++ linux-2.6.35.y/fs/ecryptfs/keystore.c 2011-03-29 23:03:03.535209714 -0700
@@ -1543,6 +1543,7 @@
printk(KERN_ERR "Could not find key with description: [%s]\n",
sig);
rc = process_request_key_err(PTR_ERR(*auth_tok_key));
+ (*auth_tok_key) = NULL;
goto out;
}
(*auth_tok) = ecryptfs_get_key_payload_data(*auth_tok_key);

2011-03-30 21:14:49

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [261/275] USB: isp1760: Implement solution for erratum 2

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Sebastian Andrzej Siewior <[email protected]>

The document says:
|2.1 Problem description
| When at least two USB devices are simultaneously running, it is observed that
| sometimes the INT corresponding to one of the USB devices stops occurring. This may
| be observed sometimes with USB-to-serial or USB-to-network devices.
| The problem is not noticed when only USB mass storage devices are running.
|2.2 Implication
| This issue is because of the clearing of the respective Done Map bit on reading the ATL
| PTD Done Map register when an INT is generated by another PTD completion, but is not
| found set on that read access. In this situation, the respective Done Map bit will remain
| reset and no further INT will be asserted so the data transfer corresponding to that USB
| device will stop.
|2.3 Workaround
| An SOF INT can be used instead of an ATL INT with polling on Done bits. A time-out can
| be implemented and if a certain Done bit is never set, verification of the PTD completion
| can be done by reading PTD contents (valid bit).
| This is a proven workaround implemented in software.

Russell King run into this with an USB-to-serial converter. This patch
implements his suggestion to enable the high frequent SOF interrupt only
at the time we have ATL packages queued. It goes even one step further
and enables the SOF interrupt only if we have more than one ATL packet
queued at the same time.

Cc: <[email protected]> # [2.6.35.x, 2.6.36.x, 2.6.37.x]
Tested-by: Russell King <[email protected]>
Signed-off-by: Sebastian Andrzej Siewior <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/usb/host/isp1760-hcd.c | 22 ++++++++++++++++------
drivers/usb/host/isp1760-hcd.h | 1 +
2 files changed, 17 insertions(+), 6 deletions(-)

Index: linux-2.6.35.y/drivers/usb/host/isp1760-hcd.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/host/isp1760-hcd.c 2011-01-13 09:47:51.000000000 -0800
+++ linux-2.6.35.y/drivers/usb/host/isp1760-hcd.c 2011-03-29 23:21:23.469065159 -0700
@@ -33,6 +33,7 @@
struct inter_packet_info atl_ints[32];
struct inter_packet_info int_ints[32];
struct memory_chunk memory_pool[BLOCKS];
+ u32 atl_queued;

/* periodic schedule support */
#define DEFAULT_I_TDPS 1024
@@ -850,6 +851,11 @@
skip_map &= ~queue_entry;
isp1760_writel(skip_map, hcd->regs + HC_ATL_PTD_SKIPMAP_REG);

+ priv->atl_queued++;
+ if (priv->atl_queued == 2)
+ isp1760_writel(INTERRUPT_ENABLE_SOT_MASK,
+ hcd->regs + HC_INTERRUPT_ENABLE);
+
buffstatus = isp1760_readl(hcd->regs + HC_BUFFER_STATUS_REG);
buffstatus |= ATL_BUFFER;
isp1760_writel(buffstatus, hcd->regs + HC_BUFFER_STATUS_REG);
@@ -991,6 +997,7 @@
u32 dw3;

status = 0;
+ priv->atl_queued--;

queue_entry = __ffs(done_map);
done_map &= ~(1 << queue_entry);
@@ -1053,11 +1060,6 @@
* device is not able to send data fast enough.
* This happens mostly on slower hardware.
*/
- printk(KERN_NOTICE "Reloading ptd %p/%p... qh %p read: "
- "%d of %zu done: %08x cur: %08x\n", qtd,
- urb, qh, PTD_XFERRED_LENGTH(dw3),
- qtd->length, done_map,
- (1 << queue_entry));

/* RL counter = ERR counter */
dw3 &= ~(0xf << 19);
@@ -1085,6 +1087,11 @@
priv_write_copy(priv, (u32 *)&ptd, usb_hcd->regs +
atl_regs, sizeof(ptd));

+ priv->atl_queued++;
+ if (priv->atl_queued == 2)
+ isp1760_writel(INTERRUPT_ENABLE_SOT_MASK,
+ usb_hcd->regs + HC_INTERRUPT_ENABLE);
+
buffstatus = isp1760_readl(usb_hcd->regs +
HC_BUFFER_STATUS_REG);
buffstatus |= ATL_BUFFER;
@@ -1190,6 +1197,9 @@
skip_map = isp1760_readl(usb_hcd->regs +
HC_ATL_PTD_SKIPMAP_REG);
}
+ if (priv->atl_queued <= 1)
+ isp1760_writel(INTERRUPT_ENABLE_MASK,
+ usb_hcd->regs + HC_INTERRUPT_ENABLE);
}

static void do_intl_int(struct usb_hcd *usb_hcd)
@@ -1769,7 +1779,7 @@
goto leave;

isp1760_writel(imask, usb_hcd->regs + HC_INTERRUPT_REG);
- if (imask & HC_ATL_INT)
+ if (imask & (HC_ATL_INT | HC_SOT_INT))
do_atl_int(usb_hcd);

if (imask & HC_INTL_INT)
Index: linux-2.6.35.y/drivers/usb/host/isp1760-hcd.h
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/host/isp1760-hcd.h 2011-01-13 09:47:51.000000000 -0800
+++ linux-2.6.35.y/drivers/usb/host/isp1760-hcd.h 2011-03-29 23:21:23.480064878 -0700
@@ -69,6 +69,7 @@

#define HC_INTERRUPT_ENABLE 0x314
#define INTERRUPT_ENABLE_MASK (HC_INTL_INT | HC_ATL_INT | HC_EOT_INT)
+#define INTERRUPT_ENABLE_SOT_MASK (HC_INTL_INT | HC_SOT_INT | HC_EOT_INT)

#define HC_ISO_INT (1 << 9)
#define HC_ATL_INT (1 << 8)

2011-03-30 21:15:09

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [259/275] USB: misc: uss720.c: add another vendor/product ID

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
In 2.6.35.10:

[ 122.146074] usb 2-1: new full speed USB device using uhci_hcd and address 2
[ 122.325102] usb 2-1: New USB device found, idVendor=050d, idProduct=0002
[ 122.325110] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 122.325117] usb 2-1: Product: IEEE-1284 Controller
[ 122.325121] usb 2-1: Manufacturer: Belk USB Printing Support
[ 123.531167] usblp0: USB Bidirectional printer dev 2 if 0 alt 1 proto 2 vid
0x050D pid 0x0002
[ 123.531208] usbcore: registered new interface driver usblp

In 2.6.35.11:

[ 8046.227051] usb 2-1: new full speed USB device using uhci_hcd and address 6
[ 8046.408083] usb 2-1: New USB device found, idVendor=050d, idProduct=0002
[ 8046.408088] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 8046.408092] usb 2-1: Product: IEEE-1284 Controller
[ 8046.408094] usb 2-1: Manufacturer: Belk USB Printing Support
[ 8047.552140] get_1284_register timeout
[ 8047.554102] uss720: async_complete: urb error -104
[repeats]
[ 8047.556111] uss720: async_complete: urb error -32
[sequence repeats]
[unplug connector]
[ 8485.688067] parport0: fix this legacy no-device port driver!
[ 8485.688427] uss720: async_complete: urb error -32

Blacklisting the uss720 driver fixes the problem.


>From 0a67b7cf26d73ed1dbea7e99d63673b5c4aa479e Mon Sep 17 00:00:00 2001
From: Thomas Sailer <[email protected]>
Date: Tue, 14 Dec 2010 16:04:05 +0100
Subject: [PATCH] USB: misc: uss720.c: add another vendor/product ID

commit ecc1624a2fff45780959efbcb73ace18fdb3c58d upstream.

Fabio Battaglia report that he has another cable that works with this
driver, so this patch adds its vendor/product ID.

Signed-off-by: Thomas Sailer <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/usb/misc/uss720.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

Index: linux-2.6.35.y/drivers/usb/misc/uss720.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/misc/uss720.c 2011-03-29 23:08:16.511201441 -0700
+++ linux-2.6.35.y/drivers/usb/misc/uss720.c 2011-03-29 23:18:25.138628187 -0700
@@ -3,7 +3,7 @@
/*
* uss720.c -- USS720 USB Parport Cable.
*
- * Copyright (C) 1999, 2005, 2010
+ * Copyright (C) 1999, 2005
* Thomas Sailer ([email protected])
*
* This program is free software; you can redistribute it and/or modify
@@ -775,8 +775,6 @@
{ USB_DEVICE(0x0557, 0x2001) },
{ USB_DEVICE(0x0729, 0x1284) },
{ USB_DEVICE(0x1293, 0x0002) },
- { USB_DEVICE(0x1293, 0x0002) },
- { USB_DEVICE(0x050d, 0x0002) },
{ } /* Terminating entry */
};

2011-03-30 21:10:07

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [252/275] eCryptfs: Unlock page in write_begin error path

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Tyler Hicks <[email protected]>

commit 50f198ae16ac66508d4b8d5a40967a8507ad19ee upstream.

Unlock the page in error path of ecryptfs_write_begin(). This may
happen, for example, if decryption fails while bring the page
up-to-date.

Signed-off-by: Tyler Hicks <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
fs/ecryptfs/mmap.c | 5 +++++
1 file changed, 5 insertions(+)

Index: linux-2.6.35.y/fs/ecryptfs/mmap.c
===================================================================
--- linux-2.6.35.y.orig/fs/ecryptfs/mmap.c 2011-03-29 22:50:10.327994152 -0700
+++ linux-2.6.35.y/fs/ecryptfs/mmap.c 2011-03-29 23:03:03.518210148 -0700
@@ -368,6 +368,11 @@
&& (pos != 0))
zero_user(page, 0, PAGE_CACHE_SIZE);
out:
+ if (unlikely(rc)) {
+ unlock_page(page);
+ page_cache_release(page);
+ *pagep = NULL;
+ }
return rc;
}

2011-03-30 21:15:35

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [258/275] Patch cab9e9848b9a8283b0504a2d7c435a9f5ba026de to the 2.6.35.y stable tree

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
stored a ref to the current cred struct in struct scm_cookie. This was fine
with AF_UNIX as that calls scm_destroy() from its packet sending functions, but
AF_NETLINK, which also uses scm_send(), does not call scm_destroy() - meaning
that the copied credentials leak each time SCM data is sent over a netlink
socket.

This can be triggered quite simply on a Fedora 13 or 14 userspace with the
2.6.35.11 kernel (or something based off of that) by calling:

#!/bin/bash
for ((i=0; i<100; i++))
do
su - -c /bin/true
cut -d: -f1 /proc/slabinfo | grep 'cred\|key\|task_struct'
cat /proc/keys | wc -l
done

This leaks the session key that pam_keyinit creates for 'su -', which appears
in /proc/keys as being revoked (has the R flag set against it) afterward su is
called.

Furthermore, if CONFIG_SLAB=y, then the cred and key slab object usage counts
can be viewed and seen to increase. The key slab increases by one object per
loop, and this can be seen after the system has had a couple of minutes to
stand after the script above has been run on it.

If the system is working correctly, the key and cred counts should return to
roughly what they were before.

This patch from upstream (b47030c71dfd6c8cd5cb6e551b6f7f7cfc96f6a6) is needed
to fix the problem:

===============================================================================

From: Eric W. Biederman <[email protected]>

af_netlink: Add needed scm_destroy after scm_send.

scm_send occasionally allocates state in the scm_cookie, so I have
modified netlink_sendmsg to guarantee that when scm_send succeeds
scm_destory will be called to free that state.

Signed-off-by: Eric W. Biederman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Reviewed-by: Daniel Lezcano <[email protected]>
Acked-by: Pavel Emelyanov <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
---

net/netlink/af_netlink.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

Index: linux-2.6.35.y/net/netlink/af_netlink.c
===================================================================
--- linux-2.6.35.y.orig/net/netlink/af_netlink.c 2011-03-29 23:57:49.891120088 -0700
+++ linux-2.6.35.y/net/netlink/af_netlink.c 2011-03-30 00:25:02.306350666 -0700
@@ -1323,8 +1323,11 @@
if (msg->msg_flags&MSG_OOB)
return -EOPNOTSUPP;

- if (NULL == siocb->scm)
+ if (NULL == siocb->scm) {
siocb->scm = &scm;
+ memset(&scm, 0, sizeof(scm));
+ }
+
err = scm_send(sock, msg, siocb->scm);
if (err < 0)
return err;

2011-03-30 21:15:54

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [254/275] PM / Hibernate: Improve comments in hibernate_preallocate_memory()

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Rafael J. Wysocki <[email protected]>

[ upstream commit 266f1a25eff5ff98c498d7754a419aacfd88f71c ]

One comment in hibernate_preallocate_memory() is wrong, so fix it and
add one more comment to clarify the meaning of the fixed one.

Signed-off-by: Rafael J. Wysocki <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
kernel/power/snapshot.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

Index: linux-2.6.35.y/kernel/power/snapshot.c
===================================================================
--- linux-2.6.35.y.orig/kernel/power/snapshot.c 2011-03-29 23:03:00.951275828 -0700
+++ linux-2.6.35.y/kernel/power/snapshot.c 2011-03-29 23:53:44.143408156 -0700
@@ -1318,12 +1318,14 @@

/* Compute the maximum number of saveable pages to leave in memory. */
max_size = (count - (size + PAGES_FOR_IO)) / 2 - 2 * SPARE_PAGES;
+ /* Compute the desired number of image pages specified by image_size. */
size = DIV_ROUND_UP(image_size, PAGE_SIZE);
if (size > max_size)
size = max_size;
/*
- * If the maximum is not less than the current number of saveable pages
- * in memory, allocate page frames for the image and we're done.
+ * If the desired number of image pages is at least as large as the
+ * current number of saveable pages in memory, allocate page frames for
+ * the image and we're done.
*/
if (size >= saveable) {
pages = preallocate_image_highmem(save_highmem);

2011-03-30 21:15:53

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [255/275] PM / Hibernate: Make default image size depend on total RAM size

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Rafael J. Wysocki <[email protected]>

[ upstream commit ac5c24ec1e983313ef0015258fba6f630e54e7cf ]

The default hibernation image size is currently hard coded and euqal
to 500 MB, which is not a reasonable default on many contemporary
systems. Make it equal 2/5 of the total RAM size (this is slightly
below the maximum, i.e. 1/2 of the total RAM size, and seems to be
generally suitable).

Signed-off-by: Rafael J. Wysocki <[email protected]>
Tested-by: M. Vefa Bicakci <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
Documentation/power/interface.txt | 2 +-
kernel/power/main.c | 1 +
kernel/power/power.h | 9 ++++++++-
kernel/power/snapshot.c | 7 ++++++-
4 files changed, 16 insertions(+), 3 deletions(-)

Index: linux-2.6.35.y/Documentation/power/interface.txt
===================================================================
--- linux-2.6.35.y.orig/Documentation/power/interface.txt 2011-03-29 22:50:08.637037418 -0700
+++ linux-2.6.35.y/Documentation/power/interface.txt 2011-03-29 23:03:03.570208818 -0700
@@ -57,7 +57,7 @@
suspend image will be as small as possible.

Reading from this file will display the current image size limit, which
-is set to 500 MB by default.
+is set to 2/5 of available RAM by default.

/sys/power/pm_trace controls the code which saves the last PM event point in
the RTC across reboots, so that you can debug a machine that just hangs
Index: linux-2.6.35.y/kernel/power/main.c
===================================================================
--- linux-2.6.35.y.orig/kernel/power/main.c 2011-03-29 22:50:08.637037418 -0700
+++ linux-2.6.35.y/kernel/power/main.c 2011-03-29 23:03:03.570208818 -0700
@@ -266,6 +266,7 @@
int error = pm_start_workqueue();
if (error)
return error;
+ hibernate_image_size_init();
power_kobj = kobject_create_and_add("power", NULL);
if (!power_kobj)
return -ENOMEM;
Index: linux-2.6.35.y/kernel/power/power.h
===================================================================
--- linux-2.6.35.y.orig/kernel/power/power.h 2011-03-29 22:50:08.637037418 -0700
+++ linux-2.6.35.y/kernel/power/power.h 2011-03-29 23:03:03.571208793 -0700
@@ -14,6 +14,9 @@
} __attribute__((aligned(PAGE_SIZE)));

#ifdef CONFIG_HIBERNATION
+/* kernel/power/snapshot.c */
+extern void __init hibernate_image_size_init(void);
+
#ifdef CONFIG_ARCH_HIBERNATION_HEADER
/* Maximum size of architecture specific data in a hibernation header */
#define MAX_ARCH_HEADER_SIZE (sizeof(struct new_utsname) + 4)
@@ -49,7 +52,11 @@
extern int hibernation_snapshot(int platform_mode);
extern int hibernation_restore(int platform_mode);
extern int hibernation_platform_enter(void);
-#endif
+
+#else /* !CONFIG_HIBERNATION */
+
+static inline void hibernate_image_size_init(void) {}
+#endif /* !CONFIG_HIBERNATION */

extern int pfn_is_nosave(unsigned long);

Index: linux-2.6.35.y/kernel/power/snapshot.c
===================================================================
--- linux-2.6.35.y.orig/kernel/power/snapshot.c 2011-03-29 23:03:03.551209304 -0700
+++ linux-2.6.35.y/kernel/power/snapshot.c 2011-03-29 23:03:03.573208741 -0700
@@ -46,7 +46,12 @@
* size will not exceed N bytes, but if that is impossible, it will
* try to create the smallest image possible.
*/
-unsigned long image_size = 500 * 1024 * 1024;
+unsigned long image_size;
+
+void __init hibernate_image_size_init(void)
+{
+ image_size = ((totalram_pages * 2) / 5) * PAGE_SIZE;
+}

/* List of PBEs needed for restoring the pages that were allocated before
* the suspend and included in the suspend image, but have also been

2011-03-30 21:16:28

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [249/275] mac80211: initialize sta->last_rx in sta_info_alloc

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Felix Fietkau <[email protected]>

commit 8bc8aecdc5e26cfda12dbd6867af4aa67836da6a upstream.

This field is used to determine the inactivity time. When in AP mode,
hostapd uses it for kicking out inactive clients after a while. Without this
patch, hostapd immediately deauthenticates a new client if it checks the
inactivity time before the client sends its first data frame.

Signed-off-by: Felix Fietkau <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
net/mac80211/sta_info.c | 1 +
1 file changed, 1 insertion(+)

Index: linux-2.6.35.y/net/mac80211/sta_info.c
===================================================================
--- linux-2.6.35.y.orig/net/mac80211/sta_info.c 2011-03-29 22:50:12.118948325 -0700
+++ linux-2.6.35.y/net/mac80211/sta_info.c 2011-03-29 23:03:03.467211454 -0700
@@ -239,6 +239,7 @@
memcpy(sta->sta.addr, addr, ETH_ALEN);
sta->local = local;
sta->sdata = sdata;
+ sta->last_rx = jiffies;

if (sta_prepare_rate_control(local, sta, gfp)) {
kfree(sta);

2011-03-30 21:16:39

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [248/275] sound/oss/opl3: validate voice and channel indexes

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Dan Rosenberg <[email protected]>

commit 4d00135a680727f6c3be78f8befaac009030e4df upstream.

User-controllable indexes for voice and channel values may cause reading
and writing beyond the bounds of their respective arrays, leading to
potentially exploitable memory corruption. Validate these indexes.

Signed-off-by: Dan Rosenberg <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
sound/oss/opl3.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)

Index: linux-2.6.35.y/sound/oss/opl3.c
===================================================================
--- linux-2.6.35.y.orig/sound/oss/opl3.c 2011-03-29 22:50:12.724932820 -0700
+++ linux-2.6.35.y/sound/oss/opl3.c 2011-03-29 23:03:03.451211863 -0700
@@ -849,6 +849,10 @@

static void opl3_panning(int dev, int voice, int value)
{
+
+ if (voice < 0 || voice >= devc->nr_voice)
+ return;
+
devc->voc[voice].panning = value;
}

@@ -1066,8 +1070,15 @@

static void opl3_setup_voice(int dev, int voice, int chn)
{
- struct channel_info *info =
- &synth_devs[dev]->chn_info[chn];
+ struct channel_info *info;
+
+ if (voice < 0 || voice >= devc->nr_voice)
+ return;
+
+ if (chn < 0 || chn > 15)
+ return;
+
+ info = &synth_devs[dev]->chn_info[chn];

opl3_set_instr(dev, voice, info->pgm_num);

2011-03-30 21:09:57

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [239/275] Input: xen-kbdfront - advertise either absolute or relative coordinates

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Olaf Hering <[email protected]>

commit 8c3c283e6bf463ab498d6e7823aff6c4762314b6 upstream.

A virtualized display device is usually viewed with the vncviewer
application, either by 'xm vnc domU' or with vncviewer localhost:port.
vncviewer and the RFB protocol provides absolute coordinates to the
virtual display. These coordinates are either passed through to a PV
guest or converted to relative coordinates for a HVM guest.

A PV guest receives these coordinates and passes them to the kernels
evdev driver. There it can be picked up by applications such as the
xorg-input drivers. Using absolute coordinates avoids issues such as
guest mouse pointer not tracking host mouse pointer due to wrong mouse
acceleration settings in the guests X display.

Advertise either absolute or relative coordinates to the input system
and the evdev driver, depending on what dom0 provides. The xorg-input
driver prefers relative coordinates even if a devices provides both.

Signed-off-by: Olaf Hering <[email protected]>
Signed-off-by: Stefano Stabellini <[email protected]>
Signed-off-by: Dmitry Torokhov <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/input/xen-kbdfront.c | 45 ++++++++++++++++++++++---------------------
1 file changed, 24 insertions(+), 21 deletions(-)

Index: linux-2.6.35.y/drivers/input/xen-kbdfront.c
===================================================================
--- linux-2.6.35.y.orig/drivers/input/xen-kbdfront.c 2011-03-29 22:50:18.101795240 -0700
+++ linux-2.6.35.y/drivers/input/xen-kbdfront.c 2011-03-29 23:03:03.192218490 -0700
@@ -109,7 +109,7 @@
static int __devinit xenkbd_probe(struct xenbus_device *dev,
const struct xenbus_device_id *id)
{
- int ret, i;
+ int ret, i, abs;
struct xenkbd_info *info;
struct input_dev *kbd, *ptr;

@@ -127,6 +127,11 @@
if (!info->page)
goto error_nomem;

+ if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-abs-pointer", "%d", &abs) < 0)
+ abs = 0;
+ if (abs)
+ xenbus_printf(XBT_NIL, dev->nodename, "request-abs-pointer", "1");
+
/* keyboard */
kbd = input_allocate_device();
if (!kbd)
@@ -136,11 +141,12 @@
kbd->id.bustype = BUS_PCI;
kbd->id.vendor = 0x5853;
kbd->id.product = 0xffff;
- kbd->evbit[0] = BIT(EV_KEY);
+
+ __set_bit(EV_KEY, kbd->evbit);
for (i = KEY_ESC; i < KEY_UNKNOWN; i++)
- set_bit(i, kbd->keybit);
+ __set_bit(i, kbd->keybit);
for (i = KEY_OK; i < KEY_MAX; i++)
- set_bit(i, kbd->keybit);
+ __set_bit(i, kbd->keybit);

ret = input_register_device(kbd);
if (ret) {
@@ -159,12 +165,20 @@
ptr->id.bustype = BUS_PCI;
ptr->id.vendor = 0x5853;
ptr->id.product = 0xfffe;
- ptr->evbit[0] = BIT(EV_KEY) | BIT(EV_REL) | BIT(EV_ABS);
+
+ if (abs) {
+ __set_bit(EV_ABS, ptr->evbit);
+ input_set_abs_params(ptr, ABS_X, 0, XENFB_WIDTH, 0, 0);
+ input_set_abs_params(ptr, ABS_Y, 0, XENFB_HEIGHT, 0, 0);
+ } else {
+ input_set_capability(ptr, EV_REL, REL_X);
+ input_set_capability(ptr, EV_REL, REL_Y);
+ }
+ input_set_capability(ptr, EV_REL, REL_WHEEL);
+
+ __set_bit(EV_KEY, ptr->evbit);
for (i = BTN_LEFT; i <= BTN_TASK; i++)
- set_bit(i, ptr->keybit);
- ptr->relbit[0] = BIT(REL_X) | BIT(REL_Y) | BIT(REL_WHEEL);
- input_set_abs_params(ptr, ABS_X, 0, XENFB_WIDTH, 0, 0);
- input_set_abs_params(ptr, ABS_Y, 0, XENFB_HEIGHT, 0, 0);
+ __set_bit(i, ptr->keybit);

ret = input_register_device(ptr);
if (ret) {
@@ -271,7 +285,7 @@
enum xenbus_state backend_state)
{
struct xenkbd_info *info = dev_get_drvdata(&dev->dev);
- int ret, val;
+ int val;

switch (backend_state) {
case XenbusStateInitialising:
@@ -282,17 +296,6 @@

case XenbusStateInitWait:
InitWait:
- ret = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
- "feature-abs-pointer", "%d", &val);
- if (ret < 0)
- val = 0;
- if (val) {
- ret = xenbus_printf(XBT_NIL, info->xbdev->nodename,
- "request-abs-pointer", "1");
- if (ret)
- printk(KERN_WARNING
- "xenkbd: can't request abs-pointer");
- }
xenbus_switch_state(dev, XenbusStateConnected);
break;

2011-03-30 21:16:55

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [247/275] cciss: fix lost command issue

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Bud Brown <[email protected]>

commit 1ddd5049545e0aa1a0ed19bca4d9c9c3ce1ac8a2 upstream.

Under certain workloads a command may seem to get lost. IOW, the Smart Array
thinks all commands have been completed but we still have commands in our
completion queue. This may lead to system instability, filesystems going
read-only, or even panics depending on the affected filesystem. We add an
extra read to force the write to complete.

Testing shows this extra read avoids the problem.

Signed-off-by: Mike Miller <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/block/cciss.h | 1 +
1 file changed, 1 insertion(+)

Index: linux-2.6.35.y/drivers/block/cciss.h
===================================================================
--- linux-2.6.35.y.orig/drivers/block/cciss.h 2011-03-29 22:50:13.312917773 -0700
+++ linux-2.6.35.y/drivers/block/cciss.h 2011-03-29 23:03:03.435212271 -0700
@@ -173,6 +173,7 @@
printk("Sending %x - down to controller\n", c->busaddr );
#endif /* CCISS_DEBUG */
writel(c->busaddr, h->vaddr + SA5_REQUEST_PORT_OFFSET);
+ readl(h->vaddr + SA5_REQUEST_PORT_OFFSET);
h->commands_outstanding++;
if ( h->commands_outstanding > h->max_outstanding)
h->max_outstanding = h->commands_outstanding;

2011-03-30 21:17:13

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [246/275] myri10ge: fix rmmod crash

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Stanislaw Gruszka <[email protected]>

commit cda6587c21a887254c8ed4b58da8fcc4040ab557 upstream.

Rmmod myri10ge crash at free_netdev() -> netif_napi_del(), because napi
structures are already deallocated. To fix call netif_napi_del() before
kfree() at myri10ge_free_slices().

Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/net/myri10ge/myri10ge.c | 1 +
1 file changed, 1 insertion(+)

Index: linux-2.6.35.y/drivers/net/myri10ge/myri10ge.c
===================================================================
--- linux-2.6.35.y.orig/drivers/net/myri10ge/myri10ge.c 2011-03-29 22:50:13.908902524 -0700
+++ linux-2.6.35.y/drivers/net/myri10ge/myri10ge.c 2011-03-29 23:03:03.419212681 -0700
@@ -3600,6 +3600,7 @@
dma_free_coherent(&pdev->dev, bytes,
ss->fw_stats, ss->fw_stats_bus);
ss->fw_stats = NULL;
+ netif_napi_del(&ss->napi);
}
}
kfree(mgp->ss);

2011-03-30 21:09:54

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [238/275] USB: cdc-acm: fix potential null-pointer dereference on disconnect

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Johan Hovold <[email protected]>

commit 7e7797e7f6f7bfab73fca02c65e40eaa5bb9000c upstream.

Fix potential null-pointer exception on disconnect introduced by commit
11ea859d64b69a747d6b060b9ed1520eab1161fe (USB: additional power savings
for cdc-acm devices that support remote wakeup).

Only access acm->dev after making sure it is non-null in control urb
completion handler.

Signed-off-by: Johan Hovold <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/usb/class/cdc-acm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6.35.y/drivers/usb/class/cdc-acm.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/class/cdc-acm.c 2011-03-29 23:03:03.154219461 -0700
+++ linux-2.6.35.y/drivers/usb/class/cdc-acm.c 2011-03-29 23:03:03.173218975 -0700
@@ -297,6 +297,8 @@
if (!ACM_READY(acm))
goto exit;

+ usb_mark_last_busy(acm->dev);
+
data = (unsigned char *)(dr + 1);
switch (dr->bNotificationType) {
case USB_CDC_NOTIFY_NETWORK_CONNECTION:
@@ -336,7 +338,6 @@
break;
}
exit:
- usb_mark_last_busy(acm->dev);
retval = usb_submit_urb(urb, GFP_ATOMIC);
if (retval)
dev_err(&urb->dev->dev, "%s - usb_submit_urb failed with "

2011-03-30 21:17:39

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [245/275] perf: Better fit max unprivileged mlock pages for tools needs

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Frederic Weisbecker <[email protected]>

commit 880f57318450dbead6a03f9e31a1468924d6dd88 upstream.

The maximum kilobytes of locked memory that an unprivileged user
can reserve is of 512 kB = 128 pages by default, scaled to the
number of onlined CPUs, which fits well with the tools that use
128 data pages by default.

However tools actually use 129 pages, because they need one more
for the user control page. Thus the default mlock threshold is
not sufficient for the default tools needs and we always end up
to evaluate the constant mlock rlimit policy, which doesn't have
this scaling with the number of online CPUs.

Hence, on systems that have more than 16 CPUs, we overlap the
rlimit threshold and fail to mmap:

$ perf record ls
Error: failed to mmap with 1 (Operation not permitted)

Just increase the max unprivileged mlock threshold by one page
so that it supports well perf tools even after 16 CPUs.

Reported-by: Han Pingtian <[email protected]>
Reported-by: Peter Zijlstra <[email protected]>
Reported-by: Arnaldo Carvalho de Melo <[email protected]>
Signed-off-by: Frederic Weisbecker <[email protected]>
Acked-by: Arnaldo Carvalho de Melo <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Cc: Stephane Eranian <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
kernel/perf_event.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6.35.y/kernel/perf_event.c
===================================================================
--- linux-2.6.35.y.orig/kernel/perf_event.c 2011-03-29 22:50:14.502887326 -0700
+++ linux-2.6.35.y/kernel/perf_event.c 2011-03-29 23:53:39.047538547 -0700
@@ -58,7 +58,8 @@
*/
int sysctl_perf_event_paranoid __read_mostly = 1;

-int sysctl_perf_event_mlock __read_mostly = 512; /* 'free' kb per user */
+/* Minimum for 128 pages + 1 for the user control page */
+int sysctl_perf_event_mlock __read_mostly = 516; /* 'free' kb per user */

/*
* max perf event sample rate

2011-03-30 21:17:51

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [244/275] ALSA: Fix yet another race in disconnection

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Takashi Iwai <[email protected]>

commit a45e3d6b13e97506b616980c0f122c3389bcefa4 upstream.

This patch fixes a race between snd_card_file_remove() and
snd_card_disconnect(). When the card is added to shutdown_files list
in snd_card_disconnect(), but it's freed in snd_card_file_remove() at
the same time, the shutdown_files list gets corrupted. The list member
must be freed in snd_card_file_remove() as well.

Reported-and-tested-by: Russ Dill <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
sound/core/init.c | 4 ++++
1 file changed, 4 insertions(+)

Index: linux-2.6.35.y/sound/core/init.c
===================================================================
--- linux-2.6.35.y.orig/sound/core/init.c 2011-03-29 22:50:15.095872154 -0700
+++ linux-2.6.35.y/sound/core/init.c 2011-03-29 23:03:03.293215905 -0700
@@ -848,6 +848,7 @@
return -ENOMEM;
mfile->file = file;
mfile->disconnected_f_op = NULL;
+ INIT_LIST_HEAD(&mfile->shutdown_list);
spin_lock(&card->files_lock);
if (card->shutdown) {
spin_unlock(&card->files_lock);
@@ -883,6 +884,9 @@
list_for_each_entry(mfile, &card->files_list, list) {
if (mfile->file == file) {
list_del(&mfile->list);
+ spin_lock(&shutdown_lock);
+ list_del(&mfile->shutdown_list);
+ spin_unlock(&shutdown_lock);
if (mfile->disconnected_f_op)
fops_put(mfile->disconnected_f_op);
found = mfile;

2011-03-30 21:09:52

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [240/275] SUNRPC: Never reuse the socket port after an xs_close()

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Trond Myklebust <[email protected]>

commit 246408dcd5dfeef2df437ccb0ef4d6ee87805f58 upstream.

If we call xs_close(), we're in one of two situations:
- Autoclose, which means we don't expect to resend a request
- bind+connect failed, which probably means the port is in use

Signed-off-by: Trond Myklebust <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
net/sunrpc/xprtsock.c | 2 ++
1 file changed, 2 insertions(+)

Index: linux-2.6.35.y/net/sunrpc/xprtsock.c
===================================================================
--- linux-2.6.35.y.orig/net/sunrpc/xprtsock.c 2011-03-29 22:50:17.446811999 -0700
+++ linux-2.6.35.y/net/sunrpc/xprtsock.c 2011-03-29 23:03:03.211218003 -0700
@@ -710,6 +710,8 @@
if (sk == NULL)
return;

+ transport->srcport = 0;
+
write_lock_bh(&sk->sk_callback_lock);
transport->inet = NULL;
transport->sock = NULL;

2011-03-30 21:18:08

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [243/275] ALSA: hda - Fix SPDIF out regression on ALC889

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Takashi Iwai <[email protected]>

commit 20b67dddcc5f29d3d0c900225d85e0ac655bc69d upstream.

The commit 5a8cfb4e8ae317d283f84122ed20faa069c5e0c4
ALSA: hda - Use ALC_INIT_DEFAULT for really default initialization
changed to use the default initialization method for ALC889, but
this caused a regression on SPDIF output on some machines.
This seems due to the COEF setup included in the default init procedure.
For making SPDIF working again, the COEF-setup has to be avoided for
the id 0889.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=24342
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
sound/pci/hda/patch_realtek.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.35.y/sound/pci/hda/patch_realtek.c
===================================================================
--- linux-2.6.35.y.orig/sound/pci/hda/patch_realtek.c 2011-03-29 22:50:15.688856979 -0700
+++ linux-2.6.35.y/sound/pci/hda/patch_realtek.c 2011-03-29 23:03:03.274216391 -0700
@@ -1161,7 +1161,7 @@
case 0x10ec0883:
case 0x10ec0885:
case 0x10ec0887:
- case 0x10ec0889:
+ /*case 0x10ec0889:*/ /* this causes an SPDIF problem */
alc889_coef_init(codec);
break;
case 0x10ec0888:

2011-03-30 21:18:28

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [241/275] fs: call security_d_instantiate in d_obtain_alias V2

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Josef Bacik <[email protected]>

commit 24ff6663ccfdaf088dfa7acae489cb11ed4f43c4 upstream.

While trying to track down some NFS problems with BTRFS, I kept noticing I was
getting -EACCESS for no apparent reason. Eric Paris and printk() helped me
figure out that it was SELinux that was giving me grief, with the following
denial

type=AVC msg=audit(1290013638.413:95): avc: denied { 0x800000 } for pid=1772
comm="nfsd" name="" dev=sda1 ino=256 scontext=system_u:system_r:kernel_t:s0
tcontext=system_u:object_r:unlabeled_t:s0 tclass=file

Turns out this is because in d_obtain_alias if we can't find an alias we create
one and do all the normal instantiation stuff, but we don't do the
security_d_instantiate.

Usually we are protected from getting a hashed dentry that hasn't yet run
security_d_instantiate() by the parent's i_mutex, but obviously this isn't an
option there, so in order to deal with the case that a second thread comes in
and finds our new dentry before we get to run security_d_instantiate(), we go
ahead and call it if we find a dentry already. Eric assures me that this is ok
as the code checks to see if the dentry has been initialized already so calling
security_d_instantiate() against the same dentry multiple times is ok. With
this patch I'm no longer getting errant -EACCESS values.

Signed-off-by: Josef Bacik <[email protected]>
Signed-off-by: Al Viro <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Cc: Chuck Ebbert <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
fs/dcache.c | 3 +++
1 file changed, 3 insertions(+)

Index: linux-2.6.35.y/fs/dcache.c
===================================================================
--- linux-2.6.35.y.orig/fs/dcache.c 2011-03-29 22:50:16.864826890 -0700
+++ linux-2.6.35.y/fs/dcache.c 2011-03-29 23:03:03.231217492 -0700
@@ -1186,9 +1186,12 @@
spin_unlock(&tmp->d_lock);

spin_unlock(&dcache_lock);
+ security_d_instantiate(tmp, inode);
return tmp;

out_iput:
+ if (res && !IS_ERR(res))
+ security_d_instantiate(res, inode);
iput(inode);
return res;
}

2011-03-30 21:18:42

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [237/275] USB: cdc-acm: fix potential null-pointer dereference

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Johan Hovold <[email protected]>

commit 15e5bee33ffc11d0e5c6f819a65e7881c5c407be upstream.

Must check return value of tty_port_tty_get.

Signed-off-by: Johan Hovold <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/usb/class/cdc-acm.c | 2 ++
1 file changed, 2 insertions(+)

Index: linux-2.6.35.y/drivers/usb/class/cdc-acm.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/class/cdc-acm.c 2011-03-29 23:03:03.135219948 -0700
+++ linux-2.6.35.y/drivers/usb/class/cdc-acm.c 2011-03-29 23:53:54.272148988 -0700
@@ -533,6 +533,8 @@
if (!ACM_READY(acm))
return;
tty = tty_port_tty_get(&acm->port);
+ if (!tty)
+ return;
tty_wakeup(tty);
tty_kref_put(tty);
}

2011-03-30 21:18:57

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [236/275] USB: cdc-acm: fix memory corruption / panic

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Johan Hovold <[email protected]>

commit 23b80550e2aa61d0ba3af98b831b9195be0db9ee upstream.

Prevent read urbs from being resubmitted from tasklet after port close.

The receive tasklet was not disabled on port close, which could lead to
corruption of receive lists on consecutive port open. In particular,
read urbs could be re-submitted before port open, added to free list in
open, and then added a second time to the free list in the completion
handler.

cdc-acm.c: Entering acm_tty_open.
cdc-acm.c: acm_control_msg: rq: 0x22 val: 0x3 len: 0x0 result: 0
cdc-acm.c: Entering acm_rx_tasklet
cdc-acm.c: acm_rx_tasklet: sending urb 0xf50da280, rcv 0xf57fbc24, buf 0xf57fbd64
cdc-acm.c: set line: 115200 0 0 8
cdc-acm.c: acm_control_msg: rq: 0x20 val: 0x0 len: 0x7 result: 7
cdc-acm.c: acm_tty_close
cdc-acm.c: acm_port_down
cdc-acm.c: acm_control_msg: rq: 0x22 val: 0x0 len: 0x0 result: 0
cdc-acm.c: acm_ctrl_irq - urb shutting down with status: -2
cdc-acm.c: acm_rx_tasklet: sending urb 0xf50da300, rcv 0xf57fbc10, buf 0xf57fbd50
cdc-acm.c: Entering acm_read_bulk with status -2
cdc_acm 4-1:1.1: Aborting, acm not ready
cdc-acm.c: Entering acm_read_bulk with status -2
cdc_acm 4-1:1.1: Aborting, acm not ready
cdc-acm.c: acm_rx_tasklet: sending urb 0xf50da380, rcv 0xf57fbbfc, buf 0xf57fbd3c
cdc-acm.c: acm_rx_tasklet: sending urb 0xf50da400, rcv 0xf57fbbe8, buf 0xf57fbd28
cdc-acm.c: acm_rx_tasklet: sending urb 0xf50da480, rcv 0xf57fbbd4, buf 0xf57fbd14
cdc-acm.c: acm_rx_tasklet: sending urb 0xf50da900, rcv 0xf57fbbc0, buf 0xf57fbd00
cdc-acm.c: acm_rx_tasklet: sending urb 0xf50da980, rcv 0xf57fbbac, buf 0xf57fbcec
cdc-acm.c: acm_rx_tasklet: sending urb 0xf50daa00, rcv 0xf57fbb98, buf 0xf57fbcd8
cdc-acm.c: acm_rx_tasklet: sending urb 0xf50daa80, rcv 0xf57fbb84, buf 0xf57fbcc4
cdc-acm.c: acm_rx_tasklet: sending urb 0xf50dab00, rcv 0xf57fbb70, buf 0xf57fbcb0
cdc-acm.c: acm_rx_tasklet: sending urb 0xf50dab80, rcv 0xf57fbb5c, buf 0xf57fbc9c
cdc-acm.c: acm_rx_tasklet: sending urb 0xf50dac00, rcv 0xf57fbb48, buf 0xf57fbc88
cdc-acm.c: acm_rx_tasklet: sending urb 0xf50dac80, rcv 0xf57fbb34, buf 0xf57fbc74
cdc-acm.c: acm_rx_tasklet: sending urb 0xf50dad00, rcv 0xf57fbb20, buf 0xf57fbc60
cdc-acm.c: acm_rx_tasklet: sending urb 0xf50dad80, rcv 0xf57fbb0c, buf 0xf57fbc4c
cdc-acm.c: acm_rx_tasklet: sending urb 0xf50da880, rcv 0xf57fbaf8, buf 0xf57fbc38
cdc-acm.c: Entering acm_tty_open.
cdc-acm.c: acm_control_msg: rq: 0x22 val: 0x3 len: 0x0 result: 0
cdc-acm.c: Entering acm_rx_tasklet
cdc-acm.c: acm_rx_tasklet: sending urb 0xf50da280, rcv 0xf57fbc24, buf 0xf57fbd64
cdc-acm.c: Entering acm_tty_write to write 3 bytes,
cdc-acm.c: Get 3 bytes...
cdc-acm.c: acm_write_start susp_count: 0
cdc-acm.c: Entering acm_read_bulk with status 0
Signed-off-by: Andi Kleen <[email protected]>

------------[ cut here ]------------
WARNING: at /home/johan/src/linux/linux-2.6/lib/list_debug.c:57 list_del+0x10c/0x120()
Hardware name: Vostro 1520
list_del corruption. next->prev should be f57fbc10, but was f57fbaf8
Modules linked in: cdc_acm
Pid: 3, comm: ksoftirqd/0 Not tainted 2.6.37+ #39
Call Trace:
[<c103c7e2>] warn_slowpath_common+0x72/0xa0
[<c11dd8ac>] ? list_del+0x10c/0x120
[<c11dd8ac>] ? list_del+0x10c/0x120
[<c103c8b3>] warn_slowpath_fmt+0x33/0x40
[<c11dd8ac>] list_del+0x10c/0x120
[<f8051dbf>] acm_rx_tasklet+0xef/0x3e0 [cdc_acm]
[<c135465d>] ? net_rps_action_and_irq_enable+0x6d/0x80
[<c1042bb6>] tasklet_action+0xe6/0x140
[<c104342f>] __do_softirq+0xaf/0x210
[<c1043380>] ? __do_softirq+0x0/0x210
<IRQ> [<c1042c9a>] ? run_ksoftirqd+0x8a/0x1c0
[<c1042c10>] ? run_ksoftirqd+0x0/0x1c0
[<c105ac24>] ? kthread+0x74/0x80
[<c105abb0>] ? kthread+0x0/0x80
[<c100337a>] ? kernel_thread_helper+0x6/0x10
---[ end trace efd9a11434f0082e ]---
------------[ cut here ]------------
WARNING: at /home/johan/src/linux/linux-2.6/lib/list_debug.c:57 list_del+0x10c/0x120()
Hardware name: Vostro 1520
list_del corruption. next->prev should be f57fbd50, but was f57fbdb0
Modules linked in: cdc_acm
Pid: 3, comm: ksoftirqd/0 Tainted: G W 2.6.37+ #39
Call Trace:
[<c103c7e2>] warn_slowpath_common+0x72/0xa0
[<c11dd8ac>] ? list_del+0x10c/0x120
[<c11dd8ac>] ? list_del+0x10c/0x120
[<c103c8b3>] warn_slowpath_fmt+0x33/0x40
[<c11dd8ac>] list_del+0x10c/0x120
[<f8051dd6>] acm_rx_tasklet+0x106/0x3e0 [cdc_acm]
[<c135465d>] ? net_rps_action_and_irq_enable+0x6d/0x80
[<c1042bb6>] tasklet_action+0xe6/0x140
[<c104342f>] __do_softirq+0xaf/0x210
[<c1043380>] ? __do_softirq+0x0/0x210
<IRQ> [<c1042c9a>] ? run_ksoftirqd+0x8a/0x1c0
[<c1042c10>] ? run_ksoftirqd+0x0/0x1c0
[<c105ac24>] ? kthread+0x74/0x80
[<c105abb0>] ? kthread+0x0/0x80
[<c100337a>] ? kernel_thread_helper+0x6/0x10
---[ end trace efd9a11434f0082f ]---
cdc-acm.c: acm_rx_tasklet: sending urb 0xf50da300, rcv 0xf57fbc10, buf 0xf57fbd50
cdc-acm.c: disconnected from network
cdc-acm.c: acm_rx_tasklet: sending urb 0xf50da380, rcv 0xf57fbbfc, buf 0xf57fbd3c
cdc-acm.c: Entering acm_rx_tasklet
------------[ cut here ]------------
WARNING: at /home/johan/src/linux/linux-2.6/lib/list_debug.c:48 list_del+0xd5/0x120()
Hardware name: Vostro 1520
list_del corruption, next is LIST_POISON1 (00100100)
Modules linked in: cdc_acm
Pid: 3, comm: ksoftirqd/0 Tainted: G W 2.6.37+ #39
Call Trace:
[<c103c7e2>] warn_slowpath_common+0x72/0xa0
[<c11dd875>] ? list_del+0xd5/0x120
[<c11dd875>] ? list_del+0xd5/0x120
[<c103c8b3>] warn_slowpath_fmt+0x33/0x40
[<c11dd875>] list_del+0xd5/0x120
[<f8051fac>] acm_rx_tasklet+0x2dc/0x3e0 [cdc_acm]
[<c106dbab>] ? trace_hardirqs_on+0xb/0x10
[<c1042b30>] ? tasklet_action+0x60/0x140
[<c1042bb6>] tasklet_action+0xe6/0x140
[<c104342f>] __do_softirq+0xaf/0x210
[<c1043380>] ? __do_softirq+0x0/0x210
<IRQ> [<c1042c9a>] ? run_ksoftirqd+0x8a/0x1c0
[<c1042c10>] ? run_ksoftirqd+0x0/0x1c0
[<c105ac24>] ? kthread+0x74/0x80
[<c105abb0>] ? kthread+0x0/0x80
[<c100337a>] ? kernel_thread_helper+0x6/0x10
---[ end trace efd9a11434f00830 ]---
BUG: unable to handle kernel paging request at 00200200
IP: [<c11dd7bd>] list_del+0x1d/0x120
*pde = 00000000
Oops: 0000 [#1] PREEMPT SMP
last sysfs file: /sys/devices/pci0000:00/0000:00:1a.1/usb4/4-1/4-1:1.0/tty/ttyACM0/uevent
Modules linked in: cdc_acm
Pid: 3, comm: ksoftirqd/0 Tainted: G W 2.6.37+ #39 0T816J/Vostro 1520
EIP: 0060:[<c11dd7bd>] EFLAGS: 00010046 CPU: 0
EIP is at list_del+0x1d/0x120
EAX: f57fbd3c EBX: f57fb800 ECX: ffff8000 EDX: 00200200
ESI: f57fbe90 EDI: f57fbd3c EBP: f600bf54 ESP: f600bf3c
DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068
Process ksoftirqd/0 (pid: 3, ti=f600a000 task=f60791c0 task.ti=f6082000)
Stack:
c1527e84 00000030 c1527e54 00100100 f57fb800 f57fbd3c f600bf98 f8051fac
f8053104 f8052b94 f600bf6c c106dbab f600bf80 00000286 f60791c0 c1042b30
f57fbda8 f57f5800 f57fbdb0 f57fbd80 f57fbe7c c1656b04 00000000 f600bfb0
Call Trace:
[<f8051fac>] ? acm_rx_tasklet+0x2dc/0x3e0 [cdc_acm]
[<c106dbab>] ? trace_hardirqs_on+0xb/0x10
[<c1042b30>] ? tasklet_action+0x60/0x140
[<c1042bb6>] ? tasklet_action+0xe6/0x140
[<c104342f>] ? __do_softirq+0xaf/0x210
[<c1043380>] ? __do_softirq+0x0/0x210
<IRQ>
[<c1042c9a>] ? run_ksoftirqd+0x8a/0x1c0
[<c1042c10>] ? run_ksoftirqd+0x0/0x1c0
[<c105ac24>] ? kthread+0x74/0x80
[<c105abb0>] ? kthread+0x0/0x80
[<c100337a>] ? kernel_thread_helper+0x6/0x10
Code: ff 48 14 e9 57 ff ff ff 90 90 90 90 90 90 55 89 e5 83 ec 18 81 38 00 01 10 00 0f 84 9c 00 00 00 8b 50 04 81 fa 00 02 20 00 74 33 <8b> 12 39 d0 75 5c 8b 10 8b 4a 04 39 c8 0f 85 b5 00 00 00 8b 48
EIP: [<c11dd7bd>] list_del+0x1d/0x120 SS:ESP 0068:f600bf3c
CR2: 0000000000200200
---[ end trace efd9a11434f00831 ]---
Kernel panic - not syncing: Fatal exception in interrupt
Pid: 3, comm: ksoftirqd/0 Tainted: G D W 2.6.37+ #39
Call Trace:
[<c13fede1>] ? printk+0x1d/0x24
[<c13fecce>] panic+0x66/0x15c
[<c10067df>] oops_end+0x8f/0x90
[<c1025476>] no_context+0xc6/0x160
[<c10255a8>] __bad_area_nosemaphore+0x98/0x140
[<c103cf68>] ? release_console_sem+0x1d8/0x210
[<c1025667>] bad_area_nosemaphore+0x17/0x20
[<c1025a49>] do_page_fault+0x279/0x420
[<c1006a8f>] ? show_trace+0x1f/0x30
[<c13fede1>] ? printk+0x1d/0x24
[<c10257d0>] ? do_page_fault+0x0/0x420
[<c140333b>] error_code+0x5f/0x64
[<c103007b>] ? select_task_rq_fair+0x37b/0x6a0
[<c10257d0>] ? do_page_fault+0x0/0x420
[<c11dd7bd>] ? list_del+0x1d/0x120
[<f8051fac>] acm_rx_tasklet+0x2dc/0x3e0 [cdc_acm]
[<c106dbab>] ? trace_hardirqs_on+0xb/0x10
[<c1042b30>] ? tasklet_action+0x60/0x140
[<c1042bb6>] tasklet_action+0xe6/0x140
[<c104342f>] __do_softirq+0xaf/0x210
[<c1043380>] ? __do_softirq+0x0/0x210
<IRQ> [<c1042c9a>] ? run_ksoftirqd+0x8a/0x1c0
[<c1042c10>] ? run_ksoftirqd+0x0/0x1c0
[<c105ac24>] ? kthread+0x74/0x80
[<c105abb0>] ? kthread+0x0/0x80
[<c100337a>] ? kernel_thread_helper+0x6/0x10
panic occurred, switching back to text console
------------[ cut here ]------------

Signed-off-by: Johan Hovold <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
drivers/usb/class/cdc-acm.c | 2 ++
1 file changed, 2 insertions(+)

Index: linux-2.6.35.y/drivers/usb/class/cdc-acm.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/class/cdc-acm.c 2011-03-29 23:02:58.785331251 -0700
+++ linux-2.6.35.y/drivers/usb/class/cdc-acm.c 2011-03-29 23:53:54.852134147 -0700
@@ -652,8 +652,10 @@
usb_kill_urb(acm->ctrlurb);
for (i = 0; i < ACM_NW; i++)
usb_kill_urb(acm->wb[i].urb);
+ tasklet_disable(&acm->urb_task);
for (i = 0; i < nr; i++)
usb_kill_urb(acm->ru[i].urb);
+ tasklet_enable(&acm->urb_task);
acm->control->needs_remote_wakeup = 0;
usb_autopm_put_interface(acm->control);
}

2011-03-30 21:19:17

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [235/275] USB: uss720 fixup refcount position

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Peter Holik <[email protected]>

commit adaa3c6342b249548ea830fe8e02aa5b45be8688 upstream.

My testprog do a lot of bitbang - after hours i got following warning and my machine lockups:
WARNING: at /build/buildd/linux-2.6.38/lib/kref.c:34
After debugging uss720 driver i discovered that the completion callback was called before
usb_submit_urb returns. The callback frees the request structure that is krefed on return by
usb_submit_urb.

Signed-off-by: Peter Holik <[email protected]>
Acked-by: Thomas Sailer <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/usb/misc/uss720.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

Index: linux-2.6.35.y/drivers/usb/misc/uss720.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/misc/uss720.c 2011-03-29 22:50:20.427735723 -0700
+++ linux-2.6.35.y/drivers/usb/misc/uss720.c 2011-03-29 23:53:41.596473326 -0700
@@ -177,12 +177,11 @@
spin_lock_irqsave(&priv->asynclock, flags);
list_add_tail(&rq->asynclist, &priv->asynclist);
spin_unlock_irqrestore(&priv->asynclock, flags);
+ kref_get(&rq->ref_count);
ret = usb_submit_urb(rq->urb, mem_flags);
- if (!ret) {
- kref_get(&rq->ref_count);
+ if (!ret)
return rq;
- }
- kref_put(&rq->ref_count, destroy_async);
+ destroy_async(&rq->ref_count);
err("submit_async_request submit_urb failed with %d", ret);
return NULL;
}

2011-03-30 21:19:34

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [223/275] PCI hotplug: acpiphp: set current_state to D0 in register_slot

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Stefano Stabellini <[email protected]>

commit 47e9037ac16637cd7f12b8790ea7ce6680e42168 upstream.

If a device doesn't support power management (pm_cap == 0) but it is
acpi_pci_power_manageable() because there is a _PS0 method declared for
it and _EJ0 is also declared for the slot then nobody is going to set
current_state = PCI_D0 for this device. This is what I think it is
happening:

pci_enable_device
|
__pci_enable_device_flags
/* here we do not set current_state because !pm_cap */
|
do_pci_enable_device
|
pci_set_power_state
|
__pci_start_power_transition
|
pci_platform_power_transition
/* platform_pci_power_manageable() calls acpi_pci_power_manageable that
* returns true */
|
platform_pci_set_power_state
/* acpi_pci_set_power_state gets called and does nothing because the
* acpi device has _EJ0, see the comment "If the ACPI device has _EJ0,
* ignore the device" */

at this point if we refer to the commit message that introduced the
comment above (10b3dcae0f275e2546e55303d64ddbb58cec7599), it is up to
the hotplug driver to set the state to D0.
However AFAICT the pci hotplug driver never does, in fact
drivers/pci/hotplug/acpiphp_glue.c:register_slot sets the slot flags to
(SLOT_ENABLED | SLOT_POWEREDON) but it does not set the pci device
current state to PCI_D0.

So my proposed fix is also to set current_state = PCI_D0 in
register_slot.
Comments are very welcome.

Signed-off-by: Stefano Stabellini <[email protected]>
Signed-off-by: Jesse Barnes <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/pci/hotplug/acpiphp_glue.c | 1 +
1 file changed, 1 insertion(+)

Index: linux-2.6.35.y/drivers/pci/hotplug/acpiphp_glue.c
===================================================================
--- linux-2.6.35.y.orig/drivers/pci/hotplug/acpiphp_glue.c 2011-03-29 22:50:27.345558715 -0700
+++ linux-2.6.35.y/drivers/pci/hotplug/acpiphp_glue.c 2011-03-29 23:03:02.881226447 -0700
@@ -212,6 +212,7 @@

pdev = pci_get_slot(pbus, PCI_DEVFN(device, function));
if (pdev) {
+ pdev->current_state = PCI_D0;
slot->flags |= (SLOT_ENABLED | SLOT_POWEREDON);
pci_dev_put(pdev);
}

2011-03-30 21:19:47

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [214/275] x86: Flush TLB if PGD entry is changed in i386 PAE mode

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Shaohua Li <[email protected]>

commit 4981d01eada5354d81c8929d5b2836829ba3df7b upstream.

According to intel CPU manual, every time PGD entry is changed in i386 PAE
mode, we need do a full TLB flush. Current code follows this and there is
comment for this too in the code.

But current code misses the multi-threaded case. A changed page table
might be used by several CPUs, every such CPU should flush TLB. Usually
this isn't a problem, because we prepopulate all PGD entries at process
fork. But when the process does munmap and follows new mmap, this issue
will be triggered.

When it happens, some CPUs keep doing page faults:

http://marc.info/?l=linux-kernel&m=129915020508238&w=2

Reported-by: Yasunori Goto<[email protected]>
Tested-by: Yasunori Goto<[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Reviewed-by: Rik van Riel <[email protected]>
Signed-off-by: Shaohua Li<[email protected]>
Cc: Mallick Asit K <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: linux-mm <[email protected]>
LKML-Reference: <1300246649.2337.95.camel@sli10-conroe>
Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
arch/x86/include/asm/pgtable-3level.h | 11 +++--------
arch/x86/mm/pgtable.c | 3 +--
2 files changed, 4 insertions(+), 10 deletions(-)

Index: linux-2.6.35.y/arch/x86/include/asm/pgtable-3level.h
===================================================================
--- linux-2.6.35.y.orig/arch/x86/include/asm/pgtable-3level.h 2011-03-29 22:50:32.352430601 -0700
+++ linux-2.6.35.y/arch/x86/include/asm/pgtable-3level.h 2011-03-29 23:03:02.707230900 -0700
@@ -69,8 +69,6 @@

static inline void pud_clear(pud_t *pudp)
{
- unsigned long pgd;
-
set_pud(pudp, __pud(0));

/*
@@ -79,13 +77,10 @@
* section 8.1: in PAE mode we explicitly have to flush the
* TLB via cr3 if the top-level pgd is changed...
*
- * Make sure the pud entry we're updating is within the
- * current pgd to avoid unnecessary TLB flushes.
+ * Currently all places where pud_clear() is called either have
+ * flush_tlb_mm() followed or don't need TLB flush (x86_64 code or
+ * pud_clear_bad()), so we don't need TLB flush here.
*/
- pgd = read_cr3();
- if (__pa(pudp) >= pgd && __pa(pudp) <
- (pgd + sizeof(pgd_t)*PTRS_PER_PGD))
- write_cr3(pgd);
}

#ifdef CONFIG_SMP
Index: linux-2.6.35.y/arch/x86/mm/pgtable.c
===================================================================
--- linux-2.6.35.y.orig/arch/x86/mm/pgtable.c 2011-03-29 22:50:32.352430601 -0700
+++ linux-2.6.35.y/arch/x86/mm/pgtable.c 2011-03-29 23:03:02.708230874 -0700
@@ -160,8 +160,7 @@
* section 8.1: in PAE mode we explicitly have to flush the
* TLB via cr3 if the top-level pgd is changed...
*/
- if (mm == current->active_mm)
- write_cr3(read_cr3());
+ flush_tlb_mm(mm);
}
#else /* !CONFIG_X86_PAE */

2011-03-30 21:19:45

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [234/275] ehci-hcd: Bug fix: don't set a QH's Halt bit

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Alan Stern <[email protected]>

commit b5a3b3d985493c173925907adfebf3edab236fe7 upstream.

This patch (as1453) fixes a long-standing bug in the ehci-hcd driver.

There is no need to set the Halt bit in the overlay region for an
unlinked or blocked QH. Contrary to what the comment says, setting
the Halt bit does not cause the QH to be patched later; that decision
(made in qh_refresh()) depends only on whether the QH is currently
pointing to a valid qTD. Likewise, setting the Halt bit does not
prevent completions from activating the QH while it is "stopped"; they
are prevented by the fact that qh_completions() temporarily changes
qh->qh_state to QH_STATE_COMPLETING.

On the other hand, there are circumstances in which the QH will be
reactivated _without_ being patched; this happens after an URB beyond
the head of the queue is unlinked. Setting the Halt bit will then
cause the hardware to see the QH with both the Active and Halt bits
set, an invalid combination that will prevent the queue from
advancing and may even crash some controllers.

Apparently the only reason this hasn't been reported before is that
unlinking URBs from the middle of a running queue is quite uncommon.
However Test 17, recently added to the usbtest driver, does exactly
this, and it confirms the presence of the bug.

In short, there is no reason to set the Halt bit for an unlinked or
blocked QH, and there is a very good reason not to set it. Therefore
the code that sets it is removed.

Signed-off-by: Alan Stern <[email protected]>
Tested-by: Andiry Xu <[email protected]>
CC: David Brownell <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/usb/host/ehci-q.c | 12 ------------
1 file changed, 12 deletions(-)

Index: linux-2.6.35.y/drivers/usb/host/ehci-q.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/host/ehci-q.c 2011-03-29 22:50:20.995721192 -0700
+++ linux-2.6.35.y/drivers/usb/host/ehci-q.c 2011-03-29 23:03:03.099220870 -0700
@@ -315,7 +315,6 @@
int stopped;
unsigned count = 0;
u8 state;
- const __le32 halt = HALT_BIT(ehci);
struct ehci_qh_hw *hw = qh->hw;

if (unlikely (list_empty (&qh->qtd_list)))
@@ -422,7 +421,6 @@
&& !(qtd->hw_alt_next
& EHCI_LIST_END(ehci))) {
stopped = 1;
- goto halt;
}

/* stop scanning when we reach qtds the hc is using */
@@ -456,16 +454,6 @@
*/
ehci_clear_tt_buffer(ehci, qh, urb, token);
}
-
- /* force halt for unlinked or blocked qh, so we'll
- * patch the qh later and so that completions can't
- * activate it while we "know" it's stopped.
- */
- if ((halt & hw->hw_token) == 0) {
-halt:
- hw->hw_token |= halt;
- wmb ();
- }
}

/* unless we already know the urb's status, collect qtd status

2011-03-30 21:20:47

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [232/275] nfsd: wrong index used in inner loop

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Mi Jinlong <[email protected]>

commit 5a02ab7c3c4580f94d13c683721039855b67cda6 upstream.

We must not use dummy for index.
After the first index, READ32(dummy) will change dummy!!!!

Signed-off-by: Mi Jinlong <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
[[email protected]: Trond points out READ_BUF alone is sufficient.]
Signed-off-by: J. Bruce Fields <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
fs/nfsd/nfs4xdr.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

Index: linux-2.6.35.y/fs/nfsd/nfs4xdr.c
===================================================================
--- linux-2.6.35.y.orig/fs/nfsd/nfs4xdr.c 2011-03-29 23:03:01.975249629 -0700
+++ linux-2.6.35.y/fs/nfsd/nfs4xdr.c 2011-03-29 23:03:03.054222021 -0700
@@ -1107,7 +1107,7 @@

u32 dummy;
char *machine_name;
- int i, j;
+ int i;
int nr_secflavs;

READ_BUF(16);
@@ -1180,8 +1180,6 @@
READ_BUF(4);
READ32(dummy);
READ_BUF(dummy * 4);
- for (j = 0; j < dummy; ++j)
- READ32(dummy);
break;
case RPC_AUTH_GSS:
dprintk("RPC_AUTH_GSS callback secflavor "
@@ -1197,7 +1195,6 @@
READ_BUF(4);
READ32(dummy);
READ_BUF(dummy);
- p += XDR_QUADLEN(dummy);
break;
default:
dprintk("Illegal callback secflavor\n");

2011-03-30 21:21:03

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [231/275] nfsd41: modify the members value of nfsd4_op_flags

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Mi Jinlong <[email protected]>

commit 5ece3cafbd88d4da5c734e1810c4a2e6474b57b2 upstream.

The members of nfsd4_op_flags, (ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS)
equals to ALLOWED_AS_FIRST_OP, maybe that's not what we want.

OP_PUTROOTFH with op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS,
can't appears as the first operation with out SEQUENCE ops.

This patch modify the wrong value of ALLOWED_WITHOUT_FH etc which
was introduced by f9bb94c4.

Reviewed-by: Benny Halevy <[email protected]>
Signed-off-by: Mi Jinlong <[email protected]>
Signed-off-by: J. Bruce Fields <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
fs/nfsd/nfs4proc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6.35.y/fs/nfsd/nfs4proc.c
===================================================================
--- linux-2.6.35.y.orig/fs/nfsd/nfs4proc.c 2011-03-29 22:50:22.719677080 -0700
+++ linux-2.6.35.y/fs/nfsd/nfs4proc.c 2011-03-29 23:03:03.035222507 -0700
@@ -954,8 +954,8 @@
void *);
enum nfsd4_op_flags {
ALLOWED_WITHOUT_FH = 1 << 0, /* No current filehandle required */
- ALLOWED_ON_ABSENT_FS = 2 << 0, /* ops processed on absent fs */
- ALLOWED_AS_FIRST_OP = 3 << 0, /* ops reqired first in compound */
+ ALLOWED_ON_ABSENT_FS = 1 << 1, /* ops processed on absent fs */
+ ALLOWED_AS_FIRST_OP = 1 << 2, /* ops reqired first in compound */
};

struct nfsd4_operation {

2011-03-30 21:21:17

by Andi Kleen

[permalink] [raw]
Subject: Re: [PATCH] [73/275] tpm_tis: Use timeouts returned from TPM

On Wed, Mar 30, 2011 at 05:13:09PM -0400, Stefan Berger wrote:
> On 03/30/2011 05:05 PM, Andi Kleen wrote:
>
> Please drop it. It has been rejected previously. A revised patch has
> been sent.

Ok. What is the subject of the revised patch?
Thanks,
-Andi

2011-03-30 21:09:38

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [228/275] procfs: fix /proc/<pid>/maps heap check

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Aaro Koskinen <[email protected]>

commit 0db0c01b53a1a421513f91573241aabafb87802a upstream.

The current code fails to print the "[heap]" marking if the heap is split
into multiple mappings.

Fix the check so that the marking is displayed in all possible cases:
1. vma matches exactly the heap
2. the heap vma is merged e.g. with bss
3. the heap vma is splitted e.g. due to locked pages

Test cases. In all cases, the process should have mapping(s) with
[heap] marking:

(1) vma matches exactly the heap

#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>

int main (void)
{
if (sbrk(4096) != (void *)-1) {
printf("check /proc/%d/maps\n", (int)getpid());
while (1)
sleep(1);
}
return 0;
}

# ./test1
check /proc/553/maps
[1] + Stopped ./test1
# cat /proc/553/maps | head -4
00008000-00009000 r-xp 00000000 01:00 3113640 /test1
00010000-00011000 rw-p 00000000 01:00 3113640 /test1
00011000-00012000 rw-p 00000000 00:00 0 [heap]
4006f000-40070000 rw-p 00000000 00:00 0

(2) the heap vma is merged

#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>

char foo[4096] = "foo";
char bar[4096];

int main (void)
{
if (sbrk(4096) != (void *)-1) {
printf("check /proc/%d/maps\n", (int)getpid());
while (1)
sleep(1);
}
return 0;
}

# ./test2
check /proc/556/maps
[2] + Stopped ./test2
# cat /proc/556/maps | head -4
00008000-00009000 r-xp 00000000 01:00 3116312 /test2
00010000-00012000 rw-p 00000000 01:00 3116312 /test2
00012000-00014000 rw-p 00000000 00:00 0 [heap]
4004a000-4004b000 rw-p 00000000 00:00 0

(3) the heap vma is splitted (this fails without the patch)

#include <stdio.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/types.h>

int main (void)
{
if ((sbrk(4096) != (void *)-1) && !mlockall(MCL_FUTURE) &&
(sbrk(4096) != (void *)-1)) {
printf("check /proc/%d/maps\n", (int)getpid());
while (1)
sleep(1);
}
return 0;
}

# ./test3
check /proc/559/maps
[1] + Stopped ./test3
# cat /proc/559/maps|head -4
00008000-00009000 r-xp 00000000 01:00 3119108 /test3
00010000-00011000 rw-p 00000000 01:00 3119108 /test3
00011000-00012000 rw-p 00000000 00:00 0 [heap]
00012000-00013000 rw-p 00000000 00:00 0 [heap]

It looks like the bug has been there forever, and since it only results in
some information missing from a procfile, it does not fulfil the -stable
"critical issue" criteria.

Signed-off-by: Aaro Koskinen <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Reviewed-by: KOSAKI Motohiro <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
fs/proc/task_mmu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6.35.y/fs/proc/task_mmu.c
===================================================================
--- linux-2.6.35.y.orig/fs/proc/task_mmu.c 2011-03-29 22:50:24.508631304 -0700
+++ linux-2.6.35.y/fs/proc/task_mmu.c 2011-03-29 23:03:02.979223940 -0700
@@ -248,8 +248,8 @@
const char *name = arch_vma_name(vma);
if (!name) {
if (mm) {
- if (vma->vm_start <= mm->start_brk &&
- vma->vm_end >= mm->brk) {
+ if (vma->vm_start <= mm->brk &&
+ vma->vm_end >= mm->start_brk) {
name = "[heap]";
} else if (vma->vm_start <= mm->start_stack &&
vma->vm_end >= mm->start_stack) {

2011-03-30 21:21:36

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [230/275] fbcon: Bugfix soft cursor detection in Tile Blitting

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Henry Nestler <[email protected]>

commit d6244bc0ed0c52a795e6f4dcab3886daf3e74fac upstream.

Use mask 0x10 for "soft cursor" detection on in function tile_cursor.
(Tile Blitting Operation in framebuffer console).

The old mask 0x01 for vc_cursor_type detects CUR_NONE, CUR_LOWER_THIRD
and every second mode value as "software cursor". This hides the cursor
for these modes (cursor.mode = 0). But, only CUR_NONE or "software cursor"
should hide the cursor.
See also 0x10 in functions add_softcursor, bit_cursor and cw_cursor.

Signed-off-by: Henry Nestler <[email protected]>
Signed-off-by: Paul Mundt <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/video/console/tileblit.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.35.y/drivers/video/console/tileblit.c
===================================================================
--- linux-2.6.35.y.orig/drivers/video/console/tileblit.c 2011-03-29 22:50:23.367660498 -0700
+++ linux-2.6.35.y/drivers/video/console/tileblit.c 2011-03-29 23:03:03.016222993 -0700
@@ -83,7 +83,7 @@
int softback_lines, int fg, int bg)
{
struct fb_tilecursor cursor;
- int use_sw = (vc->vc_cursor_type & 0x01);
+ int use_sw = (vc->vc_cursor_type & 0x10);

cursor.sx = vc->vc_x;
cursor.sy = vc->vc_y;

2011-03-30 21:21:52

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [227/275] ext3: skip orphan cleanup on rocompat fs

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Amir Goldstein <[email protected]>

commit ce654b37f87980d95f339080e4c3bdb2370bdf22 upstream.

Orphan cleanup is currently executed even if the file system has some
number of unknown ROCOMPAT features, which deletes inodes and frees
blocks, which could be very bad for some RO_COMPAT features.

This patch skips the orphan cleanup if it contains readonly compatible
features not known by this ext3 implementation, which would prevent
the fs from being mounted (or remounted) readwrite.

Signed-off-by: Amir Goldstein <[email protected]>
Signed-off-by: Jan Kara <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
fs/ext3/super.c | 7 +++++++
1 file changed, 7 insertions(+)

Index: linux-2.6.35.y/fs/ext3/super.c
===================================================================
--- linux-2.6.35.y.orig/fs/ext3/super.c 2011-03-29 22:50:25.063617102 -0700
+++ linux-2.6.35.y/fs/ext3/super.c 2011-03-29 23:03:02.960224426 -0700
@@ -1459,6 +1459,13 @@
return;
}

+ /* Check if feature set allows readwrite operations */
+ if (EXT3_HAS_RO_COMPAT_FEATURE(sb, ~EXT3_FEATURE_RO_COMPAT_SUPP)) {
+ printk(KERN_INFO "EXT3-fs: %s: Skipping orphan cleanup due to "
+ "unknown ROCOMPAT features\n", sb->s_id);
+ return;
+ }
+
if (EXT3_SB(sb)->s_mount_state & EXT3_ERROR_FS) {
if (es->s_last_orphan)
jbd_debug(1, "Errors on filesystem, "

2011-03-30 21:22:14

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [225/275] x86: Cleanup highmap after brk is concluded

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Yinghai Lu <[email protected]>

commit e5f15b45ddf3afa2bbbb10c7ea34fb32b6de0a0e upstream.

Now cleanup_highmap actually is in two steps: one is early in head64.c
and only clears above _end; a second one is in init_memory_mapping() and
tries to clean from _brk_end to _end.
It should check if those boundaries are PMD_SIZE aligned but currently
does not.
Also init_memory_mapping() is called several times for numa or memory
hotplug, so we really should not handle initial kernel mappings there.

This patch moves cleanup_highmap() down after _brk_end is settled so
we can do everything in one step.
Also we honor max_pfn_mapped in the implementation of cleanup_highmap.

Signed-off-by: Yinghai Lu <[email protected]>
Signed-off-by: Stefano Stabellini <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
LKML-Reference: <alpine.DEB.2.00.1103171739050.3382@kaball-desktop>
Signed-off-by: H. Peter Anvin <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
arch/x86/kernel/head64.c | 3 ---
arch/x86/kernel/setup.c | 5 +++++
arch/x86/mm/init.c | 19 -------------------
arch/x86/mm/init_64.c | 11 ++++++-----
4 files changed, 11 insertions(+), 27 deletions(-)

Index: linux-2.6.35.y/arch/x86/kernel/head64.c
===================================================================
--- linux-2.6.35.y.orig/arch/x86/kernel/head64.c 2011-03-29 22:50:26.228587294 -0700
+++ linux-2.6.35.y/arch/x86/kernel/head64.c 2011-03-29 23:03:02.918225501 -0700
@@ -76,9 +76,6 @@
/* Make NULL pointers segfault */
zap_identity_mappings();

- /* Cleanup the over mapped high alias */
- cleanup_highmap();
-
for (i = 0; i < NUM_EXCEPTION_VECTORS; i++) {
#ifdef CONFIG_EARLY_PRINTK
set_intr_gate(i, &early_idt_handlers[i]);
Index: linux-2.6.35.y/arch/x86/kernel/setup.c
===================================================================
--- linux-2.6.35.y.orig/arch/x86/kernel/setup.c 2011-03-29 22:50:26.228587294 -0700
+++ linux-2.6.35.y/arch/x86/kernel/setup.c 2011-03-29 23:03:02.918225501 -0700
@@ -296,6 +296,9 @@
static inline void init_gbpages(void)
{
}
+static void __init cleanup_highmap(void)
+{
+}
#endif

static void __init reserve_brk(void)
@@ -926,6 +929,8 @@

reserve_brk();

+ cleanup_highmap();
+
/*
* Find and reserve possible boot-time SMP configuration:
*/
Index: linux-2.6.35.y/arch/x86/mm/init.c
===================================================================
--- linux-2.6.35.y.orig/arch/x86/mm/init.c 2011-03-29 22:50:26.228587294 -0700
+++ linux-2.6.35.y/arch/x86/mm/init.c 2011-03-29 23:03:02.920225449 -0700
@@ -277,25 +277,6 @@
load_cr3(swapper_pg_dir);
#endif

-#ifdef CONFIG_X86_64
- if (!after_bootmem && !start) {
- pud_t *pud;
- pmd_t *pmd;
-
- mmu_cr4_features = read_cr4();
-
- /*
- * _brk_end cannot change anymore, but it and _end may be
- * located on different 2M pages. cleanup_highmap(), however,
- * can only consider _end when it runs, so destroy any
- * mappings beyond _brk_end here.
- */
- pud = pud_offset(pgd_offset_k(_brk_end), _brk_end);
- pmd = pmd_offset(pud, _brk_end - 1);
- while (++pmd <= pmd_offset(pud, (unsigned long)_end - 1))
- pmd_clear(pmd);
- }
-#endif
__flush_tlb_all();

if (!after_bootmem && e820_table_end > e820_table_start)
Index: linux-2.6.35.y/arch/x86/mm/init_64.c
===================================================================
--- linux-2.6.35.y.orig/arch/x86/mm/init_64.c 2011-03-29 22:50:26.228587294 -0700
+++ linux-2.6.35.y/arch/x86/mm/init_64.c 2011-03-29 23:03:02.921225423 -0700
@@ -50,6 +50,7 @@
#include <asm/numa.h>
#include <asm/cacheflush.h>
#include <asm/init.h>
+#include <asm/setup.h>
#include <linux/bootmem.h>

static unsigned long dma_reserve __initdata;
@@ -258,18 +259,18 @@
* to the compile time generated pmds. This results in invalid pmds up
* to the point where we hit the physaddr 0 mapping.
*
- * We limit the mappings to the region from _text to _end. _end is
- * rounded up to the 2MB boundary. This catches the invalid pmds as
+ * We limit the mappings to the region from _text to _brk_end. _brk_end
+ * is rounded up to the 2MB boundary. This catches the invalid pmds as
* well, as they are located before _text:
*/
void __init cleanup_highmap(void)
{
unsigned long vaddr = __START_KERNEL_map;
- unsigned long end = roundup((unsigned long)_end, PMD_SIZE) - 1;
+ unsigned long vaddr_end = __START_KERNEL_map + (max_pfn_mapped << PAGE_SHIFT);
+ unsigned long end = roundup((unsigned long)_brk_end, PMD_SIZE) - 1;
pmd_t *pmd = level2_kernel_pgt;
- pmd_t *last_pmd = pmd + PTRS_PER_PMD;

- for (; pmd < last_pmd; pmd++, vaddr += PMD_SIZE) {
+ for (; vaddr + PMD_SIZE - 1 < vaddr_end; pmd++, vaddr += PMD_SIZE) {
if (pmd_none(*pmd))
continue;
if (vaddr < (unsigned long) _text || vaddr > end)

2011-03-30 21:22:12

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [226/275] Prevent rt_sigqueueinfo and rt_tgsigqueueinfo from spoofing the signal code

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Julien Tinnes <[email protected]>

commit da48524eb20662618854bb3df2db01fc65f3070c upstream.

Userland should be able to trust the pid and uid of the sender of a
signal if the si_code is SI_TKILL.

Unfortunately, the kernel has historically allowed sigqueueinfo() to
send any si_code at all (as long as it was negative - to distinguish it
from kernel-generated signals like SIGILL etc), so it could spoof a
SI_TKILL with incorrect siginfo values.

Happily, it looks like glibc has always set si_code to the appropriate
SI_QUEUE, so there are probably no actual user code that ever uses
anything but the appropriate SI_QUEUE flag.

So just tighten the check for si_code (we used to allow any negative
value), and add a (one-time) warning in case there are binaries out
there that might depend on using other si_code values.

Signed-off-by: Julien Tinnes <[email protected]>
Acked-by: Oleg Nesterov <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
kernel/signal.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)

Index: linux-2.6.35.y/kernel/signal.c
===================================================================
--- linux-2.6.35.y.orig/kernel/signal.c 2011-03-29 22:50:25.616602954 -0700
+++ linux-2.6.35.y/kernel/signal.c 2011-03-29 23:03:02.941224912 -0700
@@ -2410,9 +2410,13 @@
return -EFAULT;

/* Not even root can pretend to send signals from the kernel.
- Nor can they impersonate a kill(), which adds source info. */
- if (info.si_code >= 0)
+ * Nor can they impersonate a kill()/tgkill(), which adds source info.
+ */
+ if (info.si_code != SI_QUEUE) {
+ /* We used to allow any < 0 si_code */
+ WARN_ON_ONCE(info.si_code < 0);
return -EPERM;
+ }
info.si_signo = sig;

/* POSIX.1b doesn't mention process groups. */
@@ -2426,9 +2430,13 @@
return -EINVAL;

/* Not even root can pretend to send signals from the kernel.
- Nor can they impersonate a kill(), which adds source info. */
- if (info->si_code >= 0)
+ * Nor can they impersonate a kill()/tgkill(), which adds source info.
+ */
+ if (info->si_code != SI_QUEUE) {
+ /* We used to allow any < 0 si_code */
+ WARN_ON_ONCE(info->si_code < 0);
return -EPERM;
+ }
info->si_signo = sig;

return do_send_specific(tgid, pid, sig, info);

2011-03-30 21:22:44

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [222/275] shmem: let shared anonymous be nonlinear again

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Hugh Dickins <[email protected]>

commit bee4c36a5cf5c9f63ce1d7372aa62045fbd16d47 upstream.

Up to 2.6.22, you could use remap_file_pages(2) on a tmpfs file or a
shared mapping of /dev/zero or a shared anonymous mapping. In 2.6.23 we
disabled it by default, but set VM_CAN_NONLINEAR to enable it on safe
mappings. We made sure to set it in shmem_mmap() for tmpfs files, but
missed it in shmem_zero_setup() for the others. Fix that at last.

Reported-by: Kenny Simpson <[email protected]>
Signed-off-by: Hugh Dickins <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
mm/shmem.c | 1 +
1 file changed, 1 insertion(+)

Index: linux-2.6.35.y/mm/shmem.c
===================================================================
--- linux-2.6.35.y.orig/mm/shmem.c 2011-03-29 22:50:27.900544514 -0700
+++ linux-2.6.35.y/mm/shmem.c 2011-03-29 23:03:02.862226932 -0700
@@ -2756,5 +2756,6 @@
fput(vma->vm_file);
vma->vm_file = file;
vma->vm_ops = &shmem_vm_ops;
+ vma->vm_flags |= VM_CAN_NONLINEAR;
return 0;
}

2011-03-30 21:22:46

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [221/275] aio: wake all waiters when destroying ctx

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Roland Dreier <[email protected]>

commit e91f90bb0bb10be9cc8efd09a3cf4ecffcad0db1 upstream.

The test program below will hang because io_getevents() uses
add_wait_queue_exclusive(), which means the wake_up() in io_destroy() only
wakes up one of the threads. Fix this by using wake_up_all() in the aio
code paths where we want to make sure no one gets stuck.

// t.c -- compile with gcc -lpthread -laio t.c

#include <libaio.h>
#include <pthread.h>
#include <stdio.h>
#include <unistd.h>

static const int nthr = 2;

void *getev(void *ctx)
{
struct io_event ev;
io_getevents(ctx, 1, 1, &ev, NULL);
printf("io_getevents returned\n");
return NULL;
}

int main(int argc, char *argv[])
{
io_context_t ctx = 0;
pthread_t thread[nthr];
int i;

io_setup(1024, &ctx);

for (i = 0; i < nthr; ++i)
pthread_create(&thread[i], NULL, getev, ctx);

sleep(1);

io_destroy(ctx);

for (i = 0; i < nthr; ++i)
pthread_join(thread[i], NULL);

return 0;
}

Signed-off-by: Roland Dreier <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Reviewed-by: Jeff Moyer <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
fs/aio.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6.35.y/fs/aio.c
===================================================================
--- linux-2.6.35.y.orig/fs/aio.c 2011-03-29 22:50:28.449530467 -0700
+++ linux-2.6.35.y/fs/aio.c 2011-03-29 23:03:02.843227419 -0700
@@ -512,7 +512,7 @@
ctx->reqs_active--;

if (unlikely(!ctx->reqs_active && ctx->dead))
- wake_up(&ctx->wait);
+ wake_up_all(&ctx->wait);
}

static void aio_fput_routine(struct work_struct *data)
@@ -1233,7 +1233,7 @@
* by other CPUs at this point. Right now, we rely on the
* locking done by the above calls to ensure this consistency.
*/
- wake_up(&ioctx->wait);
+ wake_up_all(&ioctx->wait);
put_ioctx(ioctx); /* once for the lookup */
}

2011-03-30 21:09:29

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [208/275] ALSA: ctxfi - Clear input settings before initialization

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Przemyslaw Bruski <[email protected]>

commit efed5f26664f93991c929d5bb343e65f900d72bc upstream.

Clear input settings before initialization.

Signed-off-by: Przemyslaw Bruski <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
sound/pci/ctxfi/ctdaio.c | 2 ++
1 file changed, 2 insertions(+)

Index: linux-2.6.35.y/sound/pci/ctxfi/ctdaio.c
===================================================================
--- linux-2.6.35.y.orig/sound/pci/ctxfi/ctdaio.c 2011-03-29 22:50:35.695345064 -0700
+++ linux-2.6.35.y/sound/pci/ctxfi/ctdaio.c 2011-03-29 23:03:02.594233790 -0700
@@ -176,6 +176,7 @@
if (!entry)
return -ENOMEM;

+ dao->ops->clear_left_input(dao);
/* Program master and conjugate resources */
input->ops->master(input);
daio->rscl.ops->master(&daio->rscl);
@@ -204,6 +205,7 @@
if (!entry)
return -ENOMEM;

+ dao->ops->clear_right_input(dao);
/* Program master and conjugate resources */
input->ops->master(input);
daio->rscr.ops->master(&daio->rscr);

2011-03-30 21:09:26

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [209/275] SUNRPC: Ensure we always run the tk_callback before tk_action

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Trond Myklebust <[email protected]>

commit e020c6800c9621a77223bf2c1ff68180e41e8ebf upstream.

This fixes a race in which the task->tk_callback() puts the rpc_task
to sleep, setting a new callback. Under certain circumstances, the current
code may end up executing the task->tk_action before it gets round to the
callback.

Signed-off-by: Trond Myklebust <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
net/sunrpc/sched.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)

Index: linux-2.6.35.y/net/sunrpc/sched.c
===================================================================
--- linux-2.6.35.y.orig/net/sunrpc/sched.c 2011-03-29 22:50:35.157358829 -0700
+++ linux-2.6.35.y/net/sunrpc/sched.c 2011-03-29 23:03:02.613233304 -0700
@@ -637,14 +637,12 @@
save_callback = task->tk_callback;
task->tk_callback = NULL;
save_callback(task);
- }
-
- /*
- * Perform the next FSM step.
- * tk_action may be NULL when the task has been killed
- * by someone else.
- */
- if (!RPC_IS_QUEUED(task)) {
+ } else {
+ /*
+ * Perform the next FSM step.
+ * tk_action may be NULL when the task has been killed
+ * by someone else.
+ */
if (task->tk_action == NULL)
break;
task->tk_action(task);

2011-03-30 21:23:27

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [219/275] x86, binutils, xen: Fix another wrong size directive

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Alexander van Heukelum <[email protected]>

commit 371c394af27ab7d1e58a66bc19d9f1f3ac1f67b4 upstream.

The latest binutils (2.21.0.20110302/Ubuntu) breaks the build
yet another time, under CONFIG_XEN=y due to a .size directive that
refers to a slightly differently named (hence, to the now very
strict and unforgiving assembler, non-existent) symbol.

[ mingo:

This unnecessary build breakage caused by new binutils
version 2.21 gets escallated back several kernel releases spanning
several years of Linux history, affecting over 130,000 upstream
kernel commits (!), on CONFIG_XEN=y 64-bit kernels (i.e. essentially
affecting all major Linux distro kernel configs).

Git annotate tells us that this slight debug symbol code mismatch
bug has been introduced in 2008 in commit 3d75e1b8:

3d75e1b8 (Jeremy Fitzhardinge 2008-07-08 15:06:49 -0700 1231) ENTRY(xen_do_hypervisor_callback) # do_hypervisor_callback(struct *pt_regs)

The 'bug' is just a slight assymetry in ENTRY()/END()
debug-symbols sequences, with lots of assembly code between the
ENTRY() and the END():

ENTRY(xen_do_hypervisor_callback) # do_hypervisor_callback(struct *pt_regs)
...
END(do_hypervisor_callback)

Human reviewers almost never catch such small mismatches, and binutils
never even warned about it either.

This new binutils version thus breaks the Xen build on all upstream kernels
since v2.6.27, out of the blue.

This makes a straightforward Git bisection of all 64-bit Xen-enabled kernels
impossible on such binutils, for a bisection window of over hundred
thousand historic commits. (!)

This is a major fail on the side of binutils and binutils needs to turn
this show-stopper build failure into a warning ASAP. ]

Signed-off-by: Alexander van Heukelum <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Cc: Jeremy Fitzhardinge <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: H.J. Lu <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: Kees Cook <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
arch/x86/kernel/entry_64.S | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.35.y/arch/x86/kernel/entry_64.S
===================================================================
--- linux-2.6.35.y.orig/arch/x86/kernel/entry_64.S 2011-03-29 22:50:29.569501808 -0700
+++ linux-2.6.35.y/arch/x86/kernel/entry_64.S 2011-03-29 23:03:02.805228392 -0700
@@ -1268,7 +1268,7 @@
decl PER_CPU_VAR(irq_count)
jmp error_exit
CFI_ENDPROC
-END(do_hypervisor_callback)
+END(xen_do_hypervisor_callback)

/*
* Hypervisor uses this for application faults while it executes.

2011-03-30 21:23:42

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [218/275] mmc: sdio: remember new card RCA when redetecting card

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Stefan Nilsson XK <[email protected]>

commit 0aab3995485b8a994bf29a995a008c9ea4a28054 upstream.

During redetection of a SDIO card, a request for a new card RCA
was submitted to the card, but was then overwritten by the old RCA.
This caused the card to be deselected instead of selected when using
the incorrect RCA. This bug's been present since the "oldcard"
handling was introduced in 2.6.32.

Signed-off-by: Stefan Nilsson XK <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Reviewed-by: Ulf Hansson <[email protected]>
Reviewed-by: Pawel Wieczorkiewicz <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
Signed-off-by: Chris Ball <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
drivers/mmc/core/sdio.c | 8 ++++++++
1 file changed, 8 insertions(+)

Index: linux-2.6.35.y/drivers/mmc/core/sdio.c
===================================================================
--- linux-2.6.35.y.orig/drivers/mmc/core/sdio.c 2011-03-29 22:50:30.116487813 -0700
+++ linux-2.6.35.y/drivers/mmc/core/sdio.c 2011-03-29 23:03:02.787228853 -0700
@@ -309,6 +309,14 @@
if (err)
goto remove;

+ /*
+ * Update oldcard with the new RCA received from the SDIO
+ * device -- we're doing this so that it's updated in the
+ * "card" struct when oldcard overwrites that later.
+ */
+ if (oldcard)
+ oldcard->rca = card->rca;
+
mmc_set_bus_mode(host, MMC_BUSMODE_PUSHPULL);
}

2011-03-30 21:23:54

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [217/275] i2c: Fix typo in instantiating-devices document

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Roman Fietze <[email protected]>

commit 6ced9e6b3901af4ab6ac0a11231402c888286ea6 upstream.

The struct i2c_board_info member holding the name is "type", not
"name".

Signed-off-by: Roman Fietze <[email protected]>
Signed-off-by: Jean Delvare <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
Documentation/i2c/instantiating-devices | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.35.y/Documentation/i2c/instantiating-devices
===================================================================
--- linux-2.6.35.y.orig/Documentation/i2c/instantiating-devices 2011-03-29 22:50:30.672473587 -0700
+++ linux-2.6.35.y/Documentation/i2c/instantiating-devices 2011-03-29 23:03:02.768229338 -0700
@@ -100,7 +100,7 @@
(...)
i2c_adap = i2c_get_adapter(2);
memset(&i2c_info, 0, sizeof(struct i2c_board_info));
- strlcpy(i2c_info.name, "isp1301_pnx", I2C_NAME_SIZE);
+ strlcpy(i2c_info.type, "isp1301_pnx", I2C_NAME_SIZE);
isp1301_i2c_client = i2c_new_probed_device(i2c_adap, &i2c_info,
normal_i2c);
i2c_put_adapter(i2c_adap);

2011-03-30 21:09:23

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [210/275] perf, powerpc: Handle events that raise an exception without overflowing

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Anton Blanchard <[email protected]>

commit 0837e3242c73566fc1c0196b4ec61779c25ffc93 upstream.

Events on POWER7 can roll back if a speculative event doesn't
eventually complete. Unfortunately in some rare cases they will
raise a performance monitor exception. We need to catch this to
ensure we reset the PMC. In all cases the PMC will be 256 or less
cycles from overflow.

Signed-off-by: Anton Blanchard <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
LKML-Reference: <20110309143842.6c22845e@kryten>
Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
arch/powerpc/include/asm/reg.h | 1 +
arch/powerpc/kernel/perf_event.c | 24 +++++++++++++++++++++++-
2 files changed, 24 insertions(+), 1 deletion(-)

Index: linux-2.6.35.y/arch/powerpc/include/asm/reg.h
===================================================================
--- linux-2.6.35.y.orig/arch/powerpc/include/asm/reg.h 2011-03-29 22:50:34.616372673 -0700
+++ linux-2.6.35.y/arch/powerpc/include/asm/reg.h 2011-03-29 23:03:02.632232817 -0700
@@ -878,6 +878,7 @@
#define PV_970 0x0039
#define PV_POWER5 0x003A
#define PV_POWER5p 0x003B
+#define PV_POWER7 0x003F
#define PV_970FX 0x003C
#define PV_630 0x0040
#define PV_630p 0x0041
Index: linux-2.6.35.y/arch/powerpc/kernel/perf_event.c
===================================================================
--- linux-2.6.35.y.orig/arch/powerpc/kernel/perf_event.c 2011-03-29 22:50:34.616372673 -0700
+++ linux-2.6.35.y/arch/powerpc/kernel/perf_event.c 2011-03-29 23:03:02.633232791 -0700
@@ -1230,6 +1230,28 @@
return ip;
}

+static bool pmc_overflow(unsigned long val)
+{
+ if ((int)val < 0)
+ return true;
+
+ /*
+ * Events on POWER7 can roll back if a speculative event doesn't
+ * eventually complete. Unfortunately in some rare cases they will
+ * raise a performance monitor exception. We need to catch this to
+ * ensure we reset the PMC. In all cases the PMC will be 256 or less
+ * cycles from overflow.
+ *
+ * We only do this if the first pass fails to find any overflowing
+ * PMCs because a user might set a period of less than 256 and we
+ * don't want to mistakenly reset them.
+ */
+ if (__is_processor(PV_POWER7) && ((0x80000000 - val) <= 256))
+ return true;
+
+ return false;
+}
+
/*
* Performance monitor interrupt stuff
*/
@@ -1277,7 +1299,7 @@
if (is_limited_pmc(i + 1))
continue;
val = read_pmc(i + 1);
- if ((int)val < 0)
+ if (pmc_overflow(val))
write_pmc(i + 1, 0);
}
}

2011-03-30 21:24:16

by Stefan Berger

[permalink] [raw]
Subject: Re: [PATCH] [73/275] tpm_tis: Use timeouts returned from TPM

On 03/30/2011 05:20 PM, Andi Kleen wrote:
> On Wed, Mar 30, 2011 at 05:13:09PM -0400, Stefan Berger wrote:
>> On 03/30/2011 05:05 PM, Andi Kleen wrote:
>>
>> Please drop it. It has been rejected previously. A revised patch has
>> been sent.
> Ok. What is the subject of the revised patch?
It's part of a series I re-posted again today:

[PATCH V2 00/12] tpm + tpm_tis : Various fixes

https://lkml.org/lkml/2011/3/30/290

Stefan

2011-03-30 21:24:11

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [216/275] fix per-cpu flag problem in the cpu affinity checkers

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Thomas Gleixner <[email protected]>

commit 9804c9eaeacfe78651052c5ddff31099f60ef78c upstream.

The CHECK_IRQ_PER_CPU is wrong, it should be checking
irq_to_desc(irq)->status not just irq.

Signed-off-by: Thomas Gleixner <[email protected]>
Signed-off-by: James Bottomley <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
arch/parisc/kernel/irq.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.35.y/arch/parisc/kernel/irq.c
===================================================================
--- linux-2.6.35.y.orig/arch/parisc/kernel/irq.c 2011-03-29 22:50:31.235459182 -0700
+++ linux-2.6.35.y/arch/parisc/kernel/irq.c 2011-03-29 23:03:02.750229799 -0700
@@ -117,7 +117,7 @@
int cpu_dest;

/* timer and ipi have to always be received on all CPUs */
- if (CHECK_IRQ_PER_CPU(irq)) {
+ if (CHECK_IRQ_PER_CPU(irq_to_desc(irq)->status)) {
/* Bad linux design decision. The mask has already
* been set; we must reset it */
cpumask_setall(irq_desc[irq].affinity);

2011-03-30 21:09:21

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [211/275] ext3: Always set dx_node's fake_dirent explicitly.

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Eric Sandeen <[email protected]>

commit d7433142b63d727b5a217c37b1a1468b116a9771 upstream.

(crossport of 1f7bebb9e911d870fa8f997ddff838e82b5715ea
by Andreas Schlick <[email protected]>)

When ext3_dx_add_entry() has to split an index node, it has to ensure that
name_len of dx_node's fake_dirent is also zero, because otherwise e2fsck
won't recognise it as an intermediate htree node and consider the htree to
be corrupted.

Signed-off-by: Eric Sandeen <[email protected]>
Signed-off-by: Jan Kara <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
fs/ext3/namei.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.35.y/fs/ext3/namei.c
===================================================================
--- linux-2.6.35.y.orig/fs/ext3/namei.c 2011-03-29 22:50:34.061386873 -0700
+++ linux-2.6.35.y/fs/ext3/namei.c 2011-03-29 23:03:02.652232306 -0700
@@ -1550,8 +1550,8 @@
goto cleanup;
node2 = (struct dx_node *)(bh2->b_data);
entries2 = node2->entries;
+ memset(&node2->fake, 0, sizeof(struct fake_dirent));
node2->fake.rec_len = ext3_rec_len_to_disk(sb->s_blocksize);
- node2->fake.inode = 0;
BUFFER_TRACE(frame->bh, "get_write_access");
err = ext3_journal_get_write_access(handle, frame->bh);
if (err)

2011-03-30 21:24:54

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [213/275] call_function_many: add missing ordering

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Milton Miller <[email protected]>

commit 45a5791920ae643eafc02e2eedef1a58e341b736 upstream.

Paul McKenney's review pointed out two problems with the barriers in the
2.6.38 update to the smp call function many code.

First, a barrier that would force the func and info members of data to
be visible before their consumption in the interrupt handler was
missing. This can be solved by adding a smp_wmb between setting the
func and info members and setting setting the cpumask; this will pair
with the existing and required smp_rmb ordering the cpumask read before
the read of refs. This placement avoids the need a second smp_rmb in
the interrupt handler which would be executed on each of the N cpus
executing the call request. (I was thinking this barrier was present
but was not).

Second, the previous write to refs (establishing the zero that we the
interrupt handler was testing from all cpus) was performed by a third
party cpu. This would invoke transitivity which, as a recient or
concurrent addition to memory-barriers.txt now explicitly states, would
require a full smp_mb().

However, we know the cpumask will only be set by one cpu (the data
owner) and any preivous iteration of the mask would have cleared by the
reading cpu. By redundantly writing refs to 0 on the owning cpu before
the smp_wmb, the write to refs will follow the same path as the writes
that set the cpumask, which in turn allows us to keep the barrier in the
interrupt handler a smp_rmb instead of promoting it to a smp_mb (which
will be be executed by N cpus for each of the possible M elements on the
list).

I moved and expanded the comment about our (ab)use of the rcu list
primitives for the concurrent walk earlier into this function. I
considered moving the first two paragraphs to the queue list head and
lock, but felt it would have been too disconected from the code.

Cc: Paul McKinney <[email protected]>
Signed-off-by: Milton Miller <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
kernel/smp.c | 46 +++++++++++++++++++++++++++++++++-------------
1 file changed, 33 insertions(+), 13 deletions(-)

Index: linux-2.6.35.y/kernel/smp.c
===================================================================
--- linux-2.6.35.y.orig/kernel/smp.c 2011-03-29 23:03:02.671231820 -0700
+++ linux-2.6.35.y/kernel/smp.c 2011-03-29 23:54:06.593833705 -0700
@@ -460,23 +460,42 @@

data = &__get_cpu_var(cfd_data);
csd_lock(&data->csd);
- BUG_ON(atomic_read(&data->refs) || !cpumask_empty(data->cpumask));

- data->csd.func = func;
- data->csd.info = info;
- cpumask_and(data->cpumask, mask, cpu_online_mask);
- cpumask_clear_cpu(this_cpu, data->cpumask);
+ /* This BUG_ON verifies our reuse assertions and can be removed */
+ BUG_ON(atomic_read(&data->refs) || !cpumask_empty(data->cpumask));

/*
+ * The global call function queue list add and delete are protected
+ * by a lock, but the list is traversed without any lock, relying
+ * on the rcu list add and delete to allow safe concurrent traversal.
* We reuse the call function data without waiting for any grace
* period after some other cpu removes it from the global queue.
- * This means a cpu might find our data block as it is writen.
- * The interrupt handler waits until it sees refs filled out
- * while its cpu mask bit is set; here we may only clear our
- * own cpu mask bit, and must wait to set refs until we are sure
- * previous writes are complete and we have obtained the lock to
- * add the element to the queue.
+ * This means a cpu might find our data block as it is being
+ * filled out.
+ *
+ * We hold off the interrupt handler on the other cpu by
+ * ordering our writes to the cpu mask vs our setting of the
+ * refs counter. We assert only the cpu owning the data block
+ * will set a bit in cpumask, and each bit will only be cleared
+ * by the subject cpu. Each cpu must first find its bit is
+ * set and then check that refs is set indicating the element is
+ * ready to be processed, otherwise it must skip the entry.
+ *
+ * On the previous iteration refs was set to 0 by another cpu.
+ * To avoid the use of transitivity, set the counter to 0 here
+ * so the wmb will pair with the rmb in the interrupt handler.
*/
+ atomic_set(&data->refs, 0); /* convert 3rd to 1st party write */
+
+ data->csd.func = func;
+ data->csd.info = info;
+
+ /* Ensure 0 refs is visible before mask. Also orders func and info */
+ smp_wmb();
+
+ /* We rely on the "and" being processed before the store */
+ cpumask_and(data->cpumask, mask, cpu_online_mask);
+ cpumask_clear_cpu(this_cpu, data->cpumask);

raw_spin_lock_irqsave(&call_function.lock, flags);
/*
@@ -486,8 +505,9 @@
*/
list_add_rcu(&data->csd.list, &call_function.queue);
/*
- * We rely on the wmb() in list_add_rcu to order the writes
- * to func, data, and cpumask before this write to refs.
+ * We rely on the wmb() in list_add_rcu to complete our writes
+ * to the cpumask before this write to refs, which indicates
+ * data is on the list and is ready to be processed.
*/
atomic_set(&data->refs, cpumask_weight(data->cpumask));
raw_spin_unlock_irqrestore(&call_function.lock, flags);

2011-03-30 21:25:11

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [207/275] ALSA: ctxfi - Fix SPDIF status retrieval

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Przemyslaw Bruski <[email protected]>

commit f164753a263bfd2daaf3e0273b179de7e099c57d upstream.

SDPIF status retrieval always returned the default settings instead of
the actual ones.

Signed-off-by: Przemyslaw Bruski <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
sound/pci/ctxfi/ctmixer.c | 19 +++++--------------
1 file changed, 5 insertions(+), 14 deletions(-)

Index: linux-2.6.35.y/sound/pci/ctxfi/ctmixer.c
===================================================================
--- linux-2.6.35.y.orig/sound/pci/ctxfi/ctmixer.c 2011-03-29 22:50:36.240331118 -0700
+++ linux-2.6.35.y/sound/pci/ctxfi/ctmixer.c 2011-03-29 23:03:02.576234251 -0700
@@ -566,19 +566,6 @@
return 0;
}

-static int ct_spdif_default_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- unsigned int status = SNDRV_PCM_DEFAULT_CON_SPDIF;
-
- ucontrol->value.iec958.status[0] = (status >> 0) & 0xff;
- ucontrol->value.iec958.status[1] = (status >> 8) & 0xff;
- ucontrol->value.iec958.status[2] = (status >> 16) & 0xff;
- ucontrol->value.iec958.status[3] = (status >> 24) & 0xff;
-
- return 0;
-}
-
static int ct_spdif_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
@@ -586,6 +573,10 @@
unsigned int status;

atc->spdif_out_get_status(atc, &status);
+
+ if (status == 0)
+ status = SNDRV_PCM_DEFAULT_CON_SPDIF;
+
ucontrol->value.iec958.status[0] = (status >> 0) & 0xff;
ucontrol->value.iec958.status[1] = (status >> 8) & 0xff;
ucontrol->value.iec958.status[2] = (status >> 16) & 0xff;
@@ -629,7 +620,7 @@
.name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, DEFAULT),
.count = 1,
.info = ct_spdif_info,
- .get = ct_spdif_default_get,
+ .get = ct_spdif_get,
.put = ct_spdif_put,
.private_value = MIXER_IEC958_DEFAULT
};

2011-03-30 21:25:09

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [212/275] call_function_many: fix list delete vs add race

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Milton Miller <[email protected]>

commit e6cd1e07a185d5f9b0aa75e020df02d3c1c44940 upstream.

Peter pointed out there was nothing preventing the list_del_rcu in
smp_call_function_interrupt from running before the list_add_rcu in
smp_call_function_many.

Fix this by not setting refs until we have gotten the lock for the list.
Take advantage of the wmb in list_add_rcu to save an explicit additional
one.

I tried to force this race with a udelay before the lock & list_add and
by mixing all 64 online cpus with just 3 random cpus in the mask, but
was unsuccessful. Still, inspection shows a valid race, and the fix is
a extension of the existing protection window in the current code.

Reported-by: Peter Zijlstra <[email protected]>
Signed-off-by: Milton Miller <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
kernel/smp.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)

Index: linux-2.6.35.y/kernel/smp.c
===================================================================
--- linux-2.6.35.y.orig/kernel/smp.c 2011-03-29 23:02:59.591310628 -0700
+++ linux-2.6.35.y/kernel/smp.c 2011-03-29 23:54:07.475811139 -0700
@@ -468,14 +468,15 @@
cpumask_clear_cpu(this_cpu, data->cpumask);

/*
- * To ensure the interrupt handler gets an complete view
- * we order the cpumask and refs writes and order the read
- * of them in the interrupt handler. In addition we may
- * only clear our own cpu bit from the mask.
+ * We reuse the call function data without waiting for any grace
+ * period after some other cpu removes it from the global queue.
+ * This means a cpu might find our data block as it is writen.
+ * The interrupt handler waits until it sees refs filled out
+ * while its cpu mask bit is set; here we may only clear our
+ * own cpu mask bit, and must wait to set refs until we are sure
+ * previous writes are complete and we have obtained the lock to
+ * add the element to the queue.
*/
- smp_wmb();
-
- atomic_set(&data->refs, cpumask_weight(data->cpumask));

raw_spin_lock_irqsave(&call_function.lock, flags);
/*
@@ -484,6 +485,11 @@
* will not miss any other list entries:
*/
list_add_rcu(&data->csd.list, &call_function.queue);
+ /*
+ * We rely on the wmb() in list_add_rcu to order the writes
+ * to func, data, and cpumask before this write to refs.
+ */
+ atomic_set(&data->refs, cpumask_weight(data->cpumask));
raw_spin_unlock_irqrestore(&call_function.lock, flags);

/*

2011-03-30 21:25:49

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [205/275] PCI: sysfs: Fix failure path for addition of "vpd" attribute

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Ben Hutchings <[email protected]>

commit 0f12a4e29368a9476076515881d9ef4e5876c6e2 upstream.

Commit 280c73d ("PCI: centralize the capabilities code in
pci-sysfs.c") changed the initialisation of the "rom" and "vpd"
attributes, and made the failure path for the "vpd" attribute
incorrect. We must free the new attribute structure (attr), but
instead we currently free dev->vpd->attr. That will normally be NULL,
resulting in a memory leak, but it might be a stale pointer, resulting
in a double-free.

Found by inspection; compile-tested only.

Signed-off-by: Ben Hutchings <[email protected]>
Signed-off-by: Jesse Barnes <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/pci/pci-sysfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.35.y/drivers/pci/pci-sysfs.c
===================================================================
--- linux-2.6.35.y.orig/drivers/pci/pci-sysfs.c 2011-03-29 22:50:37.342302922 -0700
+++ linux-2.6.35.y/drivers/pci/pci-sysfs.c 2011-03-29 23:03:02.539235198 -0700
@@ -1018,7 +1018,7 @@
attr->write = write_vpd_attr;
retval = sysfs_create_bin_file(&dev->dev.kobj, attr);
if (retval) {
- kfree(dev->vpd->attr);
+ kfree(attr);
return retval;
}
dev->vpd->attr = attr;

2011-03-30 21:25:48

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [206/275] ALSA: ctxfi - Fix incorrect SPDIF status bit mask

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Przemyslaw Bruski <[email protected]>

commit 4c1847e884efddcc3ede371f7839e5e65b25c34d upstream.

SPDIF status mask creation was incorrect.

Signed-off-by: Przemyslaw Bruski <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
sound/pci/ctxfi/ctatc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.35.y/sound/pci/ctxfi/ctatc.c
===================================================================
--- linux-2.6.35.y.orig/sound/pci/ctxfi/ctatc.c 2011-03-29 22:50:36.791317022 -0700
+++ linux-2.6.35.y/sound/pci/ctxfi/ctatc.c 2011-03-29 23:03:02.557234737 -0700
@@ -869,7 +869,7 @@
mutex_lock(&atc->atc_mutex);
dao->ops->get_spos(dao, &status);
if (((status >> 24) & IEC958_AES3_CON_FS) != iec958_con_fs) {
- status &= ((~IEC958_AES3_CON_FS) << 24);
+ status &= ~(IEC958_AES3_CON_FS << 24);
status |= (iec958_con_fs << 24);
dao->ops->set_spos(dao, status);
dao->ops->commit_write(dao);

2011-03-30 21:26:20

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [202/275] ALSA: hda - fix digital mic selection in mixer on 92HD8X codecs

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Vitaliy Kulikov <[email protected]>

commit 094a42452abd5564429045e210281c6d22e67fca upstream.

When the mux for digital mic is different from the mux for other mics,
the current auto-parser doesn't handle them in a right way but provides
only one mic. This patch fixes the issue.

Signed-off-by: Vitaliy Kulikov <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
sound/pci/hda/patch_sigmatel.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

Index: linux-2.6.35.y/sound/pci/hda/patch_sigmatel.c
===================================================================
--- linux-2.6.35.y.orig/sound/pci/hda/patch_sigmatel.c 2011-03-29 22:50:39.070258709 -0700
+++ linux-2.6.35.y/sound/pci/hda/patch_sigmatel.c 2011-03-29 23:03:02.481236681 -0700
@@ -737,7 +737,7 @@
struct sigmatel_spec *spec = codec->spec;
unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
const struct hda_input_mux *imux = spec->input_mux;
- unsigned int idx, prev_idx;
+ unsigned int idx, prev_idx, didx;

idx = ucontrol->value.enumerated.item[0];
if (idx >= imux->num_items)
@@ -749,7 +749,8 @@
snd_hda_codec_write_cache(codec, spec->mux_nids[adc_idx], 0,
AC_VERB_SET_CONNECT_SEL,
imux->items[idx].index);
- if (prev_idx >= spec->num_analog_muxes) {
+ if (prev_idx >= spec->num_analog_muxes &&
+ spec->mux_nids[adc_idx] != spec->dmux_nids[adc_idx]) {
imux = spec->dinput_mux;
/* 0 = analog */
snd_hda_codec_write_cache(codec,
@@ -759,9 +760,13 @@
}
} else {
imux = spec->dinput_mux;
+ /* first dimux item is hardcoded to select analog imux,
+ * so lets skip it
+ */
+ didx = idx - spec->num_analog_muxes + 1;
snd_hda_codec_write_cache(codec, spec->dmux_nids[adc_idx], 0,
AC_VERB_SET_CONNECT_SEL,
- imux->items[idx - 1].index);
+ imux->items[didx].index);
}
spec->cur_mux[adc_idx] = idx;
return 1;

2011-03-30 21:26:18

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [204/275] PCI: do not create quirk I/O regions below PCIBIOS_MIN_IO for ICH

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Jiri Slaby <[email protected]>

commit 87e3dc3855430bd254370afc79f2ed92250f5b7c upstream.

Some broken BIOSes on ICH4 chipset report an ACPI region which is in
conflict with legacy IDE ports when ACPI is disabled. Even though the
regions overlap, IDE ports are working correctly (we cannot find out
the decoding rules on chipsets).

So the only problem is the reported region itself, if we don't reserve
the region in the quirk everything works as expected.

This patch avoids reserving any quirk regions below PCIBIOS_MIN_IO
which is 0x1000. Some regions might be (and are by a fast google
query) below this border, but the only difference is that they won't
be reserved anymore. They should still work though the same as before.

The conflicts look like (1f.0 is bridge, 1f.1 is IDE ctrl):
pci 0000:00:1f.1: address space collision: [io 0x0170-0x0177] conflicts with 0000:00:1f.0 [io 0x0100-0x017f]

At 0x0100 a 128 bytes long ACPI region is reported in the quirk for
ICH4. ata_piix then fails to find disks because the IDE legacy ports
are zeroed:
ata_piix 0000:00:1f.1: device not available (can't reserve [io 0x0000-0x0007])

References: https://bugzilla.novell.com/show_bug.cgi?id=558740
Signed-off-by: Jiri Slaby <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Cc: Bjorn Helgaas <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Thomas Renninger <[email protected]>
Signed-off-by: Jesse Barnes <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
drivers/pci/quirks.c | 32 ++++++++++++++++++++++++--------
1 file changed, 24 insertions(+), 8 deletions(-)

Index: linux-2.6.35.y/drivers/pci/quirks.c
===================================================================
--- linux-2.6.35.y.orig/drivers/pci/quirks.c 2011-03-29 23:03:02.500236196 -0700
+++ linux-2.6.35.y/drivers/pci/quirks.c 2011-03-29 23:03:02.520235684 -0700
@@ -540,18 +540,30 @@
u32 region;
u8 enable;

+ /*
+ * The check for PCIBIOS_MIN_IO is to ensure we won't create a conflict
+ * with low legacy (and fixed) ports. We don't know the decoding
+ * priority and can't tell whether the legacy device or the one created
+ * here is really at that address. This happens on boards with broken
+ * BIOSes.
+ */
+
pci_read_config_byte(dev, ICH_ACPI_CNTL, &enable);
if (enable & ICH4_ACPI_EN) {
pci_read_config_dword(dev, ICH_PMBASE, &region);
- quirk_io_region(dev, region, 128, PCI_BRIDGE_RESOURCES,
- "ICH4 ACPI/GPIO/TCO");
+ region &= PCI_BASE_ADDRESS_IO_MASK;
+ if (region >= PCIBIOS_MIN_IO)
+ quirk_io_region(dev, region, 128, PCI_BRIDGE_RESOURCES,
+ "ICH4 ACPI/GPIO/TCO");
}

pci_read_config_byte(dev, ICH4_GPIO_CNTL, &enable);
if (enable & ICH4_GPIO_EN) {
pci_read_config_dword(dev, ICH4_GPIOBASE, &region);
- quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES + 1,
- "ICH4 GPIO");
+ region &= PCI_BASE_ADDRESS_IO_MASK;
+ if (region >= PCIBIOS_MIN_IO)
+ quirk_io_region(dev, region, 64,
+ PCI_BRIDGE_RESOURCES + 1, "ICH4 GPIO");
}
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AA_0, quirk_ich4_lpc_acpi);
@@ -573,15 +585,19 @@
pci_read_config_byte(dev, ICH_ACPI_CNTL, &enable);
if (enable & ICH6_ACPI_EN) {
pci_read_config_dword(dev, ICH_PMBASE, &region);
- quirk_io_region(dev, region, 128, PCI_BRIDGE_RESOURCES,
- "ICH6 ACPI/GPIO/TCO");
+ region &= PCI_BASE_ADDRESS_IO_MASK;
+ if (region >= PCIBIOS_MIN_IO)
+ quirk_io_region(dev, region, 128, PCI_BRIDGE_RESOURCES,
+ "ICH6 ACPI/GPIO/TCO");
}

pci_read_config_byte(dev, ICH6_GPIO_CNTL, &enable);
if (enable & ICH4_GPIO_EN) {
pci_read_config_dword(dev, ICH6_GPIOBASE, &region);
- quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES + 1,
- "ICH6 GPIO");
+ region &= PCI_BASE_ADDRESS_IO_MASK;
+ if (region >= PCIBIOS_MIN_IO)
+ quirk_io_region(dev, region, 64,
+ PCI_BRIDGE_RESOURCES + 1, "ICH6 GPIO");
}
}

2011-03-30 21:26:43

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [198/275] ath9k_hw: Fix incorrect macversion and macrev checks

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Senthil Balasubramanian <[email protected]>

commit ac45c12dfb3f727a5a7a3332ed9c11b4a5ab287e upstream.

There are few places where we are checking for macversion and revsions
before RTC is powered ON. However we are reading the macversion and
revisions only after RTC is powered ON and so both macversion and
revisions are actully zero and this leads to incorrect srev checks

Incorrect srev checks can cause registers to be configured wrongly and can
cause unexpected behavior. Fixing this seems to address the ASPM issue that
we have observed. The laptop becomes very slow and hangs mostly with ASPM L1
enabled without this fix.

fix this by reading the macversion and revisisons even before we start
using them. There is no reason why should we delay reading this info
until RTC is powered on as this is just a register information.

Signed-off-by: Senthil Balasubramanian <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/net/wireless/ath/ath9k/hw.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6.35.y/drivers/net/wireless/ath/ath9k/hw.c
===================================================================
--- linux-2.6.35.y.orig/drivers/net/wireless/ath/ath9k/hw.c 2011-03-29 22:50:41.231203416 -0700
+++ linux-2.6.35.y/drivers/net/wireless/ath/ath9k/hw.c 2011-03-29 23:03:02.404238651 -0700
@@ -519,6 +519,8 @@
if (ah->hw_version.devid == AR5416_AR9100_DEVID)
ah->hw_version.macVersion = AR_SREV_VERSION_9100;

+ ath9k_hw_read_revisions(ah);
+
if (!ath9k_hw_set_reset_reg(ah, ATH9K_RESET_POWER_ON)) {
ath_print(common, ATH_DBG_FATAL,
"Couldn't reset chip\n");
@@ -1096,8 +1098,6 @@
return false;
}

- ath9k_hw_read_revisions(ah);
-
return ath9k_hw_set_reset(ah, ATH9K_RESET_WARM);
}

2011-03-30 21:26:56

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [189/275] ftrace: Fix memory leak with function graph and cpu hotplug

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Steven Rostedt <[email protected]>

commit 868baf07b1a259f5f3803c1dc2777b6c358f83cf upstream.

When the fuction graph tracer starts, it needs to make a special
stack for each task to save the real return values of the tasks.
All running tasks have this stack created, as well as any new
tasks.

On CPU hot plug, the new idle task will allocate a stack as well
when init_idle() is called. The problem is that cpu hotplug does
not create a new idle_task. Instead it uses the idle task that
existed when the cpu went down.

ftrace_graph_init_task() will add a new ret_stack to the task
that is given to it. Because a clone will make the task
have a stack of its parent it does not check if the task's
ret_stack is already NULL or not. When the CPU hotplug code
starts a CPU up again, it will allocate a new stack even
though one already existed for it.

The solution is to treat the idle_task specially. In fact, the
function_graph code already does, just not at init_idle().
Instead of using the ftrace_graph_init_task() for the idle task,
which that function expects the task to be a clone, have a
separate ftrace_graph_init_idle_task(). Also, we will create a
per_cpu ret_stack that is used by the idle task. When we call
ftrace_graph_init_idle_task() it will check if the idle task's
ret_stack is NULL, if it is, then it will assign it the per_cpu
ret_stack.

Reported-by: Benjamin Herrenschmidt <[email protected]>
Suggested-by: Peter Zijlstra <[email protected]>
Signed-off-by: Steven Rostedt <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
include/linux/ftrace.h | 2 +
kernel/sched.c | 2 -
kernel/trace/ftrace.c | 52 ++++++++++++++++++++++++++++++++++++++++++-------
3 files changed, 48 insertions(+), 8 deletions(-)

Index: linux-2.6.35.y/include/linux/ftrace.h
===================================================================
--- linux-2.6.35.y.orig/include/linux/ftrace.h 2011-03-29 22:50:45.996081494 -0700
+++ linux-2.6.35.y/include/linux/ftrace.h 2011-03-29 23:03:02.204243769 -0700
@@ -423,6 +423,7 @@

extern void ftrace_graph_init_task(struct task_struct *t);
extern void ftrace_graph_exit_task(struct task_struct *t);
+extern void ftrace_graph_init_idle_task(struct task_struct *t, int cpu);

static inline int task_curr_ret_stack(struct task_struct *t)
{
@@ -446,6 +447,7 @@

static inline void ftrace_graph_init_task(struct task_struct *t) { }
static inline void ftrace_graph_exit_task(struct task_struct *t) { }
+static inline void ftrace_graph_init_idle_task(struct task_struct *t, int cpu) { }

static inline int register_ftrace_graph(trace_func_graph_ret_t retfunc,
trace_func_graph_ent_t entryfunc)
Index: linux-2.6.35.y/kernel/sched.c
===================================================================
--- linux-2.6.35.y.orig/kernel/sched.c 2011-03-29 23:03:00.443288827 -0700
+++ linux-2.6.35.y/kernel/sched.c 2011-03-29 23:03:02.207243691 -0700
@@ -5428,7 +5428,7 @@
* The idle tasks have their own, simple scheduling class:
*/
idle->sched_class = &idle_sched_class;
- ftrace_graph_init_task(idle);
+ ftrace_graph_init_idle_task(idle, cpu);
}

/*
Index: linux-2.6.35.y/kernel/trace/ftrace.c
===================================================================
--- linux-2.6.35.y.orig/kernel/trace/ftrace.c 2011-03-29 22:50:45.996081494 -0700
+++ linux-2.6.35.y/kernel/trace/ftrace.c 2011-03-29 23:03:02.225243230 -0700
@@ -3290,7 +3290,7 @@
/* The cpu_boot init_task->ret_stack will never be freed */
for_each_online_cpu(cpu) {
if (!idle_task(cpu)->ret_stack)
- ftrace_graph_init_task(idle_task(cpu));
+ ftrace_graph_init_idle_task(idle_task(cpu), cpu);
}

do {
@@ -3380,6 +3380,49 @@
mutex_unlock(&ftrace_lock);
}

+static DEFINE_PER_CPU(struct ftrace_ret_stack *, idle_ret_stack);
+
+static void
+graph_init_task(struct task_struct *t, struct ftrace_ret_stack *ret_stack)
+{
+ atomic_set(&t->tracing_graph_pause, 0);
+ atomic_set(&t->trace_overrun, 0);
+ t->ftrace_timestamp = 0;
+ /* make curr_ret_stack visable before we add the ret_stack */
+ smp_wmb();
+ t->ret_stack = ret_stack;
+}
+
+/*
+ * Allocate a return stack for the idle task. May be the first
+ * time through, or it may be done by CPU hotplug online.
+ */
+void ftrace_graph_init_idle_task(struct task_struct *t, int cpu)
+{
+ t->curr_ret_stack = -1;
+ /*
+ * The idle task has no parent, it either has its own
+ * stack or no stack at all.
+ */
+ if (t->ret_stack)
+ WARN_ON(t->ret_stack != per_cpu(idle_ret_stack, cpu));
+
+ if (ftrace_graph_active) {
+ struct ftrace_ret_stack *ret_stack;
+
+ ret_stack = per_cpu(idle_ret_stack, cpu);
+ if (!ret_stack) {
+ ret_stack = kmalloc(FTRACE_RETFUNC_DEPTH
+ * sizeof(struct ftrace_ret_stack),
+ GFP_KERNEL);
+ if (!ret_stack)
+ return;
+ per_cpu(idle_ret_stack, cpu) = ret_stack;
+ }
+ graph_init_task(t, ret_stack);
+ }
+}
+
/* Allocate a return stack for newly created task */
void ftrace_graph_init_task(struct task_struct *t)
{
@@ -3395,12 +3438,7 @@
GFP_KERNEL);
if (!ret_stack)
return;
- atomic_set(&t->tracing_graph_pause, 0);
- atomic_set(&t->trace_overrun, 0);
- t->ftrace_timestamp = 0;
- /* make curr_ret_stack visable before we add the ret_stack */
- smp_wmb();
- t->ret_stack = ret_stack;
+ graph_init_task(t, ret_stack);
}
}

2011-03-30 21:26:54

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [201/275] xhci: Fix cycle bit calculation during stall handling.

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Sarah Sharp <[email protected]>

commit 01a1fdb9a7afa5e3c14c9316d6f380732750b4e4 upstream.

When an endpoint stalls, we need to update the xHCI host's internal
dequeue pointer to move it past the stalled transfer. This includes
updating the cycle bit (TRB ownership bit) if we have moved the dequeue
pointer past a link TRB with the toggle cycle bit set.

When we're trying to find the new dequeue segment, find_trb_seg() is
supposed to keep track of whether we've passed any link TRBs with the
toggle cycle bit set. However, this while loop's body

while (cur_seg->trbs > trb ||
&cur_seg->trbs[TRBS_PER_SEGMENT - 1] < trb) {

Will never get executed if the ring only contains one segment.
find_trb_seg() will return immediately, without updating the new cycle
bit. Since find_trb_seg() has no idea where in the segment the TD that
stalled was, make the caller, xhci_find_new_dequeue_state(), check for
this special case and update the cycle bit accordingly.

This patch should be queued to kernels all the way back to 2.6.31.

Signed-off-by: Sarah Sharp <[email protected]>
Tested-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/usb/host/xhci-ring.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)

Index: linux-2.6.35.y/drivers/usb/host/xhci-ring.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/host/xhci-ring.c 2011-03-29 23:03:01.523261194 -0700
+++ linux-2.6.35.y/drivers/usb/host/xhci-ring.c 2011-03-29 23:53:39.667522684 -0700
@@ -483,6 +483,20 @@
state->new_cycle_state = ~(state->new_cycle_state) & 0x1;
next_trb(xhci, ep_ring, &state->new_deq_seg, &state->new_deq_ptr);

+ /*
+ * If there is only one segment in a ring, find_trb_seg()'s while loop
+ * will not run, and it will return before it has a chance to see if it
+ * needs to toggle the cycle bit. It can't tell if the stalled transfer
+ * ended just before the link TRB on a one-segment ring, or if the TD
+ * wrapped around the top of the ring, because it doesn't have the TD in
+ * question. Look for the one-segment case where stalled TRB's address
+ * is greater than the new dequeue pointer address.
+ */
+ if (ep_ring->first_seg == ep_ring->first_seg->next &&
+ state->new_deq_ptr < dev->eps[ep_index].stopped_trb)
+ state->new_cycle_state ^= 0x1;
+ xhci_dbg(xhci, "Cycle state = 0x%x\n", state->new_cycle_state);
+
/* Don't update the ring cycle state for the producer (us). */
xhci_dbg(xhci, "New dequeue segment = %p (virtual)\n",
state->new_deq_seg);

2011-03-30 21:27:38

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [193/275] ahci: AHCI mode SATA patch for Intel DH89xxCC DeviceIDs

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Seth Heasley <[email protected]>

commit a4a461a6df6c0481d5a3d61660ed97f5b539cf16 upstream.

This patch adds the AHCI-mode SATA DeviceID for the Intel DH89xxCC PCH.

Signed-off-by: Seth Heasley <[email protected]>
Signed-off-by: Jeff Garzik <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/ata/ahci.c | 1 +
1 file changed, 1 insertion(+)

Index: linux-2.6.35.y/drivers/ata/ahci.c
===================================================================
--- linux-2.6.35.y.orig/drivers/ata/ahci.c 2011-03-29 23:03:02.289241594 -0700
+++ linux-2.6.35.y/drivers/ata/ahci.c 2011-03-29 23:54:14.951619850 -0700
@@ -251,6 +251,7 @@
{ PCI_VDEVICE(INTEL, 0x1d02), board_ahci }, /* PBG AHCI */
{ PCI_VDEVICE(INTEL, 0x1d04), board_ahci }, /* PBG RAID */
{ PCI_VDEVICE(INTEL, 0x1d06), board_ahci }, /* PBG RAID */
+ { PCI_VDEVICE(INTEL, 0x2323), board_ahci }, /* DH89xxCC AHCI */

/* 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,

2011-03-30 21:27:51

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [200/275] USB: serial: ch341: add new id

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: wangyanqing <[email protected]>

commit d0781383038e983a63843a9a6a067ed781db89c1 upstream.

I picked up a new DAK-780EX(professional digitl reverb/mix system),
which use CH341T chipset to communication with computer on 3/2011
and the CH341T's vendor code is 1a86

Looking up the CH341T's vendor and product id's I see:

1a86 QinHeng Electronics
5523 CH341 in serial mode, usb to serial port converter

CH341T,CH341 are the products of the same company, maybe
have some common hardware, and I test the ch341.c works
well with CH341T

Cc: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/usb/serial/ch341.c | 1 +
1 file changed, 1 insertion(+)

Index: linux-2.6.35.y/drivers/usb/serial/ch341.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/serial/ch341.c 2011-03-29 23:02:58.478339106 -0700
+++ linux-2.6.35.y/drivers/usb/serial/ch341.c 2011-03-29 23:03:02.441237705 -0700
@@ -75,6 +75,7 @@
static const struct usb_device_id id_table[] = {
{ USB_DEVICE(0x4348, 0x5523) },
{ USB_DEVICE(0x1a86, 0x7523) },
+ { USB_DEVICE(0x1a86, 0x5523) },
{ },
};
MODULE_DEVICE_TABLE(usb, id_table);

2011-03-30 21:27:50

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [192/275] ahci: AHCI and RAID mode SATA patch for Intel Patsburg DeviceIDs

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Seth Heasley <[email protected]>

commit 992b3fb9b5391bc4de5b42bb810dc6dd583a6c4a upstream.

This patch adds the Intel Patsburg (PCH) SATA AHCI and RAID Controller
DeviceIDs.

Signed-off-by: Seth Heasley <[email protected]>
Signed-off-by: Jeff Garzik <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/ata/ahci.c | 3 +++
1 file changed, 3 insertions(+)

Index: linux-2.6.35.y/drivers/ata/ahci.c
===================================================================
--- linux-2.6.35.y.orig/drivers/ata/ahci.c 2011-03-29 22:50:44.387122663 -0700
+++ linux-2.6.35.y/drivers/ata/ahci.c 2011-03-29 23:54:15.478606367 -0700
@@ -248,6 +248,9 @@
{ PCI_VDEVICE(INTEL, 0x1c05), board_ahci }, /* CPT RAID */
{ PCI_VDEVICE(INTEL, 0x1c06), board_ahci }, /* CPT RAID */
{ PCI_VDEVICE(INTEL, 0x1c07), board_ahci }, /* CPT RAID */
+ { PCI_VDEVICE(INTEL, 0x1d02), board_ahci }, /* PBG AHCI */
+ { PCI_VDEVICE(INTEL, 0x1d04), board_ahci }, /* PBG RAID */
+ { PCI_VDEVICE(INTEL, 0x1d06), board_ahci }, /* PBG 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,

2011-03-30 21:28:17

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [187/275] MIPS: MTX-1: Make au1000_eth probe all PHY addresses

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Florian Fainelli <[email protected]>

commit bf3a1eb85967dcbaae42f4fcb53c2392cec32677 upstream.

When au1000_eth probes the MII bus for PHY address, if we do not set
au1000_eth platform data's phy_search_highest_address, the MII probing
logic will exit early and will assume a valid PHY is found at address 0.
For MTX-1, the PHY is at address 31, and without this patch, the link
detection/speed/duplex would not work correctly.

Signed-off-by: Florian Fainelli <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
To: [email protected]
Patchwork: https://patchwork.linux-mips.org/patch/2111/
Signed-off-by: Ralf Baechle <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
arch/mips/alchemy/mtx-1/platform.c | 9 +++++++++
1 file changed, 9 insertions(+)

Index: linux-2.6.35.y/arch/mips/alchemy/mtx-1/platform.c
===================================================================
--- linux-2.6.35.y.orig/arch/mips/alchemy/mtx-1/platform.c 2011-03-29 22:50:47.044054680 -0700
+++ linux-2.6.35.y/arch/mips/alchemy/mtx-1/platform.c 2011-03-29 23:03:02.147245227 -0700
@@ -28,6 +28,8 @@
#include <linux/mtd/physmap.h>
#include <mtd/mtd-abi.h>

+#include <asm/mach-au1x00/au1xxx_eth.h>
+
static struct gpio_keys_button mtx1_gpio_button[] = {
{
.gpio = 207,
@@ -140,10 +142,17 @@
&mtx1_mtd,
};

+static struct au1000_eth_platform_data mtx1_au1000_eth0_pdata = {
+ .phy_search_highest_addr = 1,
+ .phy1_search_mac0 = 1,
+};
+
static int __init mtx1_register_devices(void)
{
int rc;

+ au1xxx_override_eth_cfg(0, &mtx1_au1000_eth0_pdata);
+
rc = gpio_request(mtx1_gpio_button[0].gpio,
mtx1_gpio_button[0].desc);
if (rc < 0) {

2011-03-30 21:09:05

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [195/275] RDMA/cma: Fix crash in request handlers

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Sean Hefty <[email protected]>

commit 25ae21a10112875763c18b385624df713a288a05 upstream.

Doug Ledford and Red Hat reported a crash when running the rdma_cm on
a real-time OS. The crash has the following call trace:

cm_process_work
cma_req_handler
cma_disable_callback
rdma_create_id
kzalloc
init_completion
cma_get_net_info
cma_save_net_info
cma_any_addr
cma_zero_addr
rdma_translate_ip
rdma_copy_addr
cma_acquire_dev
rdma_addr_get_sgid
ib_find_cached_gid
cma_attach_to_dev
ucma_event_handler
kzalloc
ib_copy_ah_attr_to_user
cma_comp

[ preempted ]

cma_write
copy_from_user
ucma_destroy_id
copy_from_user
_ucma_find_context
ucma_put_ctx
ucma_free_ctx
rdma_destroy_id
cma_exch
cma_cancel_operation
rdma_node_get_transport

rt_mutex_slowunlock
bad_area_nosemaphore
oops_enter

They were able to reproduce the crash multiple times with the
following details:

Crash seems to always happen on the:
mutex_unlock(&conn_id->handler_mutex);
as conn_id looks to have been freed during this code path.

An examination of the code shows that a race exists in the request
handlers. When a new connection request is received, the rdma_cm
allocates a new connection identifier. This identifier has a single
reference count on it. If a user calls rdma_destroy_id() from another
thread after receiving a callback, rdma_destroy_id will proceed to
destroy the id and free the associated memory. However, the request
handlers may still be in the process of running. When control returns
to the request handlers, they can attempt to access the newly created
identifiers.

Fix this by holding a reference on the newly created rdma_cm_id until
the request handler is through accessing it.

Signed-off-by: Sean Hefty <[email protected]>
Acked-by: Doug Ledford <[email protected]>
Signed-off-by: Roland Dreier <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/infiniband/core/cma.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)

Index: linux-2.6.35.y/drivers/infiniband/core/cma.c
===================================================================
--- linux-2.6.35.y.orig/drivers/infiniband/core/cma.c 2011-03-29 22:50:42.822162706 -0700
+++ linux-2.6.35.y/drivers/infiniband/core/cma.c 2011-03-29 23:03:02.347240110 -0700
@@ -1136,6 +1136,11 @@
cm_id->context = conn_id;
cm_id->cm_handler = cma_ib_handler;

+ /*
+ * Protect against the user destroying conn_id from another thread
+ * until we're done accessing it.
+ */
+ atomic_inc(&conn_id->refcount);
ret = conn_id->id.event_handler(&conn_id->id, &event);
if (!ret) {
/*
@@ -1148,8 +1153,10 @@
ib_send_cm_mra(cm_id, CMA_CM_MRA_SETTING, NULL, 0);
mutex_unlock(&lock);
mutex_unlock(&conn_id->handler_mutex);
+ cma_deref_id(conn_id);
goto out;
}
+ cma_deref_id(conn_id);

/* Destroy the CM ID by returning a non-zero value. */
conn_id->cm_id.ib = NULL;
@@ -1351,17 +1358,25 @@
event.param.conn.private_data_len = iw_event->private_data_len;
event.param.conn.initiator_depth = attr.max_qp_init_rd_atom;
event.param.conn.responder_resources = attr.max_qp_rd_atom;
+
+ /*
+ * Protect against the user destroying conn_id from another thread
+ * until we're done accessing it.
+ */
+ atomic_inc(&conn_id->refcount);
ret = conn_id->id.event_handler(&conn_id->id, &event);
if (ret) {
/* User wants to destroy the CM ID */
conn_id->cm_id.iw = NULL;
cma_exch(conn_id, CMA_DESTROYING);
mutex_unlock(&conn_id->handler_mutex);
+ cma_deref_id(conn_id);
rdma_destroy_id(&conn_id->id);
goto out;
}

mutex_unlock(&conn_id->handler_mutex);
+ cma_deref_id(conn_id);

out:
if (dev)

2011-03-30 21:28:35

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [186/275] libata: no special completion processing for EH commands

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Tejun Heo <[email protected]>

commit f08dc1ac6b15c681f4643d8da1700e06c3855608 upstream.

ata_qc_complete() contains special handling for certain commands. For
example, it schedules EH for device revalidation after certain
configurations are changed. These shouldn't be applied to EH
commands but they were.

In most cases, it doesn't cause an actual problem because EH doesn't
issue any command which would trigger special handling; however, ACPI
can issue such commands via _GTF which can cause weird interactions.

Restructure ata_qc_complete() such that EH commands are always passed
on to __ata_qc_complete().

stable: Please apply to -stable only after 2.6.38 is released.

Signed-off-by: Tejun Heo <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Reported-by: Kyle McMartin <[email protected]>
Signed-off-by: Jeff Garzik <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
drivers/ata/libata-core.c | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)

Index: linux-2.6.35.y/drivers/ata/libata-core.c
===================================================================
--- linux-2.6.35.y.orig/drivers/ata/libata-core.c 2011-03-29 22:50:47.570041221 -0700
+++ linux-2.6.35.y/drivers/ata/libata-core.c 2011-03-29 23:03:02.128245713 -0700
@@ -4946,9 +4946,6 @@
{
struct ata_device *dev = qc->dev;

- if (ata_tag_internal(qc->tag))
- return;
-
if (ata_is_nodata(qc->tf.protocol))
return;

@@ -4992,14 +4989,23 @@
if (unlikely(qc->err_mask))
qc->flags |= ATA_QCFLAG_FAILED;

- if (unlikely(qc->flags & ATA_QCFLAG_FAILED)) {
- /* always fill result TF for failed qc */
+ /*
+ * Finish internal commands without any further processing
+ * and always with the result TF filled.
+ */
+ if (unlikely(ata_tag_internal(qc->tag))) {
fill_result_tf(qc);
+ __ata_qc_complete(qc);
+ return;
+ }

- if (!ata_tag_internal(qc->tag))
- ata_qc_schedule_eh(qc);
- else
- __ata_qc_complete(qc);
+ /*
+ * Non-internal qc has failed. Fill the result TF and
+ * summon EH.
+ */
+ if (unlikely(qc->flags & ATA_QCFLAG_FAILED)) {
+ fill_result_tf(qc);
+ ata_qc_schedule_eh(qc);
return;
}

2011-03-30 21:28:33

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [199/275] USB: serial/kobil_sct, fix potential tty NULL dereference

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Jiri Slaby <[email protected]>

commit 6960f40a954619857e7095a6179eef896f297077 upstream.

Make sure that we check the return value of tty_port_tty_get.
Sometimes it may return NULL and we later dereference that.

The only place here is in kobil_read_int_callback, so fix it.

Signed-off-by: Jiri Slaby <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Cc: Alan Cox <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
drivers/usb/serial/kobil_sct.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.35.y/drivers/usb/serial/kobil_sct.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/serial/kobil_sct.c 2011-03-29 22:50:40.699217027 -0700
+++ linux-2.6.35.y/drivers/usb/serial/kobil_sct.c 2011-03-29 23:03:02.423238165 -0700
@@ -372,7 +372,7 @@
}

tty = tty_port_tty_get(&port->port);
- if (urb->actual_length) {
+ if (tty && urb->actual_length) {

/* BEGIN DEBUG */
/*

2011-03-30 21:29:06

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [196/275] IB/cm: Bump reference count on cm_id before invoking callback

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Sean Hefty <[email protected]>

commit 29963437a48475036353b95ab142bf199adb909e upstream.

When processing a SIDR REQ, the ib_cm allocates a new cm_id. The
refcount of the cm_id is initialized to 1. However, cm_process_work
will decrement the refcount after invoking all callbacks. The result
is that the cm_id will end up with refcount set to 0 by the end of the
sidr req handler.

If a user tries to destroy the cm_id, the destruction will proceed,
under the incorrect assumption that no other threads are referencing
the cm_id. This can lead to a crash when the cm callback thread tries
to access the cm_id.

This problem was noticed as part of a larger investigation with kernel
crashes in the rdma_cm when running on a real time OS.

Signed-off-by: Sean Hefty <[email protected]>
Acked-by: Doug Ledford <[email protected]>
Signed-off-by: Roland Dreier <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/infiniband/core/cm.c | 1 +
1 file changed, 1 insertion(+)

Index: linux-2.6.35.y/drivers/infiniband/core/cm.c
===================================================================
--- linux-2.6.35.y.orig/drivers/infiniband/core/cm.c 2011-03-29 22:50:42.296176166 -0700
+++ linux-2.6.35.y/drivers/infiniband/core/cm.c 2011-03-29 23:03:02.367239599 -0700
@@ -2987,6 +2987,7 @@
goto out; /* No match. */
}
atomic_inc(&cur_cm_id_priv->refcount);
+ atomic_inc(&cm_id_priv->refcount);
spin_unlock_irq(&cm.lock);

cm_id_priv->id.cm_handler = cur_cm_id_priv->id.cm_handler;

2011-03-30 21:29:04

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [197/275] x86, quirk: Fix SB600 revision check

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Andreas Herrmann <[email protected]>

commit 1d3e09a304e6c4e004ca06356578b171e8735d3c upstream.

Commit 7f74f8f28a2bd9db9404f7d364e2097a0c42cc12
(x86 quirk: Fix polarity for IRQ0 pin2 override on SB800
systems) introduced a regression. It removed some SB600 specific
code to determine the revision ID without adapting a
corresponding revision ID check for SB600.

See this mail thread:

http://marc.info/?l=linux-kernel&m=129980296006380&w=2

This patch adapts the corresponding check to cover all SB600
revisions.

Tested-by: Wang Lei <[email protected]>
Signed-off-by: Andreas Herrmann <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Cc: Andrew Morton <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
arch/x86/kernel/early-quirks.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

Index: linux-2.6.35.y/arch/x86/kernel/early-quirks.c
===================================================================
--- linux-2.6.35.y.orig/arch/x86/kernel/early-quirks.c 2011-03-29 23:03:01.447263137 -0700
+++ linux-2.6.35.y/arch/x86/kernel/early-quirks.c 2011-03-29 23:03:02.000000000 -0700
@@ -161,7 +161,12 @@
if (rev >= 0x40)
acpi_fix_pin2_polarity = 1;

- if (rev > 0x13)
+ /*
+ * SB600: revisions 0x11, 0x12, 0x13, 0x14, ...
+ * SB700: revisions 0x39, 0x3a, ...
+ * SB800: revisions 0x40, 0x41, ...
+ */
+ if (rev >= 0x39)
return;

if (acpi_use_timer_override)

2011-03-30 21:08:59

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [185/275] mtd: add "platform:" prefix for platform modalias

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Axel Lin <[email protected]>

commit c804c733846572ca85c2bba60c7fe6fa024dff18 upstream.

Since 43cc71eed1250755986da4c0f9898f9a635cb3bf (platform: prefix MODALIAS
with "platform:"), the platform modalias is prefixed with "platform:".

Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Artem Bityutskiy <[email protected]>
Signed-off-by: David Woodhouse <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/mtd/nand/omap2.c | 2 +-
drivers/mtd/onenand/generic.c | 2 +-
drivers/mtd/onenand/omap2.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

Index: linux-2.6.35.y/drivers/mtd/nand/omap2.c
===================================================================
--- linux-2.6.35.y.orig/drivers/mtd/nand/omap2.c 2011-03-29 22:50:48.138026688 -0700
+++ linux-2.6.35.y/drivers/mtd/nand/omap2.c 2011-03-29 23:03:02.106246277 -0700
@@ -1077,6 +1077,6 @@
module_init(omap_nand_init);
module_exit(omap_nand_exit);

-MODULE_ALIAS(DRIVER_NAME);
+MODULE_ALIAS("platform:" DRIVER_NAME);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Glue layer for NAND flash on TI OMAP boards");
Index: linux-2.6.35.y/drivers/mtd/onenand/generic.c
===================================================================
--- linux-2.6.35.y.orig/drivers/mtd/onenand/generic.c 2011-03-29 22:50:48.138026688 -0700
+++ linux-2.6.35.y/drivers/mtd/onenand/generic.c 2011-03-29 23:03:02.106246277 -0700
@@ -131,7 +131,7 @@
.remove = __devexit_p(generic_onenand_remove),
};

-MODULE_ALIAS(DRIVER_NAME);
+MODULE_ALIAS("platform:" DRIVER_NAME);

static int __init generic_onenand_init(void)
{
Index: linux-2.6.35.y/drivers/mtd/onenand/omap2.c
===================================================================
--- linux-2.6.35.y.orig/drivers/mtd/onenand/omap2.c 2011-03-29 22:50:48.138026688 -0700
+++ linux-2.6.35.y/drivers/mtd/onenand/omap2.c 2011-03-29 23:03:02.107246252 -0700
@@ -815,7 +815,7 @@
module_init(omap2_onenand_init);
module_exit(omap2_onenand_exit);

-MODULE_ALIAS(DRIVER_NAME);
+MODULE_ALIAS("platform:" DRIVER_NAME);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Jarkko Lavinen <[email protected]>");
MODULE_DESCRIPTION("Glue layer for OneNAND flash on OMAP2 / OMAP3");

2011-03-30 21:08:57

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [183/275] ip6ip6: autoload ip6 tunnel

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: stephen hemminger <[email protected]>
Date: Thu, 10 Mar 2011 11:43:19 +0000 (+0000)
Subject: ip6ip6: autoload ip6 tunnel

From: stephen hemminger <[email protected]>

commit 6dfbd87a20a737641ef228230c77f4262434fa24 upstream

ip6ip6: autoload ip6 tunnel

Add necessary alias to autoload ip6ip6 tunnel module.

Signed-off-by: Stephen Hemminger <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
net/ipv6/ip6_tunnel.c | 1 +
1 file changed, 1 insertion(+)

Index: linux-2.6.35.y/net/ipv6/ip6_tunnel.c
===================================================================
--- linux-2.6.35.y.orig/net/ipv6/ip6_tunnel.c 2011-03-29 22:50:49.173000204 -0700
+++ linux-2.6.35.y/net/ipv6/ip6_tunnel.c 2011-03-29 23:03:02.067247275 -0700
@@ -57,6 +57,7 @@
MODULE_AUTHOR("Ville Nuorvala");
MODULE_DESCRIPTION("IPv6 tunneling device");
MODULE_LICENSE("GPL");
+MODULE_ALIAS_NETDEV("ip6tnl0");

#define IPV6_TLV_TEL_DST_SIZE 8

2011-03-30 21:29:51

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [191/275] x86: Emit "mem=nopentium ignored" warning when not supported

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Kamal Mostafa <[email protected]>

commit 9a6d44b9adb777ca9549e88cd55bd8f2673c52a2 upstream.

Emit warning when "mem=nopentium" is specified on any arch other
than x86_32 (the only that arch supports it).

Signed-off-by: Kamal Mostafa <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
BugLink: http://bugs.launchpad.net/bugs/553464
Cc: Yinghai Lu <[email protected]>
Cc: Len Brown <[email protected]>
Cc: Rafael J. Wysocki <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
arch/x86/kernel/e820.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

Index: linux-2.6.35.y/arch/x86/kernel/e820.c
===================================================================
--- linux-2.6.35.y.orig/arch/x86/kernel/e820.c 2011-03-29 23:03:02.252242542 -0700
+++ linux-2.6.35.y/arch/x86/kernel/e820.c 2011-03-29 23:03:02.270242081 -0700
@@ -980,12 +980,15 @@
if (!p)
return -EINVAL;

-#ifdef CONFIG_X86_32
if (!strcmp(p, "nopentium")) {
+#ifdef CONFIG_X86_32
setup_clear_cpu_cap(X86_FEATURE_PSE);
return 0;
- }
+#else
+ printk(KERN_WARNING "mem=nopentium ignored! (only supported on x86_32)\n");
+ return -EINVAL;
#endif
+ }

userdef = 1;
mem_size = memparse(p, &p);

2011-03-30 21:30:18

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [190/275] x86: Fix panic when handling "mem={invalid}" param

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Kamal Mostafa <[email protected]>

commit 77eed821accf5dd962b1f13bed0680e217e49112 upstream.

Avoid removing all of memory and panicing when "mem={invalid}"
is specified, e.g. mem=blahblah, mem=0, or mem=nopentium (on
platforms other than x86_32).

Signed-off-by: Kamal Mostafa <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
BugLink: http://bugs.launchpad.net/bugs/553464
Cc: Yinghai Lu <[email protected]>
Cc: Len Brown <[email protected]>
Cc: Rafael J. Wysocki <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
arch/x86/kernel/e820.c | 3 +++
1 file changed, 3 insertions(+)

Index: linux-2.6.35.y/arch/x86/kernel/e820.c
===================================================================
--- linux-2.6.35.y.orig/arch/x86/kernel/e820.c 2011-03-29 22:50:45.435095848 -0700
+++ linux-2.6.35.y/arch/x86/kernel/e820.c 2011-03-29 23:54:16.526579552 -0700
@@ -989,6 +989,9 @@

userdef = 1;
mem_size = memparse(p, &p);
+ /* don't remove all of memory when handling "mem={invalid}" param */
+ if (mem_size == 0)
+ return -EINVAL;
e820_remove_range(mem_size, ULLONG_MAX - mem_size, E820_RAM, 1);

return 0;

2011-03-30 21:08:54

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [184/275] hwmon/f71882fg: Set platform drvdata to NULL later

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Hans de Goede <[email protected]>

commit d9ebaa45472c92704f4814682eec21455edcfa1f upstream.

This avoids a possible race leading to trying to dereference NULL.

Signed-off-by: Hans de Goede <[email protected]>
Acked-by: Jean Delvare <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/hwmon/f71882fg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.35.y/drivers/hwmon/f71882fg.c
===================================================================
--- linux-2.6.35.y.orig/drivers/hwmon/f71882fg.c 2011-03-29 22:50:48.657013408 -0700
+++ linux-2.6.35.y/drivers/hwmon/f71882fg.c 2011-03-29 23:03:02.087246763 -0700
@@ -2100,7 +2100,6 @@
int nr_fans = (data->type == f71882fg) ? 4 : 3;
u8 start_reg = f71882fg_read8(data, F71882FG_REG_START);

- platform_set_drvdata(pdev, NULL);
if (data->hwmon_dev)
hwmon_device_unregister(data->hwmon_dev);

@@ -2167,6 +2166,7 @@
}
}

+ platform_set_drvdata(pdev, NULL);
kfree(data);

return 0;

2011-03-30 21:30:57

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [188/275] x86/mm: Handle mm_fault_error() in kernel space

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Andrey Vagin <[email protected]>

commit f86268549f424f83b9eb0963989270e14fbfc3de upstream.

mm_fault_error() should not execute oom-killer, if page fault
occurs in kernel space. E.g. in copy_from_user()/copy_to_user().

This would happen if we find ourselves in OOM on a
copy_to_user(), or a copy_from_user() which faults.

Without this patch, the kernels hangs up in copy_from_user(),
because OOM killer sends SIG_KILL to current process, but it
can't handle a signal while in syscall, then the kernel returns
to copy_from_user(), reexcute current command and provokes
page_fault again.

With this patch the kernel return -EFAULT from copy_from_user().

The code, which checks that page fault occurred in kernel space,
has been copied from do_sigbus().

This situation is handled by the same way on powerpc, xtensa,
tile, ...

Signed-off-by: Andrey Vagin <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: Linus Torvalds <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
arch/x86/mm/fault.c | 7 +++++++
1 file changed, 7 insertions(+)

Index: linux-2.6.35.y/arch/x86/mm/fault.c
===================================================================
--- linux-2.6.35.y.orig/arch/x86/mm/fault.c 2011-03-29 22:50:46.520068086 -0700
+++ linux-2.6.35.y/arch/x86/mm/fault.c 2011-03-29 23:03:02.185244254 -0700
@@ -831,6 +831,13 @@
unsigned long address, unsigned int fault)
{
if (fault & VM_FAULT_OOM) {
+ /* Kernel mode? Handle exceptions or die: */
+ if (!(error_code & PF_USER)) {
+ up_read(&current->mm->mmap_sem);
+ no_context(regs, error_code, address);
+ return;
+ }
+
out_of_memory(regs, error_code, address);
} else {
if (fault & (VM_FAULT_SIGBUS|VM_FAULT_HWPOISON))

2011-03-30 21:31:06

by Andi Kleen

[permalink] [raw]
Subject: Re: [PATCH] [73/275] tpm_tis: Use timeouts returned from TPM

On Wed, Mar 30, 2011 at 05:24:08PM -0400, Stefan Berger wrote:
> On 03/30/2011 05:20 PM, Andi Kleen wrote:
> >On Wed, Mar 30, 2011 at 05:13:09PM -0400, Stefan Berger wrote:
> >>On 03/30/2011 05:05 PM, Andi Kleen wrote:
> >>
> >>Please drop it. It has been rejected previously. A revised patch has
> >>been sent.
> >Ok. What is the subject of the revised patch?
> It's part of a series I re-posted again today:
>
> [PATCH V2 00/12] tpm + tpm_tis : Various fixes
>
> https://lkml.org/lkml/2011/3/30/290

I don't see a cc stable so I assume you don't want that in 2.6.35.
I dropped the original patch.

-Andi

--
[email protected] -- Speaking for myself only.

2011-03-30 21:08:49

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [179/275] netfilter: nf_log: avoid oops in (un)bind with invalid nfproto values

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Jan Engelhardt <[email protected]>

commit 9ef0298a8e5730d9a46d640014c727f3b4152870 upstream.

Like many other places, we have to check that the array index is
within allowed limits, or otherwise, a kernel oops and other nastiness
can ensue when we access memory beyond the end of the array.

[ 5954.115381] BUG: unable to handle kernel paging request at 0000004000000000
[ 5954.120014] IP: __find_logger+0x6f/0xa0
[ 5954.123979] nf_log_bind_pf+0x2b/0x70
[ 5954.123979] nfulnl_recv_config+0xc0/0x4a0 [nfnetlink_log]
[ 5954.123979] nfnetlink_rcv_msg+0x12c/0x1b0 [nfnetlink]
...

The problem goes back to v2.6.30-rc1~1372~1342~31 where nf_log_bind
was decoupled from nf_log_register.

Reported-by: Miguel Di Ciurcio Filho <[email protected]>,
via irc.freenode.net/#netfilter
Signed-off-by: Jan Engelhardt <[email protected]>
Signed-off-by: Patrick McHardy <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
net/netfilter/nf_log.c | 4 ++++
1 file changed, 4 insertions(+)

Index: linux-2.6.35.y/net/netfilter/nf_log.c
===================================================================
--- linux-2.6.35.y.orig/net/netfilter/nf_log.c 2011-03-29 22:50:51.752934191 -0700
+++ linux-2.6.35.y/net/netfilter/nf_log.c 2011-03-29 23:03:01.956250115 -0700
@@ -85,6 +85,8 @@

int nf_log_bind_pf(u_int8_t pf, const struct nf_logger *logger)
{
+ if (pf >= ARRAY_SIZE(nf_loggers))
+ return -EINVAL;
mutex_lock(&nf_log_mutex);
if (__find_logger(pf, logger->name) == NULL) {
mutex_unlock(&nf_log_mutex);
@@ -98,6 +100,8 @@

void nf_log_unbind_pf(u_int8_t pf)
{
+ if (pf >= ARRAY_SIZE(nf_loggers))
+ return;
mutex_lock(&nf_log_mutex);
rcu_assign_pointer(nf_loggers[pf], NULL);
mutex_unlock(&nf_log_mutex);

2011-03-30 21:31:31

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [173/275] cpuset: add a missing unlock in cpuset_write_resmask()

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Li Zefan <[email protected]>

commit b75f38d659e6fc747eda64cb72f3920e29dd44a4 upstream.

Don't forget to release cgroup_mutex if alloc_trial_cpuset() fails.

[[email protected]: avoid multiple return points]
Signed-off-by: Li Zefan <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Cc: Paul Menage <[email protected]>
Acked-by: David Rientjes <[email protected]>
Cc: Miao Xie <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
kernel/cpuset.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

Index: linux-2.6.35.y/kernel/cpuset.c
===================================================================
--- linux-2.6.35.y.orig/kernel/cpuset.c 2011-03-29 22:50:54.764857122 -0700
+++ linux-2.6.35.y/kernel/cpuset.c 2011-03-29 23:03:01.845252954 -0700
@@ -1576,8 +1576,10 @@
return -ENODEV;

trialcs = alloc_trial_cpuset(cs);
- if (!trialcs)
- return -ENOMEM;
+ if (!trialcs) {
+ retval = -ENOMEM;
+ goto out;
+ }

switch (cft->private) {
case FILE_CPULIST:
@@ -1592,6 +1594,7 @@
}

free_trial_cpuset(trialcs);
+out:
cgroup_unlock();
return retval;
}

2011-03-30 21:31:46

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [162/275] x86: Use u32 instead of long to set reset vector back to 0

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Don Zickus <[email protected]>

commit 299c56966a72b9109d47c71a6db52097098703dd upstream.

A customer of ours, complained that when setting the reset
vector back to 0, it trashed other data and hung their box.
They noticed when only 4 bytes were set to 0 instead of 8,
everything worked correctly.

Mathew pointed out:

|
| We're supposed to be resetting trampoline_phys_low and
| trampoline_phys_high here, which are two 16-bit values.
| Writing 64 bits is definitely going to overwrite space
| that we're not supposed to be touching.
|

So limit the area modified to u32.

Signed-off-by: Don Zickus <[email protected]>
Acked-by: Matthew Garrett <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
arch/x86/include/asm/smpboot_hooks.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.35.y/arch/x86/include/asm/smpboot_hooks.h
===================================================================
--- linux-2.6.35.y.orig/arch/x86/include/asm/smpboot_hooks.h 2011-03-29 22:51:00.390713170 -0700
+++ linux-2.6.35.y/arch/x86/include/asm/smpboot_hooks.h 2011-03-29 23:03:01.622258662 -0700
@@ -34,7 +34,7 @@
*/
CMOS_WRITE(0, 0xf);

- *((volatile long *)phys_to_virt(apic->trampoline_phys_low)) = 0;
+ *((volatile u32 *)phys_to_virt(apic->trampoline_phys_low)) = 0;
}

static inline void __init smpboot_setup_io_apic(void)

2011-03-30 21:31:44

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [164/275] clockevents: Prevent oneshot mode when broadcast device is periodic

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Thomas Gleixner <[email protected]>

commit 3a142a0672b48a853f00af61f184c7341ac9c99d upstream.

When the per cpu timer is marked CLOCK_EVT_FEAT_C3STOP, then we only
can switch into oneshot mode, when the backup broadcast device
supports oneshot mode as well. Otherwise we would try to switch the
broadcast device into an unsupported mode unconditionally. This went
unnoticed so far as the current available broadcast devices support
oneshot mode. Seth unearthed this problem while debugging and working
around an hpet related BIOS wreckage.

Add the necessary check to tick_is_oneshot_available().

Reported-and-tested-by: Seth Forshee <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
kernel/time/tick-broadcast.c | 10 ++++++++++
kernel/time/tick-common.c | 6 +++++-
kernel/time/tick-internal.h | 3 +++
3 files changed, 18 insertions(+), 1 deletion(-)

Index: linux-2.6.35.y/kernel/time/tick-broadcast.c
===================================================================
--- linux-2.6.35.y.orig/kernel/time/tick-broadcast.c 2011-03-29 22:50:59.394738656 -0700
+++ linux-2.6.35.y/kernel/time/tick-broadcast.c 2011-03-29 23:03:01.661257663 -0700
@@ -600,4 +600,14 @@
return tick_broadcast_device.mode == TICKDEV_MODE_ONESHOT;
}

+/*
+ * Check whether the broadcast device supports oneshot.
+ */
+bool tick_broadcast_oneshot_available(void)
+{
+ struct clock_event_device *bc = tick_broadcast_device.evtdev;
+
+ return bc ? bc->features & CLOCK_EVT_FEAT_ONESHOT : false;
+}
+
#endif
Index: linux-2.6.35.y/kernel/time/tick-common.c
===================================================================
--- linux-2.6.35.y.orig/kernel/time/tick-common.c 2011-03-29 22:50:59.393738682 -0700
+++ linux-2.6.35.y/kernel/time/tick-common.c 2011-03-29 23:03:01.662257637 -0700
@@ -51,7 +51,11 @@
{
struct clock_event_device *dev = __get_cpu_var(tick_cpu_device).evtdev;

- return dev && (dev->features & CLOCK_EVT_FEAT_ONESHOT);
+ if (!dev || !(dev->features & CLOCK_EVT_FEAT_ONESHOT))
+ return 0;
+ if (!(dev->features & CLOCK_EVT_FEAT_C3STOP))
+ return 1;
+ return tick_broadcast_oneshot_available();
}

/*
Index: linux-2.6.35.y/kernel/time/tick-internal.h
===================================================================
--- linux-2.6.35.y.orig/kernel/time/tick-internal.h 2011-03-29 22:50:59.393738682 -0700
+++ linux-2.6.35.y/kernel/time/tick-internal.h 2011-03-29 23:03:01.669257458 -0700
@@ -36,6 +36,7 @@
extern int tick_resume_broadcast_oneshot(struct clock_event_device *bc);
extern int tick_broadcast_oneshot_active(void);
extern void tick_check_oneshot_broadcast(int cpu);
+bool tick_broadcast_oneshot_available(void);
# else /* BROADCAST */
static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
{
@@ -46,6 +47,7 @@
static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { }
static inline int tick_broadcast_oneshot_active(void) { return 0; }
static inline void tick_check_oneshot_broadcast(int cpu) { }
+static inline bool tick_broadcast_oneshot_available(void) { return true; }
# endif /* !BROADCAST */

#else /* !ONESHOT */
@@ -76,6 +78,7 @@
return 0;
}
static inline int tick_broadcast_oneshot_active(void) { return 0; }
+static inline bool tick_broadcast_oneshot_available(void) { return false; }
#endif /* !TICK_ONESHOT */

/*

2011-03-30 21:32:16

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [163/275] fuse: fix hang of single threaded fuseblk filesystem

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Miklos Szeredi <[email protected]>

commit 5a18ec176c934ca1bc9dc61580a5e0e90a9b5733 upstream.

Single threaded NTFS-3G could get stuck if a delayed RELEASE reply
triggered a DESTROY request via path_put().

Fix this by

a) making RELEASE requests synchronous, whenever possible, on fuseblk
filesystems

b) if not possible (triggered by an asynchronous read/write) then do
the path_put() in a separate thread with schedule_work().

Reported-by: Oliver Neukum <[email protected]>
Signed-off-by: Miklos Szeredi <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
fs/fuse/file.c | 52 +++++++++++++++++++++++++++++++++++++++++++++-------
fs/fuse/fuse_i.h | 6 +++++-
2 files changed, 50 insertions(+), 8 deletions(-)

Index: linux-2.6.35.y/fs/fuse/file.c
===================================================================
--- linux-2.6.35.y.orig/fs/fuse/file.c 2011-03-29 22:50:59.901725684 -0700
+++ linux-2.6.35.y/fs/fuse/file.c 2011-03-29 23:03:01.641258175 -0700
@@ -86,18 +86,52 @@
return ff;
}

+static void fuse_release_async(struct work_struct *work)
+{
+ struct fuse_req *req;
+ struct fuse_conn *fc;
+ struct path path;
+
+ req = container_of(work, struct fuse_req, misc.release.work);
+ path = req->misc.release.path;
+ fc = get_fuse_conn(path.dentry->d_inode);
+
+ fuse_put_request(fc, req);
+ path_put(&path);
+}
+
static void fuse_release_end(struct fuse_conn *fc, struct fuse_req *req)
{
- path_put(&req->misc.release.path);
+ if (fc->destroy_req) {
+ /*
+ * If this is a fuseblk mount, then it's possible that
+ * releasing the path will result in releasing the
+ * super block and sending the DESTROY request. If
+ * the server is single threaded, this would hang.
+ * For this reason do the path_put() in a separate
+ * thread.
+ */
+ atomic_inc(&req->count);
+ INIT_WORK(&req->misc.release.work, fuse_release_async);
+ schedule_work(&req->misc.release.work);
+ } else {
+ path_put(&req->misc.release.path);
+ }
}

-static void fuse_file_put(struct fuse_file *ff)
+static void fuse_file_put(struct fuse_file *ff, bool sync)
{
if (atomic_dec_and_test(&ff->count)) {
struct fuse_req *req = ff->reserved_req;

- req->end = fuse_release_end;
- fuse_request_send_background(ff->fc, req);
+ if (sync) {
+ fuse_request_send(ff->fc, req);
+ path_put(&req->misc.release.path);
+ fuse_put_request(ff->fc, req);
+ } else {
+ req->end = fuse_release_end;
+ fuse_request_send_background(ff->fc, req);
+ }
kfree(ff);
}
}
@@ -219,8 +253,12 @@
* Normally this will send the RELEASE request, however if
* some asynchronous READ or WRITE requests are outstanding,
* the sending will be delayed.
+ *
+ * Make the release synchronous if this is a fuseblk mount,
+ * synchronous RELEASE is allowed (and desirable) in this case
+ * because the server can be trusted not to screw up.
*/
- fuse_file_put(ff);
+ fuse_file_put(ff, ff->fc->destroy_req != NULL);
}

static int fuse_open(struct inode *inode, struct file *file)
@@ -558,7 +596,7 @@
page_cache_release(page);
}
if (req->ff)
- fuse_file_put(req->ff);
+ fuse_file_put(req->ff, false);
}

static void fuse_send_readpages(struct fuse_req *req, struct file *file)
@@ -1137,7 +1175,7 @@
static void fuse_writepage_free(struct fuse_conn *fc, struct fuse_req *req)
{
__free_page(req->pages[0]);
- fuse_file_put(req->ff);
+ fuse_file_put(req->ff, false);
}

static void fuse_writepage_finish(struct fuse_conn *fc, struct fuse_req *req)
Index: linux-2.6.35.y/fs/fuse/fuse_i.h
===================================================================
--- linux-2.6.35.y.orig/fs/fuse/fuse_i.h 2011-03-29 22:50:59.901725684 -0700
+++ linux-2.6.35.y/fs/fuse/fuse_i.h 2011-03-29 23:03:01.642258149 -0700
@@ -21,6 +21,7 @@
#include <linux/rwsem.h>
#include <linux/rbtree.h>
#include <linux/poll.h>
+#include <linux/workqueue.h>

/** Max number of pages that can be used in a single read request */
#define FUSE_MAX_PAGES_PER_REQ 32
@@ -257,7 +258,10 @@
union {
struct fuse_forget_in forget_in;
struct {
- struct fuse_release_in in;
+ union {
+ struct fuse_release_in in;
+ struct work_struct work;
+ };
struct path path;
} release;
struct fuse_init_in init_in;

2011-03-30 21:32:15

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [181/275] r8169: use RxFIFO overflow workaround for 8168c chipset.

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Ivan Vecera <[email protected]>

commit b5ba6d12bdac21bc0620a5089e0f24e362645efd upstream.

I found that one of the 8168c chipsets (concretely XID 1c4000c0) starts
generating RxFIFO overflow errors. The result is an infinite loop in
interrupt handler as the RxFIFOOver is handled only for ...MAC_VER_11.
With the workaround everything goes fine.

Signed-off-by: Ivan Vecera <[email protected]>
Acked-by: Francois Romieu <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Cc: Hayes <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
drivers/net/r8169.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

Index: linux-2.6.35.y/drivers/net/r8169.c
===================================================================
--- linux-2.6.35.y.orig/drivers/net/r8169.c 2011-03-29 23:03:01.765255002 -0700
+++ linux-2.6.35.y/drivers/net/r8169.c 2011-03-29 23:03:01.995249117 -0700
@@ -3750,7 +3750,8 @@
RTL_W16(IntrMitigate, 0x5151);

/* Work around for RxFIFO overflow. */
- if (tp->mac_version == RTL_GIGA_MAC_VER_11) {
+ if (tp->mac_version == RTL_GIGA_MAC_VER_11 ||
+ tp->mac_version == RTL_GIGA_MAC_VER_22) {
tp->intr_event |= RxFIFOOver | PCSTimeout;
tp->intr_event &= ~RxOverflow;
}
@@ -4637,7 +4638,8 @@

/* Work around for rx fifo overflow */
if (unlikely(status & RxFIFOOver) &&
- (tp->mac_version == RTL_GIGA_MAC_VER_11)) {
+ (tp->mac_version == RTL_GIGA_MAC_VER_11 ||
+ tp->mac_version == RTL_GIGA_MAC_VER_22)) {
netif_stop_queue(dev);
rtl8169_tx_timeout(dev);
break;

2011-03-30 21:32:13

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [182/275] net: don't allow CAP_NET_ADMIN to load non-netdev kernel modules

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Vasiliy Kulikov <[email protected]>

commit 8909c9ad8ff03611c9c96c9a92656213e4bb495b upstream.

Since a8f80e8ff94ecba629542d9b4b5f5a8ee3eb565c any process with
CAP_NET_ADMIN may load any module from /lib/modules/. This doesn't mean
that CAP_NET_ADMIN is a superset of CAP_SYS_MODULE as modules are
limited to /lib/modules/**. However, CAP_NET_ADMIN capability shouldn't
allow anybody load any module not related to networking.

This patch restricts an ability of autoloading modules to netdev modules
with explicit aliases. This fixes CVE-2011-1019.

Arnd Bergmann suggested to leave untouched the old pre-v2.6.32 behavior
of loading netdev modules by name (without any prefix) for processes
with CAP_SYS_MODULE to maintain the compatibility with network scripts
that use autoloading netdev modules by aliases like "eth0", "wlan0".

Currently there are only three users of the feature in the upstream
kernel: ipip, ip_gre and sit.

root@albatros:~# capsh --drop=$(seq -s, 0 11),$(seq -s, 13 34) --
root@albatros:~# grep Cap /proc/$$/status
CapInh: 0000000000000000
CapPrm: fffffff800001000
CapEff: fffffff800001000
CapBnd: fffffff800001000
root@albatros:~# modprobe xfs
FATAL: Error inserting xfs
(/lib/modules/2.6.38-rc6-00001-g2bf4ca3/kernel/fs/xfs/xfs.ko): Operation not permitted
root@albatros:~# lsmod | grep xfs
root@albatros:~# ifconfig xfs
xfs: error fetching interface information: Device not found
root@albatros:~# lsmod | grep xfs
root@albatros:~# lsmod | grep sit
root@albatros:~# ifconfig sit
sit: error fetching interface information: Device not found
root@albatros:~# lsmod | grep sit
root@albatros:~# ifconfig sit0
sit0 Link encap:IPv6-in-IPv4
NOARP MTU:1480 Metric:1

root@albatros:~# lsmod | grep sit
sit 10457 0
tunnel4 2957 1 sit

For CAP_SYS_MODULE module loading is still relaxed:

root@albatros:~# grep Cap /proc/$$/status
CapInh: 0000000000000000
CapPrm: ffffffffffffffff
CapEff: ffffffffffffffff
CapBnd: ffffffffffffffff
root@albatros:~# ifconfig xfs
xfs: error fetching interface information: Device not found
root@albatros:~# lsmod | grep xfs
xfs 745319 0

Reference: https://lkml.org/lkml/2011/2/24/203

Signed-off-by: Vasiliy Kulikov <[email protected]>
Signed-off-by: Michael Tokarev <[email protected]>
Acked-by: David S. Miller <[email protected]>
Acked-by: Kees Cook <[email protected]>
Signed-off-by: James Morris <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
include/linux/netdevice.h | 4 ++++
net/core/dev.c | 13 ++++++++++---
net/ipv4/ip_gre.c | 1 +
net/ipv4/ipip.c | 1 +
net/ipv6/sit.c | 2 +-
5 files changed, 17 insertions(+), 4 deletions(-)

Index: linux-2.6.35.y/include/linux/netdevice.h
===================================================================
--- linux-2.6.35.y.orig/include/linux/netdevice.h 2011-03-29 22:50:49.747985492 -0700
+++ linux-2.6.35.y/include/linux/netdevice.h 2011-03-29 23:03:02.015248604 -0700
@@ -2344,6 +2344,10 @@
})
#endif

+#define MODULE_ALIAS_NETDEV(device) \
+ MODULE_ALIAS("netdev-" device)
+
+
#endif /* __KERNEL__ */

#endif /* _LINUX_NETDEVICE_H */
Index: linux-2.6.35.y/net/core/dev.c
===================================================================
--- linux-2.6.35.y.orig/net/core/dev.c 2011-03-29 22:50:49.746985518 -0700
+++ linux-2.6.35.y/net/core/dev.c 2011-03-29 23:03:02.017248554 -0700
@@ -1121,13 +1121,20 @@
void dev_load(struct net *net, const char *name)
{
struct net_device *dev;
+ int no_module;

rcu_read_lock();
dev = dev_get_by_name_rcu(net, name);
rcu_read_unlock();
-
- if (!dev && capable(CAP_NET_ADMIN))
- request_module("%s", name);
+ no_module = !dev;
+ if (no_module && capable(CAP_NET_ADMIN))
+ no_module = request_module("netdev-%s", name);
+ if (no_module && capable(CAP_SYS_MODULE)) {
+ if (!request_module("%s", name))
+ pr_err("Loading kernel module for a network device "
+"with CAP_SYS_MODULE (deprecated). Use CAP_NET_ADMIN and alias netdev-%s "
+"instead\n", name);
+ }
}
EXPORT_SYMBOL(dev_load);

Index: linux-2.6.35.y/net/ipv4/ip_gre.c
===================================================================
--- linux-2.6.35.y.orig/net/ipv4/ip_gre.c 2011-03-29 22:50:49.747985492 -0700
+++ linux-2.6.35.y/net/ipv4/ip_gre.c 2011-03-29 23:03:02.019248504 -0700
@@ -1701,3 +1701,4 @@
MODULE_LICENSE("GPL");
MODULE_ALIAS_RTNL_LINK("gre");
MODULE_ALIAS_RTNL_LINK("gretap");
+MODULE_ALIAS_NETDEV("gre0");
Index: linux-2.6.35.y/net/ipv4/ipip.c
===================================================================
--- linux-2.6.35.y.orig/net/ipv4/ipip.c 2011-03-29 22:50:49.747985492 -0700
+++ linux-2.6.35.y/net/ipv4/ipip.c 2011-03-29 23:03:02.021248452 -0700
@@ -850,3 +850,4 @@
module_init(ipip_init);
module_exit(ipip_fini);
MODULE_LICENSE("GPL");
+MODULE_ALIAS_NETDEV("tunl0");
Index: linux-2.6.35.y/net/ipv6/sit.c
===================================================================
--- linux-2.6.35.y.orig/net/ipv6/sit.c 2011-03-29 22:50:49.747985492 -0700
+++ linux-2.6.35.y/net/ipv6/sit.c 2011-03-29 23:03:02.040247960 -0700
@@ -1239,4 +1239,4 @@
module_init(sit_init);
module_exit(sit_cleanup);
MODULE_LICENSE("GPL");
-MODULE_ALIAS("sit0");
+MODULE_ALIAS_NETDEV("sit0");

2011-03-30 21:33:08

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [178/275] powerpc/kexec: Fix orphaned offline CPUs across kexec

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Matt Evans <[email protected]>

Commit: e8e5c2155b0035b6e04f29be67f6444bc914005b upstream

When CPU hotplug is used, some CPUs may be offline at the time a kexec is
performed. The subsequent kernel may expect these CPUs to be already running,
and will declare them stuck. On pseries, there's also a soft-offline (cede)
state that CPUs may be in; this can also cause problems as the kexeced kernel
may ask RTAS if they're online -- and RTAS would say they are. The CPU will
either appear stuck, or will cause a crash as we replace its cede loop beneath
it.

This patch kicks each present offline CPU awake before the kexec, so that
none are forever lost to these assumptions in the subsequent kernel.

Now, the behaviour is that all available CPUs that were offlined are now
online & usable after the kexec. This mimics the behaviour of a full reboot
(on which all CPUs will be restarted).

Signed-off-by: Matt Evans <[email protected]>
Signed-off-by: Benjamin Herrenschmidt <[email protected]>
Signed-off-by: Kamalesh babulal <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
cc: Anton Blanchard <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
arch/powerpc/kernel/machine_kexec_64.c | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)

Index: linux-2.6.35.y/arch/powerpc/kernel/machine_kexec_64.c
===================================================================
--- linux-2.6.35.y.orig/arch/powerpc/kernel/machine_kexec_64.c 2011-03-29 22:50:52.264921091 -0700
+++ linux-2.6.35.y/arch/powerpc/kernel/machine_kexec_64.c 2011-03-29 23:03:01.938250575 -0700
@@ -15,6 +15,7 @@
#include <linux/thread_info.h>
#include <linux/init_task.h>
#include <linux/errno.h>
+#include <linux/cpu.h>

#include <asm/page.h>
#include <asm/current.h>
@@ -199,9 +200,32 @@
mb();
}

+/*
+ * We need to make sure each present CPU is online. The next kernel will scan
+ * the device tree and assume primary threads are online and query secondary
+ * threads via RTAS to online them if required. If we don't online primary
+ * threads, they will be stuck. However, we also online secondary threads as we
+ * may be using 'cede offline'. In this case RTAS doesn't see the secondary
+ * threads as offline -- and again, these CPUs will be stuck.
+ *
+ * So, we online all CPUs that should be running, including secondary threads.
+ */
+static void wake_offline_cpus(void)
+{
+ int cpu = 0;
+
+ for_each_present_cpu(cpu) {
+ if (!cpu_online(cpu)) {
+ printk(KERN_INFO "kexec: Waking offline cpu %d.\n",
+ cpu);
+ cpu_up(cpu);
+ }
+ }
+}
+
static void kexec_prepare_cpus(void)
{
-
+ wake_offline_cpus();
smp_call_function(kexec_smp_down, NULL, /* wait */0);
local_irq_disable();
mb(); /* make sure IRQs are disabled before we say they are */

2011-03-30 21:33:29

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [177/275] mm: fix possible cause of a page_mapped BUG

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Hugh Dickins <[email protected]>

commit a3e8cc643d22d2c8ed36b9be7d9c9ca21efcf7f7 upstream.

Robert Swiecki reported a BUG_ON(page_mapped) from a fuzzer, punching
a hole with madvise(,, MADV_REMOVE). That path is under mutex, and
cannot be explained by lack of serialization in unmap_mapping_range().

Reviewing the code, I found one place where vm_truncate_count handling
should have been updated, when I switched at the last minute from one
way of managing the restart_addr to another: mremap move changes the
virtual addresses, so it ought to adjust the restart_addr.

But rather than exporting the notion of restart_addr from memory.c, or
converting to restart_pgoff throughout, simply reset vm_truncate_count
to 0 to force a rescan if mremap move races with preempted truncation.

We have no confirmation that this fixes Robert's BUG,
but it is a fix that's worth making anyway.

Signed-off-by: Hugh Dickins <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Cc: Kerin Millar <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
mm/mremap.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

Index: linux-2.6.35.y/mm/mremap.c
===================================================================
--- linux-2.6.35.y.orig/mm/mremap.c 2011-03-29 22:50:52.769908168 -0700
+++ linux-2.6.35.y/mm/mremap.c 2011-03-29 23:03:01.920251035 -0700
@@ -91,9 +91,7 @@
*/
mapping = vma->vm_file->f_mapping;
spin_lock(&mapping->i_mmap_lock);
- if (new_vma->vm_truncate_count &&
- new_vma->vm_truncate_count != vma->vm_truncate_count)
- new_vma->vm_truncate_count = 0;
+ new_vma->vm_truncate_count = 0;
}

/*

2011-03-30 21:08:42

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [171/275] arp_notify: unconditionally send gratuitous ARP for NETDEV_NOTIFY_PEERS.

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Ian Campbell <[email protected]>

commit d11327ad6695db8117c78d70611e71102ceec2ac upstream.

NETDEV_NOTIFY_PEER is an explicit request by the driver to send a link
notification while NETDEV_UP/NETDEV_CHANGEADDR generate link
notifications as a sort of side effect.

In the later cases the sysctl option is present because link
notification events can have undesired effects e.g. if the link is
flapping. I don't think this applies in the case of an explicit
request from a driver.

This patch makes NETDEV_NOTIFY_PEER unconditional, if preferred we
could add a new sysctl for this case which defaults to on.

This change causes Xen post-migration ARP notifications (which cause
switches to relearn their MAC tables etc) to be sent by default.

Signed-off-by: Ian Campbell <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
[reported to solve hyperv live migration problem - gkh]
Cc: Haiyang Zhang <[email protected]>
Cc: Mike Surcouf <[email protected]>
Cc: Hank Janssen <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
net/ipv4/devinet.c | 30 ++++++++++++++++++++----------
1 file changed, 20 insertions(+), 10 deletions(-)

Index: linux-2.6.35.y/net/ipv4/devinet.c
===================================================================
--- linux-2.6.35.y.orig/net/ipv4/devinet.c 2011-03-29 22:50:55.819830128 -0700
+++ linux-2.6.35.y/net/ipv4/devinet.c 2011-03-29 23:03:01.802254055 -0700
@@ -1029,6 +1029,21 @@
return mtu >= 68;
}

+static void inetdev_send_gratuitous_arp(struct net_device *dev,
+ struct in_device *in_dev)
+
+{
+ struct in_ifaddr *ifa = in_dev->ifa_list;
+
+ if (!ifa)
+ return;
+
+ arp_send(ARPOP_REQUEST, ETH_P_ARP,
+ ifa->ifa_address, dev,
+ ifa->ifa_address, NULL,
+ dev->dev_addr, NULL);
+}
+
/* Called only under RTNL semaphore */

static int inetdev_event(struct notifier_block *this, unsigned long event,
@@ -1081,18 +1096,13 @@
}
ip_mc_up(in_dev);
/* fall through */
- case NETDEV_NOTIFY_PEERS:
case NETDEV_CHANGEADDR:
+ if (!IN_DEV_ARP_NOTIFY(in_dev))
+ break;
+ /* fall through */
+ case NETDEV_NOTIFY_PEERS:
/* Send gratuitous ARP to notify of link change */
- if (IN_DEV_ARP_NOTIFY(in_dev)) {
- struct in_ifaddr *ifa = in_dev->ifa_list;
-
- if (ifa)
- arp_send(ARPOP_REQUEST, ETH_P_ARP,
- ifa->ifa_address, dev,
- ifa->ifa_address, NULL,
- dev->dev_addr, NULL);
- }
+ inetdev_send_gratuitous_arp(dev, in_dev);
break;
case NETDEV_DOWN:
ip_mc_down(in_dev);

2011-03-30 21:33:47

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [176/275] ixgbe: fix for 82599 erratum on Header Splitting

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Don Skidmore <[email protected]>

commit a124339ad28389093ed15eca990d39c51c5736cc upstream.

We have found a hardware erratum on 82599 hardware that can lead to
unpredictable behavior when Header Splitting mode is enabled. So
we are no longer enabling this feature on affected hardware.

Please see the 82599 Specification Update for more information.

Signed-off-by: Don Skidmore <[email protected]>
Tested-by: Stephen Ko <[email protected]>
Signed-off-by: Jeff Kirsher <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/net/ixgbe/ixgbe_main.c | 4 ++++
1 file changed, 4 insertions(+)

Index: linux-2.6.35.y/drivers/net/ixgbe/ixgbe_main.c
===================================================================
--- linux-2.6.35.y.orig/drivers/net/ixgbe/ixgbe_main.c 2011-03-29 22:50:53.271895324 -0700
+++ linux-2.6.35.y/drivers/net/ixgbe/ixgbe_main.c 2011-03-29 23:03:01.901251523 -0700
@@ -2658,6 +2658,10 @@
if (!adapter->num_vfs)
adapter->flags |= IXGBE_FLAG_RX_PS_ENABLED;

+ /* Disable packet split due to 82599 erratum #45 */
+ if (hw->mac.type == ixgbe_mac_82599EB)
+ adapter->flags &= ~IXGBE_FLAG_RX_PS_ENABLED;
+
/* Set the RX buffer length according to the mode */
if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) {
rx_buf_len = IXGBE_RX_HDR_SIZE;

2011-03-30 21:34:00

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [175/275] RxRPC: Fix v1 keys

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Anton Blanchard <[email protected]>

commit f009918a1c1bbf8607b8aab3959876913a30193a upstream.

commit 339412841d7 (RxRPC: Allow key payloads to be passed in XDR form)
broke klog for me. I notice the v1 key struct had a kif_version field
added:

-struct rxkad_key {
- u16 security_index; /* RxRPC header security index */
- u16 ticket_len; /* length of ticket[] */
- u32 expiry; /* time at which expires */
- u32 kvno; /* key version number */
- u8 session_key[8]; /* DES session key */
- u8 ticket[0]; /* the encrypted ticket */
-};

+struct rxrpc_key_data_v1 {
+ u32 kif_version; /* 1 */
+ u16 security_index;
+ u16 ticket_length;
+ u32 expiry; /* time_t */
+ u32 kvno;
+ u8 session_key[8];
+ u8 ticket[0];
+};

However the code in rxrpc_instantiate strips it away:

data += sizeof(kver);
datalen -= sizeof(kver);

Removing kif_version fixes my problem.

Signed-off-by: Anton Blanchard <[email protected]>
Signed-off-by: David Howells <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
include/keys/rxrpc-type.h | 1 -
1 file changed, 1 deletion(-)

Index: linux-2.6.35.y/include/keys/rxrpc-type.h
===================================================================
--- linux-2.6.35.y.orig/include/keys/rxrpc-type.h 2011-03-29 22:50:53.770882557 -0700
+++ linux-2.6.35.y/include/keys/rxrpc-type.h 2011-03-29 23:03:01.881252033 -0700
@@ -99,7 +99,6 @@
* structure of raw payloads passed to add_key() or instantiate key
*/
struct rxrpc_key_data_v1 {
- u32 kif_version; /* 1 */
u16 security_index;
u16 ticket_length;
u32 expiry; /* time_t */

2011-03-30 21:08:39

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [170/275] usb: iowarrior: don't trust report_size for buffer size

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Kees Cook <[email protected]>

commit 3ed780117dbe5acb64280d218f0347f238dafed0 upstream.

If the iowarrior devices in this case statement support more than 8 bytes
per report, it is possible to write past the end of a kernel heap allocation.
This will probably never be possible, but change the allocation to be more
defensive anyway.

Signed-off-by: Kees Cook <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Acked-by: Brandon Philips <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>


---
drivers/usb/misc/iowarrior.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.35.y/drivers/usb/misc/iowarrior.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/misc/iowarrior.c 2011-03-29 22:50:56.322817258 -0700
+++ linux-2.6.35.y/drivers/usb/misc/iowarrior.c 2011-03-29 23:03:01.783254541 -0700
@@ -373,7 +373,7 @@
case USB_DEVICE_ID_CODEMERCS_IOWPV2:
case USB_DEVICE_ID_CODEMERCS_IOW40:
/* IOW24 and IOW40 use a synchronous call */
- buf = kmalloc(8, GFP_KERNEL); /* 8 bytes are enough for both products */
+ buf = kmalloc(count, GFP_KERNEL);
if (!buf) {
retval = -ENOMEM;
goto exit;

2011-03-30 21:34:19

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [174/275] keyboard: integer underflow bug

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Dan Carpenter <[email protected]>

commit b652277b09d3d030cb074cc6a98ba80b34244c03 upstream.

The "ct" variable should be an unsigned int. Both struct kbdiacrs
->kb_cnt and struct kbd_data ->accent_table_size are unsigned ints.

Making it signed causes a problem in KBDIACRUC because the user could
set the signed bit and cause a buffer overflow.

Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Martin Schwidefsky <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/s390/char/keyboard.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6.35.y/drivers/s390/char/keyboard.c
===================================================================
--- linux-2.6.35.y.orig/drivers/s390/char/keyboard.c 2011-03-29 22:50:54.267869839 -0700
+++ linux-2.6.35.y/drivers/s390/char/keyboard.c 2011-03-29 23:03:01.863252494 -0700
@@ -460,7 +460,8 @@
unsigned int cmd, unsigned long arg)
{
void __user *argp;
- int ct, perm;
+ unsigned int ct;
+ int perm;

argp = (void __user *)arg;

2011-03-30 21:34:39

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [172/275] CIFS: Fix oplock break handling (try #2)

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Pavel Shilovsky <[email protected]>

commit 12fed00de963433128b5366a21a55808fab2f756 upstream.

When we get oplock break notification we should set the appropriate
value of OplockLevel field in oplock break acknowledge according to
the oplock level held by the client in this time. As we only can have
level II oplock or no oplock in the case of oplock break, we should be
aware only about clientCanCacheRead field in cifsInodeInfo structure.

Signed-off-by: Pavel Shilovsky <[email protected]>
Signed-off-by: Steve French <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
fs/cifs/cifsproto.h | 2 +-
fs/cifs/cifssmb.c | 4 +++-
fs/cifs/file.c | 21 +++++++++++----------
3 files changed, 15 insertions(+), 12 deletions(-)

Index: linux-2.6.35.y/fs/cifs/cifsproto.h
===================================================================
--- linux-2.6.35.y.orig/fs/cifs/cifsproto.h 2011-03-29 22:50:55.310843152 -0700
+++ linux-2.6.35.y/fs/cifs/cifsproto.h 2011-03-29 23:03:01.820253595 -0700
@@ -343,7 +343,7 @@
const __u16 netfid, const __u64 len,
const __u64 offset, const __u32 numUnlock,
const __u32 numLock, const __u8 lockType,
- const bool waitFlag);
+ const bool waitFlag, const __u8 oplock_level);
extern int CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon,
const __u16 smb_file_id, const int get_flag,
const __u64 len, struct file_lock *,
Index: linux-2.6.35.y/fs/cifs/cifssmb.c
===================================================================
--- linux-2.6.35.y.orig/fs/cifs/cifssmb.c 2011-03-29 22:50:55.310843152 -0700
+++ linux-2.6.35.y/fs/cifs/cifssmb.c 2011-03-29 23:03:01.822253544 -0700
@@ -1647,7 +1647,8 @@
CIFSSMBLock(const int xid, struct cifsTconInfo *tcon,
const __u16 smb_file_id, const __u64 len,
const __u64 offset, const __u32 numUnlock,
- const __u32 numLock, const __u8 lockType, const bool waitFlag)
+ const __u32 numLock, const __u8 lockType,
+ const bool waitFlag, const __u8 oplock_level)
{
int rc = 0;
LOCK_REQ *pSMB = NULL;
@@ -1675,6 +1676,7 @@
pSMB->NumberOfLocks = cpu_to_le16(numLock);
pSMB->NumberOfUnlocks = cpu_to_le16(numUnlock);
pSMB->LockType = lockType;
+ pSMB->OplockLevel = oplock_level;
pSMB->AndXCommand = 0xFF; /* none */
pSMB->Fid = smb_file_id; /* netfid stays le */

Index: linux-2.6.35.y/fs/cifs/file.c
===================================================================
--- linux-2.6.35.y.orig/fs/cifs/file.c 2011-03-29 22:50:55.310843152 -0700
+++ linux-2.6.35.y/fs/cifs/file.c 2011-03-29 23:03:01.825253466 -0700
@@ -796,12 +796,12 @@

/* BB we could chain these into one lock request BB */
rc = CIFSSMBLock(xid, tcon, netfid, length, pfLock->fl_start,
- 0, 1, lockType, 0 /* wait flag */ );
+ 0, 1, lockType, 0 /* wait flag */, 0);
if (rc == 0) {
rc = CIFSSMBLock(xid, tcon, netfid, length,
pfLock->fl_start, 1 /* numUnlock */ ,
0 /* numLock */ , lockType,
- 0 /* wait flag */ );
+ 0 /* wait flag */, 0);
pfLock->fl_type = F_UNLCK;
if (rc != 0)
cERROR(1, "Error unlocking previously locked "
@@ -818,13 +818,13 @@
rc = CIFSSMBLock(xid, tcon, netfid, length,
pfLock->fl_start, 0, 1,
lockType | LOCKING_ANDX_SHARED_LOCK,
- 0 /* wait flag */);
+ 0 /* wait flag */, 0);
if (rc == 0) {
rc = CIFSSMBLock(xid, tcon, netfid,
length, pfLock->fl_start, 1, 0,
lockType |
LOCKING_ANDX_SHARED_LOCK,
- 0 /* wait flag */);
+ 0 /* wait flag */, 0);
pfLock->fl_type = F_RDLCK;
if (rc != 0)
cERROR(1, "Error unlocking "
@@ -868,8 +868,8 @@

if (numLock) {
rc = CIFSSMBLock(xid, tcon, netfid, length,
- pfLock->fl_start,
- 0, numLock, lockType, wait_flag);
+ pfLock->fl_start, 0, numLock, lockType,
+ wait_flag, 0);

if (rc == 0) {
/* For Windows locks we must store them. */
@@ -889,9 +889,9 @@
(pfLock->fl_start + length) >=
(li->offset + li->length)) {
stored_rc = CIFSSMBLock(xid, tcon,
- netfid,
- li->length, li->offset,
- 1, 0, li->type, false);
+ netfid, li->length,
+ li->offset, 1, 0,
+ li->type, false, 0);
if (stored_rc)
rc = stored_rc;
else {
@@ -2300,7 +2300,8 @@
*/
if (!cfile->closePend && !cfile->oplock_break_cancelled) {
rc = CIFSSMBLock(0, cifs_sb->tcon, cfile->netfid, 0, 0, 0, 0,
- LOCKING_ANDX_OPLOCK_RELEASE, false);
+ LOCKING_ANDX_OPLOCK_RELEASE, false,
+ cinode->clientCanCacheRead ? 1 : 0);
cFYI(1, "Oplock release rc = %d", rc);
}
}

2011-03-30 21:34:51

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [168/275] e1000e: disable broken PHY wakeup for ICH10 LOMs, use MAC wakeup instead

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Bruce Allan <[email protected]>

commit 4def99bbfd46e05c5e03b5b282cb4ee30e27ff19 upstream.

When support for 82577/82578 was added[1] in 2.6.31, PHY wakeup was in-
advertently enabled (even though it does not function properly) on ICH10
LOMs. This patch makes it so that the ICH10 LOMs use MAC wakeup instead
as was done with the initial support for those devices (i.e. 82567LM-3,
82567LF-3 and 82567V-4).

[1] commit a4f58f5455ba0efda36fb33c37074922d1527a10

Reported-by: Aurelien Jarno <[email protected]>
Signed-off-by: Bruce Allan <[email protected]>
Signed-off-by: Jeff Kirsher <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/net/e1000e/netdev.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6.35.y/drivers/net/e1000e/netdev.c
===================================================================
--- linux-2.6.35.y.orig/drivers/net/e1000e/netdev.c 2011-03-29 22:50:57.340791211 -0700
+++ linux-2.6.35.y/drivers/net/e1000e/netdev.c 2011-03-29 23:03:01.745255514 -0700
@@ -5678,7 +5678,8 @@
/* APME bit in EEPROM is mapped to WUC.APME */
eeprom_data = er32(WUC);
eeprom_apme_mask = E1000_WUC_APME;
- if (eeprom_data & E1000_WUC_PHY_WAKE)
+ if ((hw->mac.type > e1000_ich10lan) &&
+ (eeprom_data & E1000_WUC_PHY_WAKE))
adapter->flags2 |= FLAG2_HAS_PHY_WAKEUP;
} else if (adapter->flags & FLAG_APME_IN_CTRL3) {
if (adapter->flags & FLAG_APME_CHECK_PORT_B &&

2011-03-30 21:35:03

by Oleg Nesterov

[permalink] [raw]
Subject: Re: [PATCH] [226/275] Prevent rt_sigqueueinfo and rt_tgsigqueueinfo from spoofing the signal code

On 03/30, Andi Kleen wrote:
>
> --- linux-2.6.35.y.orig/kernel/signal.c 2011-03-29 22:50:25.616602954 -0700
> +++ linux-2.6.35.y/kernel/signal.c 2011-03-29 23:03:02.941224912 -0700
> @@ -2410,9 +2410,13 @@
> return -EFAULT;
>
> /* Not even root can pretend to send signals from the kernel.
> - Nor can they impersonate a kill(), which adds source info. */
> - if (info.si_code >= 0)
> + * Nor can they impersonate a kill()/tgkill(), which adds source info.
> + */
> + if (info.si_code != SI_QUEUE) {
> + /* We used to allow any < 0 si_code */
> + WARN_ON_ONCE(info.si_code < 0);
> return -EPERM;

Oh, please don't.

Quoting Roland:

Commit da48524eb206 ("Prevent rt_sigqueueinfo and rt_tgsigqueueinfo
from spoofing the signal code") made the check on si_code too strict:
glibc's aio implementation wants to queue signals with SI_ASYNCIO, and
indeed glibc's tst-aio4 fails with the patched kernel.

If stable needs this change, then it probably needs

Relax si_code check in rt_sigqueueinfo and rt_tgsigqueueinfo
commit 243b422af9ea9af4ead07a8ad54c90d4f9b6081a

as well.

Oleg.

2011-03-30 21:35:39

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [165/275] ext2: Fix link count corruption under heavy link+rename load

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Josh Hunt <[email protected]>

commit e8a80c6f769dd4622d8b211b398452158ee60c0b upstream.

vfs_rename_other() does not lock renamed inode with i_mutex. Thus changing
i_nlink in a non-atomic manner (which happens in ext2_rename()) can corrupt
it as reported and analyzed by Josh.

In fact, there is no good reason to mess with i_nlink of the moved file.
We did it presumably to simulate linking into the new directory and unlinking
from an old one. But the practical effect of this is disputable because fsck
can possibly treat file as being properly linked into both directories without
writing any error which is confusing. So we just stop increment-decrement
games with i_nlink which also fixes the corruption.

CC: Al Viro <[email protected]>
Signed-off-by: Josh Hunt <[email protected]>
Signed-off-by: Jan Kara <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
fs/ext2/namei.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)

Index: linux-2.6.35.y/fs/ext2/namei.c
===================================================================
--- linux-2.6.35.y.orig/fs/ext2/namei.c 2011-03-29 22:50:58.827753164 -0700
+++ linux-2.6.35.y/fs/ext2/namei.c 2011-03-29 23:03:01.688256973 -0700
@@ -344,7 +344,6 @@
new_de = ext2_find_entry (new_dir, &new_dentry->d_name, &new_page);
if (!new_de)
goto out_dir;
- inode_inc_link_count(old_inode);
ext2_set_link(new_dir, new_de, new_page, old_inode, 1);
new_inode->i_ctime = CURRENT_TIME_SEC;
if (dir_de)
@@ -356,12 +355,9 @@
if (new_dir->i_nlink >= EXT2_LINK_MAX)
goto out_dir;
}
- inode_inc_link_count(old_inode);
err = ext2_add_link(new_dentry, old_inode);
- if (err) {
- inode_dec_link_count(old_inode);
+ if (err)
goto out_dir;
- }
if (dir_de)
inode_inc_link_count(new_dir);
}
@@ -369,12 +365,11 @@
/*
* Like most other Unix systems, set the ctime for inodes on a
* rename.
- * inode_dec_link_count() will mark the inode dirty.
*/
old_inode->i_ctime = CURRENT_TIME_SEC;
+ mark_inode_dirty(old_inode);

ext2_delete_entry (old_de, old_page);
- inode_dec_link_count(old_inode);

if (dir_de) {
if (old_dir != new_dir)

2011-03-30 21:35:36

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [167/275] dccp: fix oops on Reset after close

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Gerrit Renker <[email protected]>

commit 720dc34bbbe9493c7bd48b2243058b4e447a929d upstream.

This fixes a bug in the order of dccp_rcv_state_process() that still permitted
reception even after closing the socket. A Reset after close thus causes a NULL
pointer dereference by not preventing operations on an already torn-down socket.

dccp_v4_do_rcv()
|
| state other than OPEN
v
dccp_rcv_state_process()
|
| DCCP_PKT_RESET
v
dccp_rcv_reset()
|
v
dccp_time_wait()

WARNING: at net/ipv4/inet_timewait_sock.c:141 __inet_twsk_hashdance+0x48/0x128()
Modules linked in: arc4 ecb carl9170 rt2870sta(C) mac80211 r8712u(C) crc_ccitt ah
[<c0038850>] (unwind_backtrace+0x0/0xec) from [<c0055364>] (warn_slowpath_common)
[<c0055364>] (warn_slowpath_common+0x4c/0x64) from [<c0055398>] (warn_slowpath_n)
[<c0055398>] (warn_slowpath_null+0x1c/0x24) from [<c02b72d0>] (__inet_twsk_hashd)
[<c02b72d0>] (__inet_twsk_hashdance+0x48/0x128) from [<c031caa0>] (dccp_time_wai)
[<c031caa0>] (dccp_time_wait+0x40/0xc8) from [<c031c15c>] (dccp_rcv_state_proces)
[<c031c15c>] (dccp_rcv_state_process+0x120/0x538) from [<c032609c>] (dccp_v4_do_)
[<c032609c>] (dccp_v4_do_rcv+0x11c/0x14c) from [<c0286594>] (release_sock+0xac/0)
[<c0286594>] (release_sock+0xac/0x110) from [<c031fd34>] (dccp_close+0x28c/0x380)
[<c031fd34>] (dccp_close+0x28c/0x380) from [<c02d9a78>] (inet_release+0x64/0x70)

The fix is by testing the socket state first. Receiving a packet in Closed state
now also produces the required "No connection" Reset reply of RFC 4340, 8.3.1.

Reported-and-tested-by: Johan Hovold <[email protected]>
Signed-off-by: Gerrit Renker <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
net/dccp/input.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

Index: linux-2.6.35.y/net/dccp/input.c
===================================================================
--- linux-2.6.35.y.orig/net/dccp/input.c 2011-03-29 22:50:57.838778468 -0700
+++ linux-2.6.35.y/net/dccp/input.c 2011-03-29 23:03:01.725256025 -0700
@@ -617,6 +617,9 @@
/* Caller (dccp_v4_do_rcv) will send Reset */
dcb->dccpd_reset_code = DCCP_RESET_CODE_NO_CONNECTION;
return 1;
+ } else if (sk->sk_state == DCCP_CLOSED) {
+ dcb->dccpd_reset_code = DCCP_RESET_CODE_NO_CONNECTION;
+ return 1;
}

if (sk->sk_state != DCCP_REQUESTING && sk->sk_state != DCCP_RESPOND) {
@@ -679,10 +682,6 @@
}

switch (sk->sk_state) {
- case DCCP_CLOSED:
- dcb->dccpd_reset_code = DCCP_RESET_CODE_NO_CONNECTION;
- return 1;
-
case DCCP_REQUESTING:
queued = dccp_rcv_request_sent_state_process(sk, skb, dh, len);
if (queued >= 0)

2011-03-30 21:08:27

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [157/275] xhci: Fix an error in count_sg_trbs_needed()

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Paul Zimmerman <[email protected]>

commit bcd2fde05341cef0052e49566ec88b406a521cf3 upstream.

The expression

while (running_total < sg_dma_len(sg))

does not take into account that the remaining data length can be less
than sg_dma_len(sg). In that case, running_total can end up being
greater than the total data length, so an extra TRB is counted.
Changing the expression to

while (running_total < sg_dma_len(sg) && running_total < temp)

fixes that.

This patch should be queued for stable kernels back to 2.6.31.

Signed-off-by: Paul Zimmerman <[email protected]>
Signed-off-by: Sarah Sharp <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/usb/host/xhci-ring.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.35.y/drivers/usb/host/xhci-ring.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/host/xhci-ring.c 2011-03-29 23:03:01.504261681 -0700
+++ linux-2.6.35.y/drivers/usb/host/xhci-ring.c 2011-03-29 23:54:12.392685328 -0700
@@ -1896,7 +1896,7 @@
num_trbs++;

/* How many more 64KB chunks to transfer, how many more TRBs? */
- while (running_total < sg_dma_len(sg)) {
+ while (running_total < sg_dma_len(sg) && running_total < temp) {
num_trbs++;
running_total += TRB_MAX_BUFF_SIZE;
}

2011-03-30 21:36:08

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [159/275] Ocfs2/refcounttree: Fix a bug for refcounttree to writeback clusters in a right number.

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Tristan Ye <[email protected]>

commit acf3bb007e5636ef4c17505affb0974175108553 upstream.

Current refcounttree codes actually didn't writeback the new pages out in
write-back mode, due to a bug of always passing a ZERO number of clusters
to 'ocfs2_cow_sync_writeback', the patch tries to pass a proper one in.

Signed-off-by: Tristan Ye <[email protected]>
Signed-off-by: Joel Becker <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
fs/ocfs2/refcounttree.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

Index: linux-2.6.35.y/fs/ocfs2/refcounttree.c
===================================================================
--- linux-2.6.35.y.orig/fs/ocfs2/refcounttree.c 2011-03-29 22:51:01.864675455 -0700
+++ linux-2.6.35.y/fs/ocfs2/refcounttree.c 2011-03-29 23:03:01.561260222 -0700
@@ -3215,7 +3215,7 @@
u32 num_clusters, unsigned int e_flags)
{
int ret, delete, index, credits = 0;
- u32 new_bit, new_len;
+ u32 new_bit, new_len, orig_num_clusters;
unsigned int set_len;
struct ocfs2_super *osb = OCFS2_SB(sb);
handle_t *handle;
@@ -3248,6 +3248,8 @@
goto out;
}

+ orig_num_clusters = num_clusters;
+
while (num_clusters) {
ret = ocfs2_get_refcount_rec(ref_ci, context->ref_root_bh,
p_cluster, num_clusters,
@@ -3335,7 +3337,8 @@
* in write-back mode.
*/
if (context->get_clusters == ocfs2_di_get_clusters) {
- ret = ocfs2_cow_sync_writeback(sb, context, cpos, num_clusters);
+ ret = ocfs2_cow_sync_writeback(sb, context, cpos,
+ orig_num_clusters);
if (ret)
mlog_errno(ret);
}

2011-03-30 21:36:32

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [161/275] mfd: Fix NULL pointer due to non-initialized ucb1x00-ts absinfo

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Jochen Friedrich <[email protected]>

commit 9063f1f15eec35e5fd608879cef8be5728f2d12a upstream.

Call input_set_abs_params instead of manually setting absbit only.
This fixes this oops:

Unable to handle kernel NULL pointer dereference at virtual address 00000024
Internal error: Oops: 41b67017 [#1]
CPU: 0 Not tainted (2.6.37 #4)
pc : [<c016d1fc>] lr : [<00000000>] psr: 20000093
sp : c19e5f30 ip : c19e5e6c fp : c19e5f58
r10: 00000000 r9 : c19e4000 r8 : 00000003
r7 : 000001e4 r6 : 00000001 r5 : c1854400 r4 : 00000003
r3 : 00000018 r2 : 00000018 r1 : 00000018 r0 : c185447c
Flags: nzCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment kernel
Control: c1b6717f Table: c1b6717f DAC: 00000017
Stack: (0xc19e5f30 to 0xc19e6000)
5f20: 00000003 00000003 c1854400 00000013
5f40: 00000001 000001e4 000001c5 c19e5f80 c19e5f5c c016d5e8 c016cf5c 000001e4
5f60: c1854400 c18b5860 00000000 00000171 000001e4 c19e5fc4 c19e5f84 c01559a4
5f80: c016d584 c18b5868 00000000 c1bb5c40 c0035afc c18b5868 c18b5868 c1a55d54
5fa0: c18b5860 c0155750 00000013 00000000 00000000 00000000 c19e5ff4 c19e5fc8
5fc0: c0050174 c015575c 00000000 c18b5860 00000000 c19e5fd4 c19e5fd4 c1a55d54
5fe0: c00500f0 c003b464 00000000 c19e5ff8 c003b464 c00500fc 04000400 04000400
Backtrace:
Function entered at [<c016cf50>] from [<c016d5e8>]
Function entered at [<c016d578>] from [<c01559a4>]
r8:000001e4 r7:00000171 r6:00000000 r5:c18b5860 r4:c1854400
Function entered at [<c0155750>] from [<c0050174>]
Function entered at [<c00500f0>] from [<c003b464>]
r6:c003b464 r5:c00500f0 r4:c1a55d54
Code: e59520fc e1a03286 e0433186 e0822003 (e592000c)

>>PC; c016d1fc <input_handle_event+2ac/5a0> <=====

Trace; c016cf50 <input_handle_event+0/5a0>
Trace; c016d5e8 <input_event+70/88>
Trace; c016d578 <input_event+0/88>
Trace; c01559a4 <ucb1x00_thread+254/2dc>
Trace; c0155750 <ucb1x00_thread+0/2dc>
Trace; c0050174 <kthread+84/8c>
Trace; c00500f0 <kthread+0/8c>
Trace; c003b464 <do_exit+0/624>

Signed-off-by: Jochen Friedrich <[email protected]>
Signed-off-by: Samuel Ortiz <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/mfd/ucb1x00-ts.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

Index: linux-2.6.35.y/drivers/mfd/ucb1x00-ts.c
===================================================================
--- linux-2.6.35.y.orig/drivers/mfd/ucb1x00-ts.c 2011-03-29 22:51:00.879700658 -0700
+++ linux-2.6.35.y/drivers/mfd/ucb1x00-ts.c 2011-03-29 23:03:01.604259121 -0700
@@ -385,12 +385,18 @@
idev->close = ucb1x00_ts_close;

__set_bit(EV_ABS, idev->evbit);
- __set_bit(ABS_X, idev->absbit);
- __set_bit(ABS_Y, idev->absbit);
- __set_bit(ABS_PRESSURE, idev->absbit);

input_set_drvdata(idev, ts);

+ ucb1x00_adc_enable(ts->ucb);
+ ts->x_res = ucb1x00_ts_read_xres(ts);
+ ts->y_res = ucb1x00_ts_read_yres(ts);
+ ucb1x00_adc_disable(ts->ucb);
+
+ input_set_abs_params(idev, ABS_X, 0, ts->x_res, 0, 0);
+ input_set_abs_params(idev, ABS_Y, 0, ts->y_res, 0, 0);
+ input_set_abs_params(idev, ABS_PRESSURE, 0, 0, 0, 0);
+
err = input_register_device(idev);
if (err)
goto fail;

2011-03-30 21:37:05

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [160/275] drm: fix unsigned vs signed comparison issue in modeset ctl ioctl.

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Dave Airlie <[email protected]>

commit 1922756124ddd53846877416d92ba4a802bc658f upstream.

This fixes CVE-2011-1013.

Reported-by: Matthiew Herrb (OpenBSD X.org team)
Signed-off-by: Dave Airlie <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/gpu/drm/drm_irq.c | 3 ++-
include/drm/drmP.h | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)

Index: linux-2.6.35.y/drivers/gpu/drm/drm_irq.c
===================================================================
--- linux-2.6.35.y.orig/drivers/gpu/drm/drm_irq.c 2011-03-29 22:51:01.380687839 -0700
+++ linux-2.6.35.y/drivers/gpu/drm/drm_irq.c 2011-03-29 23:03:01.580259734 -0700
@@ -545,7 +545,8 @@
struct drm_file *file_priv)
{
struct drm_modeset_ctl *modeset = data;
- int crtc, ret = 0;
+ int ret = 0;
+ unsigned int crtc;

/* If drm_vblank_init() hasn't been called yet, just no-op */
if (!dev->num_crtcs)
Index: linux-2.6.35.y/include/drm/drmP.h
===================================================================
--- linux-2.6.35.y.orig/include/drm/drmP.h 2011-03-29 22:51:01.380687839 -0700
+++ linux-2.6.35.y/include/drm/drmP.h 2011-03-29 23:03:01.581259709 -0700
@@ -1021,7 +1021,7 @@
struct pci_controller *hose;
#endif
struct drm_sg_mem *sg; /**< Scatter gather memory */
- int num_crtcs; /**< Number of CRTCs on this device */
+ unsigned int num_crtcs; /**< Number of CRTCs on this device */
void *dev_private; /**< device private data */
void *mm_private;
struct address_space *dev_mapping;

2011-03-30 21:08:23

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [156/275] xhci: Fix errors in the running total calculations in the TRB math

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Paul Zimmerman <[email protected]>

commit 5807795bd4dececdf553719cc02869e633395787 upstream.

Calculations like

running_total = TRB_MAX_BUFF_SIZE -
(sg_dma_address(sg) & (TRB_MAX_BUFF_SIZE - 1));
if (running_total != 0)
num_trbs++;

are incorrect, because running_total can never be zero, so the if()
expression will never be true. I think the intention was that
running_total be in the range of 0 to TRB_MAX_BUFF_SIZE-1, not 1
to TRB_MAX_BUFF_SIZE. So adding a

running_total &= TRB_MAX_BUFF_SIZE - 1;

fixes the problem.

This patch should be queued for stable kernels back to 2.6.31.

Signed-off-by: Paul Zimmerman <[email protected]>
Signed-off-by: Sarah Sharp <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/usb/host/xhci-ring.c | 2 ++
1 file changed, 2 insertions(+)

Index: linux-2.6.35.y/drivers/usb/host/xhci-ring.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/host/xhci-ring.c 2011-03-29 23:03:01.485262166 -0700
+++ linux-2.6.35.y/drivers/usb/host/xhci-ring.c 2011-03-29 23:54:34.277125360 -0700
@@ -1891,6 +1891,7 @@
/* Scatter gather list entries may cross 64KB boundaries */
running_total = TRB_MAX_BUFF_SIZE -
(sg_dma_address(sg) & (TRB_MAX_BUFF_SIZE - 1));
+ running_total &= TRB_MAX_BUFF_SIZE - 1;
if (running_total != 0)
num_trbs++;

@@ -2171,6 +2172,7 @@
/* How much data is (potentially) left before the 64KB boundary? */
running_total = TRB_MAX_BUFF_SIZE -
(urb->transfer_dma & (TRB_MAX_BUFF_SIZE - 1));
+ running_total &= TRB_MAX_BUFF_SIZE - 1;

/* If there's some data on this 64KB chunk, or we have to send a
* zero-length transfer, we need at least one TRB

2011-03-30 21:37:42

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [158/275] x25: Do not reference freed memory.

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: David S. Miller <[email protected]>

commit 96642d42f076101ba98866363d908cab706d156c upstream.

In x25_link_free(), we destroy 'nb' before dereferencing
'nb->dev'. Don't do this, because 'nb' might be freed
by then.

Reported-by: Randy Dunlap <[email protected]>
Tested-by: Randy Dunlap <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
net/x25/x25_link.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

Index: linux-2.6.35.y/net/x25/x25_link.c
===================================================================
--- linux-2.6.35.y.orig/net/x25/x25_link.c 2011-03-29 22:51:02.348663073 -0700
+++ linux-2.6.35.y/net/x25/x25_link.c 2011-03-29 23:03:01.541260733 -0700
@@ -392,9 +392,12 @@
write_lock_bh(&x25_neigh_list_lock);

list_for_each_safe(entry, tmp, &x25_neigh_list) {
+ struct net_device *dev;
+
nb = list_entry(entry, struct x25_neigh, node);
+ dev = nb->dev;
__x25_remove_neigh(nb);
- dev_put(nb->dev);
+ dev_put(dev);
}
write_unlock_bh(&x25_neigh_list_lock);
}

2011-03-30 21:37:59

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [154/275] xhci: Avoid BUG() in interrupt context

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Paul Zimmerman <[email protected]>

commit 68e41c5d032668e2905404afbef75bc58be179d6 upstream.

Change the BUGs in xhci_find_new_dequeue_state() to WARN_ONs, to avoid
bringing down the box if one of them is hit

This patch should be queued for stable kernels back to 2.6.31.

Signed-off-by: Paul Zimmerman <[email protected]>
Signed-off-by: Sarah Sharp <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/usb/host/xhci-ring.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)

Index: linux-2.6.35.y/drivers/usb/host/xhci-ring.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/host/xhci-ring.c 2011-03-29 22:51:04.398610620 -0700
+++ linux-2.6.35.y/drivers/usb/host/xhci-ring.c 2011-03-29 23:54:35.235100848 -0700
@@ -457,8 +457,11 @@
state->new_deq_seg = find_trb_seg(cur_td->start_seg,
dev->eps[ep_index].stopped_trb,
&state->new_cycle_state);
- if (!state->new_deq_seg)
- BUG();
+ if (!state->new_deq_seg) {
+ WARN_ON(1);
+ return;
+ }
+
/* Dig out the cycle state saved by the xHC during the stop ep cmd */
xhci_dbg(xhci, "Finding endpoint context\n");
ep_ctx = xhci_get_ep_ctx(xhci, dev->out_ctx, ep_index);
@@ -469,8 +472,10 @@
state->new_deq_seg = find_trb_seg(state->new_deq_seg,
state->new_deq_ptr,
&state->new_cycle_state);
- if (!state->new_deq_seg)
- BUG();
+ if (!state->new_deq_seg) {
+ WARN_ON(1);
+ return;
+ }

trb = &state->new_deq_ptr->generic;
if ((trb->field[3] & TRB_TYPE_BITMASK) == TRB_TYPE(TRB_LINK) &&

2011-03-30 21:38:17

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [153/275] x86 quirk: Fix polarity for IRQ0 pin2 override on SB800 systems

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Andreas Herrmann <[email protected]>

commit 7f74f8f28a2bd9db9404f7d364e2097a0c42cc12 upstream.

On some SB800 systems polarity for IOAPIC pin2 is wrongly
specified as low active by BIOS. This caused system hangs after
resume from S3 when HPET was used in one-shot mode on such
systems because a timer interrupt was missed (HPET signal is
high active).

For more details see:

http://marc.info/?l=linux-kernel&m=129623757413868

Tested-by: Manoj Iyer <[email protected]>
Tested-by: Andre Przywara <[email protected]>
Signed-off-by: Andreas Herrmann <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Cc: Borislav Petkov <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
arch/x86/include/asm/acpi.h | 1 +
arch/x86/kernel/acpi/boot.c | 14 ++++++++++----
arch/x86/kernel/early-quirks.c | 16 +++++++---------
3 files changed, 18 insertions(+), 13 deletions(-)

Index: linux-2.6.35.y/arch/x86/include/asm/acpi.h
===================================================================
--- linux-2.6.35.y.orig/arch/x86/include/asm/acpi.h 2011-03-29 22:51:04.914597417 -0700
+++ linux-2.6.35.y/arch/x86/include/asm/acpi.h 2011-03-29 23:03:01.000000000 -0700
@@ -88,6 +88,7 @@
extern int acpi_pci_disabled;
extern int acpi_skip_timer_override;
extern int acpi_use_timer_override;
+extern int acpi_fix_pin2_polarity;

extern u8 acpi_sci_flags;
extern int acpi_sci_override_gsi;
Index: linux-2.6.35.y/arch/x86/kernel/acpi/boot.c
===================================================================
--- linux-2.6.35.y.orig/arch/x86/kernel/acpi/boot.c 2011-03-29 22:51:04.914597417 -0700
+++ linux-2.6.35.y/arch/x86/kernel/acpi/boot.c 2011-03-29 23:03:01.000000000 -0700
@@ -72,6 +72,7 @@
int acpi_sci_override_gsi __initdata;
int acpi_skip_timer_override __initdata;
int acpi_use_timer_override __initdata;
+int acpi_fix_pin2_polarity __initdata;

#ifdef CONFIG_X86_LOCAL_APIC
static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE;
@@ -410,10 +411,15 @@
return 0;
}

- if (acpi_skip_timer_override &&
- intsrc->source_irq == 0 && intsrc->global_irq == 2) {
- printk(PREFIX "BIOS IRQ0 pin2 override ignored.\n");
- return 0;
+ if (intsrc->source_irq == 0 && intsrc->global_irq == 2) {
+ if (acpi_skip_timer_override) {
+ printk(PREFIX "BIOS IRQ0 pin2 override ignored.\n");
+ return 0;
+ }
+ if (acpi_fix_pin2_polarity && (intsrc->inti_flags & ACPI_MADT_POLARITY_MASK)) {
+ intsrc->inti_flags &= ~ACPI_MADT_POLARITY_MASK;
+ printk(PREFIX "BIOS IRQ0 pin2 override: forcing polarity to high active.\n");
+ }
}

mp_override_legacy_irq(intsrc->source_irq,
Index: linux-2.6.35.y/arch/x86/kernel/early-quirks.c
===================================================================
--- linux-2.6.35.y.orig/arch/x86/kernel/early-quirks.c 2011-03-29 22:51:04.914597417 -0700
+++ linux-2.6.35.y/arch/x86/kernel/early-quirks.c 2011-03-29 23:54:13.604654318 -0700
@@ -145,15 +145,10 @@

static u32 __init ati_sbx00_rev(int num, int slot, int func)
{
- u32 old, d;
+ u32 d;

- d = read_pci_config(num, slot, func, 0x70);
- old = d;
- d &= ~(1<<8);
- write_pci_config(num, slot, func, 0x70, d);
d = read_pci_config(num, slot, func, 0x8);
d &= 0xff;
- write_pci_config(num, slot, func, 0x70, old);

return d;
}
@@ -162,13 +157,16 @@
{
u32 d, rev;

- if (acpi_use_timer_override)
- return;
-
rev = ati_sbx00_rev(num, slot, func);
+ if (rev >= 0x40)
+ acpi_fix_pin2_polarity = 1;
+
if (rev > 0x13)
return;

+ if (acpi_use_timer_override)
+ return;
+
/* check for IRQ0 interrupt swap */
d = read_pci_config(num, slot, func, 0x64);
if (!(d & (1<<14)))

2011-03-30 21:38:39

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [151/275] ldm: corrupted partition table can cause kernel oops

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Timo Warns <[email protected]>

commit 294f6cf48666825d23c9372ef37631232746e40d upstream.

The kernel automatically evaluates partition tables of storage devices.
The code for evaluating LDM partitions (in fs/partitions/ldm.c) contains
a bug that causes a kernel oops on certain corrupted LDM partitions. A
kernel subsystem seems to crash, because, after the oops, the kernel no
longer recognizes newly connected storage devices.

The patch changes ldm_parse_vmdb() to Validate the value of vblk_size.

Signed-off-by: Timo Warns <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Cc: Eugene Teo <[email protected]>
Acked-by: Richard Russon <[email protected]>
Cc: Harvey Harrison <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
fs/partitions/ldm.c | 5 +++++
1 file changed, 5 insertions(+)

Index: linux-2.6.35.y/fs/partitions/ldm.c
===================================================================
--- linux-2.6.35.y.orig/fs/partitions/ldm.c 2011-03-29 22:51:05.872572904 -0700
+++ linux-2.6.35.y/fs/partitions/ldm.c 2011-03-29 23:03:01.398264393 -0700
@@ -251,6 +251,11 @@
}

vm->vblk_size = get_unaligned_be32(data + 0x08);
+ if (vm->vblk_size == 0) {
+ ldm_error ("Illegal VBLK size");
+ return false;
+ }
+
vm->vblk_offset = get_unaligned_be32(data + 0x0C);
vm->last_vblk_seq = get_unaligned_be32(data + 0x04);

2011-03-30 21:38:37

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [152/275] md: correctly handle probe of an 'mdp' device.

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: NeilBrown <[email protected]>

commit 8f5f02c460b7ca74ce55ce126ce0c1e58a3f923d upstream.

'mdp' devices are md devices with preallocated device numbers
for partitions. As such it is possible to mknod and open a partition
before opening the whole device.

this causes md_probe() to be called with a device number of a
partition, which in-turn calls mddev_find with such a number.

However mddev_find expects the number of a 'whole device' and
does the wrong thing with partition numbers.

So add code to mddev_find to remove the 'partition' part of
a device number and just work with the 'whole device'.

This patch addresses https://bugzilla.kernel.org/show_bug.cgi?id=28652

Reported-by: [email protected]
Signed-off-by: NeilBrown <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/md/md.c | 3 +++
1 file changed, 3 insertions(+)

Index: linux-2.6.35.y/drivers/md/md.c
===================================================================
--- linux-2.6.35.y.orig/drivers/md/md.c 2011-03-29 23:02:59.630309629 -0700
+++ linux-2.6.35.y/drivers/md/md.c 2011-03-29 23:53:36.584601568 -0700
@@ -441,6 +441,9 @@
{
mddev_t *mddev, *new = NULL;

+ if (unit && MAJOR(unit) != MD_MAJOR)
+ unit &= ~((1<<MdpMinorShift)-1);
+
retry:
spin_lock(&all_mddevs_lock);

2011-03-30 21:39:19

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [149/275] staging: usbip: vhci: use urb->dev->portnum to find port

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Max Vozeler <[email protected]>

commit 01446ef5af4e8802369bf4d257806e24345a9371 upstream.

The access to pending_port was racy when two devices
were being attached at the same time.

Signed-off-by: Max Vozeler <[email protected]>
Tested-by: Mark Wehby <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/staging/usbip/vhci.h | 3 ---
drivers/staging/usbip/vhci_hcd.c | 4 +---
2 files changed, 1 insertion(+), 6 deletions(-)

Index: linux-2.6.35.y/drivers/staging/usbip/vhci.h
===================================================================
--- linux-2.6.35.y.orig/drivers/staging/usbip/vhci.h 2011-03-29 23:03:01.319266414 -0700
+++ linux-2.6.35.y/drivers/staging/usbip/vhci.h 2011-03-29 23:03:01.359265390 -0700
@@ -100,9 +100,6 @@
* But, the index of this array begins from 0.
*/
struct vhci_device vdev[VHCI_NPORTS];
-
- /* vhci_device which has not been assiged its address yet */
- int pending_port;
};


Index: linux-2.6.35.y/drivers/staging/usbip/vhci_hcd.c
===================================================================
--- linux-2.6.35.y.orig/drivers/staging/usbip/vhci_hcd.c 2011-03-29 23:03:01.341265850 -0700
+++ linux-2.6.35.y/drivers/staging/usbip/vhci_hcd.c 2011-03-29 23:03:01.360265365 -0700
@@ -138,8 +138,6 @@
* the_controller->vdev[rhport].ud.status = VDEV_CONNECT;
* spin_unlock(&the_controller->vdev[rhport].ud.lock); */

- the_controller->pending_port = rhport;
-
spin_unlock_irqrestore(&the_controller->lock, flags);

usb_hcd_poll_rh_status(vhci_to_hcd(the_controller));
@@ -575,7 +573,7 @@
return urb->status;
}

- vdev = port_to_vdev(the_controller->pending_port);
+ vdev = port_to_vdev(urb->dev->portnum-1);

/* refuse enqueue for dead connection */
spin_lock(&vdev->ud.lock);

2011-03-30 21:39:21

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [139/275] genirq: Disable the SHIRQ_DEBUG call in request_threaded_irq for now

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Thomas Gleixner <[email protected]>

commit 6d83f94db95cfe65d2a6359cccdf61cf087c2598 upstream.

With CONFIG_SHIRQ_DEBUG=y we call a newly installed interrupt handler
in request_threaded_irq().

The original implementation (commit a304e1b8) called the handler
_BEFORE_ it was installed, but that caused problems with handlers
calling disable_irq_nosync(). See commit 377bf1e4.

It's braindead in the first place to call disable_irq_nosync in shared
handlers, but ....

Moving this call after we installed the handler looks innocent, but it
is very subtle broken on SMP.

Interrupt handlers rely on the fact, that the irq core prevents
reentrancy.

Now this debug call violates that promise because we run the handler
w/o the IRQ_INPROGRESS protection - which we cannot apply here because
that would result in a possibly forever masked interrupt line.

A concurrent real hardware interrupt on a different CPU results in
handler reentrancy and can lead to complete wreckage, which was
unfortunately observed in reality and took a fricking long time to
debug.

Leave the code here for now. We want this debug feature, but that's
not easy to fix. We really should get rid of those
disable_irq_nosync() abusers and remove that function completely.

Signed-off-by: Thomas Gleixner <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Cc: Anton Vorontsov <[email protected]>
Cc: David Woodhouse <[email protected]>
Cc: Arjan van de Ven <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
kernel/irq/manage.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.35.y/kernel/irq/manage.c
===================================================================
--- linux-2.6.35.y.orig/kernel/irq/manage.c 2011-03-29 22:51:11.695423912 -0700
+++ linux-2.6.35.y/kernel/irq/manage.c 2011-03-29 23:03:01.175270097 -0700
@@ -1093,7 +1093,7 @@
if (retval)
kfree(action);

-#ifdef CONFIG_DEBUG_SHIRQ
+#ifdef CONFIG_DEBUG_SHIRQ_FIXME
if (!retval && (irqflags & IRQF_SHARED)) {
/*
* It's a shared IRQ -- the driver ought to be prepared for it

2011-03-30 21:08:11

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [136/275] platform: x86: acer-wmi: world-writable sysfs threeg file

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Vasiliy Kulikov <[email protected]>

commit b80b168f918bba4b847e884492415546b340e19d upstream.

Don't allow everybody to write to hardware registers.

Signed-off-by: Vasiliy Kulikov <[email protected]>
Signed-off-by: Matthew Garrett <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/platform/x86/acer-wmi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.35.y/drivers/platform/x86/acer-wmi.c
===================================================================
--- linux-2.6.35.y.orig/drivers/platform/x86/acer-wmi.c 2011-03-29 23:03:01.062272989 -0700
+++ linux-2.6.35.y/drivers/platform/x86/acer-wmi.c 2011-03-29 23:03:01.099272042 -0700
@@ -1066,7 +1066,7 @@
return -EINVAL;
return count;
}
-static DEVICE_ATTR(threeg, S_IWUGO | S_IRUGO | S_IWUSR, show_bool_threeg,
+static DEVICE_ATTR(threeg, S_IRUGO | S_IWUSR, show_bool_threeg,
set_bool_threeg);

static ssize_t show_interface(struct device *dev, struct device_attribute *attr,

2011-03-30 21:39:45

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [148/275] staging: usbip: vhci: refuse to enqueue for dead connections

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Max Vozeler <[email protected]>

commit 6d212153a838354078cc7d96f9bb23b7d1fd3d1b upstream.

There can be requests to enqueue URBs while we are shutting
down a connection.

Signed-off-by: Max Vozeler <[email protected]>
Tested-by: Mark Wehby <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/staging/usbip/vhci_hcd.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)

Index: linux-2.6.35.y/drivers/staging/usbip/vhci_hcd.c
===================================================================
--- linux-2.6.35.y.orig/drivers/staging/usbip/vhci_hcd.c 2011-03-29 23:03:01.320266388 -0700
+++ linux-2.6.35.y/drivers/staging/usbip/vhci_hcd.c 2011-03-29 23:54:38.179025521 -0700
@@ -559,6 +559,7 @@
struct device *dev = &urb->dev->dev;
int ret = 0;
unsigned long flags;
+ struct vhci_device *vdev;

usbip_dbg_vhci_hc("enter, usb_hcd %p urb %p mem_flags %d\n",
hcd, urb, mem_flags);
@@ -574,6 +575,18 @@
return urb->status;
}

+ vdev = port_to_vdev(the_controller->pending_port);
+
+ /* refuse enqueue for dead connection */
+ spin_lock(&vdev->ud.lock);
+ if (vdev->ud.status == VDEV_ST_NULL || vdev->ud.status == VDEV_ST_ERROR) {
+ usbip_uerr("enqueue for inactive port %d\n", vdev->rhport);
+ spin_unlock(&vdev->ud.lock);
+ spin_unlock_irqrestore(&the_controller->lock, flags);
+ return -ENODEV;
+ }
+ spin_unlock(&vdev->ud.lock);
+
ret = usb_hcd_link_urb_to_ep(hcd, urb);
if (ret)
goto no_need_unlink;
@@ -592,8 +605,6 @@
__u8 type = usb_pipetype(urb->pipe);
struct usb_ctrlrequest *ctrlreq =
(struct usb_ctrlrequest *) urb->setup_packet;
- struct vhci_device *vdev =
- port_to_vdev(the_controller->pending_port);

if (type != PIPE_CONTROL || !ctrlreq) {
dev_err(dev, "invalid request to devnum 0\n");

2011-03-30 21:39:58

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [147/275] staging: usbip: vhci: give back URBs from in-flight unlink requests

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Max Vozeler <[email protected]>

commit b92a5e23737172c52656a090977408a80d7f06d1 upstream.

If we never received a RET_UNLINK because the TCP
connection broke the pending URBs still need to be
unlinked and given back.

Previously processes would be stuck trying to kill
the URB even after the device was detached.

Signed-off-by: Max Vozeler <[email protected]>
Tested-by: Mark Wehby <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/staging/usbip/vhci.h | 3 +++
drivers/staging/usbip/vhci_hcd.c | 24 +++++++++++++++++++++++-
drivers/staging/usbip/vhci_rx.c | 15 +++++++++------
3 files changed, 35 insertions(+), 7 deletions(-)

Index: linux-2.6.35.y/drivers/staging/usbip/vhci.h
===================================================================
--- linux-2.6.35.y.orig/drivers/staging/usbip/vhci.h 2011-03-29 22:51:07.834522704 -0700
+++ linux-2.6.35.y/drivers/staging/usbip/vhci.h 2011-03-29 23:54:38.178025546 -0700
@@ -119,6 +119,9 @@
void vhci_rx_loop(struct usbip_task *ut);
void vhci_tx_loop(struct usbip_task *ut);

+struct urb *pickup_urb_and_free_priv(struct vhci_device *vdev,
+ __u32 seqnum);
+
#define hardware (&the_controller->pdev.dev)

static inline struct vhci_device *port_to_vdev(__u32 port)
Index: linux-2.6.35.y/drivers/staging/usbip/vhci_hcd.c
===================================================================
--- linux-2.6.35.y.orig/drivers/staging/usbip/vhci_hcd.c 2011-03-29 23:03:01.301266875 -0700
+++ linux-2.6.35.y/drivers/staging/usbip/vhci_hcd.c 2011-03-29 23:54:38.681012675 -0700
@@ -808,7 +808,6 @@
return 0;
}

-
static void vhci_device_unlink_cleanup(struct vhci_device *vdev)
{
struct vhci_unlink *unlink, *tmp;
@@ -816,11 +815,34 @@
spin_lock(&vdev->priv_lock);

list_for_each_entry_safe(unlink, tmp, &vdev->unlink_tx, list) {
+ usbip_uinfo("unlink cleanup tx %lu\n", unlink->unlink_seqnum);
list_del(&unlink->list);
kfree(unlink);
}

list_for_each_entry_safe(unlink, tmp, &vdev->unlink_rx, list) {
+ struct urb *urb;
+
+ /* give back URB of unanswered unlink request */
+ usbip_uinfo("unlink cleanup rx %lu\n", unlink->unlink_seqnum);
+
+ urb = pickup_urb_and_free_priv(vdev, unlink->unlink_seqnum);
+ if (!urb) {
+ usbip_uinfo("the urb (seqnum %lu) was already given back\n",
+ unlink->unlink_seqnum);
+ list_del(&unlink->list);
+ kfree(unlink);
+ continue;
+ }
+
+ urb->status = -ENODEV;
+
+ spin_lock(&the_controller->lock);
+ usb_hcd_unlink_urb_from_ep(vhci_to_hcd(the_controller), urb);
+ spin_unlock(&the_controller->lock);
+
+ usb_hcd_giveback_urb(vhci_to_hcd(the_controller), urb, urb->status);
+
list_del(&unlink->list);
kfree(unlink);
}
Index: linux-2.6.35.y/drivers/staging/usbip/vhci_rx.c
===================================================================
--- linux-2.6.35.y.orig/drivers/staging/usbip/vhci_rx.c 2011-03-29 22:51:07.834522704 -0700
+++ linux-2.6.35.y/drivers/staging/usbip/vhci_rx.c 2011-03-29 23:03:01.322266336 -0700
@@ -23,16 +23,14 @@
#include "vhci.h"


-/* get URB from transmitted urb queue */
-static struct urb *pickup_urb_and_free_priv(struct vhci_device *vdev,
+/* get URB from transmitted urb queue. caller must hold vdev->priv_lock */
+struct urb *pickup_urb_and_free_priv(struct vhci_device *vdev,
__u32 seqnum)
{
struct vhci_priv *priv, *tmp;
struct urb *urb = NULL;
int status;

- spin_lock(&vdev->priv_lock);
-
list_for_each_entry_safe(priv, tmp, &vdev->priv_rx, list) {
if (priv->seqnum == seqnum) {
urb = priv->urb;
@@ -63,8 +61,6 @@
}
}

- spin_unlock(&vdev->priv_lock);
-
return urb;
}

@@ -74,9 +70,11 @@
struct usbip_device *ud = &vdev->ud;
struct urb *urb;

+ spin_lock(&vdev->priv_lock);

urb = pickup_urb_and_free_priv(vdev, pdu->base.seqnum);

+ spin_unlock(&vdev->priv_lock);

if (!urb) {
usbip_uerr("cannot find a urb of seqnum %u\n",
@@ -161,7 +159,12 @@
return;
}

+ spin_lock(&vdev->priv_lock);
+
urb = pickup_urb_and_free_priv(vdev, unlink->unlink_seqnum);
+
+ spin_unlock(&vdev->priv_lock);
+
if (!urb) {
/*
* I get the result of a unlink request. But, it seems that I

2011-03-30 21:40:25

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [146/275] staging: usbip: vhci: update reference count for usb_device

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Max Vozeler <[email protected]>

commit 7606ee8aa33287dd3e6eb44c78541b87a413a325 upstream.

This fixes an oops observed when reading status during
removal of a device:

[ 1706.648285] general protection fault: 0000 [#1] SMP
[ 1706.648294] last sysfs file: /sys/devices/platform/vhci_hcd/status
[ 1706.648297] CPU 1
[ 1706.648300] Modules linked in: binfmt_misc microcode fuse loop vhci_hcd(N) usbip(N) usbcore usbip_common_mod(N) rtc_core rtc_lib joydev dm_mirror dm_region_hash dm_log linear dm_snapshot xennet dm_mod ext3 mbcache jbd processor thermal_sys hwmon xenblk cdrom
[ 1706.648324] Supported: Yes
[ 1706.648327] Pid: 10422, comm: usbip Tainted: G N 2.6.32.12-0.7-xen #1
[ 1706.648330] RIP: e030:[<ffffffff801b10d5>] [<ffffffff801b10d5>] strnlen+0x5/0x40
[ 1706.648340] RSP: e02b:ffff8800a994dd30 EFLAGS: 00010286
[ 1706.648343] RAX: ffffffff80481ec1 RBX: 0000000000000000 RCX: 0000000000000002
[ 1706.648347] RDX: 00200d1d4f1c001c RSI: ffffffffffffffff RDI: 00200d1d4f1c001c
[ 1706.648350] RBP: ffff880129a1c0aa R08: ffffffffa01901c4 R09: 0000000000000006
[ 1706.648353] R10: 0000000000000000 R11: 0000000000000000 R12: ffff8800a9a1c0ab
[ 1706.648357] R13: 00200d1d4f1c001c R14: 00000000ffffffff R15: ffff880129a1c0aa
[ 1706.648363] FS: 00007f2f2e9ca700(0000) GS:ffff880001018000(0000) knlGS:0000000000000000
[ 1706.648367] CS: e033 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1706.648370] CR2: 000000000071b048 CR3: 00000000b4b68000 CR4: 0000000000002660
[ 1706.648374] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 1706.648378] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[ 1706.648381] Process usbip (pid: 10422, threadinfo ffff8800a994c000, task ffff88007b170200)
[ 1706.648385] Stack:
[ 1706.648387] ffffffff801b28c9 0000000000000002 ffffffffa01901c4 ffff8800a9a1c0ab
[ 1706.648391] <0> ffffffffa01901c6 ffff8800a994de08 ffffffff801b339b 0000000000000004
[ 1706.648397] <0> 0000000affffffff ffffffffffffffff 00000000000067c0 0000000000000000
[ 1706.648404] Call Trace:
[ 1706.648413] [<ffffffff801b28c9>] string+0x39/0xe0
[ 1706.648419] [<ffffffff801b339b>] vsnprintf+0x1eb/0x620
[ 1706.648423] [<ffffffff801b3813>] sprintf+0x43/0x50
[ 1706.648429] [<ffffffffa018d719>] show_status+0x1b9/0x220 [vhci_hcd]
[ 1706.648438] [<ffffffff8024a2b7>] dev_attr_show+0x27/0x60
[ 1706.648445] [<ffffffff80144821>] sysfs_read_file+0x101/0x1d0
[ 1706.648451] [<ffffffff800da4a7>] vfs_read+0xc7/0x130
[ 1706.648457] [<ffffffff800da613>] sys_read+0x53/0xa0
[ 1706.648462] [<ffffffff80007458>] system_call_fastpath+0x16/0x1b
[ 1706.648468] [<00007f2f2de40f30>] 0x7f2f2de40f30
[ 1706.648470] Code: 66 0f 1f 44 00 00 48 83 c2 01 80 3a 00 75 f7 48 89 d0 48 29 f8 f3 c3 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 48 85 f6 74 29 <80> 3f 00 74 24 48 8d 56 ff 48 89 f8 eb 0e 0f 1f 44 00 00 48 83
[ 1706.648507] RIP [<ffffffff801b10d5>] strnlen+0x5/0x40
[ 1706.648511] RSP <ffff8800a994dd30>
[ 1706.649575] ---[ end trace b4eb72bf2e149593 ]---

Signed-off-by: Max Vozeler <[email protected]>
Tested-by: Mark Wehby <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/staging/usbip/vhci_hcd.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

Index: linux-2.6.35.y/drivers/staging/usbip/vhci_hcd.c
===================================================================
--- linux-2.6.35.y.orig/drivers/staging/usbip/vhci_hcd.c 2011-03-29 23:02:58.259344710 -0700
+++ linux-2.6.35.y/drivers/staging/usbip/vhci_hcd.c 2011-03-29 23:54:39.189999652 -0700
@@ -607,7 +607,9 @@
dev_info(dev, "SetAddress Request (%d) to port %d\n",
ctrlreq->wValue, vdev->rhport);

- vdev->udev = urb->dev;
+ if (vdev->udev)
+ usb_put_dev(vdev->udev);
+ vdev->udev = usb_get_dev(urb->dev);

spin_lock(&vdev->ud.lock);
vdev->ud.status = VDEV_ST_USED;
@@ -627,8 +629,9 @@
"Get_Descriptor to device 0 "
"(get max pipe size)\n");

- /* FIXME: reference count? (usb_get_dev()) */
- vdev->udev = urb->dev;
+ if (vdev->udev)
+ usb_put_dev(vdev->udev);
+ vdev->udev = usb_get_dev(urb->dev);
goto out;

default:
@@ -887,6 +890,10 @@
vdev->speed = 0;
vdev->devid = 0;

+ if (vdev->udev)
+ usb_put_dev(vdev->udev);
+ vdev->udev = NULL;
+
ud->tcp_socket = NULL;

ud->status = VDEV_ST_NULL;

2011-03-30 21:08:09

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [132/275] radio-aimslab.c needs #include <linux/delay.h>

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Geert Uytterhoeven <[email protected]>

commit 2400982a2e8a8e4e95f0a0e1517bbe63cc88038f upstream.

Commit e3c92215198cb6aa00ad38db2780faa6b72e0a3f ("[media] radio-aimslab.c: Fix
gcc 4.5+ bug") removed the include, but introduced new callers of msleep():

| drivers/media/radio/radio-aimslab.c: In function ‘rt_decvol’:
| drivers/media/radio/radio-aimslab.c:76: error: implicit declaration of function ‘msleep’

Signed-off-by: Geert Uytterhoeven <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Cc: dann frazier <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
drivers/media/radio/radio-aimslab.c | 1 +
1 file changed, 1 insertion(+)

Index: linux-2.6.35.y/drivers/media/radio/radio-aimslab.c
===================================================================
--- linux-2.6.35.y.orig/drivers/media/radio/radio-aimslab.c 2011-03-29 23:02:59.066324061 -0700
+++ linux-2.6.35.y/drivers/media/radio/radio-aimslab.c 2011-03-29 23:03:01.025273936 -0700
@@ -31,6 +31,7 @@
#include <linux/module.h> /* Modules */
#include <linux/init.h> /* Initdata */
#include <linux/ioport.h> /* request_region */
+#include <linux/delay.h> /* msleep */
#include <linux/videodev2.h> /* kernel radio structs */
#include <linux/version.h> /* for KERNEL_VERSION MACRO */
#include <linux/io.h> /* outb, outb_p */

2011-03-30 21:40:47

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [145/275] sierra: add new ID for Airprime/Sierra USB IP modem

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Jon Thomas <[email protected]>

commit e1dc5157c574e7249dc1cd072fde2e48b3011533 upstream.

I picked up a new Sierra usb 308 (At&t Shockwave) on 2/2011 and the vendor code
is 0x0f3d

Looking up vendor and product id's I see:

0f3d Airprime, Incorporated
0112 CDMA 1xEVDO PC Card, PC 5220

Sierra and Airprime are somehow related and I'm guessing the At&t usb 308 might
be have some common hardware with the AirPrime SL809x.

Signed-off-by: Jon Thomas <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/usb/serial/sierra.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

Index: linux-2.6.35.y/drivers/usb/serial/sierra.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/serial/sierra.c 2011-03-29 22:51:08.774498652 -0700
+++ linux-2.6.35.y/drivers/usb/serial/sierra.c 2011-03-29 23:03:01.283267334 -0700
@@ -302,7 +302,9 @@
.driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist
},
{ USB_DEVICE(0x413C, 0x08133) }, /* Dell Computer Corp. Wireless 5720 VZW Mobile Broadband (EVDO Rev-A) Minicard GPS Port */
-
+ { USB_DEVICE(0x0f3d, 0x68A3), /* Airprime/Sierra Wireless Direct IP modems */
+ .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist
+ },
{ }
};
MODULE_DEVICE_TABLE(usb, id_table);

2011-03-30 21:41:05

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [144/275] p54pci: update receive dma buffers before and after processing

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Christian Lamparter <[email protected]>

commit 0bf719dfdecc5552155cbec78e49fa06e531e35c upstream.

Documentation/DMA-API-HOWTO.txt states:

"DMA transfers need to be synced properly in order for
the cpu and device to see the most uptodate and correct
copy of the DMA buffer."

Signed-off-by: Christian Lamparter <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/net/wireless/p54/p54pci.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)

Index: linux-2.6.35.y/drivers/net/wireless/p54/p54pci.c
===================================================================
--- linux-2.6.35.y.orig/drivers/net/wireless/p54/p54pci.c 2011-03-29 22:51:09.343484092 -0700
+++ linux-2.6.35.y/drivers/net/wireless/p54/p54pci.c 2011-03-29 23:03:01.264267821 -0700
@@ -199,6 +199,7 @@
while (i != idx) {
u16 len;
struct sk_buff *skb;
+ dma_addr_t dma_addr;
desc = &ring[i];
len = le16_to_cpu(desc->len);
skb = rx_buf[i];
@@ -216,17 +217,20 @@

len = priv->common.rx_mtu;
}
+ dma_addr = le32_to_cpu(desc->host_addr);
+ pci_dma_sync_single_for_cpu(priv->pdev, dma_addr,
+ priv->common.rx_mtu + 32, PCI_DMA_FROMDEVICE);
skb_put(skb, len);

if (p54_rx(dev, skb)) {
- pci_unmap_single(priv->pdev,
- le32_to_cpu(desc->host_addr),
- priv->common.rx_mtu + 32,
- PCI_DMA_FROMDEVICE);
+ pci_unmap_single(priv->pdev, dma_addr,
+ priv->common.rx_mtu + 32, PCI_DMA_FROMDEVICE);
rx_buf[i] = NULL;
- desc->host_addr = 0;
+ desc->host_addr = cpu_to_le32(0);
} else {
skb_trim(skb, 0);
+ pci_dma_sync_single_for_device(priv->pdev, dma_addr,
+ priv->common.rx_mtu + 32, PCI_DMA_FROMDEVICE);
desc->len = cpu_to_le16(priv->common.rx_mtu + 32);
}

2011-03-30 21:08:07

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [135/275] eCryptfs: Copy up lower inode attrs in getattr

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Tyler Hicks <[email protected]>

commit 55f9cf6bbaa682958a7dd2755f883b768270c3ce upstream.

The lower filesystem may do some type of inode revalidation during a
getattr call. eCryptfs should take advantage of that by copying the
lower inode attributes to the eCryptfs inode after a call to
vfs_getattr() on the lower inode.

I originally wrote this fix while working on eCryptfs on nfsv3 support,
but discovered it also fixed an eCryptfs on ext4 nanosecond timestamp
bug that was reported.

https://bugs.launchpad.net/bugs/613873

Signed-off-by: Tyler Hicks <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
fs/ecryptfs/inode.c | 2 ++
1 file changed, 2 insertions(+)

Index: linux-2.6.35.y/fs/ecryptfs/inode.c
===================================================================
--- linux-2.6.35.y.orig/fs/ecryptfs/inode.c 2011-03-29 22:51:13.546376551 -0700
+++ linux-2.6.35.y/fs/ecryptfs/inode.c 2011-03-29 23:03:01.080272529 -0700
@@ -1003,6 +1003,8 @@
rc = vfs_getattr(ecryptfs_dentry_to_lower_mnt(dentry),
ecryptfs_dentry_to_lower(dentry), &lower_stat);
if (!rc) {
+ fsstack_copy_attr_all(dentry->d_inode,
+ ecryptfs_inode_to_lower(dentry->d_inode));
generic_fillattr(dentry->d_inode, stat);
stat->blocks = lower_stat.blocks;
}

2011-03-30 21:41:27

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [143/275] USB: Add quirk for Samsung Android phone modem

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Maciej Szmigiero <[email protected]>

commit 72a012ce0a02c6c616676a24b40ff81d1aaeafda upstream.

My Galaxy Spica needs this quirk when in modem mode, otherwise
it causes endless USB bus resets and is unusable in this mode.

Unfortunately Samsung decided to reuse ID of its old CDMA phone SGH-I500
for the modem part.
That's why in addition to this patch the visor driver must be prevented
from binding to SPH-I500 ID, so ACM driver can do that.

Signed-off-by: Maciej Szmigiero <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/usb/core/quirks.c | 4 ++++
1 file changed, 4 insertions(+)

Index: linux-2.6.35.y/drivers/usb/core/quirks.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/core/quirks.c 2011-03-29 23:03:01.209269229 -0700
+++ linux-2.6.35.y/drivers/usb/core/quirks.c 2011-03-29 23:03:01.246268282 -0700
@@ -48,6 +48,10 @@
{ USB_DEVICE(0x04b4, 0x0526), .driver_info =
USB_QUIRK_CONFIG_INTF_STRINGS },

+ /* Samsung Android phone modem - ID conflict with SPH-I500 */
+ { USB_DEVICE(0x04e8, 0x6601), .driver_info =
+ USB_QUIRK_CONFIG_INTF_STRINGS },
+
/* Roland SC-8820 */
{ USB_DEVICE(0x0582, 0x0007), .driver_info = USB_QUIRK_RESET_RESUME },

2011-03-30 21:41:43

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [141/275] USB: add quirks entry for Keytouch QWERTY Panel

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Alan Stern <[email protected]>

commit 3c18e30f87ac5466bddbb05cf955605efd7db025 upstream.

This patch (as1448) adds a quirks entry for the Keytouch QWERTY Panel
firmware, used in the IEC 60945 keyboard. This device crashes during
enumeration when the computer asks for its configuration string
descriptor.

Signed-off-by: Alan Stern <[email protected]>
Tested-by: kholis <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/usb/core/quirks.c | 4 ++++
1 file changed, 4 insertions(+)

Index: linux-2.6.35.y/drivers/usb/core/quirks.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/core/quirks.c 2011-03-29 22:51:10.768447631 -0700
+++ linux-2.6.35.y/drivers/usb/core/quirks.c 2011-03-29 23:54:41.011953034 -0700
@@ -68,6 +68,10 @@
/* M-Systems Flash Disk Pioneers */
{ USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME },

+ /* Keytouch QWERTY Panel keyboard */
+ { USB_DEVICE(0x0926, 0x3333), .driver_info =
+ USB_QUIRK_CONFIG_INTF_STRINGS },
+
/* X-Rite/Gretag-Macbeth Eye-One Pro display colorimeter */
{ USB_DEVICE(0x0971, 0x2000), .driver_info = USB_QUIRK_NO_SET_INTF },

2011-03-30 21:41:41

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [142/275] USB: Add Samsung SGH-I500/Android modem ID switch to visor driver

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Maciej Szmigiero <[email protected]>

commit acb52cb1613e1d3c8a8c650717cc51965c60d7d4 upstream.

[USB]Add Samsung SGH-I500/Android modem ID switch to visor driver

Samsung decided to reuse USB ID of its old CDMA phone SGH-I500 for the
modem part of some of their Android phones. At least Galaxy Spica
is affected.

This modem needs ACM driver and does not work with visor driver which
binds the conflicting ID for SGH-I500.
Because SGH-I500 is pretty an old hardware its best to add switch to
visor
driver in cause somebody still wants to use that phone with Linux.

Note that this is needed only when using the Android phone as modem,
not in USB storage or ADB mode.

Signed-off-by: Maciej Szmigiero <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/usb/serial/visor.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

Index: linux-2.6.35.y/drivers/usb/serial/visor.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/serial/visor.c 2011-03-29 22:51:10.292459811 -0700
+++ linux-2.6.35.y/drivers/usb/serial/visor.c 2011-03-29 23:03:01.228268742 -0700
@@ -27,6 +27,7 @@
#include <linux/uaccess.h>
#include <linux/usb.h>
#include <linux/usb/serial.h>
+#include <linux/usb/cdc.h>
#include "visor.h"

/*
@@ -479,6 +480,17 @@

dbg("%s", __func__);

+ /*
+ * some Samsung Android phones in modem mode have the same ID
+ * as SPH-I500, but they are ACM devices, so dont bind to them
+ */
+ if (id->idVendor == SAMSUNG_VENDOR_ID &&
+ id->idProduct == SAMSUNG_SPH_I500_ID &&
+ serial->dev->descriptor.bDeviceClass == USB_CLASS_COMM &&
+ serial->dev->descriptor.bDeviceSubClass ==
+ USB_CDC_SUBCLASS_ACM)
+ return -ENODEV;
+
if (serial->dev->actconfig->desc.bConfigurationValue != 1) {
dev_err(&serial->dev->dev, "active config #%d != 1 ??\n",
serial->dev->actconfig->desc.bConfigurationValue);

2011-03-30 21:42:04

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [140/275] usb: musb: omap2430: fix kernel panic on reboot

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Johan Hovold <[email protected]>

commit b193b412e62b134adf69af286c7e7f8e99259350 upstream.

Cancel idle timer in musb_platform_exit.

The idle timer could trigger after clock had been disabled leading to
kernel panic when MUSB_DEVCTL is accessed in musb_do_idle on 2.6.37.

The fault below is no longer triggered on 2.6.38-rc4 (clock is disabled
later, and only if compiled as a module, and the offending memory access
has moved) but the timer should be cancelled nonetheless.

Rebooting... musb_hdrc musb_hdrc: remove, state 4
usb usb1: USB disconnect, address 1
musb_hdrc musb_hdrc: USB bus 1 deregistered
Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa0ab060
Internal error: : 1028 [#1] PREEMPT
last sysfs file: /sys/kernel/uevent_seqnum
Modules linked in:
CPU: 0 Not tainted (2.6.37+ #6)
PC is at musb_do_idle+0x24/0x138
LR is at musb_do_idle+0x18/0x138
pc : [<c02377d8>] lr : [<c02377cc>] psr: 80000193
sp : cf2bdd80 ip : cf2bdd80 fp : c048a20c
r10: c048a60c r9 : c048a40c r8 : cf85e110
r7 : cf2bc000 r6 : 40000113 r5 : c0489800 r4 : cf85e110
r3 : 00000004 r2 : 00000006 r1 : fa0ab000 r0 : cf8a7000
Flags: Nzcv IRQs off FIQs on Mode SVC_32 ISA ARM Segment user
Control: 10c5387d Table: 8faac019 DAC: 00000015
Process reboot (pid: 769, stack limit = 0xcf2bc2f0)
Stack: (0xcf2bdd80 to 0xcf2be000)
dd80: 00000103 c0489800 c02377b4 c005fa34 00000555 c0071a8c c04a3858 cf2bdda8
dda0: 00000555 c048a00c cf2bdda8 cf2bdda8 1838beb0 00000103 00000004 cf2bc000
ddc0: 00000001 00000001 c04896c8 0000000a 00000000 c005ac14 00000001 c003f32c
dde0: 00000000 00000025 00000000 cf2bc000 00000002 00000001 cf2bc000 00000000
de00: 00000001 c005ad08 cf2bc000 c002e07c c03ec039 ffffffff fa200000 c0033608
de20: 00000001 00000000 cf852c14 cf81f200 c045b714 c045b708 cf2bc000 c04a37e8
de40: c0033c04 cf2bc000 00000000 00000001 cf2bde68 cf2bde68 c01c3abc c004f7d8
de60: 60000013 ffffffff c0033c04 00000000 01234567 fee1dead 00000000 c006627c
de80: 00000001 c00662c8 28121969 c00663ec cfa38c40 cf9f6a00 cf2bded0 cf9f6a0c
dea0: 00000000 cf92f000 00008914 c02cd284 c04a55c8 c028b398 c00715c0 becf24a8
dec0: 30687465 00000000 00000000 00000000 00000002 1301a8c0 00000000 00000000
dee0: 00000002 1301a8c0 00000000 00000000 c0450494 cf527920 00011f10 cf2bdf08
df00: 00011f10 cf2bdf10 00011f10 cf2bdf18 c00f0b44 c004f7e8 cf2bdf18 cf2bdf18
df20: 00011f10 cf2bdf30 00011f10 cf2bdf38 cf401300 cf486100 00000008 c00d2b28
df40: 00011f10 cf401300 00200200 c00d3388 00011f10 cfb63a88 cfb63a80 c00c2f08
df60: 00000000 00000000 cfb63a80 00000000 cf0a3480 00000006 c0033c04 cfb63a80
df80: 00000000 c00c0104 00000003 cf0a3480 cfb63a80 00000000 00000001 00000004
dfa0: 00000058 c0033a80 00000000 00000001 fee1dead 28121969 01234567 00000000
dfc0: 00000000 00000001 00000004 00000058 00000001 00000001 00000000 00000001
dfe0: 4024d200 becf2cb0 00009210 4024d218 60000010 fee1dead 00000000 00000000
[<c02377d8>] (musb_do_idle+0x24/0x138) from [<c005fa34>] (run_timer_softirq+0x1a8/0x26)
[<c005fa34>] (run_timer_softirq+0x1a8/0x26c) from [<c005ac14>] (__do_softirq+0x88/0x13)
[<c005ac14>] (__do_softirq+0x88/0x138) from [<c005ad08>] (irq_exit+0x44/0x98)
[<c005ad08>] (irq_exit+0x44/0x98) from [<c002e07c>] (asm_do_IRQ+0x7c/0xa0)
[<c002e07c>] (asm_do_IRQ+0x7c/0xa0) from [<c0033608>] (__irq_svc+0x48/0xa8)
Exception stack(0xcf2bde20 to 0xcf2bde68)
de20: 00000001 00000000 cf852c14 cf81f200 c045b714 c045b708 cf2bc000 c04a37e8
de40: c0033c04 cf2bc000 00000000 00000001 cf2bde68 cf2bde68 c01c3abc c004f7d8
de60: 60000013 ffffffff
[<c0033608>] (__irq_svc+0x48/0xa8) from [<c004f7d8>] (sub_preempt_count+0x0/0xb8)
Code: ebf86030 e5940098 e594108c e5902010 (e5d13060)
Signed-off-by: Andi Kleen <[email protected]>

---[ end trace 3689c0d808f9bf7c ]---
Kernel panic - not syncing: Fatal exception in interrupt

Signed-off-by: Johan Hovold <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
drivers/usb/musb/omap2430.c | 1 +
1 file changed, 1 insertion(+)

Index: linux-2.6.35.y/drivers/usb/musb/omap2430.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/musb/omap2430.c 2011-03-29 22:51:11.233435733 -0700
+++ linux-2.6.35.y/drivers/usb/musb/omap2430.c 2011-03-29 23:03:01.192269663 -0700
@@ -323,6 +323,7 @@

int musb_platform_exit(struct musb *musb)
{
+ del_timer_sync(&musb_idle_timer);

musb_platform_suspend(musb);

2011-03-30 21:08:03

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [133/275] ARM: Ensure predictable endian state on signal handler entry

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Russell King <[email protected]>

commit 53399053eb505cf541b2405bd9d9bca5ecfb96fb upstream.

Ensure a predictable endian state when entering signal handlers. This
avoids programs which use SETEND to momentarily switch their endian
state from having their signal handlers entered with an unpredictable
endian state.

Acked-by: Dave Martin <[email protected]>
Signed-off-by: Russell King <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
arch/arm/kernel/signal.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

Index: linux-2.6.35.y/arch/arm/kernel/signal.c
===================================================================
--- linux-2.6.35.y.orig/arch/arm/kernel/signal.c 2011-03-29 22:51:14.413354368 -0700
+++ linux-2.6.35.y/arch/arm/kernel/signal.c 2011-03-29 23:03:01.044273450 -0700
@@ -474,7 +474,9 @@
unsigned long handler = (unsigned long)ka->sa.sa_handler;
unsigned long retcode;
int thumb = 0;
- unsigned long cpsr = regs->ARM_cpsr & ~PSR_f;
+ unsigned long cpsr = regs->ARM_cpsr & ~(PSR_f | PSR_E_BIT);
+
+ cpsr |= PSR_ENDSTATE;

/*
* Maybe we need to deliver a 32-bit signal to a 26-bit task.

2011-03-30 21:08:00

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [134/275] acer-wmi: Fix capitalisation of GUID

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Matthew Garrett <[email protected]>

commit bbb706079abe955a9e3f208f541de97d99449236 upstream.

6AF4F258-B401-42fd-BE91-3D4AC2D7C0D3 needs to be
6AF4F258-B401-42FD-BE91-3D4AC2D7C0D3 to match the hardware alias.

Signed-off-by: Matthew Garrett <[email protected]>
Acked-by: Carlos Corbacho <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/platform/x86/acer-wmi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.35.y/drivers/platform/x86/acer-wmi.c
===================================================================
--- linux-2.6.35.y.orig/drivers/platform/x86/acer-wmi.c 2011-03-29 22:51:13.954366111 -0700
+++ linux-2.6.35.y/drivers/platform/x86/acer-wmi.c 2011-03-29 23:54:44.341867828 -0700
@@ -91,7 +91,7 @@
*/
#define AMW0_GUID1 "67C3371D-95A3-4C37-BB61-DD47B491DAAB"
#define AMW0_GUID2 "431F16ED-0C2B-444C-B267-27DEB140CF9C"
-#define WMID_GUID1 "6AF4F258-B401-42fd-BE91-3D4AC2D7C0D3"
+#define WMID_GUID1 "6AF4F258-B401-42FD-BE91-3D4AC2D7C0D3"
#define WMID_GUID2 "95764E09-FB56-4e83-B31A-37761F60994A"

MODULE_ALIAS("wmi:67C3371D-95A3-4C37-BB61-DD47B491DAAB");

2011-03-30 21:42:34

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [138/275] platform: x86: tc1100-wmi: world-writable sysfs wireless and jogdial files

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Vasiliy Kulikov <[email protected]>

commit 8a6a142c1286797978e4db266d22875a5f424897 upstream.

Don't allow everybody to change WMI settings.

Signed-off-by: Vasiliy Kulikov <[email protected]>
Signed-off-by: Matthew Garrett <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/platform/x86/tc1100-wmi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.35.y/drivers/platform/x86/tc1100-wmi.c
===================================================================
--- linux-2.6.35.y.orig/drivers/platform/x86/tc1100-wmi.c 2011-03-29 22:51:12.162411964 -0700
+++ linux-2.6.35.y/drivers/platform/x86/tc1100-wmi.c 2011-03-29 23:03:01.135271122 -0700
@@ -162,7 +162,7 @@
return -EINVAL; \
return count; \
} \
-static DEVICE_ATTR(value, S_IWUGO | S_IRUGO | S_IWUSR, \
+static DEVICE_ATTR(value, S_IRUGO | S_IWUSR, \
show_bool_##value, set_bool_##value);

show_set_bool(wireless, TC1100_INSTANCE_WIRELESS);

2011-03-30 21:07:53

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [123/275] isdn: hisax: Replace the bogus access to irq stats

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Thomas Gleixner <[email protected]>

commit 40f08a724fcc21285cf3a75aec957aef908605c6 upstream.

Abusing irq stats in a driver for counting interrupts is a horrible
idea and not safe with shared interrupts. Replace it by a local
interrupt counter.

Noticed by the attempt to remove the irq stats export.

Signed-off-by: Thomas Gleixner <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Reviewed-by: Ingo Molnar <[email protected]>
Cc: maximilian attems <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
drivers/isdn/hisax/config.c | 18 ++++++++++++++----
drivers/isdn/hisax/hisax.h | 1 +
2 files changed, 15 insertions(+), 4 deletions(-)

Index: linux-2.6.35.y/drivers/isdn/hisax/config.c
===================================================================
--- linux-2.6.35.y.orig/drivers/isdn/hisax/config.c 2011-03-29 22:51:18.981237487 -0700
+++ linux-2.6.35.y/drivers/isdn/hisax/config.c 2011-03-29 23:03:00.769280486 -0700
@@ -801,6 +801,16 @@
ll_unload(csta);
}

+static irqreturn_t card_irq(int intno, void *dev_id)
+{
+ struct IsdnCardState *cs = dev_id;
+ irqreturn_t ret = cs->irq_func(intno, cs);
+
+ if (ret == IRQ_HANDLED)
+ cs->irq_cnt++;
+ return ret;
+}
+
static int init_card(struct IsdnCardState *cs)
{
int irq_cnt, cnt = 3, ret;
@@ -809,10 +819,10 @@
ret = cs->cardmsg(cs, CARD_INIT, NULL);
return(ret);
}
- irq_cnt = kstat_irqs(cs->irq);
+ irq_cnt = cs->irq_cnt = 0;
printk(KERN_INFO "%s: IRQ %d count %d\n", CardType[cs->typ],
cs->irq, irq_cnt);
- if (request_irq(cs->irq, cs->irq_func, cs->irq_flags, "HiSax", cs)) {
+ if (request_irq(cs->irq, card_irq, cs->irq_flags, "HiSax", cs)) {
printk(KERN_WARNING "HiSax: couldn't get interrupt %d\n",
cs->irq);
return 1;
@@ -822,8 +832,8 @@
/* Timeout 10ms */
msleep(10);
printk(KERN_INFO "%s: IRQ %d count %d\n",
- CardType[cs->typ], cs->irq, kstat_irqs(cs->irq));
- if (kstat_irqs(cs->irq) == irq_cnt) {
+ CardType[cs->typ], cs->irq, cs->irq_cnt);
+ if (cs->irq_cnt == irq_cnt) {
printk(KERN_WARNING
"%s: IRQ(%d) getting no interrupts during init %d\n",
CardType[cs->typ], cs->irq, 4 - cnt);
Index: linux-2.6.35.y/drivers/isdn/hisax/hisax.h
===================================================================
--- linux-2.6.35.y.orig/drivers/isdn/hisax/hisax.h 2011-03-29 22:51:18.981237487 -0700
+++ linux-2.6.35.y/drivers/isdn/hisax/hisax.h 2011-03-29 23:03:00.770280460 -0700
@@ -959,6 +959,7 @@
u_long event;
struct work_struct tqueue;
struct timer_list dbusytimer;
+ unsigned int irq_cnt;
#ifdef ERROR_STATISTIC
int err_crc;
int err_tx;

2011-03-30 21:43:03

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [130/275] ALSA: HDA: Add position_fix quirk for an Asus device

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: David Henningsson <[email protected]>

commit b540afc2b3d6e4cd1d1f137ef6d9e9c78d67fecd upstream.

The bug reporter claims that position_fix=1 is needed for his
microphone to work. The controller PCI vendor-id is [1002:4383] (rev 40).

Reported-by: Kjell L.
BugLink: http://bugs.launchpad.net/bugs/718402
Signed-off-by: David Henningsson <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>


---
sound/pci/hda/hda_intel.c | 1 +
1 file changed, 1 insertion(+)

Index: linux-2.6.35.y/sound/pci/hda/hda_intel.c
===================================================================
--- linux-2.6.35.y.orig/sound/pci/hda/hda_intel.c 2011-03-29 22:51:15.809318648 -0700
+++ linux-2.6.35.y/sound/pci/hda/hda_intel.c 2011-03-29 23:03:00.988274883 -0700
@@ -2300,6 +2300,7 @@
SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB),
SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB),
SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS M2V", POS_FIX_LPIB),
+ SND_PCI_QUIRK(0x1043, 0x8410, "ASUS", POS_FIX_LPIB),
SND_PCI_QUIRK(0x104d, 0x9069, "Sony VPCS11V9E", POS_FIX_LPIB),
SND_PCI_QUIRK(0x1106, 0x3288, "ASUS M2V-MX SE", POS_FIX_LPIB),
SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba A100-259", POS_FIX_LPIB),

2011-03-30 21:43:41

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [129/275] fs/partitions: Validate map_count in Mac partition tables

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Timo Warns <[email protected]>

commit fa7ea87a057958a8b7926c1a60a3ca6d696328ed upstream.

Validate number of blocks in map and remove redundant variable.

Signed-off-by: Timo Warns <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
fs/partitions/mac.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)

Index: linux-2.6.35.y/fs/partitions/mac.c
===================================================================
--- linux-2.6.35.y.orig/fs/partitions/mac.c 2011-03-29 22:51:16.260307109 -0700
+++ linux-2.6.35.y/fs/partitions/mac.c 2011-03-29 23:03:00.969275369 -0700
@@ -29,10 +29,9 @@

int mac_partition(struct parsed_partitions *state)
{
- int slot = 1;
Sector sect;
unsigned char *data;
- int blk, blocks_in_map;
+ int slot, blocks_in_map;
unsigned secsize;
#ifdef CONFIG_PPC_PMAC
int found_root = 0;
@@ -59,10 +58,14 @@
put_dev_sector(sect);
return 0; /* not a MacOS disk */
}
- printk(" [mac]");
blocks_in_map = be32_to_cpu(part->map_count);
- for (blk = 1; blk <= blocks_in_map; ++blk) {
- int pos = blk * secsize;
+ if (blocks_in_map < 0 || blocks_in_map >= DISK_MAX_PARTS) {
+ put_dev_sector(sect);
+ return 0;
+ }
+ printk(" [mac]");
+ for (slot = 1; slot <= blocks_in_map; ++slot) {
+ int pos = slot * secsize;
put_dev_sector(sect);
data = read_part_sector(state, pos/512, &sect);
if (!data)
@@ -113,13 +116,11 @@
}

if (goodness > found_root_goodness) {
- found_root = blk;
+ found_root = slot;
found_root_goodness = goodness;
}
}
#endif /* CONFIG_PPC_PMAC */
-
- ++slot;
}
#ifdef CONFIG_PPC_PMAC
if (found_root_goodness)

2011-03-30 21:07:49

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [117/275] [v3,media] av7110: check for negative array offset

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Dan Carpenter <[email protected]>

commit cb26a24ee9706473f31d34cc259f4dcf45cd0644 upstream.

info->num comes from the user. It's type int. If the user passes
in a negative value that would cause memory corruption.

Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/media/dvb/ttpci/av7110_ca.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.35.y/drivers/media/dvb/ttpci/av7110_ca.c
===================================================================
--- linux-2.6.35.y.orig/drivers/media/dvb/ttpci/av7110_ca.c 2011-03-29 22:51:21.638169502 -0700
+++ linux-2.6.35.y/drivers/media/dvb/ttpci/av7110_ca.c 2011-03-29 23:03:00.655283403 -0700
@@ -277,7 +277,7 @@
{
ca_slot_info_t *info=(ca_slot_info_t *)parg;

- if (info->num > 1)
+ if (info->num < 0 || info->num > 1)
return -EINVAL;
av7110->ci_slot[info->num].num = info->num;
av7110->ci_slot[info->num].type = FW_CI_LL_SUPPORT(av7110->arm_app) ?

2011-03-30 21:44:02

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [127/275] s390: remove task_show_regs

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Martin Schwidefsky <[email protected]>

commit 261cd298a8c363d7985e3482946edb4bfedacf98 upstream.

task_show_regs used to be a debugging aid in the early bringup days
of Linux on s390. /proc/<pid>/status is a world readable file, it
is not a good idea to show the registers of a process. The only
correct fix is to remove task_show_regs.

Reported-by: Al Viro <[email protected]>
Signed-off-by: Martin Schwidefsky <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
arch/s390/include/asm/processor.h | 5 -----
arch/s390/kernel/traps.c | 37 -------------------------------------
fs/proc/array.c | 3 ---
3 files changed, 45 deletions(-)

Index: linux-2.6.35.y/arch/s390/include/asm/processor.h
===================================================================
--- linux-2.6.35.y.orig/arch/s390/include/asm/processor.h 2011-03-29 22:51:17.188283363 -0700
+++ linux-2.6.35.y/arch/s390/include/asm/processor.h 2011-03-29 23:03:00.876277749 -0700
@@ -150,11 +150,6 @@
*/
extern unsigned long thread_saved_pc(struct task_struct *t);

-/*
- * Print register of task into buffer. Used in fs/proc/array.c.
- */
-extern void task_show_regs(struct seq_file *m, struct task_struct *task);
-
extern void show_code(struct pt_regs *regs);

unsigned long get_wchan(struct task_struct *p);
Index: linux-2.6.35.y/arch/s390/kernel/traps.c
===================================================================
--- linux-2.6.35.y.orig/arch/s390/kernel/traps.c 2011-03-29 22:51:17.188283363 -0700
+++ linux-2.6.35.y/arch/s390/kernel/traps.c 2011-03-29 23:03:00.892277339 -0700
@@ -237,43 +237,6 @@
show_last_breaking_event(regs);
}

-/* This is called from fs/proc/array.c */
-void task_show_regs(struct seq_file *m, struct task_struct *task)
-{
- struct pt_regs *regs;
-
- regs = task_pt_regs(task);
- seq_printf(m, "task: %p, ksp: %p\n",
- task, (void *)task->thread.ksp);
- seq_printf(m, "User PSW : %p %p\n",
- (void *) regs->psw.mask, (void *)regs->psw.addr);
-
- seq_printf(m, "User GPRS: " FOURLONG,
- regs->gprs[0], regs->gprs[1],
- regs->gprs[2], regs->gprs[3]);
- seq_printf(m, " " FOURLONG,
- regs->gprs[4], regs->gprs[5],
- regs->gprs[6], regs->gprs[7]);
- seq_printf(m, " " FOURLONG,
- regs->gprs[8], regs->gprs[9],
- regs->gprs[10], regs->gprs[11]);
- seq_printf(m, " " FOURLONG,
- regs->gprs[12], regs->gprs[13],
- regs->gprs[14], regs->gprs[15]);
- seq_printf(m, "User ACRS: %08x %08x %08x %08x\n",
- task->thread.acrs[0], task->thread.acrs[1],
- task->thread.acrs[2], task->thread.acrs[3]);
- seq_printf(m, " %08x %08x %08x %08x\n",
- task->thread.acrs[4], task->thread.acrs[5],
- task->thread.acrs[6], task->thread.acrs[7]);
- seq_printf(m, " %08x %08x %08x %08x\n",
- task->thread.acrs[8], task->thread.acrs[9],
- task->thread.acrs[10], task->thread.acrs[11]);
- seq_printf(m, " %08x %08x %08x %08x\n",
- task->thread.acrs[12], task->thread.acrs[13],
- task->thread.acrs[14], task->thread.acrs[15]);
-}
-
static DEFINE_SPINLOCK(die_lock);

void die(const char * str, struct pt_regs * regs, long err)
Index: linux-2.6.35.y/fs/proc/array.c
===================================================================
--- linux-2.6.35.y.orig/fs/proc/array.c 2011-03-29 22:51:17.188283363 -0700
+++ linux-2.6.35.y/fs/proc/array.c 2011-03-29 23:53:59.507015039 -0700
@@ -353,9 +353,6 @@
task_cap(m, task);
task_cpus_allowed(m, task);
cpuset_task_status_allowed(m, task);
-#if defined(CONFIG_S390)
- task_show_regs(m, task);
-#endif
task_context_switch_counts(m, task);
return 0;
}

2011-03-30 21:43:59

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [128/275] PM / Hibernate: Return error code when alloc_image_page() fails

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Stanislaw Gruszka <[email protected]>

commit 2e725a065b0153f0c449318da1923a120477633d upstream.

Currently we return 0 in swsusp_alloc() when alloc_image_page() fails.
Fix that. Also remove unneeded "error" variable since the only
useful value of error is -ENOMEM.

[rjw: Fixed up the changelog and changed subject.]

Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Rafael J. Wysocki <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
kernel/power/snapshot.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)

Index: linux-2.6.35.y/kernel/power/snapshot.c
===================================================================
--- linux-2.6.35.y.orig/kernel/power/snapshot.c 2011-03-29 22:51:16.709295620 -0700
+++ linux-2.6.35.y/kernel/power/snapshot.c 2011-03-29 23:53:44.733393061 -0700
@@ -1512,11 +1512,8 @@
swsusp_alloc(struct memory_bitmap *orig_bm, struct memory_bitmap *copy_bm,
unsigned int nr_pages, unsigned int nr_highmem)
{
- int error = 0;
-
if (nr_highmem > 0) {
- error = get_highmem_buffer(PG_ANY);
- if (error)
+ if (get_highmem_buffer(PG_ANY))
goto err_out;
if (nr_highmem > alloc_highmem) {
nr_highmem -= alloc_highmem;
@@ -1539,7 +1536,7 @@

err_out:
swsusp_free();
- return error;
+ return -ENOMEM;
}

asmlinkage int swsusp_save(void)

2011-03-30 21:44:39

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [126/275] nfsd: correctly handle return value from nfsd_map_name_to_*

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: NeilBrown <[email protected]>

commit 47c85291d3dd1a51501555000b90f8e281a0458e upstream.

These functions return an nfs status, not a host_err. So don't
try to convert before returning.

This is a regression introduced by
3c726023402a2f3b28f49b9d90ebf9e71151157d; I fixed up two of the callers,
but missed these two.

Reported-by: Herbert Poetzl <[email protected]>
Signed-off-by: NeilBrown <[email protected]>
Signed-off-by: J. Bruce Fields <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
fs/nfsd/nfs4xdr.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

Index: linux-2.6.35.y/fs/nfsd/nfs4xdr.c
===================================================================
--- linux-2.6.35.y.orig/fs/nfsd/nfs4xdr.c 2011-03-29 22:51:17.639271825 -0700
+++ linux-2.6.35.y/fs/nfsd/nfs4xdr.c 2011-03-29 23:54:22.675422220 -0700
@@ -316,8 +316,8 @@
READ_BUF(dummy32);
len += (XDR_QUADLEN(dummy32) << 2);
READMEM(buf, dummy32);
- if ((host_err = nfsd_map_name_to_uid(argp->rqstp, buf, dummy32, &iattr->ia_uid)))
- goto out_nfserr;
+ if ((status = nfsd_map_name_to_uid(argp->rqstp, buf, dummy32, &iattr->ia_uid)))
+ return status;
iattr->ia_valid |= ATTR_UID;
}
if (bmval[1] & FATTR4_WORD1_OWNER_GROUP) {
@@ -327,8 +327,8 @@
READ_BUF(dummy32);
len += (XDR_QUADLEN(dummy32) << 2);
READMEM(buf, dummy32);
- if ((host_err = nfsd_map_name_to_gid(argp->rqstp, buf, dummy32, &iattr->ia_gid)))
- goto out_nfserr;
+ if ((status = nfsd_map_name_to_gid(argp->rqstp, buf, dummy32, &iattr->ia_gid)))
+ return status;
iattr->ia_valid |= ATTR_GID;
}
if (bmval[1] & FATTR4_WORD1_TIME_ACCESS_SET) {

2011-03-30 21:07:47

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [113/275] sctp: Fix out-of-bounds reading in sctp_asoc_get_hmac()

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Dan Rosenberg <[email protected]>

commit 51e97a12bef19b7e43199fc153cf9bd5f2140362 upstream.

The sctp_asoc_get_hmac() function iterates through a peer's hmac_ids
array and attempts to ensure that only a supported hmac entry is
returned. The current code fails to do this properly - if the last id
in the array is out of range (greater than SCTP_AUTH_HMAC_ID_MAX), the
id integer remains set after exiting the loop, and the address of an
out-of-bounds entry will be returned and subsequently used in the parent
function, causing potentially ugly memory corruption. This patch resets
the id integer to 0 on encountering an invalid id so that NULL will be
returned after finishing the loop if no valid ids are found.

Signed-off-by: Dan Rosenberg <[email protected]>
Acked-by: Vlad Yasevich <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
net/sctp/auth.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

Index: linux-2.6.35.y/net/sctp/auth.c
===================================================================
--- linux-2.6.35.y.orig/net/sctp/auth.c 2011-03-29 22:51:23.475122499 -0700
+++ linux-2.6.35.y/net/sctp/auth.c 2011-03-29 23:03:00.538286398 -0700
@@ -543,16 +543,20 @@
id = ntohs(hmacs->hmac_ids[i]);

/* Check the id is in the supported range */
- if (id > SCTP_AUTH_HMAC_ID_MAX)
+ if (id > SCTP_AUTH_HMAC_ID_MAX) {
+ id = 0;
continue;
+ }

/* See is we support the id. Supported IDs have name and
* length fields set, so that we can allocated and use
* them. We can safely just check for name, for without the
* name, we can't allocate the TFM.
*/
- if (!sctp_hmac_list[id].hmac_name)
+ if (!sctp_hmac_list[id].hmac_name) {
+ id = 0;
continue;
+ }

break;
}

2011-03-30 21:45:13

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [125/275] scsi_dh_alua: Add IBM Power Virtual SCSI ALUA device to dev list

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Brian King <[email protected]>

commit 22963a37b3437a25812cc856afa5a84ad4a3f541 upstream.

Adds IBM Power Virtual SCSI ALUA devices to the ALUA device handler.

Signed-off-by: Brian King <[email protected]>
Signed-off-by: James Bottomley <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Cc: maximilian attems <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
drivers/scsi/device_handler/scsi_dh_alua.c | 1 +
1 file changed, 1 insertion(+)

Index: linux-2.6.35.y/drivers/scsi/device_handler/scsi_dh_alua.c
===================================================================
--- linux-2.6.35.y.orig/drivers/scsi/device_handler/scsi_dh_alua.c 2011-03-29 23:03:00.822279127 -0700
+++ linux-2.6.35.y/drivers/scsi/device_handler/scsi_dh_alua.c 2011-03-29 23:03:00.839278695 -0700
@@ -721,6 +721,7 @@
{"NETAPP", "LUN"},
{"AIX", "NVDISK"},
{"NETAPP", "LUN"},
+ {"AIX", "NVDISK"},
{NULL, NULL}
};

2011-03-30 21:45:50

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [122/275] NFS: fix the return value of nfs_file_fsync()

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: J. R. Okajima <[email protected]>

commit 0702099bd86c33c2dcdbd3963433a61f3f503901 upstream.

By the commit af7fa16 2010-08-03 NFS: Fix up the fsync code
close(2) became returning the non-zero value even if it went well.
nfs_file_fsync() should return 0 when "status" is positive.

Signed-off-by: J. R. Okajima <[email protected]>
Signed-off-by: Trond Myklebust <[email protected]>
Signed-off-by: Tim Gardner <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
fs/nfs/file.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.35.y/fs/nfs/file.c
===================================================================
--- linux-2.6.35.y.orig/fs/nfs/file.c 2011-03-29 22:51:19.419226280 -0700
+++ linux-2.6.35.y/fs/nfs/file.c 2011-03-29 23:03:00.750280971 -0700
@@ -222,7 +222,7 @@
have_error |= test_bit(NFS_CONTEXT_ERROR_WRITE, &ctx->flags);
if (have_error)
ret = xchg(&ctx->error, 0);
- if (!ret)
+ if (!ret && status < 0)
ret = status;
return ret;
}

2011-03-30 21:45:48

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [119/275] CRED: Fix kernel panic upon security_file_alloc() failure.

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Tetsuo Handa <[email protected]>

commit 78d2978874e4e10e97dfd4fd79db45bdc0748550 upstream.

In get_empty_filp() since 2.6.29, file_free(f) is called with f->f_cred == NULL
when security_file_alloc() returned an error. As a result, kernel will panic()
due to put_cred(NULL) call within RCU callback.

Fix this bug by assigning f->f_cred before calling security_file_alloc().

Signed-off-by: Tetsuo Handa <[email protected]>
Signed-off-by: David Howells <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
fs/file_table.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.35.y/fs/file_table.c
===================================================================
--- linux-2.6.35.y.orig/fs/file_table.c 2011-03-29 22:51:20.759191992 -0700
+++ linux-2.6.35.y/fs/file_table.c 2011-03-29 23:03:00.692282457 -0700
@@ -123,13 +123,13 @@
goto fail;

percpu_counter_inc(&nr_files);
+ f->f_cred = get_cred(cred);
if (security_file_alloc(f))
goto fail_sec;

INIT_LIST_HEAD(&f->f_u.fu_list);
atomic_long_set(&f->f_count, 1);
rwlock_init(&f->f_owner.lock);
- f->f_cred = get_cred(cred);
spin_lock_init(&f->f_lock);
eventpoll_init_file(f);
/* f->f_version: 0 */

2011-03-30 21:45:46

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [120/275] CRED: Fix BUG() upon security_cred_alloc_blank() failure

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Tetsuo Handa <[email protected]>

commit 2edeaa34a6e3f2c43b667f6c4f7b27944b811695 upstream.

In cred_alloc_blank() since 2.6.32, abort_creds(new) is called with
new->security == NULL and new->magic == 0 when security_cred_alloc_blank()
returns an error. As a result, BUG() will be triggered if SELinux is enabled
or CONFIG_DEBUG_CREDENTIALS=y.

If CONFIG_DEBUG_CREDENTIALS=y, BUG() is called from __invalid_creds() because
cred->magic == 0. Failing that, BUG() is called from selinux_cred_free()
because selinux_cred_free() is not expecting cred->security == NULL. This does
not affect smack_cred_free(), tomoyo_cred_free() or apparmor_cred_free().

Fix these bugs by

(1) Set new->magic before calling security_cred_alloc_blank().

(2) Handle null cred->security in creds_are_invalid() and selinux_cred_free().

Signed-off-by: Tetsuo Handa <[email protected]>
Signed-off-by: David Howells <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
kernel/cred.c | 12 ++++++++----
security/selinux/hooks.c | 6 +++++-
2 files changed, 13 insertions(+), 5 deletions(-)

Index: linux-2.6.35.y/kernel/cred.c
===================================================================
--- linux-2.6.35.y.orig/kernel/cred.c 2011-03-29 22:51:20.320203225 -0700
+++ linux-2.6.35.y/kernel/cred.c 2011-03-29 23:54:51.139693889 -0700
@@ -256,13 +256,13 @@
#endif

atomic_set(&new->usage, 1);
+#ifdef CONFIG_DEBUG_CREDENTIALS
+ new->magic = CRED_MAGIC;
+#endif

if (security_cred_alloc_blank(new, GFP_KERNEL) < 0)
goto error;

-#ifdef CONFIG_DEBUG_CREDENTIALS
- new->magic = CRED_MAGIC;
-#endif
return new;

error:
@@ -754,7 +754,11 @@
if (cred->magic != CRED_MAGIC)
return true;
#ifdef CONFIG_SECURITY_SELINUX
- if (selinux_is_enabled()) {
+ /*
+ * cred->security == NULL if security_cred_alloc_blank() or
+ * security_prepare_creds() returned an error.
+ */
+ if (selinux_is_enabled() && cred->security) {
if ((unsigned long) cred->security < PAGE_SIZE)
return true;
if ((*(u32 *)cred->security & 0xffffff00) ==
Index: linux-2.6.35.y/security/selinux/hooks.c
===================================================================
--- linux-2.6.35.y.orig/security/selinux/hooks.c 2011-03-29 23:02:59.725307200 -0700
+++ linux-2.6.35.y/security/selinux/hooks.c 2011-03-29 23:03:00.712281944 -0700
@@ -3234,7 +3234,11 @@
{
struct task_security_struct *tsec = cred->security;

- BUG_ON((unsigned long) cred->security < PAGE_SIZE);
+ /*
+ * cred->security == NULL if security_cred_alloc_blank() or
+ * security_prepare_creds() returned an error.
+ */
+ BUG_ON(cred->security && (unsigned long) cred->security < PAGE_SIZE);
cred->security = (void *) 0x7UL;
kfree(tsec);
}

2011-03-30 21:45:42

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [124/275] scsi_dh_alua: add netapp to dev list

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Mike Christie <[email protected]>

commit cd4a8814d44672bd2c8f04a472121bfbe193809c upstream.

Newer Netapp target software supports ALUA, so
this patch adds them to the scsi_dev_alua dev list.

Signed-off-by: Mike Christie <[email protected]>
Signed-off-by: James Bottomley <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Cc: maximilian attems <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
drivers/scsi/device_handler/scsi_dh_alua.c | 1 +
1 file changed, 1 insertion(+)

Index: linux-2.6.35.y/drivers/scsi/device_handler/scsi_dh_alua.c
===================================================================
--- linux-2.6.35.y.orig/drivers/scsi/device_handler/scsi_dh_alua.c 2011-03-29 22:51:18.530249026 -0700
+++ linux-2.6.35.y/drivers/scsi/device_handler/scsi_dh_alua.c 2011-03-29 23:54:49.334740074 -0700
@@ -720,6 +720,7 @@
{"Intel", "Multi-Flex"},
{"NETAPP", "LUN"},
{"AIX", "NVDISK"},
+ {"NETAPP", "LUN"},
{NULL, NULL}
};

2011-03-30 21:07:44

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [112/275] mptfusion: Fix Incorrect return value in mptscsih_dev_reset

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Kashyap, Desai <[email protected]>

commit bcfe42e98047f1935c5571c8ea77beb2d43ec19d upstream.

There's a branch at the end of this function that
is supposed to normalize the return value with what
the mid-layer expects. In this one case, we get it wrong.

Also increase the verbosity of the INFO level printk
at the end of mptscsih_abort to include the actual return value
and the scmd->serial_number. The reason being success
or failure is actually determined by the state of
the internal tag list when a TMF is issued, and not the
return value of the TMF cmd. The serial_number is also
used in this decision, thus it's useful to know for debugging
purposes.

Reported-by: Peter M. Petrakis <[email protected]>
Signed-off-by: Kashyap Desai <[email protected]>
Signed-off-by: James Bottomley <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/message/fusion/mptscsih.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

Index: linux-2.6.35.y/drivers/message/fusion/mptscsih.c
===================================================================
--- linux-2.6.35.y.orig/drivers/message/fusion/mptscsih.c 2011-03-29 22:51:23.974109732 -0700
+++ linux-2.6.35.y/drivers/message/fusion/mptscsih.c 2011-03-29 23:03:00.520286858 -0700
@@ -1848,8 +1848,9 @@
}

out:
- printk(MYIOC_s_INFO_FMT "task abort: %s (sc=%p)\n",
- ioc->name, ((retval == SUCCESS) ? "SUCCESS" : "FAILED"), SCpnt);
+ printk(MYIOC_s_INFO_FMT "task abort: %s (rv=%04x) (sc=%p) (sn=%ld)\n",
+ ioc->name, ((retval == SUCCESS) ? "SUCCESS" : "FAILED"), retval,
+ SCpnt, SCpnt->serial_number);

return retval;
}
@@ -1886,7 +1887,7 @@

vdevice = SCpnt->device->hostdata;
if (!vdevice || !vdevice->vtarget) {
- retval = SUCCESS;
+ retval = 0;
goto out;
}

2011-03-30 21:46:47

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [116/275] x86/pvclock: Zero last_value on resume

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Jeremy Fitzhardinge <[email protected]>

commit e7a3481c0246c8e45e79c629efd63b168e91fcda upstream.

If the guest domain has been suspend/resumed or migrated, then the
system clock backing the pvclock clocksource may revert to a smaller
value (ie, can be non-monotonic across the migration/save-restore).

Make sure we zero last_value in that case so that the domain
continues to see clock updates.

Signed-off-by: Jeremy Fitzhardinge <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
arch/x86/include/asm/pvclock.h | 1 +
arch/x86/kernel/pvclock.c | 5 +++++
arch/x86/xen/time.c | 2 ++
3 files changed, 8 insertions(+)

Index: linux-2.6.35.y/arch/x86/include/asm/pvclock.h
===================================================================
--- linux-2.6.35.y.orig/arch/x86/include/asm/pvclock.h 2011-03-29 22:51:22.108157477 -0700
+++ linux-2.6.35.y/arch/x86/include/asm/pvclock.h 2011-03-29 23:03:00.598284861 -0700
@@ -11,5 +11,6 @@
void pvclock_read_wallclock(struct pvclock_wall_clock *wall,
struct pvclock_vcpu_time_info *vcpu,
struct timespec *ts);
+void pvclock_resume(void);

#endif /* _ASM_X86_PVCLOCK_H */
Index: linux-2.6.35.y/arch/x86/kernel/pvclock.c
===================================================================
--- linux-2.6.35.y.orig/arch/x86/kernel/pvclock.c 2011-03-29 22:51:22.108157477 -0700
+++ linux-2.6.35.y/arch/x86/kernel/pvclock.c 2011-03-29 23:03:00.598284861 -0700
@@ -120,6 +120,11 @@

static atomic64_t last_value = ATOMIC64_INIT(0);

+void pvclock_resume(void)
+{
+ atomic64_set(&last_value, 0);
+}
+
cycle_t pvclock_clocksource_read(struct pvclock_vcpu_time_info *src)
{
struct pvclock_shadow_time shadow;
Index: linux-2.6.35.y/arch/x86/xen/time.c
===================================================================
--- linux-2.6.35.y.orig/arch/x86/xen/time.c 2011-03-29 22:51:22.109157451 -0700
+++ linux-2.6.35.y/arch/x86/xen/time.c 2011-03-29 23:03:00.629284080 -0700
@@ -425,6 +425,8 @@
{
int cpu;

+ pvclock_resume();
+
if (xen_clockevent != &xen_vcpuop_clockevent)
return;

2011-03-30 21:47:01

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [111/275] mptfusion: mptctl_release is required in mptctl.c

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Kashyap, Desai <[email protected]>

commit 84857c8bf83e8aa87afc57d2956ba01f11d82386 upstream.

Added missing release callback for file_operations mptctl_fops.
Without release callback there will be never freed. It remains on
mptctl's eent list even after the file is closed and released.

Relavent RHEL bugzilla is 660871

Signed-off-by: Kashyap Desai <[email protected]>
Signed-off-by: James Bottomley <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/message/fusion/mptctl.c | 8 ++++++++
1 file changed, 8 insertions(+)

Index: linux-2.6.35.y/drivers/message/fusion/mptctl.c
===================================================================
--- linux-2.6.35.y.orig/drivers/message/fusion/mptctl.c 2011-03-29 22:51:24.407098651 -0700
+++ linux-2.6.35.y/drivers/message/fusion/mptctl.c 2011-03-29 23:03:00.501287344 -0700
@@ -588,6 +588,13 @@
}

static int
+mptctl_release(struct inode *inode, struct file *filep)
+{
+ fasync_helper(-1, filep, 0, &async_queue);
+ return 0;
+}
+
+static int
mptctl_fasync(int fd, struct file *filep, int mode)
{
MPT_ADAPTER *ioc;
@@ -2796,6 +2803,7 @@
.llseek = no_llseek,
.fasync = mptctl_fasync,
.unlocked_ioctl = mptctl_ioctl,
+ .release = mptctl_release,
#ifdef CONFIG_COMPAT
.compat_ioctl = compat_mpctl_ioctl,
#endif

2011-03-30 21:46:59

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [114/275] ocfs2_connection_find() returns pointer to bad structure

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: dann frazier <[email protected]>

commit 226291aa4641fa13cb5dec3bcb3379faa83009e2 upstream.

If ocfs2_live_connection_list is empty, ocfs2_connection_find() will return
a pointer to the LIST_HEAD, cast as a ocfs2_live_connection. This can cause
an oops when ocfs2_control_send_down() dereferences c->oc_conn:

Call Trace:
[<ffffffffa00c2a3c>] ocfs2_control_message+0x28c/0x2b0 [ocfs2_stack_user]
[<ffffffffa00c2a95>] ocfs2_control_write+0x35/0xb0 [ocfs2_stack_user]
[<ffffffff81143a88>] vfs_write+0xb8/0x1a0
[<ffffffff8155cc13>] ? do_page_fault+0x153/0x3b0
[<ffffffff811442f1>] sys_write+0x51/0x80
[<ffffffff810121b2>] system_call_fastpath+0x16/0x1b

Fix by explicitly returning NULL if no match is found.

Signed-off-by: dann frazier <[email protected]>
Signed-off-by: Joel Becker <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
fs/ocfs2/stack_user.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.35.y/fs/ocfs2/stack_user.c
===================================================================
--- linux-2.6.35.y.orig/fs/ocfs2/stack_user.c 2011-03-29 22:51:23.042133577 -0700
+++ linux-2.6.35.y/fs/ocfs2/stack_user.c 2011-03-29 23:03:00.557285910 -0700
@@ -191,7 +191,7 @@
return c;
}

- return c;
+ return NULL;
}

/*

2011-03-30 21:47:32

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [110/275] NFSD: memory corruption due to writing beyond the stat array

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Konstantin Khorenko <[email protected]>

commit 3aa6e0aa8ab3e64bbfba092c64d42fd1d006b124 upstream.

If nfsd fails to find an exported via NFS file in the readahead cache, it
should increment corresponding nfsdstats counter (ra_depth[10]), but due to a
bug it may instead write to ra_depth[11], corrupting the following field.

In a kernel with NFSDv4 compiled in the corruption takes the form of an
increment of a counter of the number of NFSv4 operation 0's received; since
there is no operation 0, this is harmless.

In a kernel with NFSDv4 disabled it corrupts whatever happens to be in the
memory beyond nfsdstats.

Signed-off-by: Konstantin Khorenko <[email protected]>
Signed-off-by: J. Bruce Fields <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
fs/nfsd/vfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.35.y/fs/nfsd/vfs.c
===================================================================
--- linux-2.6.35.y.orig/fs/nfsd/vfs.c 2011-03-29 22:51:24.834087726 -0700
+++ linux-2.6.35.y/fs/nfsd/vfs.c 2011-03-29 23:03:00.482287829 -0700
@@ -819,7 +819,7 @@
if (ra->p_count == 0)
frap = rap;
}
- depth = nfsdstats.ra_size*11/10;
+ depth = nfsdstats.ra_size;
if (!frap) {
spin_unlock(&rab->pb_lock);
return NULL;

2011-03-30 21:47:43

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [102/275] x86: Add IRQ_TIME_ACCOUNTING

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
Commit: e82b8e4ea4f3dffe6e7939f90e78da675fcc450e upstream

This patch adds IRQ_TIME_ACCOUNTING option on x86 and runtime enables it
when TSC is enabled.

This change just enables fine grained irq time accounting, isn't used yet.
Following patches use it for different purposes.

Signed-off-by: Venkatesh Pallipadi <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Mike Galbraith <[email protected]>
Acked-by: Peter Zijlstra <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
Documentation/kernel-parameters.txt | 4 ++++
arch/x86/Kconfig | 11 +++++++++++
arch/x86/kernel/tsc.c | 8 ++++++++
3 files changed, 23 insertions(+)

Index: linux-2.6.35.y/Documentation/kernel-parameters.txt
===================================================================
--- linux-2.6.35.y.orig/Documentation/kernel-parameters.txt 2011-03-29 22:51:28.997981183 -0700
+++ linux-2.6.35.y/Documentation/kernel-parameters.txt 2011-03-29 23:03:00.294292640 -0700
@@ -2672,6 +2672,10 @@
disables clocksource verification at runtime.
Used to enable high-resolution timer mode on older
hardware, and in virtualized environment.
+ [x86] noirqtime: Do not use TSC to do irq accounting.
+ Used to run time disable IRQ_TIME_ACCOUNTING on any
+ platforms where RDTSC is slow and this accounting
+ can add overhead.

turbografx.map[2|3]= [HW,JOY]
TurboGraFX parallel port interface
Index: linux-2.6.35.y/arch/x86/Kconfig
===================================================================
--- linux-2.6.35.y.orig/arch/x86/Kconfig 2011-03-29 22:51:28.997981183 -0700
+++ linux-2.6.35.y/arch/x86/Kconfig 2011-03-29 23:03:00.295292615 -0700
@@ -797,6 +797,17 @@
making when dealing with multi-core CPU chips at a cost of slightly
increased overhead in some places. If unsure say N here.

+config IRQ_TIME_ACCOUNTING
+ bool "Fine granularity task level IRQ time accounting"
+ default n
+ ---help---
+ Select this option to enable fine granularity task irq time
+ accounting. This is done by reading a timestamp on each
+ transitions between softirq and hardirq state, so there can be a
+ small performance impact.
+
+ If in doubt, say N here.
+
source "kernel/Kconfig.preempt"

config X86_UP_APIC
Index: linux-2.6.35.y/arch/x86/kernel/tsc.c
===================================================================
--- linux-2.6.35.y.orig/arch/x86/kernel/tsc.c 2011-03-29 22:51:28.997981183 -0700
+++ linux-2.6.35.y/arch/x86/kernel/tsc.c 2011-03-29 23:03:00.297292563 -0700
@@ -104,10 +104,14 @@

__setup("notsc", notsc_setup);

+static int no_sched_irq_time;
+
static int __init tsc_setup(char *str)
{
if (!strcmp(str, "reliable"))
tsc_clocksource_reliable = 1;
+ if (!strncmp(str, "noirqtime", 9))
+ no_sched_irq_time = 1;
return 1;
}

@@ -802,6 +806,7 @@
if (!tsc_unstable) {
tsc_unstable = 1;
sched_clock_stable = 0;
+ disable_sched_clock_irqtime();
printk(KERN_INFO "Marking TSC unstable due to %s\n", reason);
/* Change only the rating, when not registered */
if (clocksource_tsc.mult)
@@ -990,6 +995,9 @@
/* now allow native_sched_clock() to use rdtsc */
tsc_disabled = 0;

+ if (!no_sched_irq_time)
+ enable_sched_clock_irqtime();
+
lpj = ((u64)tsc_khz * 1000);
do_div(lpj, HZ);
lpj_fine = lpj;

2011-03-30 21:07:41

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [106/275] sched: Export account_system_vtime()

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
Commit: b7dadc38797584f6203386da1947ed5edf516646 upstream

KVM uses it for example:

ERROR: "account_system_vtime" [arch/x86/kvm/kvm.ko] undefined!

Cc: Venkatesh Pallipadi <[email protected]>
Cc: Peter Zijlstra <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Mike Galbraith <[email protected]>
Acked-by: Peter Zijlstra <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
kernel/sched.c | 1 +
1 file changed, 1 insertion(+)

Index: linux-2.6.35.y/kernel/sched.c
===================================================================
--- linux-2.6.35.y.orig/kernel/sched.c 2011-03-29 23:03:00.369290720 -0700
+++ linux-2.6.35.y/kernel/sched.c 2011-03-29 23:54:58.088516087 -0700
@@ -1901,6 +1901,7 @@

local_irq_restore(flags);
}
+EXPORT_SYMBOL_GPL(account_system_vtime);

static void sched_irq_time_avg_update(struct rq *rq, u64 curr_irq_time)
{

2011-03-30 21:48:10

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [118/275] bonding/vlan: Avoid mangled NAs on slaves without VLAN tag insertion

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Ben Hutchings <[email protected]>

This is related to commit f88a4a9b65a6f3422b81be995535d0e69df11bb8
upstream, but the bug cannot be properly fixed without the other
changes to VLAN tagging in 2.6.37.

bond_na_send() attempts to insert a VLAN tag in between building and
sending packets of the respective formats. If the slave does not
implement hardware VLAN tag insertion then vlan_put_tag() will mangle
the network-layer header because the Ethernet header is not present at
this point (unlike in bond_arp_send()).

Signed-off-by: Ben Hutchings <[email protected]>
Acked-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/net/bonding/bond_ipv6.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

Index: linux-2.6.35.y/drivers/net/bonding/bond_ipv6.c
===================================================================
--- linux-2.6.35.y.orig/drivers/net/bonding/bond_ipv6.c 2011-03-29 22:51:21.201180683 -0700
+++ linux-2.6.35.y/drivers/net/bonding/bond_ipv6.c 2011-03-29 23:03:00.673282942 -0700
@@ -70,6 +70,13 @@
};
struct sk_buff *skb;

+ /* The Ethernet header is built in ndisc_send_skb(), not
+ * ndisc_build_skb(), so we cannot insert a VLAN tag. Only an
+ * out-of-line tag inserted by the hardware will work.
+ */
+ if (vlan_id && !(slave_dev->features & NETIF_F_HW_VLAN_TX))
+ return;
+
icmp6h.icmp6_router = router;
icmp6h.icmp6_solicited = 0;
icmp6h.icmp6_override = 1;
@@ -88,7 +95,7 @@
}

if (vlan_id) {
- skb = vlan_put_tag(skb, vlan_id);
+ skb = __vlan_hwaccel_put_tag(skb, vlan_id);
if (!skb) {
pr_err("failed to insert VLAN tag\n");
return;

2011-03-30 21:07:38

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [88/275] sched: Move sched_avg_update() to update_cpu_load()

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
Commit: da2b71edd8a7db44fe1746261410a981f3e03632 upstream

Currently sched_avg_update() (which updates rt_avg stats in the rq)
is getting called from scale_rt_power() (in the load balance context)
which doesn't take rq->lock.

Fix it by moving the sched_avg_update() to more appropriate
update_cpu_load() where the CFS load gets updated as well.

Signed-off-by: Suresh Siddha <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
LKML-Reference: <1282596171.2694.3.camel@sbsiddha-MOBL3>
Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Mike Galbraith <[email protected]>
Acked-by: Peter Zijlstra <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
kernel/sched.c | 6 ++++++
kernel/sched_fair.c | 2 --
2 files changed, 6 insertions(+), 2 deletions(-)

Index: linux-2.6.35.y/kernel/sched.c
===================================================================
--- linux-2.6.35.y.orig/kernel/sched.c 2011-03-29 22:51:34.981828070 -0700
+++ linux-2.6.35.y/kernel/sched.c 2011-03-29 23:55:04.322356578 -0700
@@ -1270,6 +1270,10 @@
static void sched_rt_avg_update(struct rq *rq, u64 rt_delta)
{
}
+
+static void sched_avg_update(struct rq *rq)
+{
+}
#endif /* CONFIG_SMP */

#if BITS_PER_LONG == 32
@@ -3152,6 +3156,8 @@
}

calc_load_account_active(this_rq);
+
+ sched_avg_update(this_rq);
}

#ifdef CONFIG_SMP
Index: linux-2.6.35.y/kernel/sched_fair.c
===================================================================
--- linux-2.6.35.y.orig/kernel/sched_fair.c 2011-03-29 22:51:34.981828070 -0700
+++ linux-2.6.35.y/kernel/sched_fair.c 2011-03-29 23:55:05.971314385 -0700
@@ -2268,8 +2268,6 @@
struct rq *rq = cpu_rq(cpu);
u64 total, available;

- sched_avg_update(rq);
-
total = sched_avg_period() + (rq->clock - rq->age_stamp);
available = total - rq->rt_avg;

2011-03-30 21:48:31

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [115/275] OHCI: work around for nVidia shutdown problem

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Alan Stern <[email protected]>

commit 3df7169e73fc1d71a39cffeacc969f6840cdf52b upstream.

This patch (as1417) fixes a problem affecting some (or all) nVidia
chipsets. When the computer is shut down, the OHCI controllers
continue to power the USB buses and evidently they drive a Reset
signal out all their ports. This prevents attached devices from going
to low power. Mouse LEDs stay on, for example, which is disconcerting
for users and a drain on laptop batteries.

The fix involves leaving each OHCI controller in the OPERATIONAL state
during system shutdown rather than putting it in the RESET state.
Although this nominally means the controller is running, in fact it's
not doing very much since all the schedules are all disabled. However
there is ongoing DMA to the Host Controller Communications Area, so
the patch also disables the bus-master capability of all PCI USB
controllers after the shutdown routine runs.

The fix is applied only to nVidia-based PCI OHCI controllers, so it
shouldn't cause problems on systems using other hardware. As an added
safety measure, in case the kernel encounters one of these running
controllers during boot, the patch changes quirk_usb_handoff_ohci()
(which runs early on during PCI discovery) to reset the controller
before anything bad can happen.

Reported-by: Pali Rohár <[email protected]>
Signed-off-by: Alan Stern <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
CC: David Brownell <[email protected]>
Tested-by: Pali Rohár <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
drivers/usb/core/hcd-pci.c | 4 +++-
drivers/usb/host/ohci-hcd.c | 9 ++++++++-
drivers/usb/host/ohci-pci.c | 18 ++++++++++++++++++
drivers/usb/host/ohci.h | 1 +
drivers/usb/host/pci-quirks.c | 18 +++++++++++-------
5 files changed, 41 insertions(+), 9 deletions(-)

Index: linux-2.6.35.y/drivers/usb/core/hcd-pci.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/core/hcd-pci.c 2011-03-29 22:51:22.609144656 -0700
+++ linux-2.6.35.y/drivers/usb/core/hcd-pci.c 2011-03-29 23:03:00.575285450 -0700
@@ -317,8 +317,10 @@
if (!hcd)
return;

- if (hcd->driver->shutdown)
+ if (hcd->driver->shutdown) {
hcd->driver->shutdown(hcd);
+ pci_disable_device(dev);
+ }
}
EXPORT_SYMBOL_GPL(usb_hcd_pci_shutdown);

Index: linux-2.6.35.y/drivers/usb/host/ohci-hcd.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/host/ohci-hcd.c 2011-03-29 22:51:22.609144656 -0700
+++ linux-2.6.35.y/drivers/usb/host/ohci-hcd.c 2011-03-29 23:03:00.576285425 -0700
@@ -398,7 +398,14 @@

ohci = hcd_to_ohci (hcd);
ohci_writel (ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable);
- ohci_usb_reset (ohci);
+ ohci->hc_control = ohci_readl(ohci, &ohci->regs->control);
+
+ /* If the SHUTDOWN quirk is set, don't put the controller in RESET */
+ ohci->hc_control &= (ohci->flags & OHCI_QUIRK_SHUTDOWN ?
+ OHCI_CTRL_RWC | OHCI_CTRL_HCFS :
+ OHCI_CTRL_RWC);
+ ohci_writel(ohci, ohci->hc_control, &ohci->regs->control);
+
/* flush the writes */
(void) ohci_readl (ohci, &ohci->regs->control);
}
Index: linux-2.6.35.y/drivers/usb/host/ohci-pci.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/host/ohci-pci.c 2011-03-29 22:51:22.609144656 -0700
+++ linux-2.6.35.y/drivers/usb/host/ohci-pci.c 2011-03-29 23:03:00.577285400 -0700
@@ -201,6 +201,20 @@
return 0;
}

+/* nVidia controllers continue to drive Reset signalling on the bus
+ * even after system shutdown, wasting power. This flag tells the
+ * shutdown routine to leave the controller OPERATIONAL instead of RESET.
+ */
+static int ohci_quirk_nvidia_shutdown(struct usb_hcd *hcd)
+{
+ struct ohci_hcd *ohci = hcd_to_ohci(hcd);
+
+ ohci->flags |= OHCI_QUIRK_SHUTDOWN;
+ ohci_dbg(ohci, "enabled nVidia shutdown quirk\n");
+
+ return 0;
+}
+
/*
* The hardware normally enables the A-link power management feature, which
* lets the system lower the power consumption in idle states.
@@ -332,6 +346,10 @@
PCI_DEVICE(PCI_VENDOR_ID_ATI, 0x4399),
.driver_data = (unsigned long)ohci_quirk_amd700,
},
+ {
+ PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID),
+ .driver_data = (unsigned long) ohci_quirk_nvidia_shutdown,
+ },

/* FIXME for some of the early AMD 760 southbridges, OHCI
* won't work at all. blacklist them.
Index: linux-2.6.35.y/drivers/usb/host/ohci.h
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/host/ohci.h 2011-03-29 22:51:22.610144631 -0700
+++ linux-2.6.35.y/drivers/usb/host/ohci.h 2011-03-29 23:03:00.578285374 -0700
@@ -403,6 +403,7 @@
#define OHCI_QUIRK_HUB_POWER 0x100 /* distrust firmware power/oc setup */
#define OHCI_QUIRK_AMD_ISO 0x200 /* ISO transfers*/
#define OHCI_QUIRK_AMD_PREFETCH 0x400 /* pre-fetch for ISO transfer */
+#define OHCI_QUIRK_SHUTDOWN 0x800 /* nVidia power bug */
// there are also chip quirks/bugs in init logic

struct work_struct nec_work; /* Worker for NEC quirk */
Index: linux-2.6.35.y/drivers/usb/host/pci-quirks.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/host/pci-quirks.c 2011-03-29 22:51:22.610144631 -0700
+++ linux-2.6.35.y/drivers/usb/host/pci-quirks.c 2011-03-29 23:03:00.579285348 -0700
@@ -169,6 +169,7 @@
static void __devinit quirk_usb_handoff_ohci(struct pci_dev *pdev)
{
void __iomem *base;
+ u32 control;

if (!mmio_resource_enabled(pdev, 0))
return;
@@ -177,10 +178,14 @@
if (base == NULL)
return;

+ control = readl(base + OHCI_CONTROL);
+
/* On PA-RISC, PDC can leave IR set incorrectly; ignore it there. */
-#ifndef __hppa__
-{
- u32 control = readl(base + OHCI_CONTROL);
+#ifdef __hppa__
+#define OHCI_CTRL_MASK (OHCI_CTRL_RWC | OHCI_CTRL_IR)
+#else
+#define OHCI_CTRL_MASK OHCI_CTRL_RWC
+
if (control & OHCI_CTRL_IR) {
int wait_time = 500; /* arbitrary; 5 seconds */
writel(OHCI_INTR_OC, base + OHCI_INTRENABLE);
@@ -194,13 +199,12 @@
dev_warn(&pdev->dev, "OHCI: BIOS handoff failed"
" (BIOS bug?) %08x\n",
readl(base + OHCI_CONTROL));
-
- /* reset controller, preserving RWC */
- writel(control & OHCI_CTRL_RWC, base + OHCI_CONTROL);
}
-}
#endif

+ /* reset controller, preserving RWC (and possibly IR) */
+ writel(control & OHCI_CTRL_MASK, base + OHCI_CONTROL);
+
/*
* disable interrupts
*/

2011-03-30 21:07:34

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [97/275] sched: Fix softirq time accounting

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
Commit: 75e1056f5c57050415b64cb761a3acc35d91f013 upstream

Peter Zijlstra found a bug in the way softirq time is accounted in
VIRT_CPU_ACCOUNTING on this thread:

http://lkml.indiana.edu/hypermail//linux/kernel/1009.2/01366.html

The problem is, softirq processing uses local_bh_disable internally. There
is no way, later in the flow, to differentiate between whether softirq is
being processed or is it just that bh has been disabled. So, a hardirq when bh
is disabled results in time being wrongly accounted as softirq.

Looking at the code a bit more, the problem exists in !VIRT_CPU_ACCOUNTING
as well. As account_system_time() in normal tick based accouting also uses
softirq_count, which will be set even when not in softirq with bh disabled.

Peter also suggested solution of using 2*SOFTIRQ_OFFSET as irq count
for local_bh_{disable,enable} and using just SOFTIRQ_OFFSET while softirq
processing. The patch below does that and adds API in_serving_softirq() which
returns whether we are currently processing softirq or not.

Also changes one of the usages of softirq_count in net/sched/cls_cgroup.c
to in_serving_softirq.

Looks like many usages of in_softirq really want in_serving_softirq. Those
changes can be made individually on a case by case basis.

Signed-off-by: Venkatesh Pallipadi <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Mike Galbraith <[email protected]>
Acked-by: Peter Zijlstra <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
include/linux/hardirq.h | 5 ++++
include/linux/sched.h | 6 ++---
kernel/sched.c | 2 -
kernel/softirq.c | 51 ++++++++++++++++++++++++++++++++----------------
net/sched/cls_cgroup.c | 2 -
5 files changed, 44 insertions(+), 22 deletions(-)

Index: linux-2.6.35.y/include/linux/hardirq.h
===================================================================
--- linux-2.6.35.y.orig/include/linux/hardirq.h 2011-03-29 22:51:31.260923281 -0700
+++ linux-2.6.35.y/include/linux/hardirq.h 2011-03-29 23:55:02.073414123 -0700
@@ -64,6 +64,8 @@
#define HARDIRQ_OFFSET (1UL << HARDIRQ_SHIFT)
#define NMI_OFFSET (1UL << NMI_SHIFT)

+#define SOFTIRQ_DISABLE_OFFSET (2 * SOFTIRQ_OFFSET)
+
#ifndef PREEMPT_ACTIVE
#define PREEMPT_ACTIVE_BITS 1
#define PREEMPT_ACTIVE_SHIFT (NMI_SHIFT + NMI_BITS)
@@ -82,10 +84,13 @@
/*
* Are we doing bottom half or hardware interrupt processing?
* Are we in a softirq context? Interrupt context?
+ * in_softirq - Are we currently processing softirq or have bh disabled?
+ * in_serving_softirq - Are we currently processing softirq?
*/
#define in_irq() (hardirq_count())
#define in_softirq() (softirq_count())
#define in_interrupt() (irq_count())
+#define in_serving_softirq() (softirq_count() & SOFTIRQ_OFFSET)

/*
* Are we in NMI context?
Index: linux-2.6.35.y/include/linux/sched.h
===================================================================
--- linux-2.6.35.y.orig/include/linux/sched.h 2011-03-29 22:51:31.259923307 -0700
+++ linux-2.6.35.y/include/linux/sched.h 2011-03-29 23:55:01.610425970 -0700
@@ -2363,9 +2363,9 @@

extern int __cond_resched_softirq(void);

-#define cond_resched_softirq() ({ \
- __might_sleep(__FILE__, __LINE__, SOFTIRQ_OFFSET); \
- __cond_resched_softirq(); \
+#define cond_resched_softirq() ({ \
+ __might_sleep(__FILE__, __LINE__, SOFTIRQ_DISABLE_OFFSET); \
+ __cond_resched_softirq(); \
})

/*
Index: linux-2.6.35.y/kernel/sched.c
===================================================================
--- linux-2.6.35.y.orig/kernel/sched.c 2011-03-29 23:03:00.067298448 -0700
+++ linux-2.6.35.y/kernel/sched.c 2011-03-29 23:55:00.770447463 -0700
@@ -3363,7 +3363,7 @@
tmp = cputime_to_cputime64(cputime);
if (hardirq_count() - hardirq_offset)
cpustat->irq = cputime64_add(cpustat->irq, tmp);
- else if (softirq_count())
+ else if (in_serving_softirq())
cpustat->softirq = cputime64_add(cpustat->softirq, tmp);
else
cpustat->system = cputime64_add(cpustat->system, tmp);
Index: linux-2.6.35.y/kernel/softirq.c
===================================================================
--- linux-2.6.35.y.orig/kernel/softirq.c 2011-03-29 22:51:31.259923307 -0700
+++ linux-2.6.35.y/kernel/softirq.c 2011-03-29 23:55:01.200436460 -0700
@@ -77,11 +77,21 @@
}

/*
+ * preempt_count and SOFTIRQ_OFFSET usage:
+ * - preempt_count is changed by SOFTIRQ_OFFSET on entering or leaving
+ * softirq processing.
+ * - preempt_count is changed by SOFTIRQ_DISABLE_OFFSET (= 2 * SOFTIRQ_OFFSET)
+ * on local_bh_disable or local_bh_enable.
+ * This lets us distinguish between whether we are currently processing
+ * softirq and whether we just have bh disabled.
+ */
+
+/*
* This one is for softirq.c-internal use,
* where hardirqs are disabled legitimately:
*/
#ifdef CONFIG_TRACE_IRQFLAGS
-static void __local_bh_disable(unsigned long ip)
+static void __local_bh_disable(unsigned long ip, unsigned int cnt)
{
unsigned long flags;

@@ -95,32 +105,43 @@
* We must manually increment preempt_count here and manually
* call the trace_preempt_off later.
*/
- preempt_count() += SOFTIRQ_OFFSET;
+ preempt_count() += cnt;
/*
* Were softirqs turned off above:
*/
- if (softirq_count() == SOFTIRQ_OFFSET)
+ if (softirq_count() == cnt)
trace_softirqs_off(ip);
raw_local_irq_restore(flags);

- if (preempt_count() == SOFTIRQ_OFFSET)
+ if (preempt_count() == cnt)
trace_preempt_off(CALLER_ADDR0, get_parent_ip(CALLER_ADDR1));
}
#else /* !CONFIG_TRACE_IRQFLAGS */
-static inline void __local_bh_disable(unsigned long ip)
+static inline void __local_bh_disable(unsigned long ip, unsigned int cnt)
{
- add_preempt_count(SOFTIRQ_OFFSET);
+ add_preempt_count(cnt);
barrier();
}
#endif /* CONFIG_TRACE_IRQFLAGS */

void local_bh_disable(void)
{
- __local_bh_disable((unsigned long)__builtin_return_address(0));
+ __local_bh_disable((unsigned long)__builtin_return_address(0),
+ SOFTIRQ_DISABLE_OFFSET);
}

EXPORT_SYMBOL(local_bh_disable);

+static void __local_bh_enable(unsigned int cnt)
+{
+ WARN_ON_ONCE(in_irq());
+ WARN_ON_ONCE(!irqs_disabled());
+
+ if (softirq_count() == cnt)
+ trace_softirqs_on((unsigned long)__builtin_return_address(0));
+ sub_preempt_count(cnt);
+}
+
/*
* Special-case - softirqs can safely be enabled in
* cond_resched_softirq(), or by __do_softirq(),
@@ -128,12 +149,7 @@
*/
void _local_bh_enable(void)
{
- WARN_ON_ONCE(in_irq());
- WARN_ON_ONCE(!irqs_disabled());
-
- if (softirq_count() == SOFTIRQ_OFFSET)
- trace_softirqs_on((unsigned long)__builtin_return_address(0));
- sub_preempt_count(SOFTIRQ_OFFSET);
+ __local_bh_enable(SOFTIRQ_DISABLE_OFFSET);
}

EXPORT_SYMBOL(_local_bh_enable);
@@ -147,13 +163,13 @@
/*
* Are softirqs going to be turned on now:
*/
- if (softirq_count() == SOFTIRQ_OFFSET)
+ if (softirq_count() == SOFTIRQ_DISABLE_OFFSET)
trace_softirqs_on(ip);
/*
* Keep preemption disabled until we are done with
* softirq processing:
*/
- sub_preempt_count(SOFTIRQ_OFFSET - 1);
+ sub_preempt_count(SOFTIRQ_DISABLE_OFFSET - 1);

if (unlikely(!in_interrupt() && local_softirq_pending()))
do_softirq();
@@ -198,7 +214,8 @@
pending = local_softirq_pending();
account_system_vtime(current);

- __local_bh_disable((unsigned long)__builtin_return_address(0));
+ __local_bh_disable((unsigned long)__builtin_return_address(0),
+ SOFTIRQ_OFFSET);
lockdep_softirq_enter();

cpu = smp_processor_id();
@@ -245,7 +262,7 @@
lockdep_softirq_exit();

account_system_vtime(current);
- _local_bh_enable();
+ __local_bh_enable(SOFTIRQ_OFFSET);
}

#ifndef __ARCH_HAS_DO_SOFTIRQ
Index: linux-2.6.35.y/net/sched/cls_cgroup.c
===================================================================
--- linux-2.6.35.y.orig/net/sched/cls_cgroup.c 2011-03-29 22:51:31.259923307 -0700
+++ linux-2.6.35.y/net/sched/cls_cgroup.c 2011-03-29 23:03:00.153296248 -0700
@@ -121,7 +121,7 @@
* calls by looking at the number of nested bh disable calls because
* softirqs always disables bh.
*/
- if (softirq_count() != SOFTIRQ_OFFSET) {
+ if (in_serving_softirq()) {
/* If there is an sk_classid we'll use that. */
if (!skb->sk)
return -1;

2011-03-30 21:07:32

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [98/275] sched: Consolidate account_system_vtime extern declaration

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
Commit: e1e10a265d28273ab8c70be19d43dcbdeead6c5a upstream

Just a minor cleanup patch that makes things easier to the following patches.
No functionality change in this patch.

Signed-off-by: Venkatesh Pallipadi <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Mike Galbraith <[email protected]>
Acked-by: Peter Zijlstra <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
arch/ia64/include/asm/system.h | 4 ----
arch/powerpc/include/asm/system.h | 4 ----
arch/s390/include/asm/system.h | 1 -
include/linux/hardirq.h | 2 ++
4 files changed, 2 insertions(+), 9 deletions(-)

Index: linux-2.6.35.y/arch/ia64/include/asm/system.h
===================================================================
--- linux-2.6.35.y.orig/arch/ia64/include/asm/system.h 2011-03-29 22:51:30.768935869 -0700
+++ linux-2.6.35.y/arch/ia64/include/asm/system.h 2011-03-29 23:03:00.172295761 -0700
@@ -272,10 +272,6 @@

void default_idle(void);

-#ifdef CONFIG_VIRT_CPU_ACCOUNTING
-extern void account_system_vtime(struct task_struct *);
-#endif
-
#endif /* __KERNEL__ */

#endif /* __ASSEMBLY__ */
Index: linux-2.6.35.y/arch/powerpc/include/asm/system.h
===================================================================
--- linux-2.6.35.y.orig/arch/powerpc/include/asm/system.h 2011-03-29 22:51:30.768935869 -0700
+++ linux-2.6.35.y/arch/powerpc/include/asm/system.h 2011-03-29 23:03:00.172295761 -0700
@@ -545,10 +545,6 @@

#define PTRRELOC(x) ((typeof(x)) add_reloc_offset((unsigned long)(x)))

-#ifdef CONFIG_VIRT_CPU_ACCOUNTING
-extern void account_system_vtime(struct task_struct *);
-#endif
-
extern struct dentry *powerpc_debugfs_root;

#endif /* __KERNEL__ */
Index: linux-2.6.35.y/arch/s390/include/asm/system.h
===================================================================
--- linux-2.6.35.y.orig/arch/s390/include/asm/system.h 2011-03-29 22:51:30.768935869 -0700
+++ linux-2.6.35.y/arch/s390/include/asm/system.h 2011-03-29 23:03:00.199295071 -0700
@@ -97,7 +97,6 @@

extern void account_vtime(struct task_struct *, struct task_struct *);
extern void account_tick_vtime(struct task_struct *);
-extern void account_system_vtime(struct task_struct *);

#ifdef CONFIG_PFAULT
extern void pfault_irq_init(void);
Index: linux-2.6.35.y/include/linux/hardirq.h
===================================================================
--- linux-2.6.35.y.orig/include/linux/hardirq.h 2011-03-29 23:03:00.144296478 -0700
+++ linux-2.6.35.y/include/linux/hardirq.h 2011-03-29 23:55:00.771447437 -0700
@@ -141,6 +141,8 @@
static inline void account_system_vtime(struct task_struct *tsk)
{
}
+#else
+extern void account_system_vtime(struct task_struct *tsk);
#endif

#if defined(CONFIG_NO_HZ)

2011-03-30 21:49:07

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [109/275] kernel/user.c: add lock release annotation on free_user()

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------

From: Namhyung Kim <[email protected]>

commit 571428be550fbe37160596995e96ad398873fcbd upstream.

free_user() releases uidhash_lock but was missing annotation. Add it.
This removes following sparse warnings:

include/linux/spinlock.h:339:9: warning: context imbalance in 'free_user' - unexpected unlock
kernel/user.c:120:6: warning: context imbalance in 'free_uid' - wrong count at exit

Signed-off-by: Namhyung Kim <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Dhaval Giani <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Mike Galbraith <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>


---
kernel/user.c | 1 +
1 file changed, 1 insertion(+)

Index: linux-2.6.35.y/kernel/user.c
===================================================================
--- linux-2.6.35.y.orig/kernel/user.c 2011-03-29 22:51:25.263076751 -0700
+++ linux-2.6.35.y/kernel/user.c 2011-03-29 23:03:00.463288316 -0700
@@ -91,6 +91,7 @@
* upon function exit.
*/
static void free_user(struct user_struct *up, unsigned long flags)
+ __releases(&uidhash_lock)
{
uid_hash_remove(up);
spin_unlock_irqrestore(&uidhash_lock, flags);

2011-03-30 21:07:28

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [100/275] sched: Add a PF flag for ksoftirqd identification

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
Commit: 6cdd5199daf0cb7b0fcc8dca941af08492612887 upstream

To account softirq time cleanly in scheduler, we need to identify whether
softirq is invoked in ksoftirqd context or softirq at hardirq tail context.
Add PF_KSOFTIRQD for that purpose.

As all PF flag bits are currently taken, create space by moving one of the
infrequently used bits (PF_THREAD_BOUND) down in task_struct to be along
with some other state fields.

Signed-off-by: Venkatesh Pallipadi <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Mike Galbraith <[email protected]>
Acked-by: Peter Zijlstra <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
include/linux/sched.h | 1 +
kernel/softirq.c | 1 +
2 files changed, 2 insertions(+)

Index: linux-2.6.35.y/include/linux/sched.h
===================================================================
--- linux-2.6.35.y.orig/include/linux/sched.h 2011-03-29 23:03:00.229294303 -0700
+++ linux-2.6.35.y/include/linux/sched.h 2011-03-29 23:55:00.771447437 -0700
@@ -1685,6 +1685,7 @@
/*
* Per process flags
*/
+#define PF_KSOFTIRQD 0x00000001 /* I am ksoftirqd */
#define PF_STARTING 0x00000002 /* being created */
#define PF_EXITING 0x00000004 /* getting shut down */
#define PF_EXITPIDONE 0x00000008 /* pi exit done on shut down */
Index: linux-2.6.35.y/kernel/softirq.c
===================================================================
--- linux-2.6.35.y.orig/kernel/softirq.c 2011-03-29 23:03:00.152296274 -0700
+++ linux-2.6.35.y/kernel/softirq.c 2011-03-29 23:54:58.951494004 -0700
@@ -713,6 +713,7 @@
{
set_current_state(TASK_INTERRUPTIBLE);

+ current->flags |= PF_KSOFTIRQD;
while (!kthread_should_stop()) {
preempt_disable();
if (!local_softirq_pending()) {

2011-03-30 21:49:27

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [108/275] sched: Use group weight, idle cpu metrics to fix imbalances during idle

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
Commit: aae6d3ddd8b90f5b2c8d79a2b914d1706d124193 upstream

Currently we consider a sched domain to be well balanced when the imbalance
is less than the domain's imablance_pct. As the number of cores and threads
are increasing, current values of imbalance_pct (for example 25% for a
NUMA domain) are not enough to detect imbalances like:

a) On a WSM-EP system (two sockets, each having 6 cores and 12 logical threads),
24 cpu-hogging tasks get scheduled as 13 on one socket and 11 on another
socket. Leading to an idle HT cpu.

b) On a hypothetial 2 socket NHM-EX system (each socket having 8 cores and
16 logical threads), 16 cpu-hogging tasks can get scheduled as 9 on one
socket and 7 on another socket. Leaving one core in a socket idle
whereas in another socket we have a core having both its HT siblings busy.

While this issue can be fixed by decreasing the domain's imbalance_pct
(by making it a function of number of logical cpus in the domain), it
can potentially cause more task migrations across sched groups in an
overloaded case.

Fix this by using imbalance_pct only during newly_idle and busy
load balancing. And during idle load balancing, check if there
is an imbalance in number of idle cpu's across the busiest and this
sched_group or if the busiest group has more tasks than its weight that
the idle cpu in this_group can pull.

Reported-by: Nikhil Rao <[email protected]>
Signed-off-by: Suresh Siddha <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Mike Galbraith <[email protected]>
Acked-by: Peter Zijlstra <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
include/linux/sched.h | 1 +
kernel/sched.c | 2 ++
kernel/sched_fair.c | 34 +++++++++++++++++++++++++++++++---
3 files changed, 34 insertions(+), 3 deletions(-)

Index: linux-2.6.35.y/include/linux/sched.h
===================================================================
--- linux-2.6.35.y.orig/include/linux/sched.h 2011-03-29 23:03:00.410289673 -0700
+++ linux-2.6.35.y/include/linux/sched.h 2011-03-29 23:03:00.437288981 -0700
@@ -856,6 +856,7 @@
* single CPU.
*/
unsigned int cpu_power;
+ unsigned int group_weight;

/*
* The CPUs this group covers.
Index: linux-2.6.35.y/kernel/sched_fair.c
===================================================================
--- linux-2.6.35.y.orig/kernel/sched_fair.c 2011-03-29 23:03:00.417289492 -0700
+++ linux-2.6.35.y/kernel/sched_fair.c 2011-03-29 23:03:00.439288931 -0700
@@ -2036,13 +2036,16 @@
unsigned long this_load_per_task;
unsigned long this_nr_running;
unsigned long this_has_capacity;
+ unsigned int this_idle_cpus;

/* Statistics of the busiest group */
+ unsigned int busiest_idle_cpus;
unsigned long max_load;
unsigned long busiest_load_per_task;
unsigned long busiest_nr_running;
unsigned long busiest_group_capacity;
unsigned long busiest_has_capacity;
+ unsigned int busiest_group_weight;

int group_imb; /* Is there imbalance in this sd */
#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)
@@ -2064,6 +2067,8 @@
unsigned long sum_nr_running; /* Nr tasks running in the group */
unsigned long sum_weighted_load; /* Weighted load of group's tasks */
unsigned long group_capacity;
+ unsigned long idle_cpus;
+ unsigned long group_weight;
int group_imb; /* Is there an imbalance in the group ? */
int group_has_capacity; /* Is there extra capacity in the group? */
};
@@ -2404,7 +2409,8 @@
sgs->group_load += load;
sgs->sum_nr_running += rq->nr_running;
sgs->sum_weighted_load += weighted_cpuload(i);
-
+ if (idle_cpu(i))
+ sgs->idle_cpus++;
}

/*
@@ -2440,6 +2446,7 @@
sgs->group_imb = 1;

sgs->group_capacity = DIV_ROUND_CLOSEST(group->cpu_power, SCHED_LOAD_SCALE);
+ sgs->group_weight = group->group_weight;

if (sgs->group_capacity > sgs->sum_nr_running)
sgs->group_has_capacity = 1;
@@ -2505,13 +2512,16 @@
sds->this_nr_running = sgs.sum_nr_running;
sds->this_load_per_task = sgs.sum_weighted_load;
sds->this_has_capacity = sgs.group_has_capacity;
+ sds->this_idle_cpus = sgs.idle_cpus;
} else if (sgs.avg_load > sds->max_load &&
(sgs.sum_nr_running > sgs.group_capacity ||
sgs.group_imb)) {
sds->max_load = sgs.avg_load;
sds->busiest = group;
sds->busiest_nr_running = sgs.sum_nr_running;
+ sds->busiest_idle_cpus = sgs.idle_cpus;
sds->busiest_group_capacity = sgs.group_capacity;
+ sds->busiest_group_weight = sgs.group_weight;
sds->busiest_load_per_task = sgs.sum_weighted_load;
sds->busiest_has_capacity = sgs.group_has_capacity;
sds->group_imb = sgs.group_imb;
@@ -2736,8 +2746,26 @@
if (sds.this_load >= sds.avg_load)
goto out_balanced;

- if (100 * sds.max_load <= sd->imbalance_pct * sds.this_load)
- goto out_balanced;
+ /*
+ * In the CPU_NEWLY_IDLE, use imbalance_pct to be conservative.
+ * And to check for busy balance use !idle_cpu instead of
+ * CPU_NOT_IDLE. This is because HT siblings will use CPU_NOT_IDLE
+ * even when they are idle.
+ */
+ if (idle == CPU_NEWLY_IDLE || !idle_cpu(this_cpu)) {
+ if (100 * sds.max_load <= sd->imbalance_pct * sds.this_load)
+ goto out_balanced;
+ } else {
+ /*
+ * This cpu is idle. If the busiest group load doesn't
+ * have more tasks than the number of available cpu's and
+ * there is no imbalance between this and busiest group
+ * wrt to idle cpu's, it is balanced.
+ */
+ if ((sds.this_idle_cpus <= sds.busiest_idle_cpus + 1) &&
+ sds.busiest_nr_running <= sds.busiest_group_weight)
+ goto out_balanced;
+ }

force_balance:
/* Looks like there is an imbalance. Compute it */
Index: linux-2.6.35.y/kernel/sched.c
===================================================================
--- linux-2.6.35.y.orig/kernel/sched.c 2011-03-29 23:03:00.413289595 -0700
+++ linux-2.6.35.y/kernel/sched.c 2011-03-29 23:54:17.695549641 -0700
@@ -6839,6 +6839,8 @@
if (cpu != group_first_cpu(sd->groups))
return;

+ sd->groups->group_weight = cpumask_weight(sched_group_cpus(sd->groups));
+
child = sd->child;

sd->groups->cpu_power = 0;

2011-03-30 21:49:29

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [107/275] sched, cgroup: Fixup broken cgroup movement

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
Commit: b2b5ce022acf5e9f52f7b78c5579994fdde191d4 upstream

Dima noticed that we fail to correct the ->vruntime of sleeping tasks
when we move them between cgroups.

Reported-by: Dima Zavin <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Tested-by: Mike Galbraith <[email protected]>
LKML-Reference: <1287150604.29097.1513.camel@twins>
Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Mike Galbraith <[email protected]>
Acked-by: Peter Zijlstra <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
include/linux/sched.h | 2 +-
kernel/sched.c | 8 ++++----
kernel/sched_fair.c | 25 +++++++++++++++++++------
3 files changed, 24 insertions(+), 11 deletions(-)

Index: linux-2.6.35.y/include/linux/sched.h
===================================================================
--- linux-2.6.35.y.orig/include/linux/sched.h 2011-03-29 23:03:00.269293279 -0700
+++ linux-2.6.35.y/include/linux/sched.h 2011-03-29 23:54:57.628527856 -0700
@@ -1076,7 +1076,7 @@
struct task_struct *task);

#ifdef CONFIG_FAIR_GROUP_SCHED
- void (*moved_group) (struct task_struct *p, int on_rq);
+ void (*task_move_group) (struct task_struct *p, int on_rq);
#endif
};

Index: linux-2.6.35.y/kernel/sched.c
===================================================================
--- linux-2.6.35.y.orig/kernel/sched.c 2011-03-29 23:03:00.391290158 -0700
+++ linux-2.6.35.y/kernel/sched.c 2011-03-29 23:54:57.628527856 -0700
@@ -8332,12 +8332,12 @@
if (unlikely(running))
tsk->sched_class->put_prev_task(rq, tsk);

- set_task_rq(tsk, task_cpu(tsk));
-
#ifdef CONFIG_FAIR_GROUP_SCHED
- if (tsk->sched_class->moved_group)
- tsk->sched_class->moved_group(tsk, on_rq);
+ if (tsk->sched_class->task_move_group)
+ tsk->sched_class->task_move_group(tsk, on_rq);
+ else
#endif
+ set_task_rq(tsk, task_cpu(tsk));

if (unlikely(running))
tsk->sched_class->set_curr_task(rq);
Index: linux-2.6.35.y/kernel/sched_fair.c
===================================================================
--- linux-2.6.35.y.orig/kernel/sched_fair.c 2011-03-29 23:03:00.347291285 -0700
+++ linux-2.6.35.y/kernel/sched_fair.c 2011-03-29 23:54:57.628527856 -0700
@@ -3657,13 +3657,26 @@
}

#ifdef CONFIG_FAIR_GROUP_SCHED
-static void moved_group_fair(struct task_struct *p, int on_rq)
+static void task_move_group_fair(struct task_struct *p, int on_rq)
{
- struct cfs_rq *cfs_rq = task_cfs_rq(p);
-
- update_curr(cfs_rq);
+ /*
+ * If the task was not on the rq at the time of this cgroup movement
+ * it must have been asleep, sleeping tasks keep their ->vruntime
+ * absolute on their old rq until wakeup (needed for the fair sleeper
+ * bonus in place_entity()).
+ *
+ * If it was on the rq, we've just 'preempted' it, which does convert
+ * ->vruntime to a relative base.
+ *
+ * Make sure both cases convert their relative position when migrating
+ * to another cgroup's rq. This does somewhat interfere with the
+ * fair sleeper stuff for the first placement, but who cares.
+ */
+ if (!on_rq)
+ p->se.vruntime -= cfs_rq_of(&p->se)->min_vruntime;
+ set_task_rq(p, task_cpu(p));
if (!on_rq)
- place_entity(cfs_rq, &p->se, 1);
+ p->se.vruntime += cfs_rq_of(&p->se)->min_vruntime;
}
#endif

@@ -3715,7 +3728,7 @@
.get_rr_interval = get_rr_interval_fair,

#ifdef CONFIG_FAIR_GROUP_SCHED
- .moved_group = moved_group_fair,
+ .task_move_group = task_move_group_fair,
#endif
};

2011-03-30 21:49:54

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [105/275] sched: Call tick_check_idle before __irq_enter

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
Commit: d267f87fb8179c6dba03d08b91952e81bc3723c7 upstream

When CPU is idle and on first interrupt, irq_enter calls tick_check_idle()
to notify interruption from idle. But, there is a problem if this call
is done after __irq_enter, as all routines in __irq_enter may find
stale time due to yet to be done tick_check_idle.

Specifically, trace calls in __irq_enter when they use global clock and also
account_system_vtime change in this patch as it wants to use sched_clock_cpu()
to do proper irq timing.

But, tick_check_idle was moved after __irq_enter intentionally to
prevent problem of unneeded ksoftirqd wakeups by the commit ee5f80a:

irq: call __irq_enter() before calling the tick_idle_check
Impact: avoid spurious ksoftirqd wakeups

Moving tick_check_idle() before __irq_enter and wrapping it with
local_bh_enable/disable would solve both the problems.

Fixed-by: Yong Zhang <[email protected]>
Signed-off-by: Venkatesh Pallipadi <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Mike Galbraith <[email protected]>
Acked-by: Peter Zijlstra <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
kernel/sched.c | 2 +-
kernel/softirq.c | 12 +++++++++---
2 files changed, 10 insertions(+), 4 deletions(-)

Index: linux-2.6.35.y/kernel/sched.c
===================================================================
--- linux-2.6.35.y.orig/kernel/sched.c 2011-03-29 23:03:00.344291360 -0700
+++ linux-2.6.35.y/kernel/sched.c 2011-03-29 23:54:58.516505136 -0700
@@ -1884,8 +1884,8 @@

local_irq_save(flags);

- now = sched_clock();
cpu = smp_processor_id();
+ now = sched_clock_cpu(cpu);
delta = now - per_cpu(irq_start_time, cpu);
per_cpu(irq_start_time, cpu) = now;
/*
Index: linux-2.6.35.y/kernel/softirq.c
===================================================================
--- linux-2.6.35.y.orig/kernel/softirq.c 2011-03-29 23:03:00.249293792 -0700
+++ linux-2.6.35.y/kernel/softirq.c 2011-03-29 23:03:00.370290694 -0700
@@ -296,10 +296,16 @@

rcu_irq_enter();
if (idle_cpu(cpu) && !in_interrupt()) {
- __irq_enter();
+ /*
+ * Prevent raise_softirq from needlessly waking up ksoftirqd
+ * here, as softirq will be serviced on return from interrupt.
+ */
+ local_bh_disable();
tick_check_idle(cpu);
- } else
- __irq_enter();
+ _local_bh_enable();
+ }
+
+ __irq_enter();
}

#ifdef __ARCH_IRQ_EXIT_IRQS_DISABLED

2011-03-30 21:50:16

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [104/275] sched: Remove irq time from available CPU power

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
Commit: aa483808516ca5cacfa0e5849691f64fec25828e upstream

The idea was suggested by Peter Zijlstra here:

http://marc.info/?l=linux-kernel&m=127476934517534&w=2

irq time is technically not available to the tasks running on the CPU.
This patch removes irq time from CPU power piggybacking on
sched_rt_avg_update().

Tested this by keeping CPU X busy with a network intensive task having 75%
oa a single CPU irq processing (hard+soft) on a 4-way system. And start seven
cycle soakers on the system. Without this change, there will be two tasks on
each CPU. With this change, there is a single task on irq busy CPU X and
remaining 7 tasks are spread around among other 3 CPUs.

Signed-off-by: Venkatesh Pallipadi <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Mike Galbraith <[email protected]>
Acked-by: Peter Zijlstra <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
kernel/sched.c | 18 ++++++++++++++++++
kernel/sched_fair.c | 7 ++++++-
kernel/sched_features.h | 5 +++++
3 files changed, 29 insertions(+), 1 deletion(-)

Index: linux-2.6.35.y/kernel/sched.c
===================================================================
--- linux-2.6.35.y.orig/kernel/sched.c 2011-03-29 23:03:00.319292001 -0700
+++ linux-2.6.35.y/kernel/sched.c 2011-03-29 23:54:58.951494004 -0700
@@ -519,6 +519,10 @@
u64 avg_idle;
#endif

+#ifdef CONFIG_IRQ_TIME_ACCOUNTING
+ u64 prev_irq_time;
+#endif
+
/* calc_load related fields */
unsigned long calc_load_update;
long calc_load_active;
@@ -643,6 +647,7 @@
#endif /* CONFIG_CGROUP_SCHED */

static u64 irq_time_cpu(int cpu);
+static void sched_irq_time_avg_update(struct rq *rq, u64 irq_time);

inline void update_rq_clock(struct rq *rq)
{
@@ -654,6 +659,8 @@
irq_time = irq_time_cpu(cpu);
if (rq->clock - irq_time > rq->clock_task)
rq->clock_task = rq->clock - irq_time;
+
+ sched_irq_time_avg_update(rq, irq_time);
}

/*
@@ -1895,6 +1902,15 @@
local_irq_restore(flags);
}

+static void sched_irq_time_avg_update(struct rq *rq, u64 curr_irq_time)
+{
+ if (sched_clock_irqtime && sched_feat(NONIRQ_POWER)) {
+ u64 delta_irq = curr_irq_time - rq->prev_irq_time;
+ rq->prev_irq_time = curr_irq_time;
+ sched_rt_avg_update(rq, delta_irq);
+ }
+}
+
#else

static u64 irq_time_cpu(int cpu)
@@ -1902,6 +1918,8 @@
return 0;
}

+static void sched_irq_time_avg_update(struct rq *rq, u64 curr_irq_time) { }
+
#endif

#include "sched_stats.h"
Index: linux-2.6.35.y/kernel/sched_features.h
===================================================================
--- linux-2.6.35.y.orig/kernel/sched_features.h 2011-03-29 22:51:28.061005159 -0700
+++ linux-2.6.35.y/kernel/sched_features.h 2011-03-29 23:03:00.345291335 -0700
@@ -61,3 +61,8 @@
* release the lock. Decreases scheduling overhead.
*/
SCHED_FEAT(OWNER_SPIN, 1)
+
+/*
+ * Decrement CPU power based on irq activity
+ */
+SCHED_FEAT(NONIRQ_POWER, 1)
Index: linux-2.6.35.y/kernel/sched_fair.c
===================================================================
--- linux-2.6.35.y.orig/kernel/sched_fair.c 2011-03-29 23:03:00.320291975 -0700
+++ linux-2.6.35.y/kernel/sched_fair.c 2011-03-29 23:54:58.089516061 -0700
@@ -2276,8 +2276,13 @@
u64 total, available;

total = sched_avg_period() + (rq->clock - rq->age_stamp);
- available = total - rq->rt_avg;

+ if (unlikely(total < rq->rt_avg)) {
+ /* Ensures that power won't end up being negative */
+ available = 0;
+ } else {
+ available = total - rq->rt_avg;
+ }
if (unlikely((s64)total < SCHED_LOAD_SCALE))
total = SCHED_LOAD_SCALE;

2011-03-30 21:07:24

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [89/275] sched: Increment cache_nice_tries only on periodic lb

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
Commit: 58b26c4c025778c09c7a1438ff185080e11b7d0a upstream

scheduler uses cache_nice_tries as an indicator to do cache_hot and
active load balance, when normal load balance fails. Currently,
this value is changed on any failed load balance attempt. That ends
up being not so nice to workloads that enter/exit idle often, as
they do more frequent new_idle balance and that pretty soon results
in cache hot tasks being pulled in.

Making the cache_nice_tries ignore failed new_idle balance seems to
make better sense. With that only the failed load balance in
periodic load balance gets accounted and the rate of accumulation
of cache_nice_tries will not depend on idle entry/exit (short
running sleep-wakeup kind of tasks). This reduces movement of
cache_hot tasks.

schedstat diff (after-before) excerpt from a workload that has
frequent and short wakeup-idle pattern (:2 in cpu col below refers
to NEWIDLE idx) This snapshot was across ~400 seconds.

Without this change:
domainstats: domain0
cpu cnt bln fld imb gain hgain nobusyq nobusyg
0:2 306487 219575 73167 110069413 44583 19070 1172 218403
1:2 292139 194853 81421 120893383 50745 21902 1259 193594
2:2 283166 174607 91359 129699642 54931 23688 1287 173320
3:2 273998 161788 93991 132757146 57122 24351 1366 160422
4:2 289851 215692 62190 83398383 36377 13680 851 214841
5:2 316312 222146 77605 117582154 49948 20281 988 221158
6:2 297172 195596 83623 122133390 52801 21301 929 194667
7:2 283391 178078 86378 126622761 55122 22239 928 177150
8:2 297655 210359 72995 110246694 45798 19777 1125 209234
9:2 297357 202011 79363 119753474 50953 22088 1089 200922
10:2 278797 178703 83180 122514385 52969 22726 1128 177575
11:2 272661 167669 86978 127342327 55857 24342 1195 166474
12:2 293039 204031 73211 110282059 47285 19651 948 203083
13:2 289502 196762 76803 114712942 49339 20547 1016 195746
14:2 264446 169609 78292 115715605 50459 21017 982 168627
15:2 260968 163660 80142 116811793 51483 21281 1064 162596

With this change:
domainstats: domain0
cpu cnt bln fld imb gain hgain nobusyq nobusyg
0:2 272347 187380 77455 105420270 24975 1 953 186427
1:2 267276 172360 86234 116242264 28087 6 1028 171332
2:2 259769 156777 93281 123243134 30555 1 1043 155734
3:2 250870 143129 97627 127370868 32026 6 1188 141941
4:2 248422 177116 64096 78261112 22202 2 757 176359
5:2 275595 180683 84950 116075022 29400 6 778 179905
6:2 262418 162609 88944 119256898 31056 4 817 161792
7:2 252204 147946 92646 122388300 32879 4 824 147122
8:2 262335 172239 81631 110477214 26599 4 864 171375
9:2 261563 164775 88016 117203621 28331 3 849 163926
10:2 243389 140949 93379 121353071 29585 2 909 140040
11:2 242795 134651 98310 124768957 30895 2 1016 133635
12:2 255234 166622 79843 104696912 26483 4 746 165876
13:2 244944 151595 83855 109808099 27787 3 801 150794
14:2 241301 140982 89935 116954383 30403 6 845 140137
15:2 232271 128564 92821 119185207 31207 4 1416 127148

Signed-off-by: Venkatesh Pallipadi <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Mike Galbraith <[email protected]>
Acked-by: Peter Zijlstra <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
kernel/sched_fair.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

Index: linux-2.6.35.y/kernel/sched_fair.c
===================================================================
--- linux-2.6.35.y.orig/kernel/sched_fair.c 2011-03-29 23:02:59.969300955 -0700
+++ linux-2.6.35.y/kernel/sched_fair.c 2011-03-29 23:55:04.726346241 -0700
@@ -2894,7 +2894,14 @@

if (!ld_moved) {
schedstat_inc(sd, lb_failed[idle]);
- sd->nr_balance_failed++;
+ /*
+ * Increment the failure counter only on periodic balance.
+ * We do not want newidle balance, which can be very
+ * frequent, pollute the failure counter causing
+ * excessive cache_hot migrations and active balances.
+ */
+ if (idle != CPU_NEWLY_IDLE)
+ sd->nr_balance_failed++;

if (need_active_balance(sd, sd_idle, idle)) {
raw_spin_lock_irqsave(&busiest->lock, flags);

2011-03-30 21:50:39

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [103/275] sched: Do not account irq time to current task

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
Commit: 305e6835e05513406fa12820e40e4a8ecb63743c upstream

Scheduler accounts both softirq and interrupt processing times to the
currently running task. This means, if the interrupt processing was
for some other task in the system, then the current task ends up being
penalized as it gets shorter runtime than otherwise.

Change sched task accounting to acoount only actual task time from
currently running task. Now update_curr(), modifies the delta_exec to
depend on rq->clock_task.

Note that this change only handles CONFIG_IRQ_TIME_ACCOUNTING case. We can
extend this to CONFIG_VIRT_CPU_ACCOUNTING with minimal effort. But, thats
for later.

This change will impact scheduling behavior in interrupt heavy conditions.

Tested on a 4-way system with eth0 handled by CPU 2 and a network heavy
task (nc) running on CPU 3 (and no RSS/RFS). With that I have CPU 2
spending 75%+ of its time in irq processing. CPU 3 spending around 35%
time running nc task.

Now, if I run another CPU intensive task on CPU 2, without this change
/proc/<pid>/schedstat shows 100% of time accounted to this task. With this
change, it rightly shows less than 25% accounted to this task as remaining
time is actually spent on irq processing.

Signed-off-by: Venkatesh Pallipadi <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Mike Galbraith <[email protected]>
Acked-by: Peter Zijlstra <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
kernel/sched.c | 38 +++++++++++++++++++++++++++++++++++++-
kernel/sched_fair.c | 6 +++---
kernel/sched_rt.c | 8 ++++----
3 files changed, 44 insertions(+), 8 deletions(-)

Index: linux-2.6.35.y/kernel/sched.c
===================================================================
--- linux-2.6.35.y.orig/kernel/sched.c 2011-03-29 23:03:00.273293178 -0700
+++ linux-2.6.35.y/kernel/sched.c 2011-03-29 23:54:59.406482364 -0700
@@ -491,6 +491,7 @@
struct mm_struct *prev_mm;

u64 clock;
+ u64 clock_task;

atomic_t nr_iowait;

@@ -641,10 +642,18 @@

#endif /* CONFIG_CGROUP_SCHED */

+static u64 irq_time_cpu(int cpu);
+
inline void update_rq_clock(struct rq *rq)
{
+ int cpu = cpu_of(rq);
+ u64 irq_time;
+
if (!rq->skip_clock_update)
rq->clock = sched_clock_cpu(cpu_of(rq));
+ irq_time = irq_time_cpu(cpu);
+ if (rq->clock - irq_time > rq->clock_task)
+ rq->clock_task = rq->clock - irq_time;
}

/*
@@ -1821,6 +1830,18 @@

#ifdef CONFIG_IRQ_TIME_ACCOUNTING

+/*
+ * There are no locks covering percpu hardirq/softirq time.
+ * They are only modified in account_system_vtime, on corresponding CPU
+ * with interrupts disabled. So, writes are safe.
+ * They are read and saved off onto struct rq in update_rq_clock().
+ * This may result in other CPU reading this CPU's irq time and can
+ * race with irq/account_system_vtime on this CPU. We would either get old
+ * or new value (or semi updated value on 32 bit) with a side effect of
+ * accounting a slice of irq time to wrong task when irq is in progress
+ * while we read rq->clock. That is a worthy compromise in place of having
+ * locks on each irq in account_system_time.
+ */
static DEFINE_PER_CPU(u64, cpu_hardirq_time);
static DEFINE_PER_CPU(u64, cpu_softirq_time);

@@ -1837,6 +1858,14 @@
sched_clock_irqtime = 0;
}

+static u64 irq_time_cpu(int cpu)
+{
+ if (!sched_clock_irqtime)
+ return 0;
+
+ return per_cpu(cpu_softirq_time, cpu) + per_cpu(cpu_hardirq_time, cpu);
+}
+
void account_system_vtime(struct task_struct *curr)
{
unsigned long flags;
@@ -1866,6 +1895,13 @@
local_irq_restore(flags);
}

+#else
+
+static u64 irq_time_cpu(int cpu)
+{
+ return 0;
+}
+
#endif

#include "sched_stats.h"
@@ -3263,7 +3299,7 @@

if (task_current(rq, p)) {
update_rq_clock(rq);
- ns = rq->clock - p->se.exec_start;
+ ns = rq->clock_task - p->se.exec_start;
if ((s64)ns < 0)
ns = 0;
}
Index: linux-2.6.35.y/kernel/sched_fair.c
===================================================================
--- linux-2.6.35.y.orig/kernel/sched_fair.c 2011-03-29 23:03:00.126296938 -0700
+++ linux-2.6.35.y/kernel/sched_fair.c 2011-03-29 23:54:59.406482364 -0700
@@ -519,7 +519,7 @@
static void update_curr(struct cfs_rq *cfs_rq)
{
struct sched_entity *curr = cfs_rq->curr;
- u64 now = rq_of(cfs_rq)->clock;
+ u64 now = rq_of(cfs_rq)->clock_task;
unsigned long delta_exec;

if (unlikely(!curr))
@@ -602,7 +602,7 @@
/*
* We are starting a new run period:
*/
- se->exec_start = rq_of(cfs_rq)->clock;
+ se->exec_start = rq_of(cfs_rq)->clock_task;
}

/**************************************************
@@ -1803,7 +1803,7 @@
* 2) too many balance attempts have failed.
*/

- tsk_cache_hot = task_hot(p, rq->clock, sd);
+ tsk_cache_hot = task_hot(p, rq->clock_task, sd);
if (!tsk_cache_hot ||
sd->nr_balance_failed > sd->cache_nice_tries) {
#ifdef CONFIG_SCHEDSTATS
Index: linux-2.6.35.y/kernel/sched_rt.c
===================================================================
--- linux-2.6.35.y.orig/kernel/sched_rt.c 2011-03-29 23:03:00.028299446 -0700
+++ linux-2.6.35.y/kernel/sched_rt.c 2011-03-29 23:03:00.322291923 -0700
@@ -609,7 +609,7 @@
if (!task_has_rt_policy(curr))
return;

- delta_exec = rq->clock - curr->se.exec_start;
+ delta_exec = rq->clock_task - curr->se.exec_start;
if (unlikely((s64)delta_exec < 0))
delta_exec = 0;

@@ -618,7 +618,7 @@
curr->se.sum_exec_runtime += delta_exec;
account_group_exec_runtime(curr, delta_exec);

- curr->se.exec_start = rq->clock;
+ curr->se.exec_start = rq->clock_task;
cpuacct_charge(curr, delta_exec);

sched_rt_avg_update(rq, delta_exec);
@@ -1075,7 +1075,7 @@
} while (rt_rq);

p = rt_task_of(rt_se);
- p->se.exec_start = rq->clock;
+ p->se.exec_start = rq->clock_task;

return p;
}
@@ -1716,7 +1716,7 @@
{
struct task_struct *p = rq->curr;

- p->se.exec_start = rq->clock;
+ p->se.exec_start = rq->clock_task;

/* The running task is never eligible for pushing */
dequeue_pushable_task(rq, p);

2011-03-30 21:50:42

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [99/275] sched: Remove unused PF_ALIGNWARN flag

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
Commit: 637bbdc5b83615ef9f45f50399d1c7f27473c713 upstream

PF_ALIGNWARN is not implemented and it is for 486 as the
comment.

It is not likely someone will implement this flag feature.
So here remove this flag and leave the valuable 0x00000001 for
future use.

Signed-off-by: Dave Young <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Linus Torvalds <[email protected]>
LKML-Reference: <20100913121903.GB22238@darkstar>
Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Mike Galbraith <[email protected]>
Acked-by: Peter Zijlstra <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
include/linux/sched.h | 2 --
1 file changed, 2 deletions(-)

Index: linux-2.6.35.y/include/linux/sched.h
===================================================================
--- linux-2.6.35.y.orig/include/linux/sched.h 2011-03-29 23:03:00.145296453 -0700
+++ linux-2.6.35.y/include/linux/sched.h 2011-03-29 23:55:01.200436460 -0700
@@ -1685,8 +1685,6 @@
/*
* Per process flags
*/
-#define PF_ALIGNWARN 0x00000001 /* Print alignment warning msgs */
- /* Not implemented yet, only for 486*/
#define PF_STARTING 0x00000002 /* being created */
#define PF_EXITING 0x00000004 /* getting shut down */
#define PF_EXITPIDONE 0x00000008 /* pi exit done on shut down */

2011-03-30 21:51:16

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [101/275] sched: Add IRQ_TIME_ACCOUNTING, finer accounting of irq time

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
Commit: b52bfee445d315549d41eacf2fa7c156e7d153d5 upstream

s390/powerpc/ia64 have support for CONFIG_VIRT_CPU_ACCOUNTING which does
the fine granularity accounting of user, system, hardirq, softirq times.
Adding that option on archs like x86 will be challenging however, given the
state of TSC reliability on various platforms and also the overhead it will
add in syscall entry exit.

Instead, add a lighter variant that only does finer accounting of
hardirq and softirq times, providing precise irq times (instead of timer tick
based samples). This accounting is added with a new config option
CONFIG_IRQ_TIME_ACCOUNTING so that there won't be any overhead for users not
interested in paying the perf penalty.

This accounting is based on sched_clock, with the code being generic.
So, other archs may find it useful as well.

This patch just adds the core logic and does not enable this logic yet.

Signed-off-by: Venkatesh Pallipadi <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Mike Galbraith <[email protected]>
Acked-by: Peter Zijlstra <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
include/linux/hardirq.h | 2 -
include/linux/sched.h | 13 ++++++++++++
kernel/sched.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 63 insertions(+), 1 deletion(-)

Index: linux-2.6.35.y/include/linux/hardirq.h
===================================================================
--- linux-2.6.35.y.orig/include/linux/hardirq.h 2011-03-29 23:03:00.208294838 -0700
+++ linux-2.6.35.y/include/linux/hardirq.h 2011-03-29 23:03:00.268293305 -0700
@@ -137,7 +137,7 @@

struct task_struct;

-#ifndef CONFIG_VIRT_CPU_ACCOUNTING
+#if !defined(CONFIG_VIRT_CPU_ACCOUNTING) && !defined(CONFIG_IRQ_TIME_ACCOUNTING)
static inline void account_system_vtime(struct task_struct *tsk)
{
}
Index: linux-2.6.35.y/include/linux/sched.h
===================================================================
--- linux-2.6.35.y.orig/include/linux/sched.h 2011-03-29 23:03:00.248293818 -0700
+++ linux-2.6.35.y/include/linux/sched.h 2011-03-29 23:54:58.089516061 -0700
@@ -1823,6 +1823,19 @@
*/
extern unsigned long long cpu_clock(int cpu);

+#ifdef CONFIG_IRQ_TIME_ACCOUNTING
+/*
+ * An i/f to runtime opt-in for irq time accounting based off of sched_clock.
+ * The reason for this explicit opt-in is not to have perf penalty with
+ * slow sched_clocks.
+ */
+extern void enable_sched_clock_irqtime(void);
+extern void disable_sched_clock_irqtime(void);
+#else
+static inline void enable_sched_clock_irqtime(void) {}
+static inline void disable_sched_clock_irqtime(void) {}
+#endif
+
extern unsigned long long
task_sched_runtime(struct task_struct *task);
extern unsigned long long thread_group_sched_runtime(struct task_struct *task);
Index: linux-2.6.35.y/kernel/sched.c
===================================================================
--- linux-2.6.35.y.orig/kernel/sched.c 2011-03-29 23:03:00.149296350 -0700
+++ linux-2.6.35.y/kernel/sched.c 2011-03-29 23:54:59.868470542 -0700
@@ -1819,6 +1819,55 @@
#define for_each_class(class) \
for (class = sched_class_highest; class; class = class->next)

+#ifdef CONFIG_IRQ_TIME_ACCOUNTING
+
+static DEFINE_PER_CPU(u64, cpu_hardirq_time);
+static DEFINE_PER_CPU(u64, cpu_softirq_time);
+
+static DEFINE_PER_CPU(u64, irq_start_time);
+static int sched_clock_irqtime;
+
+void enable_sched_clock_irqtime(void)
+{
+ sched_clock_irqtime = 1;
+}
+
+void disable_sched_clock_irqtime(void)
+{
+ sched_clock_irqtime = 0;
+}
+
+void account_system_vtime(struct task_struct *curr)
+{
+ unsigned long flags;
+ int cpu;
+ u64 now, delta;
+
+ if (!sched_clock_irqtime)
+ return;
+
+ local_irq_save(flags);
+
+ now = sched_clock();
+ cpu = smp_processor_id();
+ delta = now - per_cpu(irq_start_time, cpu);
+ per_cpu(irq_start_time, cpu) = now;
+ /*
+ * We do not account for softirq time from ksoftirqd here.
+ * We want to continue accounting softirq time to ksoftirqd thread
+ * in that case, so as not to confuse scheduler with a special task
+ * that do not consume any time, but still wants to run.
+ */
+ if (hardirq_count())
+ per_cpu(cpu_hardirq_time, cpu) += delta;
+ else if (in_serving_softirq() && !(curr->flags & PF_KSOFTIRQD))
+ per_cpu(cpu_softirq_time, cpu) += delta;
+
+ local_irq_restore(flags);
+}
+
+#endif
+
#include "sched_stats.h"

static void inc_nr_running(struct rq *rq)

2011-03-30 21:07:18

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [86/275] x86, mm: avoid possible bogus tlb entries by clearing prev mm_cpumask after switching mm

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Suresh Siddha <[email protected]>

commit 831d52bc153971b70e64eccfbed2b232394f22f8 upstream.

Clearing the cpu in prev's mm_cpumask early will avoid the flush tlb
IPI's while the cr3 is still pointing to the prev mm. And this window
can lead to the possibility of bogus TLB fills resulting in strange
failures. One such problematic scenario is mentioned below.

T1. CPU-1 is context switching from mm1 to mm2 context and got a NMI
etc between the point of clearing the cpu from the mm_cpumask(mm1)
and before reloading the cr3 with the new mm2.

T2. CPU-2 is tearing down a specific vma for mm1 and will proceed with
flushing the TLB for mm1. It doesn't send the flush TLB to CPU-1
as it doesn't see that cpu listed in the mm_cpumask(mm1).

T3. After the TLB flush is complete, CPU-2 goes ahead and frees the
page-table pages associated with the removed vma mapping.

T4. CPU-2 now allocates those freed page-table pages for something
else.

T5. As the CR3 and TLB caches for mm1 is still active on CPU-1, CPU-1
can potentially speculate and walk through the page-table caches
and can insert new TLB entries. As the page-table pages are
already freed and being used on CPU-2, this page walk can
potentially insert a bogus global TLB entry depending on the
(random) contents of the page that is being used on CPU-2.

T6. This bogus TLB entry being global will be active across future CR3
changes and can result in weird memory corruption etc.

To avoid this issue, for the prev mm that is handing over the cpu to
another mm, clear the cpu from the mm_cpumask(prev) after the cr3 is
changed.

Marking it for -stable, though we haven't seen any reported failure that
can be attributed to this.

Signed-off-by: Suresh Siddha <[email protected]>
Acked-by: Ingo Molnar <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
arch/x86/include/asm/mmu_context.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

Index: linux-2.6.35.y/arch/x86/include/asm/mmu_context.h
===================================================================
--- linux-2.6.35.y.orig/arch/x86/include/asm/mmu_context.h 2011-03-29 22:51:35.790807371 -0700
+++ linux-2.6.35.y/arch/x86/include/asm/mmu_context.h 2011-03-29 23:02:59.928302005 -0700
@@ -36,8 +36,6 @@
unsigned cpu = smp_processor_id();

if (likely(prev != next)) {
- /* stop flush ipis for the previous mm */
- cpumask_clear_cpu(cpu, mm_cpumask(prev));
#ifdef CONFIG_SMP
percpu_write(cpu_tlbstate.state, TLBSTATE_OK);
percpu_write(cpu_tlbstate.active_mm, next);
@@ -47,6 +45,9 @@
/* Re-load page tables */
load_cr3(next->pgd);

+ /* stop flush ipis for the previous mm */
+ cpumask_clear_cpu(cpu, mm_cpumask(prev));
+
/*
* load the LDT, if the LDT is different:
*/

2011-03-30 21:51:32

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [96/275] sched: Drop group_capacity to 1 only if local group has extra capacity

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
Commit: 75dd321d79d495a0ee579e6249ebc38ddbb2667f upstream

When SD_PREFER_SIBLING is set on a sched domain, drop group_capacity to 1
only if the local group has extra capacity. The extra check prevents the case
where you always pull from the heaviest group when it is already under-utilized
(possible with a large weight task outweighs the tasks on the system).

For example, consider a 16-cpu quad-core quad-socket machine with MC and NUMA
scheduling domains. Let's say we spawn 15 nice0 tasks and one nice-15 task,
and each task is running on one core. In this case, we observe the following
events when balancing at the NUMA domain:

- find_busiest_group() will always pick the sched group containing the niced
task to be the busiest group.
- find_busiest_queue() will then always pick one of the cpus running the
nice0 task (never picks the cpu with the nice -15 task since
weighted_cpuload > imbalance).
- The load balancer fails to migrate the task since it is the running task
and increments sd->nr_balance_failed.
- It repeats the above steps a few more times until sd->nr_balance_failed > 5,
at which point it kicks off the active load balancer, wakes up the migration
thread and kicks the nice 0 task off the cpu.

The load balancer doesn't stop until we kick out all nice 0 tasks from
the sched group, leaving you with 3 idle cpus and one cpu running the
nice -15 task.

When balancing at the NUMA domain, we drop sgs.group_capacity to 1 if the child
domain (in this case MC) has SD_PREFER_SIBLING set. Subsequent load checks are
not relevant because the niced task has a very large weight.

In this patch, we add an extra condition to the "if(prefer_sibling)" check in
update_sd_lb_stats(). We drop the capacity of a group only if the local group
has extra capacity, ie. nr_running < group_capacity. This patch preserves the
original intent of the prefer_siblings check (to spread tasks across the system
in low utilization scenarios) and fixes the case above.

It helps in the following ways:
- In low utilization cases (where nr_tasks << nr_cpus), we still drop
group_capacity down to 1 if we prefer siblings.
- On very busy systems (where nr_tasks >> nr_cpus), sgs.nr_running will most
likely be > sgs.group_capacity.
- When balancing large weight tasks, if the local group does not have extra
capacity, we do not pick the group with the niced task as the busiest group.
This prevents failed balances, active migration and the under-utilization
described above.

Signed-off-by: Nikhil Rao <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Mike Galbraith <[email protected]>
Acked-by: Peter Zijlstra <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
kernel/sched_fair.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

Index: linux-2.6.35.y/kernel/sched_fair.c
===================================================================
--- linux-2.6.35.y.orig/kernel/sched_fair.c 2011-03-29 23:03:00.106297451 -0700
+++ linux-2.6.35.y/kernel/sched_fair.c 2011-03-29 23:54:59.868470542 -0700
@@ -2484,9 +2484,14 @@
/*
* In case the child domain prefers tasks go to siblings
* first, lower the group capacity to one so that we'll try
- * and move all the excess tasks away.
+ * and move all the excess tasks away. We lower the capacity
+ * of a group only if the local group has the capacity to fit
+ * these excess tasks, i.e. nr_running < group_capacity. The
+ * extra check prevents the case where you always pull from the
+ * heaviest group when it is already under-utilized (possible
+ * with a large weight task outweighs the tasks on the system).
*/
- if (prefer_sibling)
+ if (prefer_sibling && !local_group && sds->this_has_capacity)
sgs.group_capacity = min(sgs.group_capacity, 1UL);

if (local_group) {

2011-03-30 21:52:05

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [95/275] sched: Force balancing on newidle balance if local group has capacity

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
Commit: fab476228ba37907ad75216d0fd9732ada9c119e upstream

This patch forces a load balance on a newly idle cpu when the local group has
extra capacity and the busiest group does not have any. It improves system
utilization when balancing tasks with a large weight differential.

Under certain situations, such as a niced down task (i.e. nice = -15) in the
presence of nr_cpus NICE0 tasks, the niced task lands on a sched group and
kicks away other tasks because of its large weight. This leads to sub-optimal
utilization of the machine. Even though the sched group has capacity, it does
not pull tasks because sds.this_load >> sds.max_load, and f_b_g() returns NULL.

With this patch, if the local group has extra capacity, we shortcut the checks
in f_b_g() and try to pull a task over. A sched group has extra capacity if the
group capacity is greater than the number of running tasks in that group.

Thanks to Mike Galbraith for discussions leading to this patch and for the
insight to reuse SD_NEWIDLE_BALANCE.

Signed-off-by: Nikhil Rao <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Mike Galbraith <[email protected]>
Acked-by: Peter Zijlstra <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
kernel/sched_fair.c | 28 +++++++++++++++++++++++++---
1 file changed, 25 insertions(+), 3 deletions(-)

Index: linux-2.6.35.y/kernel/sched_fair.c
===================================================================
--- linux-2.6.35.y.orig/kernel/sched_fair.c 2011-03-29 23:03:00.087297937 -0700
+++ linux-2.6.35.y/kernel/sched_fair.c 2011-03-29 23:55:03.101387820 -0700
@@ -1765,6 +1765,10 @@
set_task_cpu(p, this_cpu);
activate_task(this_rq, p, 0);
check_preempt_curr(this_rq, p, 0);
+
+ /* re-arm NEWIDLE balancing when moving tasks */
+ src_rq->avg_idle = this_rq->avg_idle = 2*sysctl_sched_migration_cost;
+ this_rq->idle_stamp = 0;
}

/*
@@ -2031,12 +2035,14 @@
unsigned long this_load;
unsigned long this_load_per_task;
unsigned long this_nr_running;
+ unsigned long this_has_capacity;

/* Statistics of the busiest group */
unsigned long max_load;
unsigned long busiest_load_per_task;
unsigned long busiest_nr_running;
unsigned long busiest_group_capacity;
+ unsigned long busiest_has_capacity;

int group_imb; /* Is there imbalance in this sd */
#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)
@@ -2059,6 +2065,7 @@
unsigned long sum_weighted_load; /* Weighted load of group's tasks */
unsigned long group_capacity;
int group_imb; /* Is there an imbalance in the group ? */
+ int group_has_capacity; /* Is there extra capacity in the group? */
};

/**
@@ -2428,6 +2435,9 @@
sgs->group_imb = 1;

sgs->group_capacity = DIV_ROUND_CLOSEST(group->cpu_power, SCHED_LOAD_SCALE);
+
+ if (sgs->group_capacity > sgs->sum_nr_running)
+ sgs->group_has_capacity = 1;
}

/**
@@ -2484,6 +2494,7 @@
sds->this = group;
sds->this_nr_running = sgs.sum_nr_running;
sds->this_load_per_task = sgs.sum_weighted_load;
+ sds->this_has_capacity = sgs.group_has_capacity;
} else if (sgs.avg_load > sds->max_load &&
(sgs.sum_nr_running > sgs.group_capacity ||
sgs.group_imb)) {
@@ -2492,6 +2503,7 @@
sds->busiest_nr_running = sgs.sum_nr_running;
sds->busiest_group_capacity = sgs.group_capacity;
sds->busiest_load_per_task = sgs.sum_weighted_load;
+ sds->busiest_has_capacity = sgs.group_has_capacity;
sds->group_imb = sgs.group_imb;
}

@@ -2637,6 +2649,7 @@
return fix_small_imbalance(sds, this_cpu, imbalance);

}
+
/******* find_busiest_group() helpers end here *********************/

/**
@@ -2688,6 +2701,11 @@
* 4) This group is more busy than the avg busieness at this
* sched_domain.
* 5) The imbalance is within the specified limit.
+ *
+ * Note: when doing newidle balance, if the local group has excess
+ * capacity (i.e. nr_running < group_capacity) and the busiest group
+ * does not have any capacity, we force a load balance to pull tasks
+ * to the local group. In this case, we skip past checks 3, 4 and 5.
*/
if (!(*balance))
goto ret;
@@ -2695,6 +2713,11 @@
if (!sds.busiest || sds.busiest_nr_running == 0)
goto out_balanced;

+ /* SD_BALANCE_NEWIDLE trumps SMP nice when underutilized */
+ if (idle == CPU_NEWLY_IDLE && sds.this_has_capacity &&
+ !sds.busiest_has_capacity)
+ goto force_balance;
+
if (sds.this_load >= sds.max_load)
goto out_balanced;

@@ -2706,6 +2729,7 @@
if (100 * sds.max_load <= sd->imbalance_pct * sds.this_load)
goto out_balanced;

+force_balance:
/* Looks like there is an imbalance. Compute it */
calculate_imbalance(&sds, this_cpu, imbalance);
return sds.busiest;
@@ -3024,10 +3048,8 @@
interval = msecs_to_jiffies(sd->balance_interval);
if (time_after(next_balance, sd->last_balance + interval))
next_balance = sd->last_balance + interval;
- if (pulled_task) {
- this_rq->idle_stamp = 0;
+ if (pulled_task)
break;
- }
}

raw_spin_lock(&this_rq->lock);

2011-03-30 21:52:09

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [94/275] sched: Set group_imb only a task can be pulled from the busiest cpu

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
Commit: 2582f0eba54066b5e98ff2b27ef0cfa833b59f54 upstream

When cycling through sched groups to determine the busiest group, set
group_imb only if the busiest cpu has more than 1 runnable task. This patch
fixes the case where two cpus in a group have one runnable task each, but there
is a large weight differential between these two tasks. The load balancer is
unable to migrate any task from this group, and hence do not consider this
group to be imbalanced.

Signed-off-by: Nikhil Rao <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
LKML-Reference: <[email protected]>
[ small code readability edits ]
Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Mike Galbraith <[email protected]>
Acked-by: Peter Zijlstra <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
kernel/sched_fair.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)

Index: linux-2.6.35.y/kernel/sched_fair.c
===================================================================
--- linux-2.6.35.y.orig/kernel/sched_fair.c 2011-03-29 23:03:00.047298961 -0700
+++ linux-2.6.35.y/kernel/sched_fair.c 2011-03-29 23:55:03.511377329 -0700
@@ -2352,7 +2352,7 @@
int local_group, const struct cpumask *cpus,
int *balance, struct sg_lb_stats *sgs)
{
- unsigned long load, max_cpu_load, min_cpu_load;
+ unsigned long load, max_cpu_load, min_cpu_load, max_nr_running;
int i;
unsigned int balance_cpu = -1, first_idle_cpu = 0;
unsigned long avg_load_per_task = 0;
@@ -2363,6 +2363,7 @@
/* Tally up the load of all CPUs in the group */
max_cpu_load = 0;
min_cpu_load = ~0UL;
+ max_nr_running = 0;

for_each_cpu_and(i, sched_group_cpus(group), cpus) {
struct rq *rq = cpu_rq(i);
@@ -2380,8 +2381,10 @@
load = target_load(i, load_idx);
} else {
load = source_load(i, load_idx);
- if (load > max_cpu_load)
+ if (load > max_cpu_load) {
max_cpu_load = load;
+ max_nr_running = rq->nr_running;
+ }
if (min_cpu_load > load)
min_cpu_load = load;
}
@@ -2421,11 +2424,10 @@
if (sgs->sum_nr_running)
avg_load_per_task = sgs->sum_weighted_load / sgs->sum_nr_running;

- if ((max_cpu_load - min_cpu_load) > 2*avg_load_per_task)
+ if ((max_cpu_load - min_cpu_load) > 2*avg_load_per_task && max_nr_running > 1)
sgs->group_imb = 1;

- sgs->group_capacity =
- DIV_ROUND_CLOSEST(group->cpu_power, SCHED_LOAD_SCALE);
+ sgs->group_capacity = DIV_ROUND_CLOSEST(group->cpu_power, SCHED_LOAD_SCALE);
}

/**

2011-03-30 21:52:44

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [93/275] sched: Do not consider SCHED_IDLE tasks to be cache hot

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
Commit: ef8002f6848236de5adc613063ebeabddea8a6fb upstream

This patch adds a check in task_hot to return if the task has SCHED_IDLE
policy. SCHED_IDLE tasks have very low weight, and when run with regular
workloads, are typically scheduled many milliseconds apart. There is no
need to consider these tasks hot for load balancing.

Signed-off-by: Nikhil Rao <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Mike Galbraith <[email protected]>
Acked-by: Peter Zijlstra <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
kernel/sched.c | 3 +++
1 file changed, 3 insertions(+)

Index: linux-2.6.35.y/kernel/sched.c
===================================================================
--- linux-2.6.35.y.orig/kernel/sched.c 2011-03-29 23:02:59.968300981 -0700
+++ linux-2.6.35.y/kernel/sched.c 2011-03-29 23:55:02.689398361 -0700
@@ -1972,6 +1972,9 @@
if (p->sched_class != &fair_sched_class)
return 0;

+ if (unlikely(p->policy == SCHED_IDLE))
+ return 0;
+
/*
* Buddy candidates are cache hot:
*/

2011-03-30 21:07:10

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [78/275] dm mpath: disable blk_abort_queue

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Mike Snitzer <[email protected]>

commit 09c9d4c9b6a2b5909ae3c6265e4cd3820b636863 upstream.

Revert commit 224cb3e981f1b2f9f93dbd49eaef505d17d894c2
dm: Call blk_abort_queue on failed paths

Multipath began to use blk_abort_queue() to allow for
lower latency path deactivation. This was found to
cause list corruption:

the cmd gets blk_abort_queued/timedout run on it and the scsi eh
somehow is able to complete and run scsi_queue_insert while
scsi_request_fn is still trying to process the request.

https://www.redhat.com/archives/dm-devel/2010-November/msg00085.html

Signed-off-by: Mike Snitzer <[email protected]>
Signed-off-by: Alasdair G Kergon <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Cc: Mike Anderson <[email protected]>
Cc: Mike Christie <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
drivers/md/dm-mpath.c | 12 ------------
1 file changed, 12 deletions(-)

Index: linux-2.6.35.y/drivers/md/dm-mpath.c
===================================================================
--- linux-2.6.35.y.orig/drivers/md/dm-mpath.c 2011-03-29 22:51:38.968726056 -0700
+++ linux-2.6.35.y/drivers/md/dm-mpath.c 2011-03-29 23:02:59.780305791 -0700
@@ -33,7 +33,6 @@
unsigned fail_count; /* Cumulative failure count */

struct dm_path path;
- struct work_struct deactivate_path;
struct work_struct activate_path;
};

@@ -116,7 +115,6 @@
static void process_queued_ios(struct work_struct *work);
static void trigger_event(struct work_struct *work);
static void activate_path(struct work_struct *work);
-static void deactivate_path(struct work_struct *work);


/*-----------------------------------------------
@@ -129,7 +127,6 @@

if (pgpath) {
pgpath->is_active = 1;
- INIT_WORK(&pgpath->deactivate_path, deactivate_path);
INIT_WORK(&pgpath->activate_path, activate_path);
}

@@ -141,14 +138,6 @@
kfree(pgpath);
}

-static void deactivate_path(struct work_struct *work)
-{
- struct pgpath *pgpath =
- container_of(work, struct pgpath, deactivate_path);
-
- blk_abort_queue(pgpath->path.dev->bdev->bd_disk->queue);
-}
-
static struct priority_group *alloc_priority_group(void)
{
struct priority_group *pg;
@@ -993,7 +982,6 @@
pgpath->path.dev->name, m->nr_valid_paths);

schedule_work(&m->trigger_event);
- queue_work(kmultipathd, &pgpath->deactivate_path);

out:
spin_unlock_irqrestore(&m->lock, flags);

2011-03-30 21:53:08

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [90/275] sched: Try not to migrate higher priority RT tasks

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
Commit: 43fa5460fe60dea5c610490a1d263415419c60f6 upstream

When first working on the RT scheduler design, we concentrated on
keeping all CPUs running RT tasks instead of having multiple RT
tasks on a single CPU waiting for the migration thread to move
them. Instead we take a more proactive stance and push or pull RT
tasks from one CPU to another on wakeup or scheduling.

When an RT task wakes up on a CPU that is running another RT task,
instead of preempting it and killing the cache of the running RT
task, we look to see if we can migrate the RT task that is waking
up, even if the RT task waking up is of higher priority.

This may sound a bit odd, but RT tasks should be limited in
migration by the user anyway. But in practice, people do not do
this, which causes high prio RT tasks to bounce around the CPUs.
This becomes even worse when we have priority inheritance, because
a high prio task can block on a lower prio task and boost its
priority. When the lower prio task wakes up the high prio task, if
it happens to be on the same CPU it will migrate off of it.

But in reality, the above does not happen much either, because the
wake up of the lower prio task, which has already been boosted, if
it was on the same CPU as the higher prio task, it would then
migrate off of it. But anyway, we do not want to migrate them
either.

To examine the scheduling, I created a test program and examined it
under kernelshark. The test program created CPU * 2 threads, where
each thread had a different priority. The program takes different
options. The options used in this change log was to have priority
inheritance mutexes or not.

All threads did the following loop:

static void grab_lock(long id, int iter, int l)
{
ftrace_write("thread %ld iter %d, taking lock %d\n",
id, iter, l);
pthread_mutex_lock(&locks[l]);
ftrace_write("thread %ld iter %d, took lock %d\n",
id, iter, l);
busy_loop(nr_tasks - id);
ftrace_write("thread %ld iter %d, unlock lock %d\n",
id, iter, l);
pthread_mutex_unlock(&locks[l]);
}

void *start_task(void *id)
{
[...]
while (!done) {
for (l = 0; l < nr_locks; l++) {
grab_lock(id, i, l);
ftrace_write("thread %ld iter %d sleeping\n",
id, i);
ms_sleep(id);
}
i++;
}
[...]
}

The busy_loop(ms) keeps the CPU spinning for ms milliseconds. The
ms_sleep(ms) sleeps for ms milliseconds. The ftrace_write() writes
to the ftrace buffer to help analyze via ftrace.

The higher the id, the higher the prio, the shorter it does the
busy loop, but the longer it spins. This is usually the case with
RT tasks, the lower priority tasks usually run longer than higher
priority tasks.

At the end of the test, it records the number of loops each thread
took, as well as the number of voluntary preemptions, non-voluntary
preemptions, and number of migrations each thread took, taking the
information from /proc/$$/sched and /proc/$$/status.

Running this on a 4 CPU processor, the results without changes to
the kernel looked like this:

Task vol nonvol migrated iterations
Signed-off-by: Andi Kleen <[email protected]>

---- --- ------ -------- ----------
0: 53 3220 1470 98
1: 562 773 724 98
2: 752 933 1375 98
3: 749 39 697 98
4: 758 5 515 98
5: 764 2 679 99
6: 761 2 535 99
7: 757 3 346 99

total: 5156 4977 6341 787

Each thread regardless of priority migrated a few hundred times.
The higher priority tasks, were a little better but still took
quite an impact.

By letting higher priority tasks bump the lower prio task from the
CPU, things changed a bit:

Task vol nonvol migrated iterations
---- --- ------ -------- ----------
0: 37 2835 1937 98
1: 666 1821 1865 98
2: 654 1003 1385 98
3: 664 635 973 99
4: 698 197 352 99
5: 703 101 159 99
6: 708 1 75 99
7: 713 1 2 99

total: 4843 6594 6748 789

The total # of migrations did not change (several runs showed the
difference all within the noise). But we now see a dramatic
improvement to the higher priority tasks. (kernelshark showed that
the watchdog timer bumped the highest priority task to give it the
2 count. This was actually consistent with every run).

Notice that the # of iterations did not change either.

The above was with priority inheritance mutexes. That is, when the
higher prority task blocked on a lower priority task, the lower
priority task would inherit the higher priority task (which shows
why task 6 was bumped so many times). When not using priority
inheritance mutexes, the current kernel shows this:

Task vol nonvol migrated iterations
---- --- ------ -------- ----------
0: 56 3101 1892 95
1: 594 713 937 95
2: 625 188 618 95
3: 628 4 491 96
4: 640 7 468 96
5: 631 2 501 96
6: 641 1 466 96
7: 643 2 497 96

total: 4458 4018 5870 765

Not much changed with or without priority inheritance mutexes. But
if we let the high priority task bump lower priority tasks on
wakeup we see:

Task vol nonvol migrated iterations
---- --- ------ -------- ----------
0: 115 3439 2782 98
1: 633 1354 1583 99
2: 652 919 1218 99
3: 645 713 934 99
4: 690 3 3 99
5: 694 1 4 99
6: 720 3 4 99
7: 747 0 1 100

Which shows a even bigger change. The big difference between task 3
and task 4 is because we have only 4 CPUs on the machine, causing
the 4 highest prio tasks to always have preference.

Although I did not measure cache misses, and I'm sure there would
be little to measure since the test was not data intensive, I could
imagine large improvements for higher priority tasks when dealing
with lower priority tasks. Thus, I'm satisfied with making the
change and agreeing with what Gregory Haskins argued a few years
ago when we first had this discussion.

One final note. All tasks in the above tests were RT tasks. Any RT
task will always preempt a non RT task that is running on the CPU
the RT task wants to run on.

Signed-off-by: Steven Rostedt <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Cc: Gregory Haskins <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Mike Galbraith <[email protected]>
Acked-by: Peter Zijlstra <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
kernel/sched_rt.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)

Index: linux-2.6.35.y/kernel/sched_rt.c
===================================================================
--- linux-2.6.35.y.orig/kernel/sched_rt.c 2011-03-29 22:51:34.149849359 -0700
+++ linux-2.6.35.y/kernel/sched_rt.c 2011-03-29 23:55:05.138335699 -0700
@@ -960,18 +960,18 @@
* runqueue. Otherwise simply start this RT task
* on its current runqueue.
*
- * We want to avoid overloading runqueues. Even if
- * the RT task is of higher priority than the current RT task.
- * RT tasks behave differently than other tasks. If
- * one gets preempted, we try to push it off to another queue.
- * So trying to keep a preempting RT task on the same
- * cache hot CPU will force the running RT task to
- * a cold CPU. So we waste all the cache for the lower
- * RT task in hopes of saving some of a RT task
- * that is just being woken and probably will have
- * cold cache anyway.
+ * We want to avoid overloading runqueues. If the woken
+ * task is a higher priority, then it will stay on this CPU
+ * and the lower prio task should be moved to another CPU.
+ * Even though this will probably make the lower prio task
+ * lose its cache, we do not want to bounce a higher task
+ * around just because it gave up its CPU, perhaps for a
+ * lock?
+ *
+ * For equal prio tasks, we just let the scheduler sort it out.
*/
if (unlikely(rt_task(rq->curr)) &&
+ rq->curr->prio < p->prio &&
(p->rt.nr_cpus_allowed > 1)) {
int cpu = find_lowest_rq(p);

@@ -1491,6 +1491,8 @@
if (!task_running(rq, p) &&
!test_tsk_need_resched(rq->curr) &&
has_pushable_tasks(rq) &&
+ rt_task(rq->curr) &&
+ rq->curr->prio < p->prio &&
p->rt.nr_cpus_allowed > 1)
push_rt_tasks(rq);
}

2011-03-30 21:53:04

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [91/275] sched: Give CPU bound RT tasks preference

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From:: Steven Rostedt <[email protected]>

Commit: b3bc211cfe7d5fe94b310480d78e00bea96fbf2a upstream

If a high priority task is waking up on a CPU that is running a
lower priority task that is bound to a CPU, see if we can move the
high RT task to another CPU first. Note, if all other CPUs are
running higher priority tasks than the CPU bounded current task,
then it will be preempted regardless.

Signed-off-by: Steven Rostedt <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Cc: Gregory Haskins <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Mike Galbraith <[email protected]>
Acked-by: Peter Zijlstra <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
kernel/sched_rt.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

Index: linux-2.6.35.y/kernel/sched_rt.c
===================================================================
--- linux-2.6.35.y.orig/kernel/sched_rt.c 2011-03-29 23:03:00.009299932 -0700
+++ linux-2.6.35.y/kernel/sched_rt.c 2011-03-29 23:54:59.868470542 -0700
@@ -971,7 +971,8 @@
* For equal prio tasks, we just let the scheduler sort it out.
*/
if (unlikely(rt_task(rq->curr)) &&
- rq->curr->prio < p->prio &&
+ (rq->curr->rt.nr_cpus_allowed < 2 ||
+ rq->curr->prio < p->prio) &&
(p->rt.nr_cpus_allowed > 1)) {
int cpu = find_lowest_rq(p);

@@ -1491,9 +1492,10 @@
if (!task_running(rq, p) &&
!test_tsk_need_resched(rq->curr) &&
has_pushable_tasks(rq) &&
+ p->rt.nr_cpus_allowed > 1 &&
rt_task(rq->curr) &&
- rq->curr->prio < p->prio &&
- p->rt.nr_cpus_allowed > 1)
+ (rq->curr->rt.nr_cpus_allowed < 2 ||
+ rq->curr->prio < p->prio))
push_rt_tasks(rq);
}

2011-03-30 21:07:08

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [60/275] serial: unbreak billionton CF card

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Pavel Machek <[email protected]>

commit d0694e2aeb815042aa0f3e5036728b3db4446f1d upstream.

Unbreak Billionton CF bluetooth card. This actually fixes a regression
on zaurus.

Signed-off-by: Pavel Machek <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/serial/8250.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6.35.y/drivers/serial/8250.c
===================================================================
--- linux-2.6.35.y.orig/drivers/serial/8250.c 2011-03-29 22:51:45.825550607 -0700
+++ linux-2.6.35.y/drivers/serial/8250.c 2011-03-29 23:02:59.395315642 -0700
@@ -256,7 +256,8 @@
.fifo_size = 128,
.tx_loadsz = 128,
.fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10,
- .flags = UART_CAP_FIFO | UART_CAP_EFR | UART_CAP_SLEEP,
+ /* UART_CAP_EFR breaks billionon CF bluetooth card. */
+ .flags = UART_CAP_FIFO | UART_CAP_SLEEP,
},
[PORT_RSA] = {
.name = "RSA",

2011-03-30 21:53:50

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [87/275] usb: Realloc xHCI structures after a hub is verified.

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Sarah Sharp <[email protected]>

commit 653a39d1f61bdc9f277766736d21d2e9be0391cb upstream.

When there's an xHCI host power loss after a suspend from memory, the USB
core attempts to reset and verify the USB devices that are attached to the
system. The xHCI driver has to reallocate those devices, since the
hardware lost all knowledge of them during the power loss.

When a hub is plugged in, and the host loses power, the xHCI hardware
structures are not updated to say the device is a hub. This is usually
done in hub_configure() when the USB hub is detected. That function is
skipped during a reset and verify by the USB core, since the core restores
the old configuration and alternate settings, and the hub driver has no
idea this happened. This bug makes the xHCI host controller reject the
enumeration of low speed devices under the resumed hub.

Therefore, make the USB core re-setup the internal xHCI hub device
information by calling update_hub_device() when hub_activate() is called
for a hub reset resume. After a host power loss, all devices under the
roothub get a reset-resume or a disconnect.

This patch should be queued for the 2.6.37 stable tree.

Signed-off-by: Sarah Sharp <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/usb/core/hub.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)

Index: linux-2.6.35.y/drivers/usb/core/hub.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/core/hub.c 2011-03-29 23:02:58.824330253 -0700
+++ linux-2.6.35.y/drivers/usb/core/hub.c 2011-03-29 23:02:59.947301518 -0700
@@ -677,6 +677,8 @@
static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
{
struct usb_device *hdev = hub->hdev;
+ struct usb_hcd *hcd;
+ int ret;
int port1;
int status;
bool need_debounce_delay = false;
@@ -715,6 +717,25 @@
usb_autopm_get_interface_no_resume(
to_usb_interface(hub->intfdev));
return; /* Continues at init2: below */
+ } else if (type == HUB_RESET_RESUME) {
+ /* The internal host controller state for the hub device
+ * may be gone after a host power loss on system resume.
+ * Update the device's info so the HW knows it's a hub.
+ */
+ hcd = bus_to_hcd(hdev->bus);
+ if (hcd->driver->update_hub_device) {
+ ret = hcd->driver->update_hub_device(hcd, hdev,
+ &hub->tt, GFP_NOIO);
+ if (ret < 0) {
+ dev_err(hub->intfdev, "Host not "
+ "accepting hub info "
+ "update.\n");
+ dev_err(hub->intfdev, "LS/FS devices "
+ "and hubs may not work "
+ "under this hub\n.");
+ }
+ }
+ hub_power_on(hub, true);
} else {
hub_power_on(hub, true);
}

2011-03-30 21:07:04

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [58/275] p54: fix sequence no. accounting off-by-one error

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Christian Lamparter <[email protected]>

commit 3b5c5827d1f80ad8ae844a8b1183f59ddb90fe25 upstream.

P54_HDR_FLAG_DATA_OUT_SEQNR is meant to tell the
firmware that "the frame's sequence number has
already been set by the application."

Whereas IEEE80211_TX_CTL_ASSIGN_SEQ is set for
frames which lack a valid sequence number and
either the driver or firmware has to assign one.

Yup, it's the exact opposite!

Signed-off-by: Christian Lamparter <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/net/wireless/p54/txrx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.35.y/drivers/net/wireless/p54/txrx.c
===================================================================
--- linux-2.6.35.y.orig/drivers/net/wireless/p54/txrx.c 2011-03-29 22:51:46.583531213 -0700
+++ linux-2.6.35.y/drivers/net/wireless/p54/txrx.c 2011-03-29 23:02:59.358316589 -0700
@@ -616,7 +616,7 @@
else
*burst_possible = false;

- if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ)
+ if (!(info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ))
*flags |= P54_HDR_FLAG_DATA_OUT_SEQNR;

if (info->flags & IEEE80211_TX_CTL_PSPOLL_RESPONSE)

2011-03-30 21:54:07

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [85/275] drm/i915: Add dependency on CONFIG_TMPFS

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Chris Wilson <[email protected]>

commit f7ab9b407b3bc83161c2aa74c992ba4782e87c9c upstream.

Without tmpfs, shmem_readpage() is not compiled in causing an OOPS as
soon as we try to allocate some swappable pages for GEM.

Jan 19 22:52:26 harlie kernel: Modules linked in: i915(+) drm_kms_helper cfbcopyarea video backlight cfbimgblt cfbfillrect
Jan 19 22:52:26 harlie kernel:
Jan 19 22:52:26 harlie kernel: Pid: 1125, comm: modprobe Not tainted 2.6.37Harlie #10 To be filled by O.E.M./To be filled by O.E.M.
Jan 19 22:52:26 harlie kernel: EIP: 0060:[<00000000>] EFLAGS: 00010246 CPU: 3
Jan 19 22:52:26 harlie kernel: EIP is at 0x0
Jan 19 22:52:26 harlie kernel: EAX: 00000000 EBX: f7b7d000 ECX: f3383100 EDX: f7b7d000
Jan 19 22:52:26 harlie kernel: ESI: f1456118 EDI: 00000000 EBP: f2303c98 ESP: f2303c7c
Jan 19 22:52:26 harlie kernel: DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Jan 19 22:52:26 harlie kernel: Process modprobe (pid: 1125, ti=f2302000 task=f259cd80 task.ti=f2302000)
Jan 19 22:52:26 harlie kernel: Stack:
Jan 19 22:52:26 harlie udevd-work[1072]: '/sbin/modprobe -b pci:v00008086d00000046sv00000000sd00000000bc03sc00i00' unexpected exit with status 0x0009
Jan 19 22:52:26 harlie kernel: c1074061 000000d0 f2f42b80 00000000 000a13d2 f2d5dcc0 00000001 f2303cac
Jan 19 22:52:26 harlie kernel: c107416f 00000000 000a13d2 00000000 f2303cd4 f8d620ed f2cee620 00001000
Jan 19 22:52:26 harlie kernel: 00000000 000a13d2 f1456118 f2d5dcc0 f1a40000 00001000 f2303d04 f8d637ab
Jan 19 22:52:26 harlie kernel: Call Trace:
Jan 19 22:52:26 harlie kernel: [<c1074061>] ? do_read_cache_page+0x71/0x160
Jan 19 22:52:26 harlie kernel: [<c107416f>] ? read_cache_page_gfp+0x1f/0x30
Jan 19 22:52:26 harlie kernel: [<f8d620ed>] ? i915_gem_object_get_pages+0xad/0x1d0 [i915]
Jan 19 22:52:26 harlie kernel: [<f8d637ab>] ? i915_gem_object_bind_to_gtt+0xeb/0x2d0 [i915]
Jan 19 22:52:26 harlie kernel: [<f8d65961>] ? i915_gem_object_pin+0x151/0x190 [i915]
Jan 19 22:52:26 harlie kernel: [<c11e16ed>] ? drm_gem_object_init+0x3d/0x60
Jan 19 22:52:26 harlie kernel: [<f8d65aa5>] ? i915_gem_init_ringbuffer+0x105/0x1e0 [i915]
Jan 19 22:52:26 harlie kernel: [<f8d571b7>] ? i915_driver_load+0x667/0x1160 [i915]

Reported-by: John J. Stimson-III <[email protected]>
Signed-off-by: Chris Wilson <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/gpu/drm/Kconfig | 3 +++
1 file changed, 3 insertions(+)

Index: linux-2.6.35.y/drivers/gpu/drm/Kconfig
===================================================================
--- linux-2.6.35.y.orig/drivers/gpu/drm/Kconfig 2011-03-29 22:51:36.191797111 -0700
+++ linux-2.6.35.y/drivers/gpu/drm/Kconfig 2011-03-29 23:02:59.909302491 -0700
@@ -96,7 +96,10 @@
config DRM_I915
tristate "i915 driver"
depends on AGP_INTEL
+ # we need shmfs for the swappable backing store, and in particular
+ # the shmem_readpage() which depends upon tmpfs
select SHMEM
+ select TMPFS
select DRM_KMS_HELPER
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA

2011-03-30 21:54:27

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [84/275] drm/i915/lvds: Add AOpen i915GMm-HFS to the list of false-positive LVDS

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Knut Petersen <[email protected]>

commit 22ab70d3262ddb6e69b3c246a34e2967ba5eb1e8 upstream.

Signed-off-by: Knut Petersen <[email protected]>
Signed-off-by: Chris Wilson <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/gpu/drm/i915/intel_lvds.c | 8 ++++++++
1 file changed, 8 insertions(+)

Index: linux-2.6.35.y/drivers/gpu/drm/i915/intel_lvds.c
===================================================================
--- linux-2.6.35.y.orig/drivers/gpu/drm/i915/intel_lvds.c 2011-03-29 22:51:36.591786877 -0700
+++ linux-2.6.35.y/drivers/gpu/drm/i915/intel_lvds.c 2011-03-29 23:02:59.891302951 -0700
@@ -811,6 +811,14 @@
},
{
.callback = intel_no_lvds_dmi_callback,
+ .ident = "AOpen i915GMm-HFS",
+ .matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR, "AOpen"),
+ DMI_MATCH(DMI_BOARD_NAME, "i915GMm-HFS"),
+ },
+ },
+ {
+ .callback = intel_no_lvds_dmi_callback,
.ident = "Aopen i945GTt-VFA",
.matches = {
DMI_MATCH(DMI_PRODUCT_VERSION, "AO00001JW"),

2011-03-30 21:54:44

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [74/275] SELinux: define permissions for DCB netlink messages

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Eric Paris <[email protected]>

commit 350e4f31e0eaf56dfc3b328d24a11bdf42a41fb8 upstream.

Commit 2f90b865 added two new netlink message types to the netlink route
socket. SELinux has hooks to define if netlink messages are allowed to
be sent or received, but it did not know about these two new message
types. By default we allow such actions so noone likely noticed. This
patch adds the proper definitions and thus proper permissions
enforcement.

Signed-off-by: Eric Paris <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Cc: James Morris <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
security/selinux/nlmsgtab.c | 2 ++
1 file changed, 2 insertions(+)

Index: linux-2.6.35.y/security/selinux/nlmsgtab.c
===================================================================
--- linux-2.6.35.y.orig/security/selinux/nlmsgtab.c 2011-03-29 22:51:40.454688035 -0700
+++ linux-2.6.35.y/security/selinux/nlmsgtab.c 2011-03-29 23:02:59.705307710 -0700
@@ -65,6 +65,8 @@
{ RTM_NEWADDRLABEL, NETLINK_ROUTE_SOCKET__NLMSG_WRITE },
{ RTM_DELADDRLABEL, NETLINK_ROUTE_SOCKET__NLMSG_WRITE },
{ RTM_GETADDRLABEL, NETLINK_ROUTE_SOCKET__NLMSG_READ },
+ { RTM_GETDCB, NETLINK_ROUTE_SOCKET__NLMSG_READ },
+ { RTM_SETDCB, NETLINK_ROUTE_SOCKET__NLMSG_WRITE },
};

static struct nlmsg_perm nlmsg_firewall_perms[] =

2011-03-30 21:54:43

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [83/275] drm/radeon/kms: fix s/r issues with bios scratch regs

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Alex Deucher <[email protected]>

commit 87364760de5d631390c478fcbac8db1b926e0adf upstream.

The accelerate mode bit gets checked by certain atom
command tables to set up some register state. It needs
to be clear when setting modes and set when not.

Fixes:
https://bugzilla.kernel.org/show_bug.cgi?id=26942

Signed-off-by: Alex Deucher <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/gpu/drm/radeon/radeon_atombios.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

Index: linux-2.6.35.y/drivers/gpu/drm/radeon/radeon_atombios.c
===================================================================
--- linux-2.6.35.y.orig/drivers/gpu/drm/radeon/radeon_atombios.c 2011-03-29 23:02:59.818304820 -0700
+++ linux-2.6.35.y/drivers/gpu/drm/radeon/radeon_atombios.c 2011-03-29 23:02:59.873303412 -0700
@@ -2125,7 +2125,7 @@
bios_2_scratch &= ~ATOM_S2_VRI_BRIGHT_ENABLE;

/* tell the bios not to handle mode switching */
- bios_6_scratch |= (ATOM_S6_ACC_BLOCK_DISPLAY_SWITCH | ATOM_S6_ACC_MODE);
+ bios_6_scratch |= ATOM_S6_ACC_BLOCK_DISPLAY_SWITCH;

if (rdev->family >= CHIP_R600) {
WREG32(R600_BIOS_2_SCRATCH, bios_2_scratch);
@@ -2176,10 +2176,13 @@
else
bios_6_scratch = RREG32(RADEON_BIOS_6_SCRATCH);

- if (lock)
+ if (lock) {
bios_6_scratch |= ATOM_S6_CRITICAL_STATE;
- else
+ bios_6_scratch &= ~ATOM_S6_ACC_MODE;
+ } else {
bios_6_scratch &= ~ATOM_S6_CRITICAL_STATE;
+ bios_6_scratch |= ATOM_S6_ACC_MODE;
+ }

if (rdev->family >= CHIP_R600)
WREG32(R600_BIOS_6_SCRATCH, bios_6_scratch);

2011-03-30 21:55:38

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [80/275] drm/radeon/kms: make the mac rv630 quirk generic

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Alex Deucher <[email protected]>

commit be23da8ad219650517cbbb7acbeaeb235667113a upstream.

Seems some other boards do this as well.

Reported-by: Andrea Merello <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/gpu/drm/radeon/radeon_atombios.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)

Index: linux-2.6.35.y/drivers/gpu/drm/radeon/radeon_atombios.c
===================================================================
--- linux-2.6.35.y.orig/drivers/gpu/drm/radeon/radeon_atombios.c 2011-03-29 23:02:59.799305306 -0700
+++ linux-2.6.35.y/drivers/gpu/drm/radeon/radeon_atombios.c 2011-03-29 23:55:08.406252081 -0700
@@ -289,15 +289,11 @@
*line_mux = 0x90;
}

- /* mac rv630 */
- if ((dev->pdev->device == 0x9588) &&
- (dev->pdev->subsystem_vendor == 0x106b) &&
- (dev->pdev->subsystem_device == 0x00a6)) {
- if ((supported_device == ATOM_DEVICE_TV1_SUPPORT) &&
- (*connector_type == DRM_MODE_CONNECTOR_DVII)) {
- *connector_type = DRM_MODE_CONNECTOR_9PinDIN;
- *line_mux = CONNECTOR_7PIN_DIN_ENUM_ID1;
- }
+ /* mac rv630, rv730, others */
+ if ((supported_device == ATOM_DEVICE_TV1_SUPPORT) &&
+ (*connector_type == DRM_MODE_CONNECTOR_DVII)) {
+ *connector_type = DRM_MODE_CONNECTOR_9PinDIN;
+ *line_mux = CONNECTOR_7PIN_DIN_ENUM_ID1;
}

/* ASUS HD 3600 XT board lists the DVI port as HDMI */

2011-03-30 21:55:40

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [68/275] kernel/smp.c: fix smp_call_function_many() SMP race

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Anton Blanchard <[email protected]>

commit 6dc19899958e420a931274b94019e267e2396d3e upstream.

I noticed a failure where we hit the following WARN_ON in
generic_smp_call_function_interrupt:

if (!cpumask_test_and_clear_cpu(cpu, data->cpumask))
continue;

data->csd.func(data->csd.info);

refs = atomic_dec_return(&data->refs);
WARN_ON(refs < 0); <-------------------------

We atomically tested and cleared our bit in the cpumask, and yet the
number of cpus left (ie refs) was 0. How can this be?

It turns out commit 54fdade1c3332391948ec43530c02c4794a38172
("generic-ipi: make struct call_function_data lockless") is at fault. It
removes locking from smp_call_function_many and in doing so creates a
rather complicated race.

The problem comes about because:

- The smp_call_function_many interrupt handler walks call_function.queue
without any locking.
- We reuse a percpu data structure in smp_call_function_many.
- We do not wait for any RCU grace period before starting the next
smp_call_function_many.

Imagine a scenario where CPU A does two smp_call_functions back to back,
and CPU B does an smp_call_function in between. We concentrate on how CPU
C handles the calls:

CPU A CPU B CPU C CPU D

smp_call_function
smp_call_function_interrupt
walks
call_function.queue sees
data from CPU A on list

smp_call_function

smp_call_function_interrupt
walks

call_function.queue sees
(stale) CPU A on list
smp_call_function int
clears last ref on A
list_del_rcu, unlock
smp_call_function reuses
percpu *data A
data->cpumask sees and
clears bit in cpumask
might be using old or new fn!
decrements refs below 0

set data->refs (too late!)

The important thing to note is since the interrupt handler walks a
potentially stale call_function.queue without any locking, then another
cpu can view the percpu *data structure at any time, even when the owner
is in the process of initialising it.

The following test case hits the WARN_ON 100% of the time on my PowerPC
box (having 128 threads does help :)

#include <linux/module.h>
#include <linux/init.h>

#define ITERATIONS 100

static void do_nothing_ipi(void *dummy)
{
}

static void do_ipis(struct work_struct *dummy)
{
int i;

for (i = 0; i < ITERATIONS; i++)
smp_call_function(do_nothing_ipi, NULL, 1);

printk(KERN_DEBUG "cpu %d finished\n", smp_processor_id());
}

static struct work_struct work[NR_CPUS];

static int __init testcase_init(void)
{
int cpu;

for_each_online_cpu(cpu) {
INIT_WORK(&work[cpu], do_ipis);
schedule_work_on(cpu, &work[cpu]);
}

return 0;
}

static void __exit testcase_exit(void)
{
}

module_init(testcase_init)
module_exit(testcase_exit)
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Anton Blanchard");

I tried to fix it by ordering the read and the write of ->cpumask and
->refs. In doing so I missed a critical case but Paul McKenney was able
to spot my bug thankfully :) To ensure we arent viewing previous
iterations the interrupt handler needs to read ->refs then ->cpumask then
->refs _again_.

Thanks to Milton Miller and Paul McKenney for helping to debug this issue.

[[email protected]: add WARN_ON and BUG_ON, remove extra read of refs before initial read of mask that doesn't help (also noted by Peter Zijlstra), adjust comments, hopefully clarify scenario ]
[[email protected]: remove excess tests]
Signed-off-by: Anton Blanchard <[email protected]>
Signed-off-by: Milton Miller <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: "Paul E. McKenney" <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
kernel/smp.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)

Index: linux-2.6.35.y/kernel/smp.c
===================================================================
--- linux-2.6.35.y.orig/kernel/smp.c 2011-03-29 22:51:42.804627906 -0700
+++ linux-2.6.35.y/kernel/smp.c 2011-03-29 23:54:08.137794201 -0700
@@ -194,6 +194,24 @@
list_for_each_entry_rcu(data, &call_function.queue, csd.list) {
int refs;

+ /*
+ * Since we walk the list without any locks, we might
+ * see an entry that was completed, removed from the
+ * list and is in the process of being reused.
+ *
+ * We must check that the cpu is in the cpumask before
+ * checking the refs, and both must be set before
+ * executing the callback on this cpu.
+ */
+
+ if (!cpumask_test_cpu(cpu, data->cpumask))
+ continue;
+
+ smp_rmb();
+
+ if (atomic_read(&data->refs) == 0)
+ continue;
+
if (!cpumask_test_and_clear_cpu(cpu, data->cpumask))
continue;

@@ -442,11 +460,21 @@

data = &__get_cpu_var(cfd_data);
csd_lock(&data->csd);
+ BUG_ON(atomic_read(&data->refs) || !cpumask_empty(data->cpumask));

data->csd.func = func;
data->csd.info = info;
cpumask_and(data->cpumask, mask, cpu_online_mask);
cpumask_clear_cpu(this_cpu, data->cpumask);
+
+ /*
+ * To ensure the interrupt handler gets an complete view
+ * we order the cpumask and refs writes and order the read
+ * of them in the interrupt handler. In addition we may
+ * only clear our own cpu bit from the mask.
+ */
+ smp_wmb();
+
atomic_set(&data->refs, cpumask_weight(data->cpumask));

raw_spin_lock_irqsave(&call_function.lock, flags);

2011-03-30 21:56:13

by Michael Tokarev

[permalink] [raw]
Subject: Re: [PATCH] [232/275] nfsd: wrong index used in inner loop

31.03.2011 01:07, Andi Kleen wrote:
> 2.6.35-longterm review patch. If anyone has any objections, please let me know.
>
> ------------------
> From: Mi Jinlong <[email protected]>
>
> commit 5a02ab7c3c4580f94d13c683721039855b67cda6 upstream.
>
> We must not use dummy for index.
> After the first index, READ32(dummy) will change dummy!!!!

This is also in patch 180/275 (this one is 232/275).

/mjt

2011-03-30 21:56:42

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [79/275] drm/radeon/kms: add quirk for Mac Radeon HD 2600 card

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Alex Deucher <[email protected]>

commit f598aa7593427ffe3a61e7767c34bd695a5e7ed0 upstream.

Reported-by: 屋国遥 <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/gpu/drm/radeon/radeon_atombios.c | 11 +++++++++++
1 file changed, 11 insertions(+)

Index: linux-2.6.35.y/drivers/gpu/drm/radeon/radeon_atombios.c
===================================================================
--- linux-2.6.35.y.orig/drivers/gpu/drm/radeon/radeon_atombios.c 2011-03-29 22:51:38.578736036 -0700
+++ linux-2.6.35.y/drivers/gpu/drm/radeon/radeon_atombios.c 2011-03-29 23:55:09.579222069 -0700
@@ -289,6 +289,17 @@
*line_mux = 0x90;
}

+ /* mac rv630 */
+ if ((dev->pdev->device == 0x9588) &&
+ (dev->pdev->subsystem_vendor == 0x106b) &&
+ (dev->pdev->subsystem_device == 0x00a6)) {
+ if ((supported_device == ATOM_DEVICE_TV1_SUPPORT) &&
+ (*connector_type == DRM_MODE_CONNECTOR_DVII)) {
+ *connector_type = DRM_MODE_CONNECTOR_9PinDIN;
+ *line_mux = CONNECTOR_7PIN_DIN_ENUM_ID1;
+ }
+ }
+
/* ASUS HD 3600 XT board lists the DVI port as HDMI */
if ((dev->pdev->device == 0x9598) &&
(dev->pdev->subsystem_vendor == 0x1043) &&

2011-03-30 21:56:55

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [77/275] dm: dont take i_mutex to change device size

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Mike Snitzer <[email protected]>

commit c217649bf2d60ac119afd71d938278cffd55962b upstream.

No longer needlessly hold md->bdev->bd_inode->i_mutex when changing the
size of a DM device. This additional locking is unnecessary because
i_size_write() is already protected by the existing critical section in
dm_swap_table(). DM already has a reference on md->bdev so the
associated bd_inode may be changed without lifetime concerns.

A negative side-effect of having held md->bdev->bd_inode->i_mutex was
that a concurrent DM device resize and flush (via fsync) would deadlock.
Dropping md->bdev->bd_inode->i_mutex eliminates this potential for
deadlock. The following reproducer no longer deadlocks:
https://www.redhat.com/archives/dm-devel/2009-July/msg00284.html

Signed-off-by: Mike Snitzer <[email protected]>
Signed-off-by: Mikulas Patocka <[email protected]>
Signed-off-by: Alasdair G Kergon <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/md/dm.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

Index: linux-2.6.35.y/drivers/md/dm.c
===================================================================
--- linux-2.6.35.y.orig/drivers/md/dm.c 2011-03-29 22:51:39.284717971 -0700
+++ linux-2.6.35.y/drivers/md/dm.c 2011-03-29 23:02:59.762306252 -0700
@@ -2040,13 +2040,14 @@
wake_up(&md->eventq);
}

+/*
+ * Protected by md->suspend_lock obtained by dm_swap_table().
+ */
static void __set_size(struct mapped_device *md, sector_t size)
{
set_capacity(md->disk, size);

- mutex_lock(&md->bdev->bd_inode->i_mutex);
i_size_write(md->bdev->bd_inode, (loff_t)size << SECTOR_SHIFT);
- mutex_unlock(&md->bdev->bd_inode->i_mutex);
}

/*

2011-03-30 21:57:20

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [73/275] tpm_tis: Use timeouts returned from TPM

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Stefan Berger <[email protected]>

commit 9b29050f8f75916f974a2d231ae5d3cd59792296 upstream.

The current TPM TIS driver in git discards the timeout values returned
from the TPM. The check of the response packet needs to consider that
the return_code field is 0 on success and the size of the expected
packet is equivalent to the header size + u32 length indicator for the
TPM_GetCapability() result + 3 timeout indicators of type u32.

I am also adding a sysfs entry 'timeouts' showing the timeouts that are
being used.

Signed-off-by: Stefan Berger <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Tested-by: Guillaume Chazarain <[email protected]>
Signed-off-by: Rajiv Andrade <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
drivers/char/tpm/tpm.c | 18 ++++++++++++++++--
drivers/char/tpm/tpm.h | 2 ++
drivers/char/tpm/tpm_tis.c | 4 +++-
3 files changed, 21 insertions(+), 3 deletions(-)

Index: linux-2.6.35.y/drivers/char/tpm/tpm.c
===================================================================
--- linux-2.6.35.y.orig/drivers/char/tpm/tpm.c 2011-03-29 23:02:59.667308683 -0700
+++ linux-2.6.35.y/drivers/char/tpm/tpm.c 2011-03-29 23:02:59.685308223 -0700
@@ -567,9 +567,11 @@
if (rc)
return;

- if (be32_to_cpu(tpm_cmd.header.out.return_code)
- != 3 * sizeof(u32))
+ if (be32_to_cpu(tpm_cmd.header.out.return_code) != 0 ||
+ be32_to_cpu(tpm_cmd.header.out.length)
+ != sizeof(tpm_cmd.header.out) + sizeof(u32) + 3 * sizeof(u32))
return;
+
duration_cap = &tpm_cmd.params.getcap_out.cap.duration;
chip->vendor.duration[TPM_SHORT] =
usecs_to_jiffies(be32_to_cpu(duration_cap->tpm_short));
@@ -913,6 +915,18 @@
}
EXPORT_SYMBOL_GPL(tpm_show_caps_1_2);

+ssize_t tpm_show_timeouts(struct device *dev, struct device_attribute *attr,
+ char *buf)
+{
+ struct tpm_chip *chip = dev_get_drvdata(dev);
+
+ return sprintf(buf, "%d %d %d\n",
+ jiffies_to_usecs(chip->vendor.duration[TPM_SHORT]),
+ jiffies_to_usecs(chip->vendor.duration[TPM_MEDIUM]),
+ jiffies_to_usecs(chip->vendor.duration[TPM_LONG]));
+}
+EXPORT_SYMBOL_GPL(tpm_show_timeouts);
+
ssize_t tpm_store_cancel(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
Index: linux-2.6.35.y/drivers/char/tpm/tpm.h
===================================================================
--- linux-2.6.35.y.orig/drivers/char/tpm/tpm.h 2011-03-29 22:51:40.876677237 -0700
+++ linux-2.6.35.y/drivers/char/tpm/tpm.h 2011-03-29 23:02:59.685308223 -0700
@@ -56,6 +56,8 @@
char *);
extern ssize_t tpm_show_temp_deactivated(struct device *,
struct device_attribute *attr, char *);
+extern ssize_t tpm_show_timeouts(struct device *,
+ struct device_attribute *attr, char *);

struct tpm_chip;

Index: linux-2.6.35.y/drivers/char/tpm/tpm_tis.c
===================================================================
--- linux-2.6.35.y.orig/drivers/char/tpm/tpm_tis.c 2011-03-29 22:51:40.877677211 -0700
+++ linux-2.6.35.y/drivers/char/tpm/tpm_tis.c 2011-03-29 23:02:59.686308198 -0700
@@ -355,6 +355,7 @@
NULL);
static DEVICE_ATTR(caps, S_IRUGO, tpm_show_caps_1_2, NULL);
static DEVICE_ATTR(cancel, S_IWUSR | S_IWGRP, NULL, tpm_store_cancel);
+static DEVICE_ATTR(timeouts, S_IRUGO, tpm_show_timeouts, NULL);

static struct attribute *tis_attrs[] = {
&dev_attr_pubek.attr,
@@ -364,7 +365,8 @@
&dev_attr_owned.attr,
&dev_attr_temp_deactivated.attr,
&dev_attr_caps.attr,
- &dev_attr_cancel.attr, NULL,
+ &dev_attr_cancel.attr,
+ &dev_attr_timeouts.attr, NULL,
};

static struct attribute_group tis_attr_grp = {

2011-03-30 21:57:17

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [76/275] ieee80211: correct IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK macro

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Amitkumar Karwar <[email protected]>

commit 8d661f1e462d50bd83de87ee628aaf820ce3c66c upstream.

It is defined in include/linux/ieee80211.h. As per IEEE spec.
bit6 to bit15 in block ack parameter represents buffer size.
So the bitmask should be 0xFFC0.

Signed-off-by: Amitkumar Karwar <[email protected]>
Signed-off-by: Bing Zhao <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Reviewed-by: Johannes Berg <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
include/linux/ieee80211.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.35.y/include/linux/ieee80211.h
===================================================================
--- linux-2.6.35.y.orig/include/linux/ieee80211.h 2011-03-29 22:51:39.677707916 -0700
+++ linux-2.6.35.y/include/linux/ieee80211.h 2011-03-29 23:02:59.744306713 -0700
@@ -959,7 +959,7 @@
/* block-ack parameters */
#define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002
#define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C
-#define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFA0
+#define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFC0
#define IEEE80211_DELBA_PARAM_TID_MASK 0xF000
#define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800

2011-03-30 21:57:47

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [72/275] TPM: Long default timeout fix

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Rajiv Andrade <[email protected]>

commit c4ff4b829ef9e6353c0b133b7adb564a68054979 upstream.

If duration variable value is 0 at this point, it's because
chip->vendor.duration wasn't filled by tpm_get_timeouts() yet.
This patch sets then the lowest timeout just to give enough
time for tpm_get_timeouts() to further succeed.

This fix avoids long boot times in case another entity attempts
to send commands to the TPM when the TPM isn't accessible.

Signed-off-by: Rajiv Andrade <[email protected]>
Signed-off-by: James Morris <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/char/tpm/tpm.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

Index: linux-2.6.35.y/drivers/char/tpm/tpm.c
===================================================================
--- linux-2.6.35.y.orig/drivers/char/tpm/tpm.c 2011-03-29 22:51:41.259667437 -0700
+++ linux-2.6.35.y/drivers/char/tpm/tpm.c 2011-03-29 23:55:12.337151500 -0700
@@ -354,12 +354,14 @@
tpm_protected_ordinal_duration[ordinal &
TPM_PROTECTED_ORDINAL_MASK];

- if (duration_idx != TPM_UNDEFINED)
+ if (duration_idx != TPM_UNDEFINED) {
duration = chip->vendor.duration[duration_idx];
- if (duration <= 0)
+ /* if duration is 0, it's because chip->vendor.duration wasn't */
+ /* filled yet, so we set the lowest timeout just to give enough */
+ /* time for tpm_get_timeouts() to succeed */
+ return (duration <= 0 ? HZ : duration);
+ } else
return 2 * 60 * HZ;
- else
- return duration;
}
EXPORT_SYMBOL_GPL(tpm_calc_ordinal_duration);

2011-03-30 21:06:51

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [64/275] drivers: update to pl2303 usb-serial to support Motorola cables

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Dario Lombardo <[email protected]>

commit 96a3e79edff6f41b0f115a82f1a39d66218077a7 upstream.

Added 0x0307 device id to support Motorola cables to the pl2303 usb
serial driver. This cable has a modified chip that is a pl2303, but
declares itself as 0307. Fixed by adding the right device id to the
supported devices list, assigning it the code labeled
PL2303_PRODUCT_ID_MOTOROLA.

Signed-off-by: Dario Lombardo <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/usb/serial/pl2303.c | 1 +
drivers/usb/serial/pl2303.h | 1 +
2 files changed, 2 insertions(+)

Index: linux-2.6.35.y/drivers/usb/serial/pl2303.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/serial/pl2303.c 2011-03-29 23:02:58.484338952 -0700
+++ linux-2.6.35.y/drivers/usb/serial/pl2303.c 2011-03-29 23:02:59.516312546 -0700
@@ -50,6 +50,7 @@
{ USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MMX) },
{ USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_GPRS) },
{ USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_HCR331) },
+ { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MOTOROLA) },
{ USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) },
{ USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) },
{ USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) },
Index: linux-2.6.35.y/drivers/usb/serial/pl2303.h
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/serial/pl2303.h 2011-03-29 22:51:44.319589141 -0700
+++ linux-2.6.35.y/drivers/usb/serial/pl2303.h 2011-03-29 23:02:59.516312546 -0700
@@ -21,6 +21,7 @@
#define PL2303_PRODUCT_ID_MMX 0x0612
#define PL2303_PRODUCT_ID_GPRS 0x0609
#define PL2303_PRODUCT_ID_HCR331 0x331a
+#define PL2303_PRODUCT_ID_MOTOROLA 0x0307

#define ATEN_VENDOR_ID 0x0557
#define ATEN_VENDOR_ID2 0x0547

2011-03-30 21:58:04

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [71/275] pata_mpc52xx: inherit from ata_bmdma_port_ops

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Tejun Heo <[email protected]>

commit 77c5fd19075d299fe820bb59bb21b0b113676e20 upstream.

pata_mpc52xx supports BMDMA but inherits ata_sff_port_ops which
triggers BUG_ON() when a DMA command is issued. Fix it.

Signed-off-by: Tejun Heo <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Reported-by: Roman Fietze <[email protected]>
Cc: Sergei Shtylyov <[email protected]>
Signed-off-by: Jeff Garzik <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
drivers/ata/pata_mpc52xx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.35.y/drivers/ata/pata_mpc52xx.c
===================================================================
--- linux-2.6.35.y.orig/drivers/ata/pata_mpc52xx.c 2011-03-29 22:51:41.645657560 -0700
+++ linux-2.6.35.y/drivers/ata/pata_mpc52xx.c 2011-03-29 23:02:59.649309143 -0700
@@ -610,7 +610,7 @@
};

static struct ata_port_operations mpc52xx_ata_port_ops = {
- .inherits = &ata_sff_port_ops,
+ .inherits = &ata_bmdma_port_ops,
.sff_dev_select = mpc52xx_ata_dev_select,
.set_piomode = mpc52xx_ata_set_piomode,
.set_dmamode = mpc52xx_ata_set_dmamode,

2011-03-30 21:06:49

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [65/275] klist: Fix object alignment on 64-bit.

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: David Miller <[email protected]>

commit 795abaf1e4e188c4171e3cd3dbb11a9fcacaf505 upstream.

Commit c0e69a5bbc6f ("klist.c: bit 0 in pointer can't be used as flag")
intended to make sure that all klist objects were at least pointer size
aligned, but used the constant "4" which only works on 32-bit.

Use "sizeof(void *)" which is correct in all cases.

Signed-off-by: David S. Miller <[email protected]>
Acked-by: Jesper Nilsson <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
include/linux/klist.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.35.y/include/linux/klist.h
===================================================================
--- linux-2.6.35.y.orig/include/linux/klist.h 2011-03-29 22:51:43.946598685 -0700
+++ linux-2.6.35.y/include/linux/klist.h 2011-03-29 23:02:59.534312087 -0700
@@ -22,7 +22,7 @@
struct list_head k_list;
void (*get)(struct klist_node *);
void (*put)(struct klist_node *);
-} __attribute__ ((aligned (4)));
+} __attribute__ ((aligned (sizeof(void *))));

#define KLIST_INIT(_name, _get, _put) \
{ .k_lock = __SPIN_LOCK_UNLOCKED(_name.k_lock), \

2011-03-30 21:58:27

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [70/275] md: fix regression with re-adding devices to arrays with no metadata

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: NeilBrown <[email protected]>

commit bf572541ab44240163eaa2d486b06f306a31d45a upstream.

Commit 1a855a0606 (2.6.37-rc4) fixed a problem where devices were
re-added when they shouldn't be but caused a regression in a less
common case that means sometimes devices cannot be re-added when they
should be.

In particular, when re-adding a device to an array without metadata
we should always access the device, but after the above commit we
didn't.

This patch sets the In_sync flag in that case so that the re-add
succeeds.

This patch is suitable for any -stable kernel to which 1a855a0606 was
applied.

Signed-off-by: NeilBrown <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/md/md.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

Index: linux-2.6.35.y/drivers/md/md.c
===================================================================
--- linux-2.6.35.y.orig/drivers/md/md.c 2011-03-29 22:51:42.038647504 -0700
+++ linux-2.6.35.y/drivers/md/md.c 2011-03-29 23:54:36.691063594 -0700
@@ -5109,9 +5109,10 @@
/* set saved_raid_disk if appropriate */
if (!mddev->persistent) {
if (info->state & (1<<MD_DISK_SYNC) &&
- info->raid_disk < mddev->raid_disks)
+ info->raid_disk < mddev->raid_disks) {
rdev->raid_disk = info->raid_disk;
- else
+ set_bit(In_sync, &rdev->flags);
+ } else
rdev->raid_disk = -1;
} else
super_types[mddev->major_version].

2011-03-30 21:58:48

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [67/275] parisc : Remove broken line wrapping handling pdc_iodc_print()

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Guy Martin <[email protected]>

commit fbea668498e93bb38ac9226c7af9120a25957375 upstream.

Remove the broken line wrapping handling in pdc_iodc_print().
It is broken in 3 ways :
- It doesn't keep track of the current screen position, it just
assumes that the new buffer will be printed at the begining of the
screen.
- It doesn't take in account that non printable characters won't
increase the current position on the screen.
- And last but not least, it triggers a kernel panic if a backspace
is the first char in the provided buffer :

Backtrace:
[<0000000040128ec4>] pdc_console_write+0x44/0x78
[<0000000040128f18>] pdc_console_tty_write+0x20/0x38
[<000000004032f1ac>] n_tty_write+0x2a4/0x550
[<000000004032b158>] tty_write+0x1e0/0x2d8
[<00000000401bb420>] vfs_write+0xb8/0x188
[<00000000401bb630>] sys_write+0x68/0xb8
[<0000000040104eb8>] syscall_exit+0x0/0x14

Most terminals handle the line wrapping just fine. I've confirmed that
it works correctly on a C8000 with both vga and serial output.

Signed-off-by: Guy Martin <[email protected]>
Signed-off-by: James Bottomley <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
arch/parisc/kernel/firmware.c | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)

Index: linux-2.6.35.y/arch/parisc/kernel/firmware.c
===================================================================
--- linux-2.6.35.y.orig/arch/parisc/kernel/firmware.c 2011-03-29 22:51:43.187618105 -0700
+++ linux-2.6.35.y/arch/parisc/kernel/firmware.c 2011-03-29 23:02:59.573311089 -0700
@@ -1126,15 +1126,13 @@
unsigned int i;
unsigned long flags;

- for (i = 0; i < count && i < 79;) {
+ for (i = 0; i < count;) {
switch(str[i]) {
case '\n':
iodc_dbuf[i+0] = '\r';
iodc_dbuf[i+1] = '\n';
i += 2;
goto print;
- case '\b': /* BS */
- i--; /* overwrite last */
default:
iodc_dbuf[i] = str[i];
i++;
@@ -1142,15 +1140,6 @@
}
}

- /* if we're at the end of line, and not already inserting a newline,
- * insert one anyway. iodc console doesn't claim to support >79 char
- * lines. don't account for this in the return value.
- */
- if (i == 79 && iodc_dbuf[i-1] != '\n') {
- iodc_dbuf[i+0] = '\r';
- iodc_dbuf[i+1] = '\n';
- }
-
print:
spin_lock_irqsave(&pdc_lock, flags);
real32_call(PAGE0->mem_cons.iodc_io,

2011-03-30 21:58:50

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [66/275] powerpc: Fix some 6xx/7xxx CPU setup functions

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Benjamin Herrenschmidt <[email protected]>

commit 1f1936ff3febf38d582177ea319eaa278f32c91f upstream.

Some of those functions try to adjust the CPU features, for example
to remove NAP support on some revisions. However, they seem to use
r5 as an index into the CPU table entry, which might have been right
a long time ago but no longer is. r4 is the right register to use.

This probably caused some off behaviours on some PowerMac variants
using 750cx or 7455 processor revisions.

Signed-off-by: Benjamin Herrenschmidt <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
arch/powerpc/kernel/cpu_setup_6xx.S | 40 ++++++++++++++++++------------------
1 file changed, 20 insertions(+), 20 deletions(-)

Index: linux-2.6.35.y/arch/powerpc/kernel/cpu_setup_6xx.S
===================================================================
--- linux-2.6.35.y.orig/arch/powerpc/kernel/cpu_setup_6xx.S 2011-03-29 22:51:43.567608382 -0700
+++ linux-2.6.35.y/arch/powerpc/kernel/cpu_setup_6xx.S 2011-03-29 23:02:59.554311574 -0700
@@ -18,7 +18,7 @@
#include <asm/mmu.h>

_GLOBAL(__setup_cpu_603)
- mflr r4
+ mflr r5
BEGIN_MMU_FTR_SECTION
li r10,0
mtspr SPRN_SPRG_603_LRU,r10 /* init SW LRU tracking */
@@ -27,60 +27,60 @@
bl __init_fpu_registers
END_FTR_SECTION_IFCLR(CPU_FTR_FPU_UNAVAILABLE)
bl setup_common_caches
- mtlr r4
+ mtlr r5
blr
_GLOBAL(__setup_cpu_604)
- mflr r4
+ mflr r5
bl setup_common_caches
bl setup_604_hid0
- mtlr r4
+ mtlr r5
blr
_GLOBAL(__setup_cpu_750)
- mflr r4
+ mflr r5
bl __init_fpu_registers
bl setup_common_caches
bl setup_750_7400_hid0
- mtlr r4
+ mtlr r5
blr
_GLOBAL(__setup_cpu_750cx)
- mflr r4
+ mflr r5
bl __init_fpu_registers
bl setup_common_caches
bl setup_750_7400_hid0
bl setup_750cx
- mtlr r4
+ mtlr r5
blr
_GLOBAL(__setup_cpu_750fx)
- mflr r4
+ mflr r5
bl __init_fpu_registers
bl setup_common_caches
bl setup_750_7400_hid0
bl setup_750fx
- mtlr r4
+ mtlr r5
blr
_GLOBAL(__setup_cpu_7400)
- mflr r4
+ mflr r5
bl __init_fpu_registers
bl setup_7400_workarounds
bl setup_common_caches
bl setup_750_7400_hid0
- mtlr r4
+ mtlr r5
blr
_GLOBAL(__setup_cpu_7410)
- mflr r4
+ mflr r5
bl __init_fpu_registers
bl setup_7410_workarounds
bl setup_common_caches
bl setup_750_7400_hid0
li r3,0
mtspr SPRN_L2CR2,r3
- mtlr r4
+ mtlr r5
blr
_GLOBAL(__setup_cpu_745x)
- mflr r4
+ mflr r5
bl setup_common_caches
bl setup_745x_specifics
- mtlr r4
+ mtlr r5
blr

/* Enable caches for 603's, 604, 750 & 7400 */
@@ -194,10 +194,10 @@
cror 4*cr0+eq,4*cr0+eq,4*cr1+eq
cror 4*cr0+eq,4*cr0+eq,4*cr2+eq
bnelr
- lwz r6,CPU_SPEC_FEATURES(r5)
+ lwz r6,CPU_SPEC_FEATURES(r4)
li r7,CPU_FTR_CAN_NAP
andc r6,r6,r7
- stw r6,CPU_SPEC_FEATURES(r5)
+ stw r6,CPU_SPEC_FEATURES(r4)
blr

/* 750fx specific
@@ -225,12 +225,12 @@
andis. r11,r11,L3CR_L3E@h
beq 1f
END_FTR_SECTION_IFSET(CPU_FTR_L3CR)
- lwz r6,CPU_SPEC_FEATURES(r5)
+ lwz r6,CPU_SPEC_FEATURES(r4)
andi. r0,r6,CPU_FTR_L3_DISABLE_NAP
beq 1f
li r7,CPU_FTR_CAN_NAP
andc r6,r6,r7
- stw r6,CPU_SPEC_FEATURES(r5)
+ stw r6,CPU_SPEC_FEATURES(r4)
1:
mfspr r11,SPRN_HID0

2011-03-30 21:59:21

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [63/275] fix jiffy calculations in calibrate_delay_direct to handle overflow

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Tim Deegan <[email protected]>

commit 70a062286b9dfcbd24d2e11601aecfead5cf709a upstream.

Fixes a hang when booting as dom0 under Xen, when jiffies can be
quite large by the time the kernel init gets this far.

Signed-off-by: Tim Deegan <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
[[email protected]: !time_after() -> time_before_eq() as suggested by Jiri Slaby]
Signed-off-by: Jan Beulich <[email protected]>
Cc: Jiri Slaby <[email protected]>
Cc: Jeremy Fitzhardinge <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
init/calibrate.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

Index: linux-2.6.35.y/init/calibrate.c
===================================================================
--- linux-2.6.35.y.orig/init/calibrate.c 2011-03-29 22:51:44.697579468 -0700
+++ linux-2.6.35.y/init/calibrate.c 2011-03-29 23:02:59.497313032 -0700
@@ -66,7 +66,7 @@
pre_start = 0;
read_current_timer(&start);
start_jiffies = jiffies;
- while (jiffies <= (start_jiffies + 1)) {
+ while (time_before_eq(jiffies, start_jiffies + 1)) {
pre_start = start;
read_current_timer(&start);
}
@@ -74,8 +74,8 @@

pre_end = 0;
end = post_start;
- while (jiffies <=
- (start_jiffies + 1 + DELAY_CALIBRATION_TICKS)) {
+ while (time_before_eq(jiffies, start_jiffies + 1 +
+ DELAY_CALIBRATION_TICKS)) {
pre_end = end;
read_current_timer(&end);
}

2011-03-30 21:59:37

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [61/275] ptrace: use safer wake up on ptrace_detach()

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Tejun Heo <[email protected]>

commit 01e05e9a90b8f4c3997ae0537e87720eb475e532 upstream.

The wake_up_process() call in ptrace_detach() is spurious and not
interlocked with the tracee state. IOW, the tracee could be running or
sleeping in any place in the kernel by the time wake_up_process() is
called. This can lead to the tracee waking up unexpectedly which can be
dangerous.

The wake_up is spurious and should be removed but for now reduce its
toxicity by only waking up if the tracee is in TRACED or STOPPED state.

This bug can possibly be used as an attack vector. I don't think it
will take too much effort to come up with an attack which triggers oops
somewhere. Most sleeps are wrapped in condition test loops and should
be safe but we have quite a number of places where sleep and wakeup
conditions are expected to be interlocked. Although the window of
opportunity is tiny, ptrace can be used by non-privileged users and with
some loading the window can definitely be extended and exploited.

Signed-off-by: Tejun Heo <[email protected]>
Acked-by: Roland McGrath <[email protected]>
Acked-by: Oleg Nesterov <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
kernel/ptrace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.35.y/kernel/ptrace.c
===================================================================
--- linux-2.6.35.y.orig/kernel/ptrace.c 2011-03-29 22:51:45.449560230 -0700
+++ linux-2.6.35.y/kernel/ptrace.c 2011-03-29 23:02:59.433314670 -0700
@@ -313,7 +313,7 @@
child->exit_code = data;
dead = __ptrace_detach(current, child);
if (!child->exit_state)
- wake_up_process(child);
+ wake_up_state(child, TASK_TRACED | TASK_STOPPED);
}
write_unlock_irq(&tasklist_lock);

2011-03-30 21:06:36

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [53/275] iwlagn: Re-enable RF_KILL interrupt when down

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Don Fry <[email protected]>

commit 3dd823e6b86407aed1a025041d8f1df77e43a9c8 upstream.

With commit 554d1d027b19265c4aa3f718b3126d2b86e09a08 only one RF_KILL
interrupt will be seen by the driver when the interface is down.

Re-enable the interrupt when it occurs to see all transitions.

Signed-off-by: Don Fry <[email protected]>
Signed-off-by: Wey-Yi Guy <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/net/wireless/iwlwifi/iwl-agn.c | 6 ++++++
1 file changed, 6 insertions(+)

Index: linux-2.6.35.y/drivers/net/wireless/iwlwifi/iwl-agn.c
===================================================================
--- linux-2.6.35.y.orig/drivers/net/wireless/iwlwifi/iwl-agn.c 2011-03-29 23:02:58.917327873 -0700
+++ linux-2.6.35.y/drivers/net/wireless/iwlwifi/iwl-agn.c 2011-03-29 23:02:59.268318892 -0700
@@ -1205,6 +1205,9 @@
/* only Re-enable if diabled by irq */
if (test_bit(STATUS_INT_ENABLED, &priv->status))
iwl_enable_interrupts(priv);
+ /* Re-enable RF_KILL if it occurred */
+ else if (handled & CSR_INT_BIT_RF_KILL)
+ iwl_enable_rfkill_int(priv);

#ifdef CONFIG_IWLWIFI_DEBUG
if (iwl_get_debug_level(priv) & (IWL_DL_ISR)) {
@@ -1420,6 +1423,9 @@
/* only Re-enable if diabled by irq */
if (test_bit(STATUS_INT_ENABLED, &priv->status))
iwl_enable_interrupts(priv);
+ /* Re-enable RF_KILL if it occurred */
+ else if (handled & CSR_INT_BIT_RF_KILL)
+ iwl_enable_rfkill_int(priv);
}

/* the threshold ratio of actual_ack_cnt to expected_ack_cnt in percent */

2011-03-30 22:00:06

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [57/275] ds2760_battery: Fix calculation of time_to_empty_now

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Sven Neumann <[email protected]>

commit 86af95039b69a90db15294eb1f9c147f1df0a8ea upstream.

A check against division by zero was modified in commit b0525b48.
Since this change time_to_empty_now is always reported as zero
while the battery is discharging and as a negative value while
the battery is charging. This is because current is negative while
the battery is discharging.

Fix the check introduced by commit b0525b48 so that time_to_empty_now
is reported correctly during discharge and as zero while charging.

Signed-off-by: Sven Neumann <[email protected]>
Acked-by: Daniel Mack <[email protected]>
Signed-off-by: Anton Vorontsov <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/power/ds2760_battery.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.35.y/drivers/power/ds2760_battery.c
===================================================================
--- linux-2.6.35.y.orig/drivers/power/ds2760_battery.c 2011-03-29 22:51:46.955521695 -0700
+++ linux-2.6.35.y/drivers/power/ds2760_battery.c 2011-03-29 23:02:59.340317050 -0700
@@ -212,7 +212,7 @@
if (di->rem_capacity > 100)
di->rem_capacity = 100;

- if (di->current_uA >= 100L)
+ if (di->current_uA < -100L)
di->life_sec = -((di->accum_current_uAh - di->empty_uAh) * 36L)
/ (di->current_uA / 100L);
else

2011-03-30 21:06:34

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [48/275] ALSA: hrtimer: handle delayed timer interrupts

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Clemens Ladisch <[email protected]>

commit b1d4f7f4bdcf9915c41ff8cfc4425c84dabb1fde upstream.

If a timer interrupt was delayed too much, hrtimer_forward_now() will
forward the timer expiry more than once. When this happens, the
additional number of elapsed ALSA timer ticks must be passed to
snd_timer_interrupt() to prevent the ALSA timer from falling behind.

This mostly fixes MIDI slowdown problems on highly-loaded systems with
badly behaved interrupt handlers.

Signed-off-by: Clemens Ladisch <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Reported-and-tested-by: Arthur Marsh <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
sound/core/hrtimer.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

Index: linux-2.6.35.y/sound/core/hrtimer.c
===================================================================
--- linux-2.6.35.y.orig/sound/core/hrtimer.c 2011-03-29 22:51:50.260437129 -0700
+++ linux-2.6.35.y/sound/core/hrtimer.c 2011-03-29 23:02:59.176321246 -0700
@@ -45,12 +45,13 @@
{
struct snd_hrtimer *stime = container_of(hrt, struct snd_hrtimer, hrt);
struct snd_timer *t = stime->timer;
+ unsigned long oruns;

if (!atomic_read(&stime->running))
return HRTIMER_NORESTART;

- hrtimer_forward_now(hrt, ns_to_ktime(t->sticks * resolution));
- snd_timer_interrupt(stime->timer, t->sticks);
+ oruns = hrtimer_forward_now(hrt, ns_to_ktime(t->sticks * resolution));
+ snd_timer_interrupt(stime->timer, t->sticks * oruns);

if (!atomic_read(&stime->running))
return HRTIMER_NORESTART;

2011-03-30 22:00:42

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [56/275] virtio: remove virtio-pci root device

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Milton Miller <[email protected]>

commit 8b3bb3ecf1934ac4a7005ad9017de1127e2fbd2f upstream.

We sometimes need to map between the virtio device and
the given pci device. One such use is OS installer that
gets the boot pci device from BIOS and needs to
find the relevant block device. Since it can't,
installation fails.

Instead of creating a top-level devices/virtio-pci
directory, create each device under the corresponding
pci device node. Symlinks to all virtio-pci
devices can be found under the pci driver link in
bus/pci/drivers/virtio-pci/devices, and all virtio
devices under drivers/bus/virtio/devices.

Signed-off-by: Milton Miller <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
Acked-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Tested-by: Michael S. Tsirkin <[email protected]>
Acked-by: Gleb Natapov <[email protected]>
Tested-by: "Daniel P. Berrange" <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
drivers/virtio/virtio_pci.c | 20 ++------------------
1 file changed, 2 insertions(+), 18 deletions(-)

Index: linux-2.6.35.y/drivers/virtio/virtio_pci.c
===================================================================
--- linux-2.6.35.y.orig/drivers/virtio/virtio_pci.c 2011-03-29 22:51:47.321512330 -0700
+++ linux-2.6.35.y/drivers/virtio/virtio_pci.c 2011-03-29 23:02:59.322317511 -0700
@@ -96,11 +96,6 @@

MODULE_DEVICE_TABLE(pci, virtio_pci_id_table);

-/* A PCI device has it's own struct device and so does a virtio device so
- * we create a place for the virtio devices to show up in sysfs. I think it
- * would make more sense for virtio to not insist on having it's own device. */
-static struct device *virtio_pci_root;
-
/* Convert a generic virtio device to our structure */
static struct virtio_pci_device *to_vp_device(struct virtio_device *vdev)
{
@@ -629,7 +624,7 @@
if (vp_dev == NULL)
return -ENOMEM;

- vp_dev->vdev.dev.parent = virtio_pci_root;
+ vp_dev->vdev.dev.parent = &pci_dev->dev;
vp_dev->vdev.dev.release = virtio_pci_release_dev;
vp_dev->vdev.config = &virtio_pci_config_ops;
vp_dev->pci_dev = pci_dev;
@@ -717,17 +712,7 @@

static int __init virtio_pci_init(void)
{
- int err;
-
- virtio_pci_root = root_device_register("virtio-pci");
- if (IS_ERR(virtio_pci_root))
- return PTR_ERR(virtio_pci_root);
-
- err = pci_register_driver(&virtio_pci_driver);
- if (err)
- root_device_unregister(virtio_pci_root);
-
- return err;
+ return pci_register_driver(&virtio_pci_driver);
}

module_init(virtio_pci_init);
@@ -735,7 +720,6 @@
static void __exit virtio_pci_exit(void)
{
pci_unregister_driver(&virtio_pci_driver);
- root_device_unregister(virtio_pci_root);
}

module_exit(virtio_pci_exit);

2011-03-30 22:01:06

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [54/275] rapidio: fix hang on RapidIO doorbell queue full condition

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Thomas Taranowski <[email protected]>

commit 12a4dc43911785f51a596f771ae0701b18d436f1 upstream.

In fsl_rio_dbell_handler() the code currently simply acknowledges the QFI
queue full interrupt, but does nothing to resolve the queue full
condition. Instead, it jumps to the end of the isr. When a queue full
condition occurs, the isr is then re-entered immediately and continually,
forever.

The fix is to just fall through and read out current doorbell entries.

Signed-off-by: Thomas Taranowski <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Cc: Alexandre Bounine <[email protected]>
Cc: Kumar Gala <[email protected]>
Cc: Matt Porter <[email protected]>
Cc: Li Yang <[email protected]>
Cc: Thomas Moll <[email protected]>
Cc: Micha Nelissen <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Cc: Grant Likely <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
arch/powerpc/sysdev/fsl_rio.c | 1 -
1 file changed, 1 deletion(-)

Index: linux-2.6.35.y/arch/powerpc/sysdev/fsl_rio.c
===================================================================
--- linux-2.6.35.y.orig/arch/powerpc/sysdev/fsl_rio.c 2011-03-29 22:51:48.062493371 -0700
+++ linux-2.6.35.y/arch/powerpc/sysdev/fsl_rio.c 2011-03-29 23:02:59.287318406 -0700
@@ -952,7 +952,6 @@
if (dsr & DOORBELL_DSR_QFI) {
pr_info("RIO: doorbell queue full\n");
out_be32(&priv->msg_regs->dsr, DOORBELL_DSR_QFI);
- goto out;
}

/* XXX Need to check/dispatch until queue empty */

2011-03-30 21:06:32

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [43/275] em28xx: Fix audio input for Terratec Grabby

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Mauro Carvalho Chehab <[email protected]>

commit a3fa904ec79b94f0db7faed010ff94d42f7d1d47 upstream.

The audio input line was wrong. Fix it.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/media/video/em28xx/em28xx-cards.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6.35.y/drivers/media/video/em28xx/em28xx-cards.c
===================================================================
--- linux-2.6.35.y.orig/drivers/media/video/em28xx/em28xx-cards.c 2011-03-29 22:51:52.060391073 -0700
+++ linux-2.6.35.y/drivers/media/video/em28xx/em28xx-cards.c 2011-03-29 23:02:59.085323575 -0700
@@ -1605,11 +1605,11 @@
.input = { {
.type = EM28XX_VMUX_COMPOSITE1,
.vmux = SAA7115_COMPOSITE0,
- .amux = EM28XX_AMUX_VIDEO2,
+ .amux = EM28XX_AMUX_LINE_IN,
}, {
.type = EM28XX_VMUX_SVIDEO,
.vmux = SAA7115_SVIDEO3,
- .amux = EM28XX_AMUX_VIDEO2,
+ .amux = EM28XX_AMUX_LINE_IN,
} },
},
[EM2860_BOARD_TERRATEC_AV350] = {

2011-03-30 22:01:30

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [52/275] rtc-cmos: fix suspend/resume

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Paul Fox <[email protected]>

commit 2fb08e6ca9f00d1aedb3964983e9c8f84b36b807 upstream.

rtc-cmos was setting suspend/resume hooks at the device_driver level.
However, the platform bus code (drivers/base/platform.c) only looks for
resume hooks at the dev_pm_ops level, or within the platform_driver.

Switch rtc_cmos to use dev_pm_ops so that suspend/resume code is executed
again.

Paul said:

: The user visible symptom in our (XO laptop) case was that rtcwake would
: fail to wake the laptop. The RTC alarm would expire, but the wakeup
: wasn't unmasked.
:
: As for severity, the impact may have been reduced because if I recall
: correctly, the bug only affected platforms with CONFIG_PNP disabled.

Signed-off-by: Paul Fox <[email protected]>
Signed-off-by: Daniel Drake <[email protected]>
Acked-by: Rafael J. Wysocki <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/rtc/rtc-cmos.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)

Index: linux-2.6.35.y/drivers/rtc/rtc-cmos.c
===================================================================
--- linux-2.6.35.y.orig/drivers/rtc/rtc-cmos.c 2011-03-29 22:51:48.793474666 -0700
+++ linux-2.6.35.y/drivers/rtc/rtc-cmos.c 2011-03-29 23:02:59.249319378 -0700
@@ -36,6 +36,7 @@
#include <linux/platform_device.h>
#include <linux/mod_devicetable.h>
#include <linux/log2.h>
+#include <linux/pm.h>

/* this is for "generic access to PC-style RTC" using CMOS_READ/CMOS_WRITE */
#include <asm-generic/rtc.h>
@@ -850,7 +851,7 @@

#ifdef CONFIG_PM

-static int cmos_suspend(struct device *dev, pm_message_t mesg)
+static int cmos_suspend(struct device *dev)
{
struct cmos_rtc *cmos = dev_get_drvdata(dev);
unsigned char tmp;
@@ -898,7 +899,7 @@
*/
static inline int cmos_poweroff(struct device *dev)
{
- return cmos_suspend(dev, PMSG_HIBERNATE);
+ return cmos_suspend(dev);
}

static int cmos_resume(struct device *dev)
@@ -945,9 +946,9 @@
return 0;
}

+static SIMPLE_DEV_PM_OPS(cmos_pm_ops, cmos_suspend, cmos_resume);
+
#else
-#define cmos_suspend NULL
-#define cmos_resume NULL

static inline int cmos_poweroff(struct device *dev)
{
@@ -1083,7 +1084,7 @@

static int cmos_pnp_suspend(struct pnp_dev *pnp, pm_message_t mesg)
{
- return cmos_suspend(&pnp->dev, mesg);
+ return cmos_suspend(&pnp->dev);
}

static int cmos_pnp_resume(struct pnp_dev *pnp)
@@ -1163,8 +1164,9 @@
.shutdown = cmos_platform_shutdown,
.driver = {
.name = (char *) driver_name,
- .suspend = cmos_suspend,
- .resume = cmos_resume,
+#ifdef CONFIG_PM
+ .pm = &cmos_pm_ops,
+#endif
}
};

2011-03-30 22:01:43

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [51/275] NFS: Fix "kernel BUG at fs/aio.c:554!"

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Chuck Lever <[email protected]>

commit 839f7ad6932d95f4d5ae7267b95c574714ff3d5b upstream.

Nick Piggin reports:

> I'm getting use after frees in aio code in NFS
>
> [ 2703.396766] Call Trace:
> [ 2703.396858] [<ffffffff8100b057>] ? native_sched_clock+0x27/0x80
> [ 2703.396959] [<ffffffff8108509e>] ? put_lock_stats+0xe/0x40
> [ 2703.397058] [<ffffffff81088348>] ? lock_release_holdtime+0xa8/0x140
> [ 2703.397159] [<ffffffff8108a2a5>] lock_acquire+0x95/0x1b0
> [ 2703.397260] [<ffffffff811627db>] ? aio_put_req+0x2b/0x60
> [ 2703.397361] [<ffffffff81039701>] ? get_parent_ip+0x11/0x50
> [ 2703.397464] [<ffffffff81612a31>] _raw_spin_lock_irq+0x41/0x80
> [ 2703.397564] [<ffffffff811627db>] ? aio_put_req+0x2b/0x60
> [ 2703.397662] [<ffffffff811627db>] aio_put_req+0x2b/0x60
> [ 2703.397761] [<ffffffff811647fe>] do_io_submit+0x2be/0x7c0
> [ 2703.397895] [<ffffffff81164d0b>] sys_io_submit+0xb/0x10
> [ 2703.397995] [<ffffffff8100307b>] system_call_fastpath+0x16/0x1b
>
> Adding some tracing, it is due to nfs completing the request then
> returning something other than -EIOCBQUEUED, so aio.c
> also completes the request.

To address this, prevent the NFS direct I/O engine from completing
async iocbs when the forward path returns an error without starting
any I/O.

This fix appears to survive ^C during both "xfstest no. 208" and "fsx
-Z."

It's likely this bug has existed for a very long while, as we are seeing
very similar symptoms in OEL 5. Copying stable.

Signed-off-by: Chuck Lever <[email protected]>
Signed-off-by: Trond Myklebust <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
fs/nfs/direct.c | 34 ++++++++++++++++++++--------------
1 file changed, 20 insertions(+), 14 deletions(-)

Index: linux-2.6.35.y/fs/nfs/direct.c
===================================================================
--- linux-2.6.35.y.orig/fs/nfs/direct.c 2011-03-29 22:51:49.201464226 -0700
+++ linux-2.6.35.y/fs/nfs/direct.c 2011-03-29 23:02:59.231319840 -0700
@@ -402,15 +402,18 @@
pos += vec->iov_len;
}

+ /*
+ * If no bytes were started, return the error, and let the
+ * generic layer handle the completion.
+ */
+ if (requested_bytes == 0) {
+ nfs_direct_req_release(dreq);
+ return result < 0 ? result : -EIO;
+ }
+
if (put_dreq(dreq))
nfs_direct_complete(dreq);
-
- if (requested_bytes != 0)
- return 0;
-
- if (result < 0)
- return result;
- return -EIO;
+ return 0;
}

static ssize_t nfs_direct_read(struct kiocb *iocb, const struct iovec *iov,
@@ -830,15 +833,18 @@
pos += vec->iov_len;
}

+ /*
+ * If no bytes were started, return the error, and let the
+ * generic layer handle the completion.
+ */
+ if (requested_bytes == 0) {
+ nfs_direct_req_release(dreq);
+ return result < 0 ? result : -EIO;
+ }
+
if (put_dreq(dreq))
nfs_direct_write_complete(dreq, dreq->inode);
-
- if (requested_bytes != 0)
- return 0;
-
- if (result < 0)
- return result;
- return -EIO;
+ return 0;
}

static ssize_t nfs_direct_write(struct kiocb *iocb, const struct iovec *iov,

2011-03-30 21:06:29

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [44/275] ALSA : au88x0 - Limit number of channels to fix Oops via OSS emu

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Raymond Yau <[email protected]>

commit d9ab344336f74c012f6643ed3d1ad8ca0136de3b upstream.

Fix playback/capture channels patch to change supported playback
channels of au8830 to 1,2,4 and capture channels to 1,2.
This prevent oops when oss emulation use SNDCTL_DSP_CHANNELS to
set 3 Channels

Signed-off-by: Raymond Yau <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
sound/pci/au88x0/au88x0_pcm.c | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)

Index: linux-2.6.35.y/sound/pci/au88x0/au88x0_pcm.c
===================================================================
--- linux-2.6.35.y.orig/sound/pci/au88x0/au88x0_pcm.c 2011-03-29 22:51:51.705400156 -0700
+++ linux-2.6.35.y/sound/pci/au88x0/au88x0_pcm.c 2011-03-29 23:02:59.103323115 -0700
@@ -42,11 +42,7 @@
.rate_min = 5000,
.rate_max = 48000,
.channels_min = 1,
-#ifdef CHIP_AU8830
- .channels_max = 4,
-#else
.channels_max = 2,
-#endif
.buffer_bytes_max = 0x10000,
.period_bytes_min = 0x1,
.period_bytes_max = 0x1000,
@@ -115,6 +111,17 @@
.periods_max = 64,
};
#endif
+#ifdef CHIP_AU8830
+static unsigned int au8830_channels[3] = {
+ 1, 2, 4,
+};
+
+static struct snd_pcm_hw_constraint_list hw_constraints_au8830_channels = {
+ .count = ARRAY_SIZE(au8830_channels),
+ .list = au8830_channels,
+ .mask = 0,
+};
+#endif
/* open callback */
static int snd_vortex_pcm_open(struct snd_pcm_substream *substream)
{
@@ -156,6 +163,15 @@
if (VORTEX_PCM_TYPE(substream->pcm) == VORTEX_PCM_ADB
|| VORTEX_PCM_TYPE(substream->pcm) == VORTEX_PCM_I2S)
runtime->hw = snd_vortex_playback_hw_adb;
+#ifdef CHIP_AU8830
+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
+ VORTEX_PCM_TYPE(substream->pcm) == VORTEX_PCM_ADB) {
+ runtime->hw.channels_max = 4;
+ snd_pcm_hw_constraint_list(runtime, 0,
+ SNDRV_PCM_HW_PARAM_CHANNELS,
+ &hw_constraints_au8830_channels);
+ }
+#endif
substream->runtime->private_data = NULL;
}
#ifndef CHIP_AU8810

2011-03-30 22:03:37

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [50/275] ASoC: Blackfin AC97: fix build error after multi-component update

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Mike Frysinger <[email protected]>

commit e9c2048915048d605fd76539ddd96f00d593e1eb upstream.

We need to tweak how we query the active capture/playback state after
the recent overhauls of common code.

Signed-off-by: Mike Frysinger <[email protected]>
Acked-by: Liam Girdwood <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
sound/soc/blackfin/bf5xx-ac97.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6.35.y/sound/soc/blackfin/bf5xx-ac97.c
===================================================================
--- linux-2.6.35.y.orig/sound/soc/blackfin/bf5xx-ac97.c 2011-03-29 22:51:49.530455809 -0700
+++ linux-2.6.35.y/sound/soc/blackfin/bf5xx-ac97.c 2011-03-29 23:02:59.213320299 -0700
@@ -261,9 +261,9 @@
pr_debug("%s : sport %d\n", __func__, dai->id);
if (!dai->active)
return 0;
- if (dai->capture.active)
+ if (dai->capture_active)
sport_rx_stop(sport);
- if (dai->playback.active)
+ if (dai->playback_active)
sport_tx_stop(sport);
return 0;
}

2011-03-30 22:04:22

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [47/275] input: bcm5974: Add support for MacBookAir3

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Edgar (gimli) Hucek <[email protected]>

commit 6021afcf19d8c6f5db6d11cadcfb6a22d0c28a48 upstream.

This patch adds support for the MacBookAir3,1 and MacBookAir3,2
models.

[[email protected]: touchpad range calibration]
Signed-off-by: Edgar (gimli) Hucek <[email protected]>
Signed-off-by: Henrik Rydberg <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/input/mouse/bcm5974.c | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)

Index: linux-2.6.35.y/drivers/input/mouse/bcm5974.c
===================================================================
--- linux-2.6.35.y.orig/drivers/input/mouse/bcm5974.c 2011-03-29 22:51:50.618427970 -0700
+++ linux-2.6.35.y/drivers/input/mouse/bcm5974.c 2011-03-29 23:02:59.158321707 -0700
@@ -55,6 +55,14 @@
#define USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI 0x0236
#define USB_DEVICE_ID_APPLE_WELLSPRING3_ISO 0x0237
#define USB_DEVICE_ID_APPLE_WELLSPRING3_JIS 0x0238
+/* MacbookAir3,2 (unibody), aka wellspring5 */
+#define USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI 0x023f
+#define USB_DEVICE_ID_APPLE_WELLSPRING4_ISO 0x0240
+#define USB_DEVICE_ID_APPLE_WELLSPRING4_JIS 0x0241
+/* MacbookAir3,1 (unibody), aka wellspring4 */
+#define USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI 0x0242
+#define USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO 0x0243
+#define USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS 0x0244

#define BCM5974_DEVICE(prod) { \
.match_flags = (USB_DEVICE_ID_MATCH_DEVICE | \
@@ -80,6 +88,14 @@
BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI),
BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING3_ISO),
BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING3_JIS),
+ /* MacbookAir3,2 */
+ BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI),
+ BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING4_ISO),
+ BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING4_JIS),
+ /* MacbookAir3,1 */
+ BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI),
+ BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO),
+ BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS),
/* Terminating entry */
{}
};
@@ -234,6 +250,30 @@
{ DIM_X, DIM_X / SN_COORD, -4460, 5166 },
{ DIM_Y, DIM_Y / SN_COORD, -75, 6700 }
},
+ {
+ USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI,
+ USB_DEVICE_ID_APPLE_WELLSPRING4_ISO,
+ USB_DEVICE_ID_APPLE_WELLSPRING4_JIS,
+ HAS_INTEGRATED_BUTTON,
+ 0x84, sizeof(struct bt_data),
+ 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS,
+ { DIM_PRESSURE, DIM_PRESSURE / SN_PRESSURE, 0, 300 },
+ { DIM_WIDTH, DIM_WIDTH / SN_WIDTH, 0, 2048 },
+ { DIM_X, DIM_X / SN_COORD, -4620, 5140 },
+ { DIM_Y, DIM_Y / SN_COORD, -150, 6600 }
+ },
+ {
+ USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI,
+ USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO,
+ USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS,
+ HAS_INTEGRATED_BUTTON,
+ 0x84, sizeof(struct bt_data),
+ 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS,
+ { DIM_PRESSURE, DIM_PRESSURE / SN_PRESSURE, 0, 300 },
+ { DIM_WIDTH, DIM_WIDTH / SN_WIDTH, 0, 2048 },
+ { DIM_X, DIM_X / SN_COORD, -4616, 5112 },
+ { DIM_Y, DIM_Y / SN_COORD, -142, 5234 }
+ },
{}
};

2011-03-30 22:04:20

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [49/275] ASoC: WM8990: msleep() takes milliseconds not jiffies

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Dimitris Papastamos <[email protected]>

commit 7ebcf5d6021a696680ee77d9162a2edec2d671dd upstream.

Signed-off-by: Dimitris Papastamos <[email protected]>
Acked-by: Liam Girdwood <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
sound/soc/codecs/wm8990.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

Index: linux-2.6.35.y/sound/soc/codecs/wm8990.c
===================================================================
--- linux-2.6.35.y.orig/sound/soc/codecs/wm8990.c 2011-03-29 22:51:49.895446469 -0700
+++ linux-2.6.35.y/sound/soc/codecs/wm8990.c 2011-03-29 23:02:59.194320786 -0700
@@ -1185,7 +1185,7 @@
WM8990_VMIDTOG);

/* Delay to allow output caps to discharge */
- msleep(msecs_to_jiffies(300));
+ msleep(300);

/* Disable VMIDTOG */
snd_soc_write(codec, WM8990_ANTIPOP2, WM8990_SOFTST |
@@ -1197,17 +1197,17 @@
/* Enable outputs */
snd_soc_write(codec, WM8990_POWER_MANAGEMENT_1, 0x1b00);

- msleep(msecs_to_jiffies(50));
+ msleep(50);

/* Enable VMID at 2x50k */
snd_soc_write(codec, WM8990_POWER_MANAGEMENT_1, 0x1f02);

- msleep(msecs_to_jiffies(100));
+ msleep(100);

/* Enable VREF */
snd_soc_write(codec, WM8990_POWER_MANAGEMENT_1, 0x1f03);

- msleep(msecs_to_jiffies(600));
+ msleep(600);

/* Enable BUFIOEN */
snd_soc_write(codec, WM8990_ANTIPOP2, WM8990_SOFTST |
@@ -1252,7 +1252,7 @@
/* Disable VMID */
snd_soc_write(codec, WM8990_POWER_MANAGEMENT_1, 0x1f01);

- msleep(msecs_to_jiffies(300));
+ msleep(300);

/* Enable all output discharge bits */
snd_soc_write(codec, WM8990_ANTIPOP1, WM8990_DIS_LLINE |

2011-03-30 22:04:45

by Michael Tokarev

[permalink] [raw]
Subject: Re: [PATCH] [232/275] nfsd: wrong index used in inner loop

31.03.2011 01:56, Michael Tokarev пишет:
> 31.03.2011 01:07, Andi Kleen wrote:
>> 2.6.35-longterm review patch. If anyone has any objections, please let me know.
>>
>> ------------------
>> From: Mi Jinlong <[email protected]>
>>
>> commit 5a02ab7c3c4580f94d13c683721039855b67cda6 upstream.
>>
>> We must not use dummy for index.
>> After the first index, READ32(dummy) will change dummy!!!!
>
> This is also in patch 180/275 (this one is 232/275).

Doh, so this 232/275 basically reverts that 180 and makes
other change down the line, but keeps the subject intact.
Especially useful that the two patches are so far away
from each other (more than 50 patches in-between).
Confusing :)

So both are actually needed, apparently.

Thanks!

/mjt

2011-03-30 21:06:27

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [45/275] ALSA: HDA: Fix dmesg output of HDMI supported bits

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: David Henningsson <[email protected]>

commit d757534ed15387202e322854cd72dc58bbb975de upstream.

This typo caused the dmesg output of the supported bits of HDMI
to be cut off early.

Signed-off-by: David Henningsson <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
sound/pci/hda/hda_eld.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.35.y/sound/pci/hda/hda_eld.c
===================================================================
--- linux-2.6.35.y.orig/sound/pci/hda/hda_eld.c 2011-03-29 22:51:51.337409574 -0700
+++ linux-2.6.35.y/sound/pci/hda/hda_eld.c 2011-03-29 23:02:59.121322653 -0700
@@ -381,7 +381,7 @@
snd_print_pcm_rates(a->rates, buf, sizeof(buf));

if (a->format == AUDIO_CODING_TYPE_LPCM)
- snd_print_pcm_bits(a->sample_bits, buf2 + 8, sizeof(buf2 - 8));
+ snd_print_pcm_bits(a->sample_bits, buf2 + 8, sizeof(buf2) - 8);
else if (a->max_bitrate)
snprintf(buf2, sizeof(buf2),
", max bitrate = %d", a->max_bitrate);

2011-03-30 22:05:21

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [38/275] libsas: fix runaway error handler problem

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: James Bottomley <[email protected]>

commit 9ee91f7fb550a4c82f82d9818e42493484c754af upstream.

libsas makes use of scsi_schedule_eh() but forgets to clear the
host_eh_scheduled flag in its error handling routine. Because of this,
the error handler thread never gets to sleep; it's constantly awake and
trying to run the error routine leading to console spew and inability to
run anything else (at least on a UP system). The fix is to clear the
flag as we splice the work queue.

Signed-off-by: James Bottomley <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/scsi/libsas/sas_scsi_host.c | 1 +
1 file changed, 1 insertion(+)

Index: linux-2.6.35.y/drivers/scsi/libsas/sas_scsi_host.c
===================================================================
--- linux-2.6.35.y.orig/drivers/scsi/libsas/sas_scsi_host.c 2011-03-29 22:51:53.815346169 -0700
+++ linux-2.6.35.y/drivers/scsi/libsas/sas_scsi_host.c 2011-03-29 23:02:58.973326440 -0700
@@ -649,6 +649,7 @@

spin_lock_irqsave(shost->host_lock, flags);
list_splice_init(&shost->eh_cmd_q, &eh_work_q);
+ shost->host_eh_scheduled = 0;
spin_unlock_irqrestore(shost->host_lock, flags);

SAS_DPRINTK("Enter %s\n", __func__);

2011-03-30 22:05:18

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [41/275] mpt2sas: Kernel Panic during Large Topology discovery

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Kashyap, Desai <[email protected]>

commit 4224489f45b503f0a1f1cf310f76dc108f45689a upstream.

There was a configuration page timing out during the initial port
enable at driver load time. The port enable would fail, and this would
result in the driver unloading itself, meanwhile the driver was accessing
freed memory in another context resulting in the panic. The fix is to
prevent access to freed memory once the driver had issued the diag reset
which woke up the sleeping port enable process. The routine
_base_reset_handler was reorganized so the last sleeping process woken up was
the port_enable.

Signed-off-by: Kashyap Desai <[email protected]>
Signed-off-by: James Bottomley <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/scsi/mpt2sas/mpt2sas_base.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)

Index: linux-2.6.35.y/drivers/scsi/mpt2sas/mpt2sas_base.c
===================================================================
--- linux-2.6.35.y.orig/drivers/scsi/mpt2sas/mpt2sas_base.c 2011-03-29 23:02:59.029325007 -0700
+++ linux-2.6.35.y/drivers/scsi/mpt2sas/mpt2sas_base.c 2011-03-29 23:02:59.049324495 -0700
@@ -3736,6 +3736,8 @@
static void
_base_reset_handler(struct MPT2SAS_ADAPTER *ioc, int reset_phase)
{
+ mpt2sas_scsih_reset_handler(ioc, reset_phase);
+ mpt2sas_ctl_reset_handler(ioc, reset_phase);
switch (reset_phase) {
case MPT2_IOC_PRE_RESET:
dtmprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s: "
@@ -3766,8 +3768,6 @@
"MPT2_IOC_DONE_RESET\n", ioc->name, __func__));
break;
}
- mpt2sas_scsih_reset_handler(ioc, reset_phase);
- mpt2sas_ctl_reset_handler(ioc, reset_phase);
}

/**
@@ -3821,6 +3821,7 @@
{
int r;
unsigned long flags;
+ u8 pe_complete = ioc->wait_for_port_enable_to_complete;

dtmprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s: enter\n", ioc->name,
__func__));
@@ -3845,6 +3846,14 @@
if (r)
goto out;
_base_reset_handler(ioc, MPT2_IOC_AFTER_RESET);
+
+ /* If this hard reset is called while port enable is active, then
+ * there is no reason to call make_ioc_operational
+ */
+ if (pe_complete) {
+ r = -EFAULT;
+ goto out;
+ }
r = _base_make_ioc_operational(ioc, sleep_flag);
if (!r)
_base_reset_handler(ioc, MPT2_IOC_DONE_RESET);

2011-03-30 22:05:16

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [42/275] radio-aimslab.c: Fix gcc 4.5+ bug

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Mauro Carvalho Chehab <[email protected]>

commit e3c92215198cb6aa00ad38db2780faa6b72e0a3f upstream.

gcc 4.5+ doesn't properly evaluate some inlined expressions.
A previous patch were proposed by Andrew Morton using noinline.
However, the entire inlined function is bogus, so let's just
remove it and be happy.

Reported-by: Andrew Morton <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/media/radio/radio-aimslab.c | 23 ++++++-----------------
1 file changed, 6 insertions(+), 17 deletions(-)

Index: linux-2.6.35.y/drivers/media/radio/radio-aimslab.c
===================================================================
--- linux-2.6.35.y.orig/drivers/media/radio/radio-aimslab.c 2011-03-29 22:51:52.415381990 -0700
+++ linux-2.6.35.y/drivers/media/radio/radio-aimslab.c 2011-03-29 23:54:46.149821568 -0700
@@ -31,7 +31,6 @@
#include <linux/module.h> /* Modules */
#include <linux/init.h> /* Initdata */
#include <linux/ioport.h> /* request_region */
-#include <linux/delay.h> /* udelay */
#include <linux/videodev2.h> /* kernel radio structs */
#include <linux/version.h> /* for KERNEL_VERSION MACRO */
#include <linux/io.h> /* outb, outb_p */
@@ -71,27 +70,17 @@

/* local things */

-static void sleep_delay(long n)
-{
- /* Sleep nicely for 'n' uS */
- int d = n / msecs_to_jiffies(1000);
- if (!d)
- udelay(n);
- else
- msleep(jiffies_to_msecs(d));
-}
-
static void rt_decvol(struct rtrack *rt)
{
outb(0x58, rt->io); /* volume down + sigstr + on */
- sleep_delay(100000);
+ msleep(100);
outb(0xd8, rt->io); /* volume steady + sigstr + on */
}

static void rt_incvol(struct rtrack *rt)
{
outb(0x98, rt->io); /* volume up + sigstr + on */
- sleep_delay(100000);
+ msleep(100);
outb(0xd8, rt->io); /* volume steady + sigstr + on */
}

@@ -120,7 +109,7 @@

if (vol == 0) { /* volume = 0 means mute the card */
outb(0x48, rt->io); /* volume down but still "on" */
- sleep_delay(2000000); /* make sure it's totally down */
+ msleep(2000); /* make sure it's totally down */
outb(0xd0, rt->io); /* volume steady, off */
rt->curvol = 0; /* track the volume state! */
mutex_unlock(&rt->lock);
@@ -155,7 +144,7 @@
outb_p(128+64+16+8+ 1, rt->io); /* on + wr-enable + data low */
outb_p(128+64+16+8+2+1, rt->io); /* clock */
}
- sleep_delay(1000);
+ msleep(1);
}

static void send_1_byte(struct rtrack *rt)
@@ -169,7 +158,7 @@
outb_p(128+64+16+8+4+2+1, rt->io); /* clock */
}

- sleep_delay(1000);
+ msleep(1);
}

static int rt_setfreq(struct rtrack *rt, unsigned long freq)
@@ -427,7 +416,7 @@

/* this ensures that the volume is all the way down */
outb(0x48, rt->io); /* volume down but still "on" */
- sleep_delay(2000000); /* make sure it's totally down */
+ msleep(2000); /* make sure it's totally down */
outb(0xc0, rt->io); /* steady volume, mute card */

return 0;

2011-03-30 22:05:14

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [46/275] ALSA: hda - Fix memory leaks in conexant jack arrays

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Takashi Iwai <[email protected]>

commit 70f7db11c45a313b23922cacf248c613c3b2144c upstream.

The Conexant codec driver adds the jack arrays in init callback which
may be called also in each PM resume. This results in the addition of
new jack element at each time.

The fix is to check whether the requested jack is already present in
the array.

Reference: Novell bug 668929
https://bugzilla.novell.com/show_bug.cgi?id=668929

Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
sound/pci/hda/patch_conexant.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

Index: linux-2.6.35.y/sound/pci/hda/patch_conexant.c
===================================================================
--- linux-2.6.35.y.orig/sound/pci/hda/patch_conexant.c 2011-03-29 22:51:50.977418784 -0700
+++ linux-2.6.35.y/sound/pci/hda/patch_conexant.c 2011-03-29 23:02:59.140322167 -0700
@@ -391,10 +391,16 @@
struct conexant_spec *spec;
struct conexant_jack *jack;
const char *name;
- int err;
+ int i, err;

spec = codec->spec;
snd_array_init(&spec->jacks, sizeof(*jack), 32);
+
+ jack = spec->jacks.list;
+ for (i = 0; i < spec->jacks.used; i++, jack++)
+ if (jack->nid == nid)
+ return 0 ; /* already present */
+
jack = snd_array_new(&spec->jacks);
name = (type == SND_JACK_HEADPHONE) ? "Headphone" : "Mic" ;

2011-03-30 22:06:26

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [37/275] fix medium error problems with some arrays which can cause data corruption

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: James Bottomley <[email protected]>

commit a8733c7baf457b071528e385a0b7d4aaec79287c upstream.

Our current handling of medium error assumes that data is returned up
to the bad sector. This assumption holds good for all disk devices,
all DIF arrays and most ordinary arrays. However, an LSI array engine
was recently discovered which reports a medium error without returning
any data. This means that when we report good data up to the medium
error, we've reported junk originally in the buffer as good. Worse,
if the read consists of requested data plus a readahead, and the error
occurs in readahead, we'll just strip off the readahead and report
junk up to userspace as good data with no error.

The fix for this is to have the error position computation take into
account the amount of data returned by the driver using the scsi
residual data. Unfortunately, not every driver fills in this data,
but for those who don't, it's set to zero, which means we'll think a
full set of data was transferred and the behaviour will be identical
to the prior behaviour of the code (believe the buffer up to the error
sector). All modern drivers seem to set the residual, so that should
fix up the LSI failure/corruption case.

Reported-by: Douglas Gilbert <[email protected]>
Signed-off-by: James Bottomley <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/scsi/sd.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

Index: linux-2.6.35.y/drivers/scsi/sd.c
===================================================================
--- linux-2.6.35.y.orig/drivers/scsi/sd.c 2011-03-29 22:51:54.208336113 -0700
+++ linux-2.6.35.y/drivers/scsi/sd.c 2011-03-29 23:02:58.955326901 -0700
@@ -1111,6 +1111,12 @@
u64 end_lba = blk_rq_pos(scmd->request) + (scsi_bufflen(scmd) / 512);
u64 bad_lba;
int info_valid;
+ /*
+ * resid is optional but mostly filled in. When it's unused,
+ * its value is zero, so we assume the whole buffer transferred
+ */
+ unsigned int transferred = scsi_bufflen(scmd) - scsi_get_resid(scmd);
+ unsigned int good_bytes;

if (!blk_fs_request(scmd->request))
return 0;
@@ -1144,7 +1150,8 @@
/* This computation should always be done in terms of
* the resolution of the device's medium.
*/
- return (bad_lba - start_lba) * scmd->device->sector_size;
+ good_bytes = (bad_lba - start_lba) * scmd->device->sector_size;
+ return min(good_bytes, transferred);
}

/**

2011-03-30 22:06:23

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [36/275] ath9k: Fix bug in delimiter padding computation

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Vasanthakumar Thiagarajan <[email protected]>

commit 39ec2997c374b528cdbf65099b6d6b8593a67f7f upstream.

There is a roundng error in delimiter padding computation
which causes severe throughput drop with some of AR9003.

signed-off-by: Felix Fietkau <[email protected]>
Signed-off-by: Vasanthakumar Thiagarajan <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/net/wireless/ath/ath9k/ath9k.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6.35.y/drivers/net/wireless/ath/ath9k/ath9k.h
===================================================================
--- linux-2.6.35.y.orig/drivers/net/wireless/ath/ath9k/ath9k.h 2011-03-29 22:51:54.545327490 -0700
+++ linux-2.6.35.y/drivers/net/wireless/ath/ath9k/ath9k.h 2011-03-29 23:02:58.936327387 -0700
@@ -174,8 +174,8 @@

/* returns delimiter padding required given the packet length */
#define ATH_AGGR_GET_NDELIM(_len) \
- (((((_len) + ATH_AGGR_DELIM_SZ) < ATH_AGGR_MINPLEN) ? \
- (ATH_AGGR_MINPLEN - (_len) - ATH_AGGR_DELIM_SZ) : 0) >> 2)
+ (((_len) >= ATH_AGGR_MINPLEN) ? 0 : \
+ DIV_ROUND_UP(ATH_AGGR_MINPLEN - (_len), ATH_AGGR_DELIM_SZ))

#define BAW_WITHIN(_start, _bawsz, _seqno) \
((((_seqno) - (_start)) & 4095) < (_bawsz))

2011-03-30 22:06:21

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [40/275] mpt2sas: Correct resizing calculation for max_queue_depth

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Kashyap, Desai <[email protected]>

commit 11e1b961ab067ee3acaf723531da4d3f23e1d6f7 upstream.

The ioc->hba_queue_depth is not properly resized when the controller
firmware reports that it supports more outstanding IO than what can be fit
inside the reply descriptor pool depth. This is reproduced by setting the
controller global credits larger than 30,000. The bug results in an
incorrect sizing of the queues. The fix is to resize the queue_size by
dividing queue_diff by two.

Signed-off-by: Kashyap Desai <[email protected]>
Signed-off-by: James Bottomley <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/scsi/mpt2sas/mpt2sas_base.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

Index: linux-2.6.35.y/drivers/scsi/mpt2sas/mpt2sas_base.c
===================================================================
--- linux-2.6.35.y.orig/drivers/scsi/mpt2sas/mpt2sas_base.c 2011-03-29 22:51:53.119363977 -0700
+++ linux-2.6.35.y/drivers/scsi/mpt2sas/mpt2sas_base.c 2011-03-29 23:55:24.206847783 -0700
@@ -2050,9 +2050,9 @@
/* adjust hba_queue_depth, reply_free_queue_depth,
* and queue_size
*/
- ioc->hba_queue_depth -= queue_diff;
- ioc->reply_free_queue_depth -= queue_diff;
- queue_size -= queue_diff;
+ ioc->hba_queue_depth -= (queue_diff / 2);
+ ioc->reply_free_queue_depth -= (queue_diff / 2);
+ queue_size = facts->MaxReplyDescriptorPostQueueDepth;
}
ioc->reply_post_queue_depth = queue_size;

2011-03-30 22:06:57

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [28/275] USB: cdc-acm: Adding second ACM channel support for Nokia N8

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Arvid Ephraim Picciani <[email protected]>

commit 721d92fc6373dee15846216f9d178ec240ec0fd7 upstream.

This adds the N8 to the list of devices in cdc-acm, in order to get the
secondary ACM device exposed.

In the spirit of:
http://kerneltrap.org/mailarchive/linux-usb/2010/9/4/6264554

Signed-off-by: Arvid Ephraim Picciani <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/usb/class/cdc-acm.c | 1 +
1 file changed, 1 insertion(+)

Index: linux-2.6.35.y/drivers/usb/class/cdc-acm.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/class/cdc-acm.c 2011-03-29 22:51:57.312256691 -0700
+++ linux-2.6.35.y/drivers/usb/class/cdc-acm.c 2011-03-29 23:53:55.425119487 -0700
@@ -1613,6 +1613,7 @@
{ NOKIA_PCSUITE_ACM_INFO(0x0154), }, /* Nokia 5800 XpressMusic */
{ NOKIA_PCSUITE_ACM_INFO(0x04ce), }, /* Nokia E90 */
{ NOKIA_PCSUITE_ACM_INFO(0x01d4), }, /* Nokia E55 */
+ { NOKIA_PCSUITE_ACM_INFO(0x0302), }, /* Nokia N8 */
{ SAMSUNG_PCSUITE_ACM_INFO(0x6651), }, /* Samsung GTi8510 (INNOV8) */

/* NOTE: non-Nokia COMM/ACM/0xff is likely MSFT RNDIS... NOT a modem! */

2011-03-30 22:07:16

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [39/275] mpt2sas: Fix device removal handshake for zoned devices

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Kashyap, Desai <[email protected]>

commit 4dc2757a2e9a9d1f2faee4fc6119276fc0061c16 upstream.

When zoning end devices, the driver is not sending device
removal handshake alogrithm to firmware. This results in controller
firmware not sending sas topology add events the next time the device is
added. The fix is the driver should be doing the device removal handshake
even though the PHYSTATUS_VACANT bit is set in the PhyStatus of the
event data. The current design is avoiding the handshake when the
VACANT bit is set in the phy status.

Signed-off-by: Kashyap Desai <[email protected]>
Signed-off-by: James Bottomley <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/scsi/mpt2sas/mpt2sas_scsih.c | 3 ---
1 file changed, 3 deletions(-)

Index: linux-2.6.35.y/drivers/scsi/mpt2sas/mpt2sas_scsih.c
===================================================================
--- linux-2.6.35.y.orig/drivers/scsi/mpt2sas/mpt2sas_scsih.c 2011-03-29 22:51:53.469355022 -0700
+++ linux-2.6.35.y/drivers/scsi/mpt2sas/mpt2sas_scsih.c 2011-03-29 23:02:59.011325469 -0700
@@ -2759,9 +2759,6 @@
u16 handle;

for (i = 0 ; i < event_data->NumEntries; i++) {
- if (event_data->PHY[i].PhyStatus &
- MPI2_EVENT_SAS_TOPO_PHYSTATUS_VACANT)
- continue;
handle = le16_to_cpu(event_data->PHY[i].AttachedDevHandle);
if (!handle)
continue;

2011-03-30 21:06:17

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [31/275] staging: comedi: add support for newer jr3 1-channel pci board

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Ruben Smits <[email protected]>

commit 6292817d58637f85dd623cfe563c7f5ec4f4c470 upstream.

add DEVICE_ID to table

Signed-off-by: Ruben Smits <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/staging/comedi/drivers/jr3_pci.c | 7 +++++++
1 file changed, 7 insertions(+)

Index: linux-2.6.35.y/drivers/staging/comedi/drivers/jr3_pci.c
===================================================================
--- linux-2.6.35.y.orig/drivers/staging/comedi/drivers/jr3_pci.c 2011-03-29 22:51:56.279283123 -0700
+++ linux-2.6.35.y/drivers/staging/comedi/drivers/jr3_pci.c 2011-03-29 23:02:58.842329792 -0700
@@ -53,6 +53,7 @@

#define PCI_VENDOR_ID_JR3 0x1762
#define PCI_DEVICE_ID_JR3_1_CHANNEL 0x3111
+#define PCI_DEVICE_ID_JR3_1_CHANNEL_NEW 0x1111
#define PCI_DEVICE_ID_JR3_2_CHANNEL 0x3112
#define PCI_DEVICE_ID_JR3_3_CHANNEL 0x3113
#define PCI_DEVICE_ID_JR3_4_CHANNEL 0x3114
@@ -72,6 +73,8 @@
{
PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_1_CHANNEL,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {
+ PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_1_CHANNEL_NEW,
+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {
PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_2_CHANNEL,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {
PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_3_CHANNEL,
@@ -808,6 +811,10 @@
devpriv->n_channels = 1;
}
break;
+ case PCI_DEVICE_ID_JR3_1_CHANNEL_NEW:{
+ devpriv->n_channels = 1;
+ }
+ break;
case PCI_DEVICE_ID_JR3_2_CHANNEL:{
devpriv->n_channels = 2;
}

2011-03-30 21:06:15

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [30/275] USB: prevent buggy hubs from crashing the USB stack

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Alan Stern <[email protected]>

commit d199c96d41d80a567493e12b8e96ea056a1350c1 upstream.

If anyone comes across a high-speed hub that (by mistake or by design)
claims to have no Transaction Translators, plugging a full- or
low-speed device into it will cause the USB stack to crash. This
patch (as1446) prevents the problem by ignoring such devices, since
the kernel has no way to communicate with them.

Signed-off-by: Alan Stern <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Tested-by: Perry Neben <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
drivers/usb/core/hub.c | 5 +++++
1 file changed, 5 insertions(+)

Index: linux-2.6.35.y/drivers/usb/core/hub.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/core/hub.c 2011-03-29 22:51:56.618274449 -0700
+++ linux-2.6.35.y/drivers/usb/core/hub.c 2011-03-29 23:55:06.774293840 -0700
@@ -2721,6 +2721,11 @@
udev->ttport = hdev->ttport;
} else if (udev->speed != USB_SPEED_HIGH
&& hdev->speed == USB_SPEED_HIGH) {
+ if (!hub->tt.hub) {
+ dev_err(&udev->dev, "parent hub has no TT\n");
+ retval = -EINVAL;
+ goto fail;
+ }
udev->tt = &hub->tt;
udev->ttport = port1;
}

2011-03-30 22:07:50

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [23/275] USB: g_printer: fix bug in module parameter definitions

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Alan Stern <[email protected]>

commit ad84e4a9efb7c8ed322bafb6ebdb9c3a49a3d3a8 upstream.

This patch (as1442) fixes a bug in g_printer: Module parameters should
not be marked "__initdata" if they are accessible in sysfs (i.e., if
the mode value in the module_param() macro is nonzero). Otherwise
attempts to access the parameters will cause addressing violations.

Character-string module parameters must not be marked "__initdata"
if the module can be unloaded, because the kernel needs to access the
parameter variable at unload time in order to free the
dynamically-allocated string.

Signed-off-by: Alan Stern <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
CC: Roland Kletzing <[email protected]>
CC: Craig W. Nadler <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
drivers/usb/gadget/printer.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

Index: linux-2.6.35.y/drivers/usb/gadget/printer.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/gadget/printer.c 2011-03-29 22:51:58.997213578 -0700
+++ linux-2.6.35.y/drivers/usb/gadget/printer.c 2011-03-29 23:02:58.690333681 -0700
@@ -130,31 +130,31 @@
* parameters are in UTF-8 (superset of ASCII's 7 bit characters).
*/

-static ushort __initdata idVendor;
+static ushort idVendor;
module_param(idVendor, ushort, S_IRUGO);
MODULE_PARM_DESC(idVendor, "USB Vendor ID");

-static ushort __initdata idProduct;
+static ushort idProduct;
module_param(idProduct, ushort, S_IRUGO);
MODULE_PARM_DESC(idProduct, "USB Product ID");

-static ushort __initdata bcdDevice;
+static ushort bcdDevice;
module_param(bcdDevice, ushort, S_IRUGO);
MODULE_PARM_DESC(bcdDevice, "USB Device version (BCD)");

-static char *__initdata iManufacturer;
+static char *iManufacturer;
module_param(iManufacturer, charp, S_IRUGO);
MODULE_PARM_DESC(iManufacturer, "USB Manufacturer string");

-static char *__initdata iProduct;
+static char *iProduct;
module_param(iProduct, charp, S_IRUGO);
MODULE_PARM_DESC(iProduct, "USB Product string");

-static char *__initdata iSerialNum;
+static char *iSerialNum;
module_param(iSerialNum, charp, S_IRUGO);
MODULE_PARM_DESC(iSerialNum, "1");

-static char *__initdata iPNPstring;
+static char *iPNPstring;
module_param(iPNPstring, charp, S_IRUGO);
MODULE_PARM_DESC(iPNPstring, "MFG:linux;MDL:g_printer;CLS:PRINTER;SN:1;");

2011-03-30 22:08:08

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [13/275] USB: CP210x Add two device IDs

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Craig Shelley <[email protected]>

commit faea63f7ccfddfb8fc19798799fcd38c58415172 upstream.

Device Ids added for IRZ Automation Teleport SG-10 GSM/GPRS Modem and
DekTec DTA Plus VHF/UHF Booster/Attenuator.

Signed-off-by: Craig Shelley <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/usb/serial/cp210x.c | 2 ++
1 file changed, 2 insertions(+)

Index: linux-2.6.35.y/drivers/usb/serial/cp210x.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/serial/cp210x.c 2011-03-29 23:02:58.479339081 -0700
+++ linux-2.6.35.y/drivers/usb/serial/cp210x.c 2011-03-29 23:55:33.857600845 -0700
@@ -108,7 +108,9 @@
{ USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */
{ USB_DEVICE(0x10C4, 0x8382) }, /* Cygnal Integrated Products, Inc. */
{ USB_DEVICE(0x10C4, 0x83A8) }, /* Amber Wireless AMB2560 */
+ { USB_DEVICE(0x10C4, 0x83D8) }, /* DekTec DTA Plus VHF/UHF Booster/Attenuator */
{ USB_DEVICE(0x10C4, 0x8411) }, /* Kyocera GPS Module */
+ { USB_DEVICE(0x10C4, 0x8418) }, /* IRZ Automation Teleport SG-10 GSM/GPRS Modem */
{ USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */
{ USB_DEVICE(0x10C4, 0x8477) }, /* Balluff RFID */
{ USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */

2011-03-30 22:08:06

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [15/275] USB: usb-storage: unusual_devs update for Cypress ATACB

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Richard Schütz <[email protected]>

commit cae41118f50ef0c431e13159df6d7dd8bbd54004 upstream.

New device ID added for unusual Cypress ATACB device.

Signed-off-by: Richard Schütz <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/usb/storage/unusual_cypress.h | 5 +++++
1 file changed, 5 insertions(+)

Index: linux-2.6.35.y/drivers/usb/storage/unusual_cypress.h
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/storage/unusual_cypress.h 2011-03-29 22:52:01.983137175 -0700
+++ linux-2.6.35.y/drivers/usb/storage/unusual_cypress.h 2011-03-29 23:02:58.541337493 -0700
@@ -31,4 +31,9 @@
"Cypress ISD-300LP",
US_SC_CYP_ATACB, US_PR_DEVICE, NULL, 0),

+UNUSUAL_DEV( 0x14cd, 0x6116, 0x0000, 0x9999,
+ "Super Top",
+ "USB 2.0 SATA BRIDGE",
+ US_SC_CYP_ATACB, US_PR_DEVICE, NULL, 0),
+
#endif /* defined(CONFIG_USB_STORAGE_CYPRESS_ATACB) || ... */

2011-03-30 22:08:50

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [35/275] iwlagn: enable only rfkill interrupt when device is down

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Stanislaw Gruszka <[email protected]>

commit 554d1d027b19265c4aa3f718b3126d2b86e09a08 upstream.

Since commit 6cd0b1cb872b3bf9fc5de4536404206ab74bafdd "iwlagn: fix
hw-rfkill while the interface is down", we enable interrupts when
device is not ready to receive them. However hardware, when it is in
some inconsistent state, can generate other than rfkill interrupts
and crash the system. I can reproduce crash with "kernel BUG at
drivers/net/wireless/iwlwifi/iwl-agn.c:1010!" message, when forcing
firmware restarts.

To fix only enable rfkill interrupt when down device and after probe.
I checked patch on laptop with 5100 device, rfkill change is still
passed to user space when device is down.

Signed-off-by: Stanislaw Gruszka <[email protected]>
Acked-by: Wey-Yi Guy <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/net/wireless/iwlwifi/iwl-agn.c | 9 +++++----
drivers/net/wireless/iwlwifi/iwl-helpers.h | 6 ++++++
2 files changed, 11 insertions(+), 4 deletions(-)

Index: linux-2.6.35.y/drivers/net/wireless/iwlwifi/iwl-agn.c
===================================================================
--- linux-2.6.35.y.orig/drivers/net/wireless/iwlwifi/iwl-agn.c 2011-03-29 22:51:54.909318176 -0700
+++ linux-2.6.35.y/drivers/net/wireless/iwlwifi/iwl-agn.c 2011-03-29 23:55:19.919957475 -0700
@@ -3112,9 +3112,10 @@

flush_workqueue(priv->workqueue);

- /* enable interrupts again in order to receive rfkill changes */
+ /* User space software may expect getting rfkill changes
+ * even if interface is down */
iwl_write32(priv, CSR_INT, 0xFFFFFFFF);
- iwl_enable_interrupts(priv);
+ iwl_enable_rfkill_int(priv);

IWL_DEBUG_MAC80211(priv, "leave\n");
}
@@ -3832,14 +3833,14 @@
* 8. Enable interrupts and read RFKILL state
*********************************************/

- /* enable interrupts if needed: hw bug w/a */
+ /* enable rfkill interrupt: hw bug w/a */
pci_read_config_word(priv->pci_dev, PCI_COMMAND, &pci_cmd);
if (pci_cmd & PCI_COMMAND_INTX_DISABLE) {
pci_cmd &= ~PCI_COMMAND_INTX_DISABLE;
pci_write_config_word(priv->pci_dev, PCI_COMMAND, pci_cmd);
}

- iwl_enable_interrupts(priv);
+ iwl_enable_rfkill_int(priv);

/* If platform's RF_KILL switch is NOT set to KILL */
if (iwl_read32(priv, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)
Index: linux-2.6.35.y/drivers/net/wireless/iwlwifi/iwl-helpers.h
===================================================================
--- linux-2.6.35.y.orig/drivers/net/wireless/iwlwifi/iwl-helpers.h 2011-03-29 22:51:54.908318202 -0700
+++ linux-2.6.35.y/drivers/net/wireless/iwlwifi/iwl-helpers.h 2011-03-29 23:02:58.917327873 -0700
@@ -163,6 +163,12 @@
IWL_DEBUG_ISR(priv, "Disabled interrupts\n");
}

+static inline void iwl_enable_rfkill_int(struct iwl_priv *priv)
+{
+ IWL_DEBUG_ISR(priv, "Enabling rfkill interrupt\n");
+ iwl_write32(priv, CSR_INT_MASK, CSR_INT_BIT_RF_KILL);
+}
+
static inline void iwl_enable_interrupts(struct iwl_priv *priv)
{
IWL_DEBUG_ISR(priv, "Enabling interrupts\n");

2011-03-30 21:06:11

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [25/275] USB: ti_usb: fix module removal

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Ionut Nicu <[email protected]>

commit b14de3857227cd978f515247853fd15cc2425d3e upstream.

If usb_deregister() is called after usb_serial_deregister() when
the device is plugged in, the following Oops occurs:

[ 95.337377] BUG: unable to handle kernel NULL pointer dereference at 00000010
[ 95.338236] IP: [<c0776b2d>] klist_put+0x12/0x62
[ 95.338356] *pdpt = 000000003001a001 *pde = 0000000000000000
[ 95.338356] Oops: 0000 [#1] SMP
[ 95.340499] last sysfs file: /sys/devices/pci0000:00/0000:00:1d.2/usb8/idVendor
[ 95.340499] Modules linked in: ti_usb_3410_5052(-) usbserial cpufreq_ondemand acpi_cpufreq mperf iptable_nat nf_nat iptable_mangle ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_filter ip6_tables ipv6 uinput arc4 ecb iwlagn iwlcore mac80211 cfg80211 microcode pcspkr acer_wmi joydev wmi sky2 [last unloaded: scsi_wait_scan]
[ 95.341908]
[ 95.341908] Pid: 1532, comm: modprobe Not tainted 2.6.37-rc7+ #6 Eiger /Aspire 5930
[ 95.341908] EIP: 0060:[<c0776b2d>] EFLAGS: 00010246 CPU: 0
[ 95.341908] EIP is at klist_put+0x12/0x62
[ 95.341908] EAX: 00000000 EBX: eedc0c84 ECX: c09c21b4 EDX: 00000001
[ 95.341908] ESI: 00000000 EDI: efaa0c1c EBP: f214fe2c ESP: f214fe1c
[ 95.341908] DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
[ 95.341908] Process modprobe (pid: 1532, ti=f214e000 task=efaaf080 task.ti=f214e000)
[ 95.341908] Stack:
[ 95.341908] f214fe24 eedc0c84 efaaf080 efaa0c1c f214fe34 c0776ba8 f214fe5c c0776c76
[ 95.341908] c09c21b4 c09c21b4 eedc0c84 efaaf080 00000000 c0634398 eafe2d1c f7b515f0
[ 95.341908] f214fe6c c0631b5c eafe2d50 eafe2d1c f214fe7c c0631ba2 eafe2d1c eafe2c00
[ 95.341908] Call Trace:
[ 95.341908] [<c0776ba8>] ? klist_del+0xd/0xf
[ 95.341908] [<c0776c76>] ? klist_remove+0x48/0x74
[ 95.341908] [<c0634398>] ? devres_release_all+0x49/0x51
[ 95.341908] [<c0631b5c>] ? __device_release_driver+0x7b/0xa4
[ 95.341908] [<c0631ba2>] ? device_release_driver+0x1d/0x28
[ 95.341908] [<c06317c4>] ? bus_remove_device+0x92/0xa1
[ 95.341908] [<c062f3d8>] ? device_del+0xf9/0x13e
[ 95.341908] [<f7b06146>] ? usb_serial_disconnect+0xd9/0x116 [usbserial]
[ 95.341908] [<c0681e3f>] ? usb_disable_interface+0x32/0x40
[ 95.341908] [<c0683972>] ? usb_unbind_interface+0x48/0xfd
[ 95.341908] [<c0631b43>] ? __device_release_driver+0x62/0xa4
[ 95.341908] [<c06320b9>] ? driver_detach+0x62/0x81
[ 95.341908] [<c0631a41>] ? bus_remove_driver+0x8f/0xae
[ 95.341908] [<c063214c>] ? driver_unregister+0x50/0x57
[ 95.341908] [<c0682f95>] ? usb_deregister+0x77/0x84
[ 95.341908] [<f7b505b6>] ? ti_exit+0x26/0x28 [ti_usb_3410_5052]
[ 95.341908] [<c046a307>] ? sys_delete_module+0x181/0x1de
[ 95.341908] [<c04e2727>] ? path_put+0x1a/0x1d
[ 95.341908] [<c047f4c5>] ? audit_syscall_entry+0x116/0x138
[ 95.341908] [<c04094df>] ? sysenter_do_call+0x12/0x28
[ 95.341908] Code: 00 83 7d f0 00 74 09 85 f6 74 05 89 f0 ff 55 f0 8b 43 04 5a 5b 5e 5f 5d c3 55 89 e5 57 56 53 89 c3 83 ec 04 8b 30 83 e6 fe 89 f0 <8b> 7e 10 88 55 f0 e8 47 26 01 00 8a 55 f0 84 d2 74 17 f6 03 01
[ 95.341908] EIP: [<c0776b2d>] klist_put+0x12/0x62 SS:ESP 0068:f214fe1c
[ 95.341908] CR2: 0000000000000010
[ 95.342357] ---[ end trace 8124d00ad871ad18 ]---

Signed-off-by: Ionut Nicu <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/usb/serial/ti_usb_3410_5052.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.35.y/drivers/usb/serial/ti_usb_3410_5052.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/serial/ti_usb_3410_5052.c 2011-03-29 22:51:58.334230542 -0700
+++ linux-2.6.35.y/drivers/usb/serial/ti_usb_3410_5052.c 2011-03-29 23:02:58.728332710 -0700
@@ -365,9 +365,9 @@

static void __exit ti_exit(void)
{
+ usb_deregister(&ti_usb_driver);
usb_serial_deregister(&ti_1port_device);
usb_serial_deregister(&ti_2port_device);
- usb_deregister(&ti_usb_driver);
}

2011-03-30 22:09:12

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [11/275] hwmon: (via686a) Initialize fan_div values

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Jean Delvare <[email protected]>

commit f790674d3f87df6390828ac21a7d1530f71b59c8 upstream.

Functions set_fan_min() and set_fan_div() assume that the fan_div
values have already been read from the register. The driver currently
doesn't initialize them at load time, they are only set when function
via686a_update_device() is called. This means that set_fan_min() and
set_fan_div() misbehave if, for example, "sensors -s" is called
before any monitoring application (e.g. "sensors") is has been run.

Fix the problem by always initializing the fan_div values at device
bind time.

Signed-off-by: Jean Delvare <[email protected]>
Acked-by: Guenter Roeck <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/hwmon/via686a.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)

Index: linux-2.6.35.y/drivers/hwmon/via686a.c
===================================================================
--- linux-2.6.35.y.orig/drivers/hwmon/via686a.c 2011-03-29 22:52:03.381101405 -0700
+++ linux-2.6.35.y/drivers/hwmon/via686a.c 2011-03-29 23:02:58.460339566 -0700
@@ -687,6 +687,13 @@
return 0;
}

+static void via686a_update_fan_div(struct via686a_data *data)
+{
+ int reg = via686a_read_value(data, VIA686A_REG_FANDIV);
+ data->fan_div[0] = (reg >> 4) & 0x03;
+ data->fan_div[1] = reg >> 6;
+}
+
static void __devinit via686a_init_device(struct via686a_data *data)
{
u8 reg;
@@ -700,6 +707,9 @@
via686a_write_value(data, VIA686A_REG_TEMP_MODE,
(reg & ~VIA686A_TEMP_MODE_MASK)
| VIA686A_TEMP_MODE_CONTINUOUS);
+
+ /* Pre-read fan clock divisor values */
+ via686a_update_fan_div(data);
}

static struct via686a_data *via686a_update_device(struct device *dev)
@@ -751,9 +761,7 @@
(via686a_read_value(data, VIA686A_REG_TEMP_LOW23) &
0xc0) >> 6;

- i = via686a_read_value(data, VIA686A_REG_FANDIV);
- data->fan_div[0] = (i >> 4) & 0x03;
- data->fan_div[1] = i >> 6;
+ via686a_update_fan_div(data);
data->alarms =
via686a_read_value(data,
VIA686A_REG_ALARM1) |

2011-03-30 22:09:09

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [34/275] staging: hv: Enable sending GARP packet after live migration

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Haiyang Zhang <[email protected]>

commit 7c161d0b900ea9bd9fc5ea5d3fa9916e9eb0dd88 upstream.

The hv_netvsc gets RNDIS_STATUS_MEDIA_CONNECT event after the VM
is live migrated. Adding call to netif_notify_peers() for this event
to send GARP (Gratuitous ARP) to notify network peers. Otherwise,
the VM's network connection may stop after a live migration.

This patch should also be applied to stable kernel 2.6.32 and later.

Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/staging/hv/netvsc_drv.c | 1 +
1 file changed, 1 insertion(+)

Index: linux-2.6.35.y/drivers/staging/hv/netvsc_drv.c
===================================================================
--- linux-2.6.35.y.orig/drivers/staging/hv/netvsc_drv.c 2011-03-29 22:51:55.255309324 -0700
+++ linux-2.6.35.y/drivers/staging/hv/netvsc_drv.c 2011-03-29 23:02:58.898328360 -0700
@@ -249,6 +249,7 @@
if (status == 1) {
netif_carrier_on(net);
netif_wake_queue(net);
+ netif_notify_peers(net);
} else {
netif_carrier_off(net);
netif_stop_queue(net);

2011-03-30 22:09:06

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [12/275] USB: serial: handle Data Carrier Detect changes

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Libor Pechacek <[email protected]>

commit d14fc1a74e846d7851f24fc9519fe87dc12a1231 upstream.

Alan's commit 335f8514f200e63d689113d29cb7253a5c282967 introduced
.carrier_raised function in several drivers. That also means
tty_port_block_til_ready can now suspend the process trying to open the serial
port when Carrier Detect is low and put it into tty_port.open_wait queue. We
need to wake up the process when Carrier Detect goes high and trigger TTY
hangup when CD goes low.

Some of the devices do not report modem status line changes, or at least we
don't understand the status message, so for those we remove .carrier_raised
again.

Signed-off-by: Libor Pechacek <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/usb/serial/ch341.c | 10 ++++++++++
drivers/usb/serial/cp210x.c | 11 -----------
drivers/usb/serial/digi_acceleport.c | 10 ----------
drivers/usb/serial/generic.c | 20 ++++++++++++++++++++
drivers/usb/serial/keyspan_pda.c | 17 -----------------
drivers/usb/serial/pl2303.c | 11 +++++++++++
drivers/usb/serial/spcp8x5.c | 5 ++++-
include/linux/usb/serial.h | 3 +++
8 files changed, 48 insertions(+), 39 deletions(-)

Index: linux-2.6.35.y/drivers/usb/serial/ch341.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/serial/ch341.c 2011-03-29 22:52:03.062109567 -0700
+++ linux-2.6.35.y/drivers/usb/serial/ch341.c 2011-03-29 23:54:12.689677728 -0700
@@ -486,12 +486,22 @@
if (actual_length >= 4) {
struct ch341_private *priv = usb_get_serial_port_data(port);
unsigned long flags;
+ u8 prev_line_status = priv->line_status;

spin_lock_irqsave(&priv->lock, flags);
priv->line_status = (~(data[2])) & CH341_BITS_MODEM_STAT;
if ((data[1] & CH341_MULT_STAT))
priv->multi_status_change = 1;
spin_unlock_irqrestore(&priv->lock, flags);
+
+ if ((priv->line_status ^ prev_line_status) & CH341_BIT_DCD) {
+ struct tty_struct *tty = tty_port_tty_get(&port->port);
+ if (tty)
+ usb_serial_handle_dcd_change(port, tty,
+ priv->line_status & CH341_BIT_DCD);
+ tty_kref_put(tty);
+ }
+
wake_up_interruptible(&priv->delta_msr_wait);
}

Index: linux-2.6.35.y/drivers/usb/serial/cp210x.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/serial/cp210x.c 2011-03-29 22:52:03.062109567 -0700
+++ linux-2.6.35.y/drivers/usb/serial/cp210x.c 2011-03-29 23:55:34.182592529 -0700
@@ -49,7 +49,6 @@
static void cp210x_break_ctl(struct tty_struct *, int);
static int cp210x_startup(struct usb_serial *);
static void cp210x_dtr_rts(struct usb_serial_port *p, int on);
-static int cp210x_carrier_raised(struct usb_serial_port *p);

static int debug;

@@ -165,7 +164,6 @@
.tiocmset = cp210x_tiocmset,
.attach = cp210x_startup,
.dtr_rts = cp210x_dtr_rts,
- .carrier_raised = cp210x_carrier_raised
};

/* Config request types */
@@ -764,15 +762,6 @@
return result;
}

-static int cp210x_carrier_raised(struct usb_serial_port *p)
-{
- unsigned int control;
- cp210x_get_config(p, CP210X_GET_MDMSTS, &control, 1);
- if (control & CONTROL_DCD)
- return 1;
- return 0;
-}
-
static void cp210x_break_ctl (struct tty_struct *tty, int break_state)
{
struct usb_serial_port *port = tty->driver_data;
Index: linux-2.6.35.y/drivers/usb/serial/digi_acceleport.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/serial/digi_acceleport.c 2011-03-29 22:52:03.063109542 -0700
+++ linux-2.6.35.y/drivers/usb/serial/digi_acceleport.c 2011-03-29 23:02:58.480339055 -0700
@@ -455,7 +455,6 @@
static int digi_chars_in_buffer(struct tty_struct *tty);
static int digi_open(struct tty_struct *tty, struct usb_serial_port *port);
static void digi_close(struct usb_serial_port *port);
-static int digi_carrier_raised(struct usb_serial_port *port);
static void digi_dtr_rts(struct usb_serial_port *port, int on);
static int digi_startup_device(struct usb_serial *serial);
static int digi_startup(struct usb_serial *serial);
@@ -511,7 +510,6 @@
.open = digi_open,
.close = digi_close,
.dtr_rts = digi_dtr_rts,
- .carrier_raised = digi_carrier_raised,
.write = digi_write,
.write_room = digi_write_room,
.write_bulk_callback = digi_write_bulk_callback,
@@ -1337,14 +1335,6 @@
digi_set_modem_signals(port, on * (TIOCM_DTR|TIOCM_RTS), 1);
}

-static int digi_carrier_raised(struct usb_serial_port *port)
-{
- struct digi_port *priv = usb_get_serial_port_data(port);
- if (priv->dp_modem_signals & TIOCM_CD)
- return 1;
- return 0;
-}
-
static int digi_open(struct tty_struct *tty, struct usb_serial_port *port)
{
int ret;
Index: linux-2.6.35.y/drivers/usb/serial/generic.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/serial/generic.c 2011-03-29 22:52:03.062109567 -0700
+++ linux-2.6.35.y/drivers/usb/serial/generic.c 2011-03-29 23:02:58.482339003 -0700
@@ -481,6 +481,26 @@
}
EXPORT_SYMBOL_GPL(usb_serial_handle_break);

+/**
+ * usb_serial_handle_dcd_change - handle a change of carrier detect state
+ * @port: usb_serial_port structure for the open port
+ * @tty: tty_struct structure for the port
+ * @status: new carrier detect status, nonzero if active
+ */
+void usb_serial_handle_dcd_change(struct usb_serial_port *usb_port,
+ struct tty_struct *tty, unsigned int status)
+{
+ struct tty_port *port = &usb_port->port;
+
+ dbg("%s - port %d, status %d", __func__, usb_port->number, status);
+
+ if (status)
+ wake_up_interruptible(&port->open_wait);
+ else if (tty && !C_CLOCAL(tty))
+ tty_hangup(tty);
+}
+EXPORT_SYMBOL_GPL(usb_serial_handle_dcd_change);
+
int usb_serial_generic_resume(struct usb_serial *serial)
{
struct usb_serial_port *port;
Index: linux-2.6.35.y/drivers/usb/serial/keyspan_pda.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/serial/keyspan_pda.c 2011-03-29 22:52:03.063109542 -0700
+++ linux-2.6.35.y/drivers/usb/serial/keyspan_pda.c 2011-03-29 23:02:58.483338977 -0700
@@ -680,22 +680,6 @@
}
}

-static int keyspan_pda_carrier_raised(struct usb_serial_port *port)
-{
- struct usb_serial *serial = port->serial;
- unsigned char modembits;
-
- /* If we can read the modem status and the DCD is low then
- carrier is not raised yet */
- if (keyspan_pda_get_modem_info(serial, &modembits) >= 0) {
- if (!(modembits & (1>>6)))
- return 0;
- }
- /* Carrier raised, or we failed (eg disconnected) so
- progress accordingly */
- return 1;
-}
-

static int keyspan_pda_open(struct tty_struct *tty,
struct usb_serial_port *port)
@@ -882,7 +866,6 @@
.id_table = id_table_std,
.num_ports = 1,
.dtr_rts = keyspan_pda_dtr_rts,
- .carrier_raised = keyspan_pda_carrier_raised,
.open = keyspan_pda_open,
.close = keyspan_pda_close,
.write = keyspan_pda_write,
Index: linux-2.6.35.y/drivers/usb/serial/pl2303.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/serial/pl2303.c 2011-03-29 22:52:03.062109567 -0700
+++ linux-2.6.35.y/drivers/usb/serial/pl2303.c 2011-03-29 23:55:15.808062688 -0700
@@ -677,9 +677,11 @@
{

struct pl2303_private *priv = usb_get_serial_port_data(port);
+ struct tty_struct *tty;
unsigned long flags;
u8 status_idx = UART_STATE;
u8 length = UART_STATE + 1;
+ u8 prev_line_status;
u16 idv, idp;

idv = le16_to_cpu(port->serial->dev->descriptor.idVendor);
@@ -701,11 +703,20 @@

/* Save off the uart status for others to look at */
spin_lock_irqsave(&priv->lock, flags);
+ prev_line_status = priv->line_status;
priv->line_status = data[status_idx];
spin_unlock_irqrestore(&priv->lock, flags);
if (priv->line_status & UART_BREAK_ERROR)
usb_serial_handle_break(port);
wake_up_interruptible(&priv->delta_msr_wait);
+
+ tty = tty_port_tty_get(&port->port);
+ if (!tty)
+ return;
+ if ((priv->line_status ^ prev_line_status) & UART_DCD)
+ usb_serial_handle_dcd_change(port, tty,
+ priv->line_status & UART_DCD);
+ tty_kref_put(tty);
}

static void pl2303_read_int_callback(struct urb *urb)
Index: linux-2.6.35.y/drivers/usb/serial/spcp8x5.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/serial/spcp8x5.c 2011-03-29 22:52:03.063109542 -0700
+++ linux-2.6.35.y/drivers/usb/serial/spcp8x5.c 2011-03-29 23:02:58.486338902 -0700
@@ -133,7 +133,7 @@

/* how come ??? */
#define UART_STATE 0x08
-#define UART_STATE_TRANSIENT_MASK 0x74
+#define UART_STATE_TRANSIENT_MASK 0x75
#define UART_DCD 0x01
#define UART_DSR 0x02
#define UART_BREAK_ERROR 0x04
@@ -531,6 +531,9 @@
tty_insert_flip_string_fixed_flag(tty, data, tty_flag,
urb->actual_length);
tty_flip_buffer_push(tty);
+ if (status & UART_DCD)
+ usb_serial_handle_dcd_change(port, tty,
+ priv->line_status & MSR_STATUS_LINE_DCD);
tty_kref_put(tty);
}

Index: linux-2.6.35.y/include/linux/usb/serial.h
===================================================================
--- linux-2.6.35.y.orig/include/linux/usb/serial.h 2011-03-29 22:52:03.062109567 -0700
+++ linux-2.6.35.y/include/linux/usb/serial.h 2011-03-29 23:02:58.487338876 -0700
@@ -346,6 +346,9 @@
struct usb_serial_port *port,
unsigned int ch);
extern int usb_serial_handle_break(struct usb_serial_port *port);
+extern void usb_serial_handle_dcd_change(struct usb_serial_port *usb_port,
+ struct tty_struct *tty,
+ unsigned int status);


extern int usb_serial_bus_register(struct usb_serial_driver *device);

2011-03-30 22:09:55

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [33/275] Staging: hv: fix sysfs symlink on hv block device

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Ky Srinivasan <[email protected]>

commit 268eff909afaca93188d2d14554cbf824f6a0e41 upstream.

The block device does not create the proper symlink in sysfs because we
forgot to set up the gendisk structure properly. This patch fixes the
issue.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Cc: Hank Janssen <[email protected]>
Cc: Haiyang Zhang <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
drivers/staging/hv/blkvsc_drv.c | 1 +
1 file changed, 1 insertion(+)

Index: linux-2.6.35.y/drivers/staging/hv/blkvsc_drv.c
===================================================================
--- linux-2.6.35.y.orig/drivers/staging/hv/blkvsc_drv.c 2011-03-29 22:51:55.596300598 -0700
+++ linux-2.6.35.y/drivers/staging/hv/blkvsc_drv.c 2011-03-29 23:02:58.880328819 -0700
@@ -378,6 +378,7 @@
blkdev->gd->first_minor = 0;
blkdev->gd->fops = &block_ops;
blkdev->gd->private_data = blkdev;
+ blkdev->gd->driverfs_dev = &(blkdev->device_ctx->device);
sprintf(blkdev->gd->disk_name, "hd%c", 'a' + devnum);

blkvsc_do_inquiry(blkdev);

2011-03-30 22:10:21

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [20/275] USB: adding USB support for Cinterion's HC2x, EU3 and PH8 products

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Nicolaus Colberg <[email protected]>

commit aa52b3a92918039b273fc9d1994bd34227c40269 upstream.

/drivers/usb/serial/option.c: Adding support for Cinterion's HC25, HC28,
HC28J, EU3-E, EU3-P and PH8 by correcting/adding Cinterion's and
Siemens' Vendor IDs as well as Product IDs and USB_DEVICE tuples

Signed-off-by: Nicolaus Colberg <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/usb/serial/option.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)

Index: linux-2.6.35.y/drivers/usb/serial/option.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/serial/option.c 2011-03-29 22:51:59.987188247 -0700
+++ linux-2.6.35.y/drivers/usb/serial/option.c 2011-03-29 23:02:58.635335088 -0700
@@ -362,7 +362,16 @@
#define HAIER_VENDOR_ID 0x201e
#define HAIER_PRODUCT_CE100 0x2009

-#define CINTERION_VENDOR_ID 0x0681
+/* Cinterion (formerly Siemens) products */
+#define SIEMENS_VENDOR_ID 0x0681
+#define CINTERION_VENDOR_ID 0x1e2d
+#define CINTERION_PRODUCT_HC25_MDM 0x0047
+#define CINTERION_PRODUCT_HC25_MDMNET 0x0040
+#define CINTERION_PRODUCT_HC28_MDM 0x004C
+#define CINTERION_PRODUCT_HC28_MDMNET 0x004A /* same for HC28J */
+#define CINTERION_PRODUCT_EU3_E 0x0051
+#define CINTERION_PRODUCT_EU3_P 0x0052
+#define CINTERION_PRODUCT_PH8 0x0053

/* Olivetti products */
#define OLIVETTI_VENDOR_ID 0x0b3c
@@ -912,7 +921,17 @@
{ USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_100F) },
{ USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1011)},
{ USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1012)},
- { USB_DEVICE(CINTERION_VENDOR_ID, 0x0047) },
+ /* Cinterion */
+ { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_E) },
+ { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_P) },
+ { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8) },
+ { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) },
+ { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) },
+ { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDM) },
+ { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDMNET) },
+ { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, /* HC28 enumerates with Siemens or Cinterion VID depending on FW revision */
+ { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) },
+
{ USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) },
{ USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */
{ } /* Terminating entry */

2011-03-30 22:10:19

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [29/275] USB: ftdi_sio: Add VID=0x0647, PID=0x0100 for Acton Research spectrograph

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Michael Williamson <[email protected]>

commit 28fe2eb0162a1d23370dd99ff7d0e35632b1ee91 upstream.

Add the USB Vendor ID and Product ID for a Acton Research Corp.
spectrograph device with a FTDI chip for serial I/O.

Signed-off-by: Michael H Williamson <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/usb/serial/ftdi_sio.c | 1 +
drivers/usb/serial/ftdi_sio_ids.h | 6 ++++++
2 files changed, 7 insertions(+)

Index: linux-2.6.35.y/drivers/usb/serial/ftdi_sio.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/serial/ftdi_sio.c 2011-03-29 23:02:58.765331762 -0700
+++ linux-2.6.35.y/drivers/usb/serial/ftdi_sio.c 2011-03-29 23:02:58.803330791 -0700
@@ -620,6 +620,7 @@
{ USB_DEVICE(FTDI_VID, FTDI_OCEANIC_PID) },
{ USB_DEVICE(TTI_VID, TTI_QL355P_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_RM_CANVIEW_PID) },
+ { USB_DEVICE(ACTON_VID, ACTON_SPECTRAPRO_PID) },
{ USB_DEVICE(CONTEC_VID, CONTEC_COM1USBH_PID) },
{ USB_DEVICE(BANDB_VID, BANDB_USOTL4_PID) },
{ USB_DEVICE(BANDB_VID, BANDB_USTL4_PID) },
Index: linux-2.6.35.y/drivers/usb/serial/ftdi_sio_ids.h
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/serial/ftdi_sio_ids.h 2011-03-29 23:02:58.765331762 -0700
+++ linux-2.6.35.y/drivers/usb/serial/ftdi_sio_ids.h 2011-03-29 23:02:58.804330765 -0700
@@ -518,6 +518,12 @@
#define RATOC_PRODUCT_ID_USB60F 0xb020

/*
+ * Acton Research Corp.
+ */
+#define ACTON_VID 0x0647 /* Vendor ID */
+#define ACTON_SPECTRAPRO_PID 0x0100
+
+/*
* Contec products (http://www.contec.com)
* Submitted by Daniel Sangorrin
*/

2011-03-30 22:10:17

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [32/275] staging: comedi: ni_labpc: Use shared IRQ for PCMCIA card

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Ian Abbott <[email protected]>

commit d1ce318496f5943d2cc5e20171fc383a59a1421f upstream.

The ni_labpc driver module only requests a shared IRQ for PCI devices,
requesting a non-shared IRQ for non-PCI devices.
As this module is also used by the ni_labpc_cs module for certain
National Instruments PCMCIA cards, it also needs to request a shared IRQ
for PCMCIA devices, otherwise you get a IRQ mismatch with the CardBus
controller.

Signed-off-by: Ian Abbott <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/staging/comedi/drivers/ni_labpc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6.35.y/drivers/staging/comedi/drivers/ni_labpc.c
===================================================================
--- linux-2.6.35.y.orig/drivers/staging/comedi/drivers/ni_labpc.c 2011-03-29 22:51:55.939291822 -0700
+++ linux-2.6.35.y/drivers/staging/comedi/drivers/ni_labpc.c 2011-03-29 23:02:58.861329307 -0700
@@ -571,7 +571,8 @@
/* grab our IRQ */
if (irq) {
isr_flags = 0;
- if (thisboard->bustype == pci_bustype)
+ if (thisboard->bustype == pci_bustype
+ || thisboard->bustype == pcmcia_bustype)
isr_flags |= IRQF_SHARED;
if (request_irq(irq, labpc_interrupt, isr_flags,
driver_labpc.driver_name, dev)) {

2011-03-30 21:06:07

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [19/275] USB: serial: Updated support for ICOM devices

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Pieter Maes <[email protected]>

commit a9d61bc49188e32d2ae9cf0f683cde3e1744feef upstream.

I found the original patch on the db0fhn repeater wiki (couldn't find the email
of the origial author) I guess it was never commited.
I updated and added some Icom HAM-radio devices to the ftdi driver.
Added extra comments to make clear what devices it are.

Signed-off-by: Pieter Maes <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/usb/serial/ftdi_sio.c | 12 +++++++++++-
drivers/usb/serial/ftdi_sio_ids.h | 20 ++++++++++++++++----
2 files changed, 27 insertions(+), 5 deletions(-)

Index: linux-2.6.35.y/drivers/usb/serial/ftdi_sio.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/serial/ftdi_sio.c 2011-03-29 22:52:00.334179369 -0700
+++ linux-2.6.35.y/drivers/usb/serial/ftdi_sio.c 2011-03-29 23:55:29.226719337 -0700
@@ -675,7 +675,17 @@
{ USB_DEVICE(FTDI_VID, FTDI_PCDJ_DAC2_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_RRCIRKITS_LOCOBUFFER_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_ASK_RDR400_PID) },
- { USB_DEVICE(ICOM_ID1_VID, ICOM_ID1_PID) },
+ { USB_DEVICE(ICOM_VID, ICOM_ID_1_PID) },
+ { USB_DEVICE(ICOM_VID, ICOM_OPC_U_UC_PID) },
+ { USB_DEVICE(ICOM_VID, ICOM_ID_RP2C1_PID) },
+ { USB_DEVICE(ICOM_VID, ICOM_ID_RP2C2_PID) },
+ { USB_DEVICE(ICOM_VID, ICOM_ID_RP2D_PID) },
+ { USB_DEVICE(ICOM_VID, ICOM_ID_RP2VT_PID) },
+ { USB_DEVICE(ICOM_VID, ICOM_ID_RP2VR_PID) },
+ { USB_DEVICE(ICOM_VID, ICOM_ID_RP4KVT_PID) },
+ { USB_DEVICE(ICOM_VID, ICOM_ID_RP4KVR_PID) },
+ { USB_DEVICE(ICOM_VID, ICOM_ID_RP2KVT_PID) },
+ { USB_DEVICE(ICOM_VID, ICOM_ID_RP2KVR_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_ACG_HFDUAL_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_YEI_SERVOCENTER31_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_THORLABS_PID) },
Index: linux-2.6.35.y/drivers/usb/serial/ftdi_sio_ids.h
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/serial/ftdi_sio_ids.h 2011-03-29 22:52:00.334179369 -0700
+++ linux-2.6.35.y/drivers/usb/serial/ftdi_sio_ids.h 2011-03-29 23:55:29.226719337 -0700
@@ -569,11 +569,23 @@
#define OCT_US101_PID 0x0421 /* OCT US101 USB to RS-232 */

/*
- * Icom ID-1 digital transceiver
+ * Definitions for Icom Inc. devices
*/
-
-#define ICOM_ID1_VID 0x0C26
-#define ICOM_ID1_PID 0x0004
+#define ICOM_VID 0x0C26 /* Icom vendor ID */
+/* Note: ID-1 is a communications tranceiver for HAM-radio operators */
+#define ICOM_ID_1_PID 0x0004 /* ID-1 USB to RS-232 */
+/* Note: OPC is an Optional cable to connect an Icom Tranceiver */
+#define ICOM_OPC_U_UC_PID 0x0018 /* OPC-478UC, OPC-1122U cloning cable */
+/* Note: ID-RP* devices are Icom Repeater Devices for HAM-radio */
+#define ICOM_ID_RP2C1_PID 0x0009 /* ID-RP2C Asset 1 to RS-232 */
+#define ICOM_ID_RP2C2_PID 0x000A /* ID-RP2C Asset 2 to RS-232 */
+#define ICOM_ID_RP2D_PID 0x000B /* ID-RP2D configuration port*/
+#define ICOM_ID_RP2VT_PID 0x000C /* ID-RP2V Transmit config port */
+#define ICOM_ID_RP2VR_PID 0x000D /* ID-RP2V Receive config port */
+#define ICOM_ID_RP4KVT_PID 0x0010 /* ID-RP4000V Transmit config port */
+#define ICOM_ID_RP4KVR_PID 0x0011 /* ID-RP4000V Receive config port */
+#define ICOM_ID_RP2KVT_PID 0x0012 /* ID-RP2000V Transmit config port */
+#define ICOM_ID_RP2KVR_PID 0x0013 /* ID-RP2000V Receive config port */

/*
* GN Otometrics (http://www.otometrics.com)

2011-03-30 21:06:05

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [17/275] USB: usb-storage: unusual_devs entry for CamSport Evo

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Alan Stern <[email protected]>

commit 12f68c480c7155a66bd2a76ab2fef28dd5f93fa2 upstream.

This patch (as1438) adds an unusual_devs entry for the MagicPixel
FW_Omega2 chip, used in the CamSport Evo camera. The firmware
incorrectly reports a vendor-specific bDeviceClass.

Signed-off-by: Alan Stern <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Reported-by: <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
drivers/usb/storage/unusual_devs.h | 9 +++++++++
1 file changed, 9 insertions(+)

Index: linux-2.6.35.y/drivers/usb/storage/unusual_devs.h
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/storage/unusual_devs.h 2011-03-29 23:02:58.560337007 -0700
+++ linux-2.6.35.y/drivers/usb/storage/unusual_devs.h 2011-03-29 23:55:32.576633622 -0700
@@ -1043,6 +1043,15 @@
US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_BULK32),

+/* Reported by <[email protected]>
+ * The device reports a vendor-specific device class, requiring an
+ * explicit vendor/product match.
+ */
+UNUSUAL_DEV( 0x0851, 0x1542, 0x0002, 0x0002,
+ "MagicPixel",
+ "FW_Omega2",
+ US_SC_DEVICE, US_PR_DEVICE, NULL, 0),
+
/* Andrew Lunn <[email protected]>
* PanDigital Digital Picture Frame. Does not like ALLOW_MEDIUM_REMOVAL
* on LUN 4.

2011-03-30 22:11:28

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [27/275] USB: ftdi_sio: add ST Micro Connect Lite uart support

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Jean-Christophe PLAGNIOL-VILLARD <[email protected]>

commit 6ec2f46c4b4abf48c88c0ae7c476f347b97e1105 upstream.

on ST Micro Connect Lite we have 4 port
Part A and B for the JTAG
Port C Uart
Port D for PIO

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/usb/serial/ftdi_sio.c | 26 ++++++++++++++++++++++++++
drivers/usb/serial/ftdi_sio_ids.h | 6 ++++++
2 files changed, 32 insertions(+)

Index: linux-2.6.35.y/drivers/usb/serial/ftdi_sio.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/serial/ftdi_sio.c 2011-03-29 23:02:58.615335600 -0700
+++ linux-2.6.35.y/drivers/usb/serial/ftdi_sio.c 2011-03-29 23:55:28.414740114 -0700
@@ -99,6 +99,7 @@
static int ftdi_jtag_probe(struct usb_serial *serial);
static int ftdi_mtxorb_hack_setup(struct usb_serial *serial);
static int ftdi_NDI_device_setup(struct usb_serial *serial);
+static int ftdi_stmclite_probe(struct usb_serial *serial);
static void ftdi_USB_UIRT_setup(struct ftdi_private *priv);
static void ftdi_HE_TIRA1_setup(struct ftdi_private *priv);

@@ -122,6 +123,10 @@
.port_probe = ftdi_HE_TIRA1_setup,
};

+static struct ftdi_sio_quirk ftdi_stmclite_quirk = {
+ .probe = ftdi_stmclite_probe,
+};
+
/*
* The 8U232AM has the same API as the sio except for:
* - it can support MUCH higher baudrates; up to:
@@ -809,6 +814,8 @@
{ USB_DEVICE(FTDI_VID, FTDI_DOTEC_PID) },
{ USB_DEVICE(QIHARDWARE_VID, MILKYMISTONE_JTAGSERIAL_PID),
.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
+ { USB_DEVICE(ST_VID, ST_STMCLT1030_PID),
+ .driver_info = (kernel_ulong_t)&ftdi_stmclite_quirk },
{ }, /* Optional parameter entry */
{ } /* Terminating entry */
};
@@ -1690,6 +1697,25 @@
}

/*
+ * First and second port on STMCLiteadaptors is reserved for JTAG interface
+ * and the forth port for pio
+ */
+static int ftdi_stmclite_probe(struct usb_serial *serial)
+{
+ struct usb_device *udev = serial->dev;
+ struct usb_interface *interface = serial->interface;
+
+ dbg("%s", __func__);
+
+ if (interface == udev->actconfig->interface[2])
+ return 0;
+
+ dev_info(&udev->dev, "Ignoring serial port reserved for JTAG\n");
+
+ return -ENODEV;
+}
+
+/*
* The Matrix Orbital VK204-25-USB has an invalid IN endpoint.
* We have to correct it if we want to read from it.
*/
Index: linux-2.6.35.y/drivers/usb/serial/ftdi_sio_ids.h
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/serial/ftdi_sio_ids.h 2011-03-29 23:02:58.616335575 -0700
+++ linux-2.6.35.y/drivers/usb/serial/ftdi_sio_ids.h 2011-03-29 23:55:28.414740114 -0700
@@ -1034,6 +1034,12 @@
#define WHT_PID 0x0004 /* Wireless Handheld Terminal */

/*
+ * STMicroelectonics
+ */
+#define ST_VID 0x0483
+#define ST_STMCLT1030_PID 0x3747 /* ST Micro Connect Lite STMCLT1030 */
+
+/*
* Papouch products (http://www.papouch.com/)
* Submitted by Folkert van Heusden
*/

2011-03-30 22:11:42

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [7/275] staging: usbip: remove double giveback of URB

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: =?UTF-8?q?M=C3=A1rton=20N=C3=A9meth?= <[email protected]>

commit 7571f089d7522a95c103558faf313c7af8856ceb upstream.

In the vhci_urb_dequeue() function the TCP connection is checked twice.
Each time when the TCP connection is closed the URB is unlinked and given
back. Remove the second attempt of unlinking and giving back of the URB completely.

This patch fixes the bug described at https://bugzilla.kernel.org/show_bug.cgi?id=24872 .

Signed-off-by: Márton Németh <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/staging/usbip/vhci_hcd.c | 14 --------------
1 file changed, 14 deletions(-)

Index: linux-2.6.35.y/drivers/staging/usbip/vhci_hcd.c
===================================================================
--- linux-2.6.35.y.orig/drivers/staging/usbip/vhci_hcd.c 2011-03-29 22:52:04.724067043 -0700
+++ linux-2.6.35.y/drivers/staging/usbip/vhci_hcd.c 2011-03-29 23:54:39.657987678 -0700
@@ -799,20 +799,6 @@
spin_unlock_irqrestore(&vdev->priv_lock, flags2);
}

-
- if (!vdev->ud.tcp_socket) {
- /* tcp connection is closed */
- usbip_uinfo("vhci_hcd: vhci_urb_dequeue() gives back urb %p\n",
- urb);
-
- usb_hcd_unlink_urb_from_ep(hcd, urb);
-
- spin_unlock_irqrestore(&the_controller->lock, flags);
- usb_hcd_giveback_urb(vhci_to_hcd(the_controller), urb,
- urb->status);
- spin_lock_irqsave(&the_controller->lock, flags);
- }
-
spin_unlock_irqrestore(&the_controller->lock, flags);

usbip_dbg_vhci_hc("leave\n");

2011-03-30 22:11:55

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [5/275] thinkpad-acpi: avoid keymap pitfall

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Henrique de Moraes Holschuh <[email protected]>

[ upstream commit fc6e756894b703952fd277a1f98a5d93e7ba847a ]

Change the code so that it will use the correct size for keymap entries.
Do it in a way that makes it harder to screw it up in the future.

Reported-by: Jaime Velasco Juan <[email protected]>
Signed-off-by: Henrique de Moraes Holschuh <[email protected]>
Signed-off-by: Matthew Garrett <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/platform/x86/thinkpad_acpi.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

Index: linux-2.6.35.y/drivers/platform/x86/thinkpad_acpi.c
===================================================================
--- linux-2.6.35.y.orig/drivers/platform/x86/thinkpad_acpi.c 2011-03-29 23:02:58.202346167 -0700
+++ linux-2.6.35.y/drivers/platform/x86/thinkpad_acpi.c 2011-03-29 23:02:58.223345630 -0700
@@ -3093,7 +3093,8 @@
TPACPI_Q_IBM('1', 'D', TPACPI_HK_Q_INIMASK), /* X22, X23, X24 */
};

-typedef u16 tpacpi_keymap_t[TPACPI_HOTKEY_MAP_LEN];
+typedef u16 tpacpi_keymap_entry_t;
+typedef tpacpi_keymap_entry_t tpacpi_keymap_t[TPACPI_HOTKEY_MAP_LEN];

static int __init hotkey_init(struct ibm_init_struct *iibm)
{
@@ -3230,7 +3231,7 @@
};

#define TPACPI_HOTKEY_MAP_SIZE sizeof(tpacpi_keymap_t)
-#define TPACPI_HOTKEY_MAP_TYPESIZE sizeof(tpacpi_keymap_t[0])
+#define TPACPI_HOTKEY_MAP_TYPESIZE sizeof(tpacpi_keymap_entry_t)

int res, i;
int status;

2011-03-30 22:11:53

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [6/275] Fix cred leak in AF_NETLINK

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
Patch cab9e9848b9a8283b0504a2d7c435a9f5ba026de to the 2.6.35.y stable tree
stored a ref to the current cred struct in struct scm_cookie. This was fine
with AF_UNIX as that calls scm_destroy() from its packet sending functions, but
AF_NETLINK, which also uses scm_send(), does not call scm_destroy() - meaning
that the copied credentials leak each time SCM data is sent over a netlink
socket.

This can be triggered quite simply on a Fedora 13 or 14 userspace with the
2.6.35.11 kernel (or something based off of that) by calling:

#!/bin/bash
for ((i=0; i<100; i++))
do
su - -c /bin/true
cut -d: -f1 /proc/slabinfo | grep 'cred\|key\|task_struct'
cat /proc/keys | wc -l
done

This leaks the session key that pam_keyinit creates for 'su -', which appears
in /proc/keys as being revoked (has the R flag set against it) afterward su is
called.

Furthermore, if CONFIG_SLAB=y, then the cred and key slab object usage counts
can be viewed and seen to increase. The key slab increases by one object per
loop, and this can be seen after the system has had a couple of minutes to
stand after the script above has been run on it.

If the system is working correctly, the key and cred counts should return to
roughly what they were before.

Signed-off-by: David Howells <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---

net/netlink/af_netlink.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)

Index: linux-2.6.35.y/net/netlink/af_netlink.c
===================================================================
--- linux-2.6.35.y.orig/net/netlink/af_netlink.c 2011-03-29 22:52:05.032059161 -0700
+++ linux-2.6.35.y/net/netlink/af_netlink.c 2011-03-29 23:53:42.295455441 -0700
@@ -1330,12 +1330,16 @@
return err;

if (msg->msg_namelen) {
- if (addr->nl_family != AF_NETLINK)
- return -EINVAL;
+ if (addr->nl_family != AF_NETLINK) {
+ err = -EINVAL;
+ goto out;
+ }
dst_pid = addr->nl_pid;
dst_group = ffs(addr->nl_groups);
- if (dst_group && !netlink_capable(sock, NL_NONROOT_SEND))
- return -EPERM;
+ if (dst_group && !netlink_capable(sock, NL_NONROOT_SEND)) {
+ err = -EPERM;
+ goto out;
+ }
} else {
dst_pid = nlk->dst_pid;
dst_group = nlk->dst_group;
@@ -1387,6 +1391,8 @@
err = netlink_unicast(sk, skb, dst_pid, msg->msg_flags&MSG_DONTWAIT);

out:
+ scm_destroy(siocb->scm);
+ siocb->scm = NULL;
return err;
}

2011-03-30 22:12:27

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [24/275] USB: io_edgeport: fix the reported firmware major and minor

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Bjørn Mork <[email protected]>

commit 271c1150b4f8e1685e5a8cbf76e329ec894481da upstream.

The major and minor number saved in the product_info structure
were copied from the address instead of the data, causing an
inconsistency in the reported versions during firmware loading:

usb 4-1: firmware: requesting edgeport/down.fw
/usr/src/linux/drivers/usb/serial/io_edgeport.c: downloading firmware version (930) 1.16.4
[..]
/usr/src/linux/drivers/usb/serial/io_edgeport.c: edge_startup - time 3 4328191260
/usr/src/linux/drivers/usb/serial/io_edgeport.c: FirmwareMajorVersion 0.0.4

This can cause some confusion whether firmware loaded successfully
or not.

Signed-off-by: Bjørn Mork <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/usb/serial/io_edgeport.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6.35.y/drivers/usb/serial/io_edgeport.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/serial/io_edgeport.c 2011-03-29 22:51:58.665222072 -0700
+++ linux-2.6.35.y/drivers/usb/serial/io_edgeport.c 2011-03-29 23:02:58.709333195 -0700
@@ -2894,8 +2894,8 @@

dbg("%s %d.%d.%d", fw_info, rec->data[0], rec->data[1], build);

- edge_serial->product_info.FirmwareMajorVersion = fw->data[0];
- edge_serial->product_info.FirmwareMinorVersion = fw->data[1];
+ edge_serial->product_info.FirmwareMajorVersion = rec->data[0];
+ edge_serial->product_info.FirmwareMinorVersion = rec->data[1];
edge_serial->product_info.FirmwareBuildNumber = cpu_to_le16(build);

for (rec = ihex_next_binrec(rec); rec;

2011-03-30 22:12:55

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [21/275] USB: EHCI: ASPM quirk of ISOC on AMD Hudson

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Alex He <[email protected]>

commit baab93afc2844b68d57b0dcca5e1d34c5d7cf411 upstream.

AMD Hudson also needs the same ASPM quirk as SB800

Signed-off-by: Alex He <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/usb/host/ehci-pci.c | 33 ++++++++++++++++++++-------------
1 file changed, 20 insertions(+), 13 deletions(-)

Index: linux-2.6.35.y/drivers/usb/host/ehci-pci.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/host/ehci-pci.c 2011-03-29 23:02:58.277344248 -0700
+++ linux-2.6.35.y/drivers/usb/host/ehci-pci.c 2011-03-29 23:02:58.654334603 -0700
@@ -41,28 +41,35 @@
return 0;
}

-static int ehci_quirk_amd_SB800(struct ehci_hcd *ehci)
+static int ehci_quirk_amd_hudson(struct ehci_hcd *ehci)
{
struct pci_dev *amd_smbus_dev;
u8 rev = 0;

amd_smbus_dev = pci_get_device(PCI_VENDOR_ID_ATI, 0x4385, NULL);
- if (!amd_smbus_dev)
- return 0;
-
- pci_read_config_byte(amd_smbus_dev, PCI_REVISION_ID, &rev);
- if (rev < 0x40) {
- pci_dev_put(amd_smbus_dev);
- amd_smbus_dev = NULL;
- return 0;
+ if (amd_smbus_dev) {
+ pci_read_config_byte(amd_smbus_dev, PCI_REVISION_ID, &rev);
+ if (rev < 0x40) {
+ pci_dev_put(amd_smbus_dev);
+ amd_smbus_dev = NULL;
+ return 0;
+ }
+ } else {
+ amd_smbus_dev = pci_get_device(PCI_VENDOR_ID_AMD, 0x780b, NULL);
+ if (!amd_smbus_dev)
+ return 0;
+ pci_read_config_byte(amd_smbus_dev, PCI_REVISION_ID, &rev);
+ if (rev < 0x11 || rev > 0x18) {
+ pci_dev_put(amd_smbus_dev);
+ amd_smbus_dev = NULL;
+ return 0;
+ }
}

if (!amd_nb_dev)
amd_nb_dev = pci_get_device(PCI_VENDOR_ID_AMD, 0x1510, NULL);
- if (!amd_nb_dev)
- ehci_err(ehci, "QUIRK: unable to get AMD NB device\n");

- ehci_info(ehci, "QUIRK: Enable AMD SB800 L1 fix\n");
+ ehci_info(ehci, "QUIRK: Enable exception for AMD Hudson ASPM\n");

pci_dev_put(amd_smbus_dev);
amd_smbus_dev = NULL;
@@ -128,7 +135,7 @@
/* cache this readonly data; minimize chip reads */
ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);

- if (ehci_quirk_amd_SB800(ehci))
+ if (ehci_quirk_amd_hudson(ehci))
ehci->amd_l1_fix = 1;

retval = ehci_halt(ehci);

2011-03-30 22:12:54

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [22/275] USB: EHCI: fix DMA deallocation bug

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Alan Stern <[email protected]>

commit f75593ceaa08e6d27aec1a5de31cded19e850dd1 upstream.

This patch (as1440) fixes a bug in ehci-hcd. ehci->periodic_size is
used to compute the size in a dma_alloc_coherent() call, but then it
gets changed later on. As a result, the corresponding call to
dma_free_coherent() passes a different size from the original
allocation. Fix the problem by adjusting ehci->periodic_size before
carrying out any of the memory allocations.

Signed-off-by: Alan Stern <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Tested-by: Larry Finger <[email protected]>
CC: David Brownell <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
drivers/usb/host/ehci-hcd.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)

Index: linux-2.6.35.y/drivers/usb/host/ehci-hcd.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/host/ehci-hcd.c 2011-03-29 23:02:58.277344248 -0700
+++ linux-2.6.35.y/drivers/usb/host/ehci-hcd.c 2011-03-29 23:02:58.672334141 -0700
@@ -544,6 +544,8 @@
ehci->iaa_watchdog.function = ehci_iaa_watchdog;
ehci->iaa_watchdog.data = (unsigned long) ehci;

+ hcc_params = ehci_readl(ehci, &ehci->caps->hcc_params);
+
/*
* hw default: 1K periodic list heads, one per frame.
* periodic_size can shrink by USBCMD update if hcc_params allows.
@@ -551,11 +553,20 @@
ehci->periodic_size = DEFAULT_I_TDPS;
INIT_LIST_HEAD(&ehci->cached_itd_list);
INIT_LIST_HEAD(&ehci->cached_sitd_list);
+
+ if (HCC_PGM_FRAMELISTLEN(hcc_params)) {
+ /* periodic schedule size can be smaller than default */
+ switch (EHCI_TUNE_FLS) {
+ case 0: ehci->periodic_size = 1024; break;
+ case 1: ehci->periodic_size = 512; break;
+ case 2: ehci->periodic_size = 256; break;
+ default: BUG();
+ }
+ }
if ((retval = ehci_mem_init(ehci, GFP_KERNEL)) < 0)
return retval;

/* controllers may cache some of the periodic schedule ... */
- hcc_params = ehci_readl(ehci, &ehci->caps->hcc_params);
if (HCC_ISOC_CACHE(hcc_params)) // full frame cache
ehci->i_thresh = 2 + 8;
else // N microframes cached
@@ -604,12 +615,6 @@
/* periodic schedule size can be smaller than default */
temp &= ~(3 << 2);
temp |= (EHCI_TUNE_FLS << 2);
- switch (EHCI_TUNE_FLS) {
- case 0: ehci->periodic_size = 1024; break;
- case 1: ehci->periodic_size = 512; break;
- case 2: ehci->periodic_size = 256; break;
- default: BUG();
- }
}
ehci->command = temp;

2011-03-30 22:13:32

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [16/275] USB: usb-storage: unusual_devs update for TrekStor DataStation maxi g.u external hard drive enclosure

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: =?UTF-8?q?Richard=20Sch=C3=BCtz?= <[email protected]>

commit 7e1e7bd9dbd469267b6e6de1bf8d71a7d65ce86a upstream.

The TrekStor DataStation maxi g.u external hard drive enclosure uses a
JMicron USB to SATA chip which needs the US_FL_IGNORE_RESIDUE flag to work
properly.

Signed-off-by: Richard Schütz <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/usb/storage/unusual_devs.h | 9 +++++++++
1 file changed, 9 insertions(+)

Index: linux-2.6.35.y/drivers/usb/storage/unusual_devs.h
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/storage/unusual_devs.h 2011-03-29 22:52:01.660145439 -0700
+++ linux-2.6.35.y/drivers/usb/storage/unusual_devs.h 2011-03-29 23:55:32.897625408 -0700
@@ -1866,6 +1866,15 @@
US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_BAD_SENSE ),

+/* Patch by Richard Sch?tz <[email protected]>
+ * This external hard drive enclosure uses a JMicron chip which
+ * needs the US_FL_IGNORE_RESIDUE flag to work properly. */
+UNUSUAL_DEV( 0x1e68, 0x001b, 0x0000, 0x0000,
+ "TrekStor GmbH & Co. KG",
+ "DataStation maxi g.u",
+ US_SC_DEVICE, US_PR_DEVICE, NULL,
+ US_FL_IGNORE_RESIDUE | US_FL_SANE_SENSE ),
+
UNUSUAL_DEV( 0x2116, 0x0320, 0x0001, 0x0001,
"ST",
"2A",

2011-03-30 21:05:49

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [8/275] USB: EHCI: ASPM quirk of ISOC on AMD SB800

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Alex He <[email protected]>

commit 05570297ecbe834b1756b522412b68eaffb9ab11 upstream.

When ASPM PM Feature is enabled on UMI link, devices that use ISOC stream of
data transfer may be exposed to longer latency causing less than optimal per-
formance of the device. The longer latencies are normal and are due to link
wake time coming out of low power state which happens frequently to save
power when the link is not active.
The following code will make exception for certain features of ASPM to be by
passed and keep the logic normal state only when the ISOC device is connected
and active. This change will allow the device to run at optimal performance
yet minimize the impact on overall power savings.

Signed-off-by: Alex He <[email protected]>
Acked-by: David Brownell <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/usb/host/ehci-hcd.c | 8 ++++
drivers/usb/host/ehci-pci.c | 32 +++++++++++++++++
drivers/usb/host/ehci-sched.c | 79 ++++++++++++++++++++++++++++++++++++++++++
drivers/usb/host/ehci.h | 1
4 files changed, 120 insertions(+)

Index: linux-2.6.35.y/drivers/usb/host/ehci-hcd.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/host/ehci-hcd.c 2011-03-29 22:52:04.410075076 -0700
+++ linux-2.6.35.y/drivers/usb/host/ehci-hcd.c 2011-03-29 23:55:31.249667575 -0700
@@ -102,6 +102,9 @@

#define INTR_MASK (STS_IAA | STS_FATAL | STS_PCD | STS_ERR | STS_INT)

+/* for ASPM quirk of ISOC on AMD SB800 */
+static struct pci_dev *amd_nb_dev;
+
/*-------------------------------------------------------------------------*/

#include "ehci.h"
@@ -501,6 +504,11 @@
spin_unlock_irq (&ehci->lock);
ehci_mem_cleanup (ehci);

+ if (amd_nb_dev) {
+ pci_dev_put(amd_nb_dev);
+ amd_nb_dev = NULL;
+ }
+
#ifdef EHCI_STATS
ehci_dbg (ehci, "irq normal %ld err %ld reclaim %ld (lost %ld)\n",
ehci->stats.normal, ehci->stats.error, ehci->stats.reclaim,
Index: linux-2.6.35.y/drivers/usb/host/ehci-pci.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/host/ehci-pci.c 2011-03-29 22:52:04.411075050 -0700
+++ linux-2.6.35.y/drivers/usb/host/ehci-pci.c 2011-03-29 23:55:31.575659235 -0700
@@ -41,6 +41,35 @@
return 0;
}

+static int ehci_quirk_amd_SB800(struct ehci_hcd *ehci)
+{
+ struct pci_dev *amd_smbus_dev;
+ u8 rev = 0;
+
+ amd_smbus_dev = pci_get_device(PCI_VENDOR_ID_ATI, 0x4385, NULL);
+ if (!amd_smbus_dev)
+ return 0;
+
+ pci_read_config_byte(amd_smbus_dev, PCI_REVISION_ID, &rev);
+ if (rev < 0x40) {
+ pci_dev_put(amd_smbus_dev);
+ amd_smbus_dev = NULL;
+ return 0;
+ }
+
+ if (!amd_nb_dev)
+ amd_nb_dev = pci_get_device(PCI_VENDOR_ID_AMD, 0x1510, NULL);
+ if (!amd_nb_dev)
+ ehci_err(ehci, "QUIRK: unable to get AMD NB device\n");
+
+ ehci_info(ehci, "QUIRK: Enable AMD SB800 L1 fix\n");
+
+ pci_dev_put(amd_smbus_dev);
+ amd_smbus_dev = NULL;
+
+ return 1;
+}
+
/* called during probe() after chip reset completes */
static int ehci_pci_setup(struct usb_hcd *hcd)
{
@@ -99,6 +128,9 @@
/* cache this readonly data; minimize chip reads */
ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);

+ if (ehci_quirk_amd_SB800(ehci))
+ ehci->amd_l1_fix = 1;
+
retval = ehci_halt(ehci);
if (retval)
return retval;
Index: linux-2.6.35.y/drivers/usb/host/ehci-sched.c
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/host/ehci-sched.c 2011-03-29 22:52:04.411075050 -0700
+++ linux-2.6.35.y/drivers/usb/host/ehci-sched.c 2011-03-29 23:02:58.367341947 -0700
@@ -1586,6 +1586,63 @@
*hw_p = cpu_to_hc32(ehci, itd->itd_dma | Q_TYPE_ITD);
}

+#define AB_REG_BAR_LOW 0xe0
+#define AB_REG_BAR_HIGH 0xe1
+#define AB_INDX(addr) ((addr) + 0x00)
+#define AB_DATA(addr) ((addr) + 0x04)
+#define NB_PCIE_INDX_ADDR 0xe0
+#define NB_PCIE_INDX_DATA 0xe4
+#define NB_PIF0_PWRDOWN_0 0x01100012
+#define NB_PIF0_PWRDOWN_1 0x01100013
+
+static void ehci_quirk_amd_L1(struct ehci_hcd *ehci, int disable)
+{
+ u32 addr, addr_low, addr_high, val;
+
+ outb_p(AB_REG_BAR_LOW, 0xcd6);
+ addr_low = inb_p(0xcd7);
+ outb_p(AB_REG_BAR_HIGH, 0xcd6);
+ addr_high = inb_p(0xcd7);
+ addr = addr_high << 8 | addr_low;
+ outl_p(0x30, AB_INDX(addr));
+ outl_p(0x40, AB_DATA(addr));
+ outl_p(0x34, AB_INDX(addr));
+ val = inl_p(AB_DATA(addr));
+
+ if (disable) {
+ val &= ~0x8;
+ val |= (1 << 4) | (1 << 9);
+ } else {
+ val |= 0x8;
+ val &= ~((1 << 4) | (1 << 9));
+ }
+ outl_p(val, AB_DATA(addr));
+
+ if (amd_nb_dev) {
+ addr = NB_PIF0_PWRDOWN_0;
+ pci_write_config_dword(amd_nb_dev, NB_PCIE_INDX_ADDR, addr);
+ pci_read_config_dword(amd_nb_dev, NB_PCIE_INDX_DATA, &val);
+ if (disable)
+ val &= ~(0x3f << 7);
+ else
+ val |= 0x3f << 7;
+
+ pci_write_config_dword(amd_nb_dev, NB_PCIE_INDX_DATA, val);
+
+ addr = NB_PIF0_PWRDOWN_1;
+ pci_write_config_dword(amd_nb_dev, NB_PCIE_INDX_ADDR, addr);
+ pci_read_config_dword(amd_nb_dev, NB_PCIE_INDX_DATA, &val);
+ if (disable)
+ val &= ~(0x3f << 7);
+ else
+ val |= 0x3f << 7;
+
+ pci_write_config_dword(amd_nb_dev, NB_PCIE_INDX_DATA, val);
+ }
+
+ return;
+}
+
/* fit urb's itds into the selected schedule slot; activate as needed */
static int
itd_link_urb (
@@ -1613,6 +1670,12 @@
next_uframe >> 3, next_uframe & 0x7);
stream->start = jiffies;
}
+
+ if (ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs == 0) {
+ if (ehci->amd_l1_fix == 1)
+ ehci_quirk_amd_L1(ehci, 1);
+ }
+
ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs++;

/* fill iTDs uframe by uframe */
@@ -1739,6 +1802,11 @@
(void) disable_periodic(ehci);
ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--;

+ if (ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs == 0) {
+ if (ehci->amd_l1_fix == 1)
+ ehci_quirk_amd_L1(ehci, 0);
+ }
+
if (unlikely(list_is_singular(&stream->td_list))) {
ehci_to_hcd(ehci)->self.bandwidth_allocated
-= stream->bandwidth;
@@ -2026,6 +2094,12 @@
stream->interval, hc32_to_cpu(ehci, stream->splits));
stream->start = jiffies;
}
+
+ if (ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs == 0) {
+ if (ehci->amd_l1_fix == 1)
+ ehci_quirk_amd_L1(ehci, 1);
+ }
+
ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs++;

/* fill sITDs frame by frame */
@@ -2128,6 +2202,11 @@
(void) disable_periodic(ehci);
ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--;

+ if (ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs == 0) {
+ if (ehci->amd_l1_fix == 1)
+ ehci_quirk_amd_L1(ehci, 0);
+ }
+
if (list_is_singular(&stream->td_list)) {
ehci_to_hcd(ehci)->self.bandwidth_allocated
-= stream->bandwidth;
Index: linux-2.6.35.y/drivers/usb/host/ehci.h
===================================================================
--- linux-2.6.35.y.orig/drivers/usb/host/ehci.h 2011-03-29 22:52:04.410075076 -0700
+++ linux-2.6.35.y/drivers/usb/host/ehci.h 2011-03-29 23:02:58.377341684 -0700
@@ -131,6 +131,7 @@
unsigned need_io_watchdog:1;
unsigned broken_periodic:1;
unsigned fs_i_thresh:1; /* Intel iso scheduling */
+ unsigned amd_l1_fix:1;

/* required for usb32 quirk */
#define OHCI_CTRL_HCFS (3 << 6)

2011-03-30 21:05:48

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [9/275] rt2x00: add device id for windy31 usb device

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Greg Kroah-Hartman <[email protected]>

commit 9c4cf6d94fb362c27a24df5223ed6e327eb7279a upstream.

This patch adds the device id for the windy31 USB device to the rt73usb
driver.

Thanks to Ralf Flaxa for reporting this and providing testing and a
sample device.

Reported-by: Ralf Flaxa <[email protected]>
Tested-by: Ralf Flaxa <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Acked-by: Ivo van Doorn <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/net/wireless/rt2x00/rt73usb.c | 1 +
1 file changed, 1 insertion(+)

Index: linux-2.6.35.y/drivers/net/wireless/rt2x00/rt73usb.c
===================================================================
--- linux-2.6.35.y.orig/drivers/net/wireless/rt2x00/rt73usb.c 2011-03-29 22:52:04.013085234 -0700
+++ linux-2.6.35.y/drivers/net/wireless/rt2x00/rt73usb.c 2011-03-29 23:02:58.424340488 -0700
@@ -2392,6 +2392,7 @@
{ USB_DEVICE(0x04bb, 0x093d), USB_DEVICE_DATA(&rt73usb_ops) },
{ USB_DEVICE(0x148f, 0x2573), USB_DEVICE_DATA(&rt73usb_ops) },
{ USB_DEVICE(0x148f, 0x2671), USB_DEVICE_DATA(&rt73usb_ops) },
+ { USB_DEVICE(0x0812, 0x3101), USB_DEVICE_DATA(&rt73usb_ops) },
/* Qcom */
{ USB_DEVICE(0x18e8, 0x6196), USB_DEVICE_DATA(&rt73usb_ops) },
{ USB_DEVICE(0x18e8, 0x6229), USB_DEVICE_DATA(&rt73usb_ops) },

2011-03-30 22:14:19

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [3/275] thinkpad-acpi: add support for model-specific keymaps

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Henrique de Moraes Holschuh <[email protected]>

[ upstream commit d1e14dca6a18aa40394316c872993ae3bc7e311a ]

Use the quirks engine to select model-specific keymaps, which makes
it much easier to extend should we need it.

Keycodes are based on the tables at
http://www.thinkwiki.org/wiki/Default_meanings_of_special_keys.

Signed-off-by: Henrique de Moraes Holschuh <[email protected]>
Signed-off-by: Matthew Garrett <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/platform/x86/thinkpad_acpi.c | 60 ++++++++++++++++++++++++-----------
1 file changed, 42 insertions(+), 18 deletions(-)

Index: linux-2.6.35.y/drivers/platform/x86/thinkpad_acpi.c
===================================================================
--- linux-2.6.35.y.orig/drivers/platform/x86/thinkpad_acpi.c 2011-03-29 23:02:58.160347243 -0700
+++ linux-2.6.35.y/drivers/platform/x86/thinkpad_acpi.c 2011-03-29 23:55:37.173515999 -0700
@@ -3093,6 +3093,8 @@
TPACPI_Q_IBM('1', 'D', TPACPI_HK_Q_INIMASK), /* X22, X23, X24 */
};

+typedef u16 tpacpi_keymap_t[TPACPI_HOTKEY_MAP_LEN];
+
static int __init hotkey_init(struct ibm_init_struct *iibm)
{
/* Requirements for changing the default keymaps:
@@ -3124,9 +3126,17 @@
* If the above is too much to ask, don't change the keymap.
* Ask the thinkpad-acpi maintainer to do it, instead.
*/
- static u16 ibm_keycode_map[TPACPI_HOTKEY_MAP_LEN] __initdata = {
+
+ enum keymap_index {
+ TPACPI_KEYMAP_IBM_GENERIC = 0,
+ TPACPI_KEYMAP_LENOVO_GENERIC,
+ };
+
+ static const tpacpi_keymap_t tpacpi_keymaps[] __initconst = {
+ /* Generic keymap for IBM ThinkPads */
+ [TPACPI_KEYMAP_IBM_GENERIC] = {
/* Scan Codes 0x00 to 0x0B: ACPI HKEY FN+F1..F12 */
- KEY_FN_F1, KEY_FN_F2, KEY_COFFEE, KEY_SLEEP,
+ KEY_FN_F1, KEY_BATTERY, KEY_COFFEE, KEY_SLEEP,
KEY_WLAN, KEY_FN_F6, KEY_SWITCHVIDEOMODE, KEY_FN_F8,
KEY_FN_F9, KEY_FN_F10, KEY_FN_F11, KEY_SUSPEND,

@@ -3157,8 +3167,10 @@
/* (assignments unknown, please report if found) */
KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN,
KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN,
- };
- static u16 lenovo_keycode_map[TPACPI_HOTKEY_MAP_LEN] __initdata = {
+ },
+
+ /* Generic keymap for Lenovo ThinkPads */
+ [TPACPI_KEYMAP_LENOVO_GENERIC] = {
/* Scan Codes 0x00 to 0x0B: ACPI HKEY FN+F1..F12 */
KEY_FN_F1, KEY_COFFEE, KEY_BATTERY, KEY_SLEEP,
KEY_WLAN, KEY_FN_F6, KEY_SWITCHVIDEOMODE, KEY_FN_F8,
@@ -3200,10 +3212,25 @@
/* (assignments unknown, please report if found) */
KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN,
KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN,
+ },
};

-#define TPACPI_HOTKEY_MAP_SIZE sizeof(ibm_keycode_map)
-#define TPACPI_HOTKEY_MAP_TYPESIZE sizeof(ibm_keycode_map[0])
+ static const struct tpacpi_quirk tpacpi_keymap_qtable[] __initconst = {
+ /* Generic maps (fallback) */
+ {
+ .vendor = PCI_VENDOR_ID_IBM,
+ .bios = TPACPI_MATCH_ANY, .ec = TPACPI_MATCH_ANY,
+ .quirks = TPACPI_KEYMAP_IBM_GENERIC,
+ },
+ {
+ .vendor = PCI_VENDOR_ID_LENOVO,
+ .bios = TPACPI_MATCH_ANY, .ec = TPACPI_MATCH_ANY,
+ .quirks = TPACPI_KEYMAP_LENOVO_GENERIC,
+ },
+ };
+
+#define TPACPI_HOTKEY_MAP_SIZE sizeof(tpacpi_keymap_t)
+#define TPACPI_HOTKEY_MAP_TYPESIZE sizeof(tpacpi_keymap_t[0])

int res, i;
int status;
@@ -3212,6 +3239,7 @@
bool tabletsw_state = false;

unsigned long quirks;
+ unsigned long keymap_id;

vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY,
"initializing hotkey subdriver\n");
@@ -3352,7 +3380,6 @@
goto err_exit;

/* Set up key map */
-
hotkey_keycode_map = kmalloc(TPACPI_HOTKEY_MAP_SIZE,
GFP_KERNEL);
if (!hotkey_keycode_map) {
@@ -3362,17 +3389,14 @@
goto err_exit;
}

- if (tpacpi_is_lenovo()) {
- dbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY,
- "using Lenovo default hot key map\n");
- memcpy(hotkey_keycode_map, &lenovo_keycode_map,
- TPACPI_HOTKEY_MAP_SIZE);
- } else {
- dbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY,
- "using IBM default hot key map\n");
- memcpy(hotkey_keycode_map, &ibm_keycode_map,
- TPACPI_HOTKEY_MAP_SIZE);
- }
+ keymap_id = tpacpi_check_quirks(tpacpi_keymap_qtable,
+ ARRAY_SIZE(tpacpi_keymap_qtable));
+ BUG_ON(keymap_id >= ARRAY_SIZE(tpacpi_keymaps));
+ dbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY,
+ "using keymap number %lu\n", keymap_id);
+
+ memcpy(hotkey_keycode_map, &tpacpi_keymaps[keymap_id],
+ TPACPI_HOTKEY_MAP_SIZE);

input_set_capability(tpacpi_inputdev, EV_MSC, MSC_SCAN);
tpacpi_inputdev->keycodesize = TPACPI_HOTKEY_MAP_TYPESIZE;

2011-03-30 22:14:56

by Andi Kleen

[permalink] [raw]
Subject: [PATCH] [2/275] thinkpad-acpi: lock down size of hotkey keymap

2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Henrique de Moraes Holschuh <[email protected]>

[ upstream commit 34a656d22f5539f613b93e7a1d14b4bd53592505 ]

Use a safer coding style for the hotkey keymap. This does not fix any
problems, as the current code is correct. But it might help avoid
mistakes in the future.

Signed-off-by: Henrique de Moraes Holschuh <[email protected]>
Signed-off-by: Matthew Garrett <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>

---
drivers/platform/x86/thinkpad_acpi.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)

Index: linux-2.6.35.y/drivers/platform/x86/thinkpad_acpi.c
===================================================================
--- linux-2.6.35.y.orig/drivers/platform/x86/thinkpad_acpi.c 2011-03-29 22:52:06.274027381 -0700
+++ linux-2.6.35.y/drivers/platform/x86/thinkpad_acpi.c 2011-03-29 23:55:37.481508118 -0700
@@ -1911,6 +1911,17 @@
TP_ACPI_HOTKEYSCAN_VOLUMEDOWN,
TP_ACPI_HOTKEYSCAN_MUTE,
TP_ACPI_HOTKEYSCAN_THINKPAD,
+ TP_ACPI_HOTKEYSCAN_UNK1,
+ TP_ACPI_HOTKEYSCAN_UNK2,
+ TP_ACPI_HOTKEYSCAN_UNK3,
+ TP_ACPI_HOTKEYSCAN_UNK4,
+ TP_ACPI_HOTKEYSCAN_UNK5,
+ TP_ACPI_HOTKEYSCAN_UNK6,
+ TP_ACPI_HOTKEYSCAN_UNK7,
+ TP_ACPI_HOTKEYSCAN_UNK8,
+
+ /* Hotkey keymap size */
+ TPACPI_HOTKEY_MAP_LEN
};

enum { /* Keys/events available through NVRAM polling */
@@ -3113,7 +3124,7 @@
* If the above is too much to ask, don't change the keymap.
* Ask the thinkpad-acpi maintainer to do it, instead.
*/
- static u16 ibm_keycode_map[] __initdata = {
+ static u16 ibm_keycode_map[TPACPI_HOTKEY_MAP_LEN] __initdata = {
/* Scan Codes 0x00 to 0x0B: ACPI HKEY FN+F1..F12 */
KEY_FN_F1, KEY_FN_F2, KEY_COFFEE, KEY_SLEEP,
KEY_WLAN, KEY_FN_F6, KEY_SWITCHVIDEOMODE, KEY_FN_F8,
@@ -3147,7 +3158,7 @@
KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN,
KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN,
};
- static u16 lenovo_keycode_map[] __initdata = {
+ static u16 lenovo_keycode_map[TPACPI_HOTKEY_MAP_LEN] __initdata = {
/* Scan Codes 0x00 to 0x0B: ACPI HKEY FN+F1..F12 */
KEY_FN_F1, KEY_COFFEE, KEY_BATTERY, KEY_SLEEP,
KEY_WLAN, KEY_FN_F6, KEY_SWITCHVIDEOMODE, KEY_FN_F8,
@@ -3191,7 +3202,6 @@
KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN,
};

-#define TPACPI_HOTKEY_MAP_LEN ARRAY_SIZE(ibm_keycode_map)
#define TPACPI_HOTKEY_MAP_SIZE sizeof(ibm_keycode_map)
#define TPACPI_HOTKEY_MAP_TYPESIZE sizeof(ibm_keycode_map[0])

@@ -3469,7 +3479,8 @@
*send_acpi_ev = true;
*ignore_acpi_ev = false;

- if (scancode > 0 && scancode < 0x21) {
+ /* HKEY event 0x1001 is scancode 0x00 */
+ if (scancode > 0 && scancode <= TPACPI_HOTKEY_MAP_LEN) {
scancode--;
if (!(hotkey_source_mask & (1 << scancode))) {
tpacpi_input_send_key_masked(scancode);

2011-03-30 23:33:31

by Andi Kleen

[permalink] [raw]
Subject: Re: [PATCH] [232/275] nfsd: wrong index used in inner loop

> Doh, so this 232/275 basically reverts that 180 and makes
> other change down the line, but keeps the subject intact.
> Especially useful that the two patches are so far away
> from each other (more than 50 patches in-between).
> Confusing :)
>
> So both are actually needed, apparently.

Sorry about that -- i ended up grabbing those from .32 and since
there were multiple releases in sequence it ended up this way.

I can collapse the two patches.

Are the leftover hunks after that good?

-Andi

--
[email protected] -- Speaking for myself only.

2011-03-30 23:44:15

by Andi Kleen

[permalink] [raw]
Subject: Re: [PATCH] [226/275] Prevent rt_sigqueueinfo and rt_tgsigqueueinfo from spoofing the signal code

> If stable needs this change, then it probably needs
>
> Relax si_code check in rt_sigqueueinfo and rt_tgsigqueueinfo
> commit 243b422af9ea9af4ead07a8ad54c90d4f9b6081a
>
> as well.

Added thanks.

BTW I think Greg would need that too for .32.

-Andi

2011-03-30 23:48:18

by Julien Tinnes

[permalink] [raw]
Subject: Re: [PATCH] [226/275] Prevent rt_sigqueueinfo and rt_tgsigqueueinfo from spoofing the signal code

On Wed, Mar 30, 2011 at 4:44 PM, Andi Kleen <[email protected]> wrote:
>> If stable needs this change, then it probably needs
>>
>> ? ? ? Relax si_code check in rt_sigqueueinfo and rt_tgsigqueueinfo
>> ? ? ? commit 243b422af9ea9af4ead07a8ad54c90d4f9b6081a
>>
>> as well.
>
> Added thanks.
>
> BTW I think Greg would need that too for .32.

He has it already I think (thanks to Oleg).

Julien

2011-03-31 05:27:46

by Yinghai Lu

[permalink] [raw]
Subject: Re: [PATCH] [225/275] x86: Cleanup highmap after brk is concluded

On 03/30/2011 02:07 PM, Andi Kleen wrote:
> 2.6.35-longterm review patch. If anyone has any objections, please let me know.
>
> ------------------
> From: Yinghai Lu<[email protected]>
>
> commit e5f15b45ddf3afa2bbbb10c7ea34fb32b6de0a0e upstream.
>
> Now cleanup_highmap actually is in two steps: one is early in head64.c
> and only clears above _end; a second one is in init_memory_mapping() and
> tries to clean from _brk_end to _end.
> It should check if those boundaries are PMD_SIZE aligned but currently
> does not.
> Also init_memory_mapping() is called several times for numa or memory
> hotplug, so we really should not handle initial kernel mappings there.
>
> This patch moves cleanup_highmap() down after _brk_end is settled so
> we can do everything in one step.
> Also we honor max_pfn_mapped in the implementation of cleanup_highmap.
>

gentoo guys reported this one cause resume freeze.

https://bugs.gentoo.org/show_bug.cgi?id=361159

2011-03-31 05:31:15

by Andi Kleen

[permalink] [raw]
Subject: Re: [PATCH] [225/275] x86: Cleanup highmap after brk is concluded

On Wed, Mar 30, 2011 at 10:26:28PM -0700, Yinghai Lu wrote:
> gentoo guys reported this one cause resume freeze.
>
> https://bugs.gentoo.org/show_bug.cgi?id=361159

thanks. dropped.

-Andi

--
[email protected] -- Speaking for myself only.

2011-03-31 05:55:14

by Pali Rohár

[permalink] [raw]
Subject: Re: [PATCH] [115/275] OHCI: work around for nVidia shutdown problem

Hello,

please see comment 33 in LP bug tracker:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/42149

Maybe there are problem with this patch on new nvidia HW.

2011/3/30 Andi Kleen <[email protected]>:
> 2.6.35-longterm review patch.  If anyone has any objections, please let me know.
>
> ------------------
> From: Alan Stern <[email protected]>
>
> commit 3df7169e73fc1d71a39cffeacc969f6840cdf52b upstream.
>
> This patch (as1417) fixes a problem affecting some (or all) nVidia
> chipsets.  When the computer is shut down, the OHCI controllers
> continue to power the USB buses and evidently they drive a Reset
> signal out all their ports.  This prevents attached devices from going
> to low power.  Mouse LEDs stay on, for example, which is disconcerting
> for users and a drain on laptop batteries.
>
> The fix involves leaving each OHCI controller in the OPERATIONAL state
> during system shutdown rather than putting it in the RESET state.
> Although this nominally means the controller is running, in fact it's
> not doing very much since all the schedules are all disabled.  However
> there is ongoing DMA to the Host Controller Communications Area, so
> the patch also disables the bus-master capability of all PCI USB
> controllers after the shutdown routine runs.
>
> The fix is applied only to nVidia-based PCI OHCI controllers, so it
> shouldn't cause problems on systems using other hardware.  As an added
> safety measure, in case the kernel encounters one of these running
> controllers during boot, the patch changes quirk_usb_handoff_ohci()
> (which runs early on during PCI discovery) to reset the controller
> before anything bad can happen.
>
> Reported-by: Pali Rohár <[email protected]>
> Signed-off-by: Alan Stern <[email protected]>
> Signed-off-by: Andi Kleen <[email protected]>
> CC: David Brownell <[email protected]>
> Tested-by: Pali Rohár <[email protected]>
> Signed-off-by: Greg Kroah-Hartman <[email protected]>
>
> ---
>  drivers/usb/core/hcd-pci.c    |    4 +++-
>  drivers/usb/host/ohci-hcd.c   |    9 ++++++++-
>  drivers/usb/host/ohci-pci.c   |   18 ++++++++++++++++++
>  drivers/usb/host/ohci.h       |    1 +
>  drivers/usb/host/pci-quirks.c |   18 +++++++++++-------
>  5 files changed, 41 insertions(+), 9 deletions(-)
>
> Index: linux-2.6.35.y/drivers/usb/core/hcd-pci.c
> ===================================================================
> --- linux-2.6.35.y.orig/drivers/usb/core/hcd-pci.c      2011-03-29 22:51:22.609144656 -0700
> +++ linux-2.6.35.y/drivers/usb/core/hcd-pci.c   2011-03-29 23:03:00.575285450 -0700
> @@ -317,8 +317,10 @@
>        if (!hcd)
>                return;
>
> -       if (hcd->driver->shutdown)
> +       if (hcd->driver->shutdown) {
>                hcd->driver->shutdown(hcd);
> +               pci_disable_device(dev);
> +       }
>  }
>  EXPORT_SYMBOL_GPL(usb_hcd_pci_shutdown);
>
> Index: linux-2.6.35.y/drivers/usb/host/ohci-hcd.c
> ===================================================================
> --- linux-2.6.35.y.orig/drivers/usb/host/ohci-hcd.c     2011-03-29 22:51:22.609144656 -0700
> +++ linux-2.6.35.y/drivers/usb/host/ohci-hcd.c  2011-03-29 23:03:00.576285425 -0700
> @@ -398,7 +398,14 @@
>
>        ohci = hcd_to_ohci (hcd);
>        ohci_writel (ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable);
> -       ohci_usb_reset (ohci);
> +       ohci->hc_control = ohci_readl(ohci, &ohci->regs->control);
> +
> +       /* If the SHUTDOWN quirk is set, don't put the controller in RESET */
> +       ohci->hc_control &= (ohci->flags & OHCI_QUIRK_SHUTDOWN ?
> +                       OHCI_CTRL_RWC | OHCI_CTRL_HCFS :
> +                       OHCI_CTRL_RWC);
> +       ohci_writel(ohci, ohci->hc_control, &ohci->regs->control);
> +
>        /* flush the writes */
>        (void) ohci_readl (ohci, &ohci->regs->control);
>  }
> Index: linux-2.6.35.y/drivers/usb/host/ohci-pci.c
> ===================================================================
> --- linux-2.6.35.y.orig/drivers/usb/host/ohci-pci.c     2011-03-29 22:51:22.609144656 -0700
> +++ linux-2.6.35.y/drivers/usb/host/ohci-pci.c  2011-03-29 23:03:00.577285400 -0700
> @@ -201,6 +201,20 @@
>        return 0;
>  }
>
> +/* nVidia controllers continue to drive Reset signalling on the bus
> + * even after system shutdown, wasting power.  This flag tells the
> + * shutdown routine to leave the controller OPERATIONAL instead of RESET.
> + */
> +static int ohci_quirk_nvidia_shutdown(struct usb_hcd *hcd)
> +{
> +       struct ohci_hcd *ohci = hcd_to_ohci(hcd);
> +
> +       ohci->flags |= OHCI_QUIRK_SHUTDOWN;
> +       ohci_dbg(ohci, "enabled nVidia shutdown quirk\n");
> +
> +       return 0;
> +}
> +
>  /*
>  * The hardware normally enables the A-link power management feature, which
>  * lets the system lower the power consumption in idle states.
> @@ -332,6 +346,10 @@
>                PCI_DEVICE(PCI_VENDOR_ID_ATI, 0x4399),
>                .driver_data = (unsigned long)ohci_quirk_amd700,
>        },
> +       {
> +               PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID),
> +               .driver_data = (unsigned long) ohci_quirk_nvidia_shutdown,
> +       },
>
>        /* FIXME for some of the early AMD 760 southbridges, OHCI
>         * won't work at all.  blacklist them.
> Index: linux-2.6.35.y/drivers/usb/host/ohci.h
> ===================================================================
> --- linux-2.6.35.y.orig/drivers/usb/host/ohci.h 2011-03-29 22:51:22.610144631 -0700
> +++ linux-2.6.35.y/drivers/usb/host/ohci.h      2011-03-29 23:03:00.578285374 -0700
> @@ -403,6 +403,7 @@
>  #define        OHCI_QUIRK_HUB_POWER    0x100                   /* distrust firmware power/oc setup */
>  #define        OHCI_QUIRK_AMD_ISO      0x200                   /* ISO transfers*/
>  #define        OHCI_QUIRK_AMD_PREFETCH 0x400                   /* pre-fetch for ISO transfer */
> +#define        OHCI_QUIRK_SHUTDOWN     0x800                   /* nVidia power bug */
>        // there are also chip quirks/bugs in init logic
>
>        struct work_struct      nec_work;       /* Worker for NEC quirk */
> Index: linux-2.6.35.y/drivers/usb/host/pci-quirks.c
> ===================================================================
> --- linux-2.6.35.y.orig/drivers/usb/host/pci-quirks.c   2011-03-29 22:51:22.610144631 -0700
> +++ linux-2.6.35.y/drivers/usb/host/pci-quirks.c        2011-03-29 23:03:00.579285348 -0700
> @@ -169,6 +169,7 @@
>  static void __devinit quirk_usb_handoff_ohci(struct pci_dev *pdev)
>  {
>        void __iomem *base;
> +       u32 control;
>
>        if (!mmio_resource_enabled(pdev, 0))
>                return;
> @@ -177,10 +178,14 @@
>        if (base == NULL)
>                return;
>
> +       control = readl(base + OHCI_CONTROL);
> +
>  /* On PA-RISC, PDC can leave IR set incorrectly; ignore it there. */
> -#ifndef __hppa__
> -{
> -       u32 control = readl(base + OHCI_CONTROL);
> +#ifdef __hppa__
> +#define        OHCI_CTRL_MASK          (OHCI_CTRL_RWC | OHCI_CTRL_IR)
> +#else
> +#define        OHCI_CTRL_MASK          OHCI_CTRL_RWC
> +
>        if (control & OHCI_CTRL_IR) {
>                int wait_time = 500; /* arbitrary; 5 seconds */
>                writel(OHCI_INTR_OC, base + OHCI_INTRENABLE);
> @@ -194,13 +199,12 @@
>                        dev_warn(&pdev->dev, "OHCI: BIOS handoff failed"
>                                        " (BIOS bug?) %08x\n",
>                                        readl(base + OHCI_CONTROL));
> -
> -               /* reset controller, preserving RWC */
> -               writel(control & OHCI_CTRL_RWC, base + OHCI_CONTROL);
>        }
> -}
>  #endif
>
> +       /* reset controller, preserving RWC (and possibly IR) */
> +       writel(control & OHCI_CTRL_MASK, base + OHCI_CONTROL);
> +
>        /*
>         * disable interrupts
>         */
>



--
Pali Rohár
[email protected]

2011-03-31 06:07:14

by Andi Kleen

[permalink] [raw]
Subject: Re: [PATCH] [115/275] OHCI: work around for nVidia shutdown problem

On Thu, Mar 31, 2011 at 07:54:31AM +0200, Pali Roh?r wrote:
> Hello,
>
> please see comment 33 in LP bug tracker:
> https://bugs.launchpad.net/ubuntu/+source/linux/+bug/42149

Alan? Should I include http://marc.info/?l=linux-usb&m=130142049527638&w=2
too or drop this patch?

-Andi

2011-03-31 06:44:07

by Michael Tokarev

[permalink] [raw]
Subject: Re: [PATCH] [232/275] nfsd: wrong index used in inner loop

31.03.2011 03:33, Andi Kleen wrote:
>> Doh, so this 232/275 basically reverts that 180 and makes
>> other change down the line, but keeps the subject intact.
>> Especially useful that the two patches are so far away
>> from each other (more than 50 patches in-between).
>> Confusing :)
>>
>> So both are actually needed, apparently.
>
> Sorry about that -- i ended up grabbing those from .32 and since
> there were multiple releases in sequence it ended up this way.

It's definitely not your fault -- second patch should be
named differently (since it does something else) but it's
not.

> I can collapse the two patches.

Just be careful they don't end in the same _file_. In
the gregkh's stable-queue repository each patch is keept
in a separate file named after the subject line, so that
means just that - the same file.

> Are the leftover hunks after that good?

I remember original discussion when first patch has been
posted (was fun to read the original code), but I missed
second half of it. So I re-read it and found the second
part now, all is ok with it and with the resulting two-
patch solution, except of the possible "patch name" clash,
which may only when organizing patches in a plain directory.

Anyway, that's a good story I think, and the conclusion is -
please name your patches correctly :)

Thank you!

/mjt

2011-03-31 13:55:42

by Alan Stern

[permalink] [raw]
Subject: Re: [PATCH] [115/275] OHCI: work around for nVidia shutdown problem

On Thu, 31 Mar 2011, Andi Kleen wrote:

> On Thu, Mar 31, 2011 at 07:54:31AM +0200, Pali Roh?r wrote:
> > Hello,
> >
> > please see comment 33 in LP bug tracker:
> > https://bugs.launchpad.net/ubuntu/+source/linux/+bug/42149
>
> Alan? Should I include http://marc.info/?l=linux-usb&m=130142049527638&w=2
> too or drop this patch?

For now I think it should be dropped. There is a fix for the problem
in that comment, but so far only one person has tested it (in fact,
only one person has reported having the problem). For details, see the
thread starting here:

http://marc.info/?l=linux-kernel&m=130132879827993&w=2

When the fix is approved and goes into the other stable kernels, then
you can merge both patches.

Alan Stern

Subject: Re: [PATCH] [0/275] 2.6.35.12 longterm review

On Wed, Mar 30, 2011 at 02:03:53PM -0700, Andi Kleen wrote:
>
> This is the start of the longterm review cycle for the 2.6.35.12 release.
> There are a large number of 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. 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.
>
> The full quilt queue can be found at
> git://git.kernel.org/pub/scm/linux/kernel/git/longterm/longterm-queue-2.6.35
>
> Responses should be made within 48 hours.

Can you include in this series also the following upstream patch?:
commit 7a89e4c "USB: serial: option: Apply OPTION_BLACKLIST_SENDSETUP
also for ZTE MF626"

It affects also .35, I thought it was going in in this .35 update too as
it's Cc: stable, but if it's already queued for the next .35 update then
please disregard this.

>
> -Andi
> --
> 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/
>

--
[]'s
Herton

2011-03-31 18:51:56

by Andi Kleen

[permalink] [raw]
Subject: Re: [PATCH] [115/275] OHCI: work around for nVidia shutdown problem

> For now I think it should be dropped. There is a fix for the problem
> in that comment, but so far only one person has tested it (in fact,
> only one person has reported having the problem). For details, see the
> thread starting here:
>
> http://marc.info/?l=linux-kernel&m=130132879827993&w=2
>
> When the fix is approved and goes into the other stable kernels, then
> you can merge both patches.
>

Dropped for now. Thanks.
-Andi

2011-03-31 18:52:55

by Andi Kleen

[permalink] [raw]
Subject: Re: [PATCH] [0/275] 2.6.35.12 longterm review

> Can you include in this series also the following upstream patch?:
> commit 7a89e4c "USB: serial: option: Apply OPTION_BLACKLIST_SENDSETUP
> also for ZTE MF626"
>
> It affects also .35, I thought it was going in in this .35 update too as
> it's Cc: stable, but if it's already queued for the next .35 update then
> please disregard this.

It's not queued yet, but I should pick it up with the next update.
For this one it's too late.
Thanks,
-Andi

2011-04-02 19:41:17

by J. Bruce Fields

[permalink] [raw]
Subject: Re: [PATCH] [232/275] nfsd: wrong index used in inner loop

On Thu, Mar 31, 2011 at 10:44:00AM +0400, Michael Tokarev wrote:
> 31.03.2011 03:33, Andi Kleen wrote:
> >> Doh, so this 232/275 basically reverts that 180 and makes
> >> other change down the line, but keeps the subject intact.
> >> Especially useful that the two patches are so far away
> >> from each other (more than 50 patches in-between).
> >> Confusing :)
> >>
> >> So both are actually needed, apparently.
> >
> > Sorry about that -- i ended up grabbing those from .32 and since
> > there were multiple releases in sequence it ended up this way.
>
> It's definitely not your fault -- second patch should be
> named differently (since it does something else) but it's
> not.
>
> > I can collapse the two patches.
>
> Just be careful they don't end in the same _file_. In
> the gregkh's stable-queue repository each patch is keept
> in a separate file named after the subject line, so that
> means just that - the same file.
>
> > Are the leftover hunks after that good?
>
> I remember original discussion when first patch has been
> posted (was fun to read the original code), but I missed
> second half of it. So I re-read it and found the second
> part now, all is ok with it and with the resulting two-
> patch solution, except of the possible "patch name" clash,
> which may only when organizing patches in a plain directory.
>
> Anyway, that's a good story I think, and the conclusion is -
> please name your patches correctly :)

Apologies, my fault--thanks for sorting it out.

--b.

2011-06-23 18:54:03

by Alan Stern

[permalink] [raw]
Subject: Re: [PATCH] [115/275] OHCI: work around for nVidia shutdown problem

On Thu, 31 Mar 2011, Andi Kleen wrote:

> On Thu, Mar 31, 2011 at 07:54:31AM +0200, Pali Roh?r wrote:
> > Hello,
> >
> > please see comment 33 in LP bug tracker:
> > https://bugs.launchpad.net/ubuntu/+source/linux/+bug/42149
>
> Alan? Should I include http://marc.info/?l=linux-usb&m=130142049527638&w=2
> too or drop this patch?

I think it has been long enough, and no more complaints have shown up.
That fix is in the mainstream kernel as commit
2b7aaf503d56216b847c8265421d2a7d9b42df3e. It should be safe to add the
two changes in your longterm stable tree.

Alan Stern