From: Greg Kroah-Hartman Date: Tue, 4 Mar 2014 02:03:46 +0000 (-0800) Subject: 3.10-stable patches X-Git-Tag: v3.10.33~27 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e1e05785d4045dca71797b26b70caa87c0c48d22;p=thirdparty%2Fkernel%2Fstable-queue.git 3.10-stable patches added patches: acpi-pci-fix-memory-leak-in-acpi_pci_irq_enable.patch acpi-processor-rework-processor-throttling-with-work_on_cpu.patch acpi-video-filter-the-_bcl-table-for-duplicate-brightness-values.patch i7core_edac-fix-pci-device-reference-count.patch pci-enable-intx-if-bios-left-them-disabled.patch --- diff --git a/queue-3.10/acpi-pci-fix-memory-leak-in-acpi_pci_irq_enable.patch b/queue-3.10/acpi-pci-fix-memory-leak-in-acpi_pci_irq_enable.patch new file mode 100644 index 00000000000..7f6ea100aa1 --- /dev/null +++ b/queue-3.10/acpi-pci-fix-memory-leak-in-acpi_pci_irq_enable.patch @@ -0,0 +1,32 @@ +From b685f3b1744061aa9ad822548ba9c674de5be7c6 Mon Sep 17 00:00:00 2001 +From: Tomasz Nowicki +Date: Mon, 10 Feb 2014 14:00:11 +0100 +Subject: ACPI / PCI: Fix memory leak in acpi_pci_irq_enable() + +From: Tomasz Nowicki + +commit b685f3b1744061aa9ad822548ba9c674de5be7c6 upstream. + +acpi_pci_link_allocate_irq() can return negative gsi even if +entry != NULL. For that case we have a memory leak, so free +entry before returning from acpi_pci_irq_enable() for gsi < 0. + +Signed-off-by: Tomasz Nowicki +[rjw: Subject and changelog] +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/acpi/pci_irq.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/acpi/pci_irq.c ++++ b/drivers/acpi/pci_irq.c +@@ -432,6 +432,7 @@ int acpi_pci_irq_enable(struct pci_dev * + pin_name(pin)); + } + ++ kfree(entry); + return 0; + } + diff --git a/queue-3.10/acpi-processor-rework-processor-throttling-with-work_on_cpu.patch b/queue-3.10/acpi-processor-rework-processor-throttling-with-work_on_cpu.patch new file mode 100644 index 00000000000..342ae0abe10 --- /dev/null +++ b/queue-3.10/acpi-processor-rework-processor-throttling-with-work_on_cpu.patch @@ -0,0 +1,173 @@ +From f3ca4164529b875374c410193bbbac0ee960895f Mon Sep 17 00:00:00 2001 +From: Lan Tianyu +Date: Wed, 26 Feb 2014 21:03:05 +0800 +Subject: ACPI / processor: Rework processor throttling with work_on_cpu() + +From: Lan Tianyu + +commit f3ca4164529b875374c410193bbbac0ee960895f upstream. + +acpi_processor_set_throttling() uses set_cpus_allowed_ptr() to make +sure that the (struct acpi_processor)->acpi_processor_set_throttling() +callback will run on the right CPU. However, the function may be +called from a worker thread already bound to a different CPU in which +case that won't work. + +Make acpi_processor_set_throttling() use work_on_cpu() as appropriate +instead of abusing set_cpus_allowed_ptr(). + +Reported-and-tested-by: Jiri Olsa +Signed-off-by: Lan Tianyu +[rjw: Changelog] +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/acpi/processor_throttling.c | 69 ++++++++++++++++-------------------- + 1 file changed, 32 insertions(+), 37 deletions(-) + +--- a/drivers/acpi/processor_throttling.c ++++ b/drivers/acpi/processor_throttling.c +@@ -59,6 +59,12 @@ struct throttling_tstate { + int target_state; /* target T-state */ + }; + ++struct acpi_processor_throttling_arg { ++ struct acpi_processor *pr; ++ int target_state; ++ bool force; ++}; ++ + #define THROTTLING_PRECHANGE (1) + #define THROTTLING_POSTCHANGE (2) + +@@ -1063,16 +1069,24 @@ static int acpi_processor_set_throttling + return 0; + } + ++static long acpi_processor_throttling_fn(void *data) ++{ ++ struct acpi_processor_throttling_arg *arg = data; ++ struct acpi_processor *pr = arg->pr; ++ ++ return pr->throttling.acpi_processor_set_throttling(pr, ++ arg->target_state, arg->force); ++} ++ + int acpi_processor_set_throttling(struct acpi_processor *pr, + int state, bool force) + { +- cpumask_var_t saved_mask; + int ret = 0; + unsigned int i; + struct acpi_processor *match_pr; + struct acpi_processor_throttling *p_throttling; ++ struct acpi_processor_throttling_arg arg; + struct throttling_tstate t_state; +- cpumask_var_t online_throttling_cpus; + + if (!pr) + return -EINVAL; +@@ -1083,14 +1097,6 @@ int acpi_processor_set_throttling(struct + if ((state < 0) || (state > (pr->throttling.state_count - 1))) + return -EINVAL; + +- if (!alloc_cpumask_var(&saved_mask, GFP_KERNEL)) +- return -ENOMEM; +- +- if (!alloc_cpumask_var(&online_throttling_cpus, GFP_KERNEL)) { +- free_cpumask_var(saved_mask); +- return -ENOMEM; +- } +- + if (cpu_is_offline(pr->id)) { + /* + * the cpu pointed by pr->id is offline. Unnecessary to change +@@ -1099,17 +1105,15 @@ int acpi_processor_set_throttling(struct + return -ENODEV; + } + +- cpumask_copy(saved_mask, ¤t->cpus_allowed); + t_state.target_state = state; + p_throttling = &(pr->throttling); +- cpumask_and(online_throttling_cpus, cpu_online_mask, +- p_throttling->shared_cpu_map); ++ + /* + * The throttling notifier will be called for every + * affected cpu in order to get one proper T-state. + * The notifier event is THROTTLING_PRECHANGE. + */ +- for_each_cpu(i, online_throttling_cpus) { ++ for_each_cpu_and(i, cpu_online_mask, p_throttling->shared_cpu_map) { + t_state.cpu = i; + acpi_processor_throttling_notifier(THROTTLING_PRECHANGE, + &t_state); +@@ -1121,21 +1125,18 @@ int acpi_processor_set_throttling(struct + * it can be called only for the cpu pointed by pr. + */ + if (p_throttling->shared_type == DOMAIN_COORD_TYPE_SW_ANY) { +- /* FIXME: use work_on_cpu() */ +- if (set_cpus_allowed_ptr(current, cpumask_of(pr->id))) { +- /* Can't migrate to the pr->id CPU. Exit */ +- ret = -ENODEV; +- goto exit; +- } +- ret = p_throttling->acpi_processor_set_throttling(pr, +- t_state.target_state, force); ++ arg.pr = pr; ++ arg.target_state = state; ++ arg.force = force; ++ ret = work_on_cpu(pr->id, acpi_processor_throttling_fn, &arg); + } else { + /* + * When the T-state coordination is SW_ALL or HW_ALL, + * it is necessary to set T-state for every affected + * cpus. + */ +- for_each_cpu(i, online_throttling_cpus) { ++ for_each_cpu_and(i, cpu_online_mask, ++ p_throttling->shared_cpu_map) { + match_pr = per_cpu(processors, i); + /* + * If the pointer is invalid, we will report the +@@ -1156,13 +1157,12 @@ int acpi_processor_set_throttling(struct + "on CPU %d\n", i)); + continue; + } +- t_state.cpu = i; +- /* FIXME: use work_on_cpu() */ +- if (set_cpus_allowed_ptr(current, cpumask_of(i))) +- continue; +- ret = match_pr->throttling. +- acpi_processor_set_throttling( +- match_pr, t_state.target_state, force); ++ ++ arg.pr = match_pr; ++ arg.target_state = state; ++ arg.force = force; ++ ret = work_on_cpu(pr->id, acpi_processor_throttling_fn, ++ &arg); + } + } + /* +@@ -1171,17 +1171,12 @@ int acpi_processor_set_throttling(struct + * affected cpu to update the T-states. + * The notifier event is THROTTLING_POSTCHANGE + */ +- for_each_cpu(i, online_throttling_cpus) { ++ for_each_cpu_and(i, cpu_online_mask, p_throttling->shared_cpu_map) { + t_state.cpu = i; + acpi_processor_throttling_notifier(THROTTLING_POSTCHANGE, + &t_state); + } +- /* restore the previous state */ +- /* FIXME: use work_on_cpu() */ +- set_cpus_allowed_ptr(current, saved_mask); +-exit: +- free_cpumask_var(online_throttling_cpus); +- free_cpumask_var(saved_mask); ++ + return ret; + } + diff --git a/queue-3.10/acpi-video-filter-the-_bcl-table-for-duplicate-brightness-values.patch b/queue-3.10/acpi-video-filter-the-_bcl-table-for-duplicate-brightness-values.patch new file mode 100644 index 00000000000..330d552da79 --- /dev/null +++ b/queue-3.10/acpi-video-filter-the-_bcl-table-for-duplicate-brightness-values.patch @@ -0,0 +1,74 @@ +From bd8ba20597f0cfef3ef65c3fd2aa92ab23d4c8e1 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Thu, 13 Feb 2014 16:32:51 +0100 +Subject: ACPI / video: Filter the _BCL table for duplicate brightness values + +From: Hans de Goede + +commit bd8ba20597f0cfef3ef65c3fd2aa92ab23d4c8e1 upstream. + +Some devices have duplicate entries in there brightness levels table, ie +on my Dell Latitude E6430 the table looks like this: + +[ 3.686060] acpi backlight index 0, val 80 +[ 3.686095] acpi backlight index 1, val 50 +[ 3.686122] acpi backlight index 2, val 5 +[ 3.686147] acpi backlight index 3, val 5 +[ 3.686172] acpi backlight index 4, val 5 +[ 3.686197] acpi backlight index 5, val 5 +[ 3.686223] acpi backlight index 6, val 5 +[ 3.686248] acpi backlight index 7, val 5 +[ 3.686273] acpi backlight index 8, val 6 +[ 3.686332] acpi backlight index 9, val 7 +[ 3.686356] acpi backlight index 10, val 8 +[ 3.686380] acpi backlight index 11, val 9 +etc. + +Notice that brightness values 0-5 are all mapped to 5. This means that +if userspace writes any value between 0 and 5 to the brightness sysfs attribute +and then reads it, it will always return 0, which is somewhat unexpected. + +This is a problem for ie gnome-settings-daemon, which uses read-modify-write +logic when the users presses the brightness up or down keys. This is done +this way to take brightness changes from other sources into account. + +On this specific laptop what happens once the brightness has been set to 0, +is that gsd reads 0, adds 5, writes 5, and on the next brightness up key press +again reads 0, so things get stuck at the lowest brightness setting. + +Filtering out the duplicate table entries, makes any write to brightness +read back as the written value as one would expect, fixing this. + +Signed-off-by: Hans de Goede +Reviewed-by: Aaron Lu +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/acpi/video.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +--- a/drivers/acpi/video.c ++++ b/drivers/acpi/video.c +@@ -733,6 +733,7 @@ acpi_video_init_brightness(struct acpi_v + union acpi_object *o; + struct acpi_video_device_brightness *br = NULL; + int result = -EINVAL; ++ u32 value; + + if (!ACPI_SUCCESS(acpi_video_device_lcd_query_levels(device, &obj))) { + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Could not query available " +@@ -763,7 +764,12 @@ acpi_video_init_brightness(struct acpi_v + printk(KERN_ERR PREFIX "Invalid data\n"); + continue; + } +- br->levels[count] = (u32) o->integer.value; ++ value = (u32) o->integer.value; ++ /* Skip duplicate entries */ ++ if (count > 2 && br->levels[count - 1] == value) ++ continue; ++ ++ br->levels[count] = value; + + if (br->levels[count] > max_level) + max_level = br->levels[count]; diff --git a/queue-3.10/i7core_edac-fix-pci-device-reference-count.patch b/queue-3.10/i7core_edac-fix-pci-device-reference-count.patch new file mode 100644 index 00000000000..52e6714d384 --- /dev/null +++ b/queue-3.10/i7core_edac-fix-pci-device-reference-count.patch @@ -0,0 +1,60 @@ +From c0f5eeed0f4cef4f05b74883a7160e7edde58b6a Mon Sep 17 00:00:00 2001 +From: Jean Delvare +Date: Mon, 24 Feb 2014 09:39:27 +0100 +Subject: i7core_edac: Fix PCI device reference count + +From: Jean Delvare + +commit c0f5eeed0f4cef4f05b74883a7160e7edde58b6a upstream. + +The reference count changes done by pci_get_device can be a little +misleading when the usage diverges from the most common scheme. The +reference count of the device passed as the last parameter is always +decreased, even if the function returns no new device. So if we are +going to try alternative device IDs, we must manually increment the +device reference count before each retry. If we don't, we end up +decreasing the reference count, and after a few modprobe/rmmod cycles +the PCI devices will vanish. + +In other words and as Alan put it: without this fix the EDAC code +corrupts the PCI device list. + +This fixes kernel bug #50491: +https://bugzilla.kernel.org/show_bug.cgi?id=50491 + +Signed-off-by: Jean Delvare +Link: http://lkml.kernel.org/r/20140224093927.7659dd9d@endymion.delvare +Reviewed-by: Alan Cox +Cc: Mauro Carvalho Chehab +Cc: Doug Thompson +Signed-off-by: Borislav Petkov +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/edac/i7core_edac.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +--- a/drivers/edac/i7core_edac.c ++++ b/drivers/edac/i7core_edac.c +@@ -1334,14 +1334,19 @@ static int i7core_get_onedevice(struct p + * is at addr 8086:2c40, instead of 8086:2c41. So, we need + * to probe for the alternate address in case of failure + */ +- if (dev_descr->dev_id == PCI_DEVICE_ID_INTEL_I7_NONCORE && !pdev) ++ if (dev_descr->dev_id == PCI_DEVICE_ID_INTEL_I7_NONCORE && !pdev) { ++ pci_dev_get(*prev); /* pci_get_device will put it */ + pdev = pci_get_device(PCI_VENDOR_ID_INTEL, + PCI_DEVICE_ID_INTEL_I7_NONCORE_ALT, *prev); ++ } + +- if (dev_descr->dev_id == PCI_DEVICE_ID_INTEL_LYNNFIELD_NONCORE && !pdev) ++ if (dev_descr->dev_id == PCI_DEVICE_ID_INTEL_LYNNFIELD_NONCORE && ++ !pdev) { ++ pci_dev_get(*prev); /* pci_get_device will put it */ + pdev = pci_get_device(PCI_VENDOR_ID_INTEL, + PCI_DEVICE_ID_INTEL_LYNNFIELD_NONCORE_ALT, + *prev); ++ } + + if (!pdev) { + if (*prev) { diff --git a/queue-3.10/pci-enable-intx-if-bios-left-them-disabled.patch b/queue-3.10/pci-enable-intx-if-bios-left-them-disabled.patch new file mode 100644 index 00000000000..8499530532c --- /dev/null +++ b/queue-3.10/pci-enable-intx-if-bios-left-them-disabled.patch @@ -0,0 +1,54 @@ +From 1f42db786b14a31bf807fc41ee5583a00c08fcb1 Mon Sep 17 00:00:00 2001 +From: Bjorn Helgaas +Date: Fri, 14 Feb 2014 13:48:16 -0700 +Subject: PCI: Enable INTx if BIOS left them disabled + +From: Bjorn Helgaas + +commit 1f42db786b14a31bf807fc41ee5583a00c08fcb1 upstream. + +Some firmware leaves the Interrupt Disable bit set even if the device uses +INTx interrupts. Clear Interrupt Disable so we get those interrupts. + +Based on the report mentioned below, if the user selects the "EHCI only" +option in the Intel Baytrail BIOS, the EHCI device is handed off to the OS +with the PCI_COMMAND_INTX_DISABLE bit set. + +Link: http://lkml.kernel.org/r/20140114181721.GC12126@xanatos +Link: https://bugzilla.kernel.org/show_bug.cgi?id=70601 +Reported-by: Chris Cheng +Reported-and-tested-by: Jamie Chen +Signed-off-by: Bjorn Helgaas +CC: Sarah Sharp +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/pci/pci.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/drivers/pci/pci.c ++++ b/drivers/pci/pci.c +@@ -1119,6 +1119,8 @@ EXPORT_SYMBOL_GPL(pci_load_and_free_save + static int do_pci_enable_device(struct pci_dev *dev, int bars) + { + int err; ++ u16 cmd; ++ u8 pin; + + err = pci_set_power_state(dev, PCI_D0); + if (err < 0 && err != -EIO) +@@ -1128,6 +1130,14 @@ static int do_pci_enable_device(struct p + return err; + pci_fixup_device(pci_fixup_enable, dev); + ++ pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin); ++ if (pin) { ++ pci_read_config_word(dev, PCI_COMMAND, &cmd); ++ if (cmd & PCI_COMMAND_INTX_DISABLE) ++ pci_write_config_word(dev, PCI_COMMAND, ++ cmd & ~PCI_COMMAND_INTX_DISABLE); ++ } ++ + return 0; + } + diff --git a/queue-3.10/series b/queue-3.10/series index 4dfb21df6c9..0500d86a0b7 100644 --- a/queue-3.10/series +++ b/queue-3.10/series @@ -58,3 +58,8 @@ perf-x86-fix-event-scheduling.patch ata-enable-quirk-from-jmicron-jmb350-for-jmb394.patch sata_sil-apply-mod15write-quirk-to-toshiba-mk2561gsyn.patch cpufreq-powernow-k8-initialize-per-cpu-data-structures-properly.patch +pci-enable-intx-if-bios-left-them-disabled.patch +acpi-pci-fix-memory-leak-in-acpi_pci_irq_enable.patch +i7core_edac-fix-pci-device-reference-count.patch +acpi-video-filter-the-_bcl-table-for-duplicate-brightness-values.patch +acpi-processor-rework-processor-throttling-with-work_on_cpu.patch