From de3bbc38f80fd3a8c3944adfedc4ec879124dd1f Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 20 Dec 2010 11:56:48 -0800 Subject: [PATCH] .36 patches --- ...her-dmi-match-entry-for-msi-hardware.patch | 31 +++ ...ca-fix-scope-op-in-module-level-code.patch | 68 +++++ ...memory-leak-on-file-creation-failure.patch | 31 +++ ...r-the-6th-row-of-the-keyboard-matrix.patch | 43 +++ ...e-hpd-irq-in-handler-not-bottom-half.patch | 107 ++++++++ .../pm-runtime-fix-pm_runtime_suspended.patch | 52 ++++ ...ntk-fix-wake_up_klogd-vs-cpu-hotplug.patch | 44 +++ ...ed-cure-more-no_hz-load-average-woes.patch | 259 ++++++++++++++++++ queue-2.6.36/series | 9 + ...at-is-an-integer-constant-expression.patch | 69 +++++ 10 files changed, 713 insertions(+) create mode 100644 queue-2.6.36/acpi-ec-add-another-dmi-match-entry-for-msi-hardware.patch create mode 100644 queue-2.6.36/acpica-fix-scope-op-in-module-level-code.patch create mode 100644 queue-2.6.36/inotify-stop-kernel-memory-leak-on-file-creation-failure.patch create mode 100644 queue-2.6.36/mips-jz4740-qi_lb60-fix-gpio-for-the-6th-row-of-the-keyboard-matrix.patch create mode 100644 queue-2.6.36/nouveau-acknowledge-hpd-irq-in-handler-not-bottom-half.patch create mode 100644 queue-2.6.36/pm-runtime-fix-pm_runtime_suspended.patch create mode 100644 queue-2.6.36/printk-fix-wake_up_klogd-vs-cpu-hotplug.patch create mode 100644 queue-2.6.36/sched-cure-more-no_hz-load-average-woes.patch create mode 100644 queue-2.6.36/xen-provide-a-variant-of-__ring_size-that-is-an-integer-constant-expression.patch diff --git a/queue-2.6.36/acpi-ec-add-another-dmi-match-entry-for-msi-hardware.patch b/queue-2.6.36/acpi-ec-add-another-dmi-match-entry-for-msi-hardware.patch new file mode 100644 index 00000000000..4a78a9654f6 --- /dev/null +++ b/queue-2.6.36/acpi-ec-add-another-dmi-match-entry-for-msi-hardware.patch @@ -0,0 +1,31 @@ +From a5dc4f898c2a0f66e2cefada6c687db82ba2fcbc Mon Sep 17 00:00:00 2001 +From: Alexey Starikovskiy +Date: Thu, 9 Dec 2010 17:07:54 -0500 +Subject: ACPI: EC: Add another dmi match entry for MSI hardware + +From: Alexey Starikovskiy + +commit a5dc4f898c2a0f66e2cefada6c687db82ba2fcbc upstream. + +http://bugzilla.kernel.org/show_bug.cgi?id=15418 + +Signed-off-by: Alexey Starikovskiy +Signed-off-by: Len Brown +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/acpi/ec.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/acpi/ec.c ++++ b/drivers/acpi/ec.c +@@ -929,6 +929,9 @@ static struct dmi_system_id __initdata e + ec_flag_msi, "MSI hardware", { + DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-Star")}, NULL}, + { ++ ec_flag_msi, "MSI hardware", { ++ DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-STAR")}, NULL}, ++ { + ec_validate_ecdt, "ASUS hardware", { + DMI_MATCH(DMI_BIOS_VENDOR, "ASUS") }, NULL}, + {}, diff --git a/queue-2.6.36/acpica-fix-scope-op-in-module-level-code.patch b/queue-2.6.36/acpica-fix-scope-op-in-module-level-code.patch new file mode 100644 index 00000000000..268796ce827 --- /dev/null +++ b/queue-2.6.36/acpica-fix-scope-op-in-module-level-code.patch @@ -0,0 +1,68 @@ +From 8df3fc981dc12d9fdcaef4100a2193b605024d7a Mon Sep 17 00:00:00 2001 +From: Bob Moore +Date: Sat, 23 Oct 2010 01:36:40 -0400 +Subject: ACPICA: Fix Scope() op in module level code + +From: Bob Moore + +commit 8df3fc981dc12d9fdcaef4100a2193b605024d7a upstream. + +Some Panasonic Toughbooks create nodes in module level code. +Module level code is the executable AML code outside of control method, +for example, below AML code creates a node \_SB.PCI0.GFX0.DD02.CUBL + + If (\_OSI ("Windows 2006")) + { + Scope (\_SB.PCI0.GFX0.DD02) + { + Name (CUBL, Ones) + ... + } + } + +Scope() op does not actually create a new object, it refers to an +existing object(\_SB.PCI0.GFX0.DD02 in above example). However, for +Scope(), we want to indeed open a new scope, so the child nodes(CUBL in +above example) can be created correctly under it. + +https://bugzilla.kernel.org/show_bug.cgi?id=19462 + +Signed-off-by: Bob Moore +Signed-off-by: Lin Ming +Signed-off-by: Len Brown +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/acpi/acpica/dswexec.c | 19 +++++++++++++++++-- + 1 file changed, 17 insertions(+), 2 deletions(-) + +--- a/drivers/acpi/acpica/dswexec.c ++++ b/drivers/acpi/acpica/dswexec.c +@@ -300,10 +300,25 @@ acpi_ds_exec_begin_op(struct acpi_walk_s + * we must enter this object into the namespace. The created + * object is temporary and will be deleted upon completion of + * the execution of this method. ++ * ++ * Note 10/2010: Except for the Scope() op. This opcode does ++ * not actually create a new object, it refers to an existing ++ * object. However, for Scope(), we want to indeed open a ++ * new scope. + */ +- status = acpi_ds_load2_begin_op(walk_state, NULL); ++ if (op->common.aml_opcode != AML_SCOPE_OP) { ++ status = ++ acpi_ds_load2_begin_op(walk_state, NULL); ++ } else { ++ status = ++ acpi_ds_scope_stack_push(op->named.node, ++ op->named.node-> ++ type, walk_state); ++ if (ACPI_FAILURE(status)) { ++ return_ACPI_STATUS(status); ++ } ++ } + } +- + break; + + case AML_CLASS_EXECUTE: diff --git a/queue-2.6.36/inotify-stop-kernel-memory-leak-on-file-creation-failure.patch b/queue-2.6.36/inotify-stop-kernel-memory-leak-on-file-creation-failure.patch new file mode 100644 index 00000000000..f401887bf15 --- /dev/null +++ b/queue-2.6.36/inotify-stop-kernel-memory-leak-on-file-creation-failure.patch @@ -0,0 +1,31 @@ +From a2ae4cc9a16e211c8a128ba10d22a85431f093ab Mon Sep 17 00:00:00 2001 +From: Eric Paris +Date: Tue, 23 Nov 2010 18:18:37 -0500 +Subject: inotify: stop kernel memory leak on file creation failure + +From: Eric Paris + +commit a2ae4cc9a16e211c8a128ba10d22a85431f093ab upstream. + +If inotify_init is unable to allocate a new file for the new inotify +group we leak the new group. This patch drops the reference on the +group on file allocation failure. + +Reported-by: Vegard Nossum +Signed-off-by: Eric Paris +Signed-off-by: Greg Kroah-Hartman + +--- + fs/notify/inotify/inotify_user.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/fs/notify/inotify/inotify_user.c ++++ b/fs/notify/inotify/inotify_user.c +@@ -751,6 +751,7 @@ SYSCALL_DEFINE1(inotify_init1, int, flag + if (ret >= 0) + return ret; + ++ fsnotify_put_group(group); + atomic_dec(&user->inotify_devs); + out_free_uid: + free_uid(user); diff --git a/queue-2.6.36/mips-jz4740-qi_lb60-fix-gpio-for-the-6th-row-of-the-keyboard-matrix.patch b/queue-2.6.36/mips-jz4740-qi_lb60-fix-gpio-for-the-6th-row-of-the-keyboard-matrix.patch new file mode 100644 index 00000000000..337b8339e74 --- /dev/null +++ b/queue-2.6.36/mips-jz4740-qi_lb60-fix-gpio-for-the-6th-row-of-the-keyboard-matrix.patch @@ -0,0 +1,43 @@ +From fe749aab1d21cbb4d87527a7df8799583c233496 Mon Sep 17 00:00:00 2001 +From: Lars-Peter Clausen +Date: Thu, 4 Nov 2010 23:25:56 +0100 +Subject: MIPS: jz4740: qi_lb60: Fix gpio for the 6th row of the keyboard matrix + +From: Lars-Peter Clausen + +commit fe749aab1d21cbb4d87527a7df8799583c233496 upstream. + +This patch fixes the gpio number for the 6th row of the keyboard matrix. + +(And fixes a typo in my name...) + +Signed-off-by: Lars-Peter Clausen +Cc: linux-mips@linux-mips.org +Signed-off-by: https://patchwork.linux-mips.org/patch/1754/ +Signed-off-by: Ralf Baechle +Signed-off-by: Greg Kroah-Hartman + +--- + arch/mips/jz4740/board-qi_lb60.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/arch/mips/jz4740/board-qi_lb60.c ++++ b/arch/mips/jz4740/board-qi_lb60.c +@@ -5,7 +5,7 @@ + * + * Copyright (c) 2009 Qi Hardware inc., + * Author: Xiangfu Liu +- * Copyright 2010, Lars-Petrer Clausen ++ * Copyright 2010, Lars-Peter Clausen + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 or later +@@ -235,7 +235,7 @@ static const unsigned int qi_lb60_keypad + QI_LB60_GPIO_KEYIN(3), + QI_LB60_GPIO_KEYIN(4), + QI_LB60_GPIO_KEYIN(5), +- QI_LB60_GPIO_KEYIN(7), ++ QI_LB60_GPIO_KEYIN(6), + QI_LB60_GPIO_KEYIN8, + }; + diff --git a/queue-2.6.36/nouveau-acknowledge-hpd-irq-in-handler-not-bottom-half.patch b/queue-2.6.36/nouveau-acknowledge-hpd-irq-in-handler-not-bottom-half.patch new file mode 100644 index 00000000000..98d01b3fa82 --- /dev/null +++ b/queue-2.6.36/nouveau-acknowledge-hpd-irq-in-handler-not-bottom-half.patch @@ -0,0 +1,107 @@ +From ab838338a2a9e0cb8346eb0cab9977be13e8dce5 Mon Sep 17 00:00:00 2001 +From: Andy Lutomirski +Date: Tue, 16 Nov 2010 18:40:52 -0500 +Subject: nouveau: Acknowledge HPD irq in handler, not bottom half + +From: Andy Lutomirski + +commit ab838338a2a9e0cb8346eb0cab9977be13e8dce5 upstream. + +The old code generated an interrupt storm bad enough to completely +take down my system. + +Signed-off-by: Andy Lutomirski +Signed-off-by: Ben Skeggs +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/nouveau/nouveau_drv.h | 6 +++++ + drivers/gpu/drm/nouveau/nouveau_irq.c | 1 + drivers/gpu/drm/nouveau/nv50_display.c | 35 ++++++++++++++++++++++++--------- + 3 files changed, 33 insertions(+), 9 deletions(-) + +--- a/drivers/gpu/drm/nouveau/nouveau_drv.h ++++ b/drivers/gpu/drm/nouveau/nouveau_drv.h +@@ -531,6 +531,12 @@ struct drm_nouveau_private { + struct work_struct irq_work; + struct work_struct hpd_work; + ++ struct { ++ spinlock_t lock; ++ uint32_t hpd0_bits; ++ uint32_t hpd1_bits; ++ } hpd_state; ++ + struct list_head vbl_waiting; + + struct { +--- a/drivers/gpu/drm/nouveau/nouveau_irq.c ++++ b/drivers/gpu/drm/nouveau/nouveau_irq.c +@@ -52,6 +52,7 @@ nouveau_irq_preinstall(struct drm_device + if (dev_priv->card_type >= NV_50) { + INIT_WORK(&dev_priv->irq_work, nv50_display_irq_handler_bh); + INIT_WORK(&dev_priv->hpd_work, nv50_display_irq_hotplug_bh); ++ spin_lock_init(&dev_priv->hpd_state.lock); + INIT_LIST_HEAD(&dev_priv->vbl_waiting); + } + } +--- a/drivers/gpu/drm/nouveau/nv50_display.c ++++ b/drivers/gpu/drm/nouveau/nv50_display.c +@@ -1012,11 +1012,18 @@ nv50_display_irq_hotplug_bh(struct work_ + struct drm_connector *connector; + const uint32_t gpio_reg[4] = { 0xe104, 0xe108, 0xe280, 0xe284 }; + uint32_t unplug_mask, plug_mask, change_mask; +- uint32_t hpd0, hpd1 = 0; ++ uint32_t hpd0, hpd1; + +- hpd0 = nv_rd32(dev, 0xe054) & nv_rd32(dev, 0xe050); ++ spin_lock_irq(&dev_priv->hpd_state.lock); ++ hpd0 = dev_priv->hpd_state.hpd0_bits; ++ dev_priv->hpd_state.hpd0_bits = 0; ++ hpd1 = dev_priv->hpd_state.hpd1_bits; ++ dev_priv->hpd_state.hpd1_bits = 0; ++ spin_unlock_irq(&dev_priv->hpd_state.lock); ++ ++ hpd0 &= nv_rd32(dev, 0xe050); + if (dev_priv->chipset >= 0x90) +- hpd1 = nv_rd32(dev, 0xe074) & nv_rd32(dev, 0xe070); ++ hpd1 &= nv_rd32(dev, 0xe070); + + plug_mask = (hpd0 & 0x0000ffff) | (hpd1 << 16); + unplug_mask = (hpd0 >> 16) | (hpd1 & 0xffff0000); +@@ -1058,10 +1065,6 @@ nv50_display_irq_hotplug_bh(struct work_ + helper->dpms(connector->encoder, DRM_MODE_DPMS_OFF); + } + +- nv_wr32(dev, 0xe054, nv_rd32(dev, 0xe054)); +- if (dev_priv->chipset >= 0x90) +- nv_wr32(dev, 0xe074, nv_rd32(dev, 0xe074)); +- + drm_helper_hpd_irq_event(dev); + } + +@@ -1072,8 +1075,22 @@ nv50_display_irq_handler(struct drm_devi + uint32_t delayed = 0; + + if (nv_rd32(dev, NV50_PMC_INTR_0) & NV50_PMC_INTR_0_HOTPLUG) { +- if (!work_pending(&dev_priv->hpd_work)) +- queue_work(dev_priv->wq, &dev_priv->hpd_work); ++ uint32_t hpd0_bits, hpd1_bits = 0; ++ ++ hpd0_bits = nv_rd32(dev, 0xe054); ++ nv_wr32(dev, 0xe054, hpd0_bits); ++ ++ if (dev_priv->chipset >= 0x90) { ++ hpd1_bits = nv_rd32(dev, 0xe074); ++ nv_wr32(dev, 0xe074, hpd1_bits); ++ } ++ ++ spin_lock(&dev_priv->hpd_state.lock); ++ dev_priv->hpd_state.hpd0_bits |= hpd0_bits; ++ dev_priv->hpd_state.hpd1_bits |= hpd1_bits; ++ spin_unlock(&dev_priv->hpd_state.lock); ++ ++ queue_work(dev_priv->wq, &dev_priv->hpd_work); + } + + while (nv_rd32(dev, NV50_PMC_INTR_0) & NV50_PMC_INTR_0_DISPLAY) { diff --git a/queue-2.6.36/pm-runtime-fix-pm_runtime_suspended.patch b/queue-2.6.36/pm-runtime-fix-pm_runtime_suspended.patch new file mode 100644 index 00000000000..8968a8e02f7 --- /dev/null +++ b/queue-2.6.36/pm-runtime-fix-pm_runtime_suspended.patch @@ -0,0 +1,52 @@ +From f08f5a0add20834d3f3d876dfe08005a5df656db Mon Sep 17 00:00:00 2001 +From: Rafael J. Wysocki +Date: Thu, 16 Dec 2010 17:11:58 +0100 +Subject: PM / Runtime: Fix pm_runtime_suspended() + +From: Rafael J. Wysocki + +commit f08f5a0add20834d3f3d876dfe08005a5df656db upstream. + +There are some situations (e.g. in __pm_generic_call()), where +pm_runtime_suspended() is used to decide whether or not to execute +a device's (system) ->suspend() callback. The callback is not +executed if pm_runtime_suspended() returns true, but it does so +for devices that don't even support runtime PM, because the +power.disable_depth device field is ignored by it. This leads to +problems (i.e. devices are not suspened when they should), so rework +pm_runtime_suspended() so that it returns false if the device's +power.disable_depth field is different from zero. + +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Greg Kroah-Hartman + +--- + Documentation/power/runtime_pm.txt | 4 ++-- + include/linux/pm_runtime.h | 3 ++- + 2 files changed, 4 insertions(+), 3 deletions(-) + +--- a/Documentation/power/runtime_pm.txt ++++ b/Documentation/power/runtime_pm.txt +@@ -336,8 +336,8 @@ drivers/base/power/runtime.c and include + zero) + + bool pm_runtime_suspended(struct device *dev); +- - return true if the device's runtime PM status is 'suspended', or false +- otherwise ++ - return true if the device's runtime PM status is 'suspended' and its ++ 'power.disable_depth' field is equal to zero, or false otherwise + + void pm_runtime_allow(struct device *dev); + - set the power.runtime_auto flag for the device and decrease its usage +--- a/include/linux/pm_runtime.h ++++ b/include/linux/pm_runtime.h +@@ -67,7 +67,8 @@ static inline void device_set_run_wake(s + + static inline bool pm_runtime_suspended(struct device *dev) + { +- return dev->power.runtime_status == RPM_SUSPENDED; ++ return dev->power.runtime_status == RPM_SUSPENDED ++ && !dev->power.disable_depth; + } + + #else /* !CONFIG_PM_RUNTIME */ diff --git a/queue-2.6.36/printk-fix-wake_up_klogd-vs-cpu-hotplug.patch b/queue-2.6.36/printk-fix-wake_up_klogd-vs-cpu-hotplug.patch new file mode 100644 index 00000000000..745ae6b1ca9 --- /dev/null +++ b/queue-2.6.36/printk-fix-wake_up_klogd-vs-cpu-hotplug.patch @@ -0,0 +1,44 @@ +From 49f4138346b3cec2706adff02658fe27ceb1e46f Mon Sep 17 00:00:00 2001 +From: Heiko Carstens +Date: Fri, 26 Nov 2010 13:42:47 +0100 +Subject: printk: Fix wake_up_klogd() vs cpu hotplug + +From: Heiko Carstens + +commit 49f4138346b3cec2706adff02658fe27ceb1e46f upstream. + +wake_up_klogd() may get called from preemptible context but uses +__raw_get_cpu_var() to write to a per cpu variable. If it gets preempted +between getting the address and writing to it, the cpu in question could be +offline if the process gets scheduled back and hence writes to the per cpu data +of an offline cpu. + +This buggy behaviour was introduced with fa33507a "printk: robustify +printk, fix #2" which was supposed to fix a "using smp_processor_id() in +preemptible" warning. + +Let's use this_cpu_write() instead which disables preemption and makes sure +that the outlined scenario cannot happen. + +Signed-off-by: Heiko Carstens +Acked-by: Eric Dumazet +Signed-off-by: Peter Zijlstra +LKML-Reference: <20101126124247.GC7023@osiris.boeblingen.de.ibm.com> +Signed-off-by: Ingo Molnar +Signed-off-by: Greg Kroah-Hartman + +--- + kernel/printk.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/kernel/printk.c ++++ b/kernel/printk.c +@@ -1070,7 +1070,7 @@ int printk_needs_cpu(int cpu) + void wake_up_klogd(void) + { + if (waitqueue_active(&log_wait)) +- __raw_get_cpu_var(printk_pending) = 1; ++ this_cpu_write(printk_pending, 1); + } + + /** diff --git a/queue-2.6.36/sched-cure-more-no_hz-load-average-woes.patch b/queue-2.6.36/sched-cure-more-no_hz-load-average-woes.patch new file mode 100644 index 00000000000..b4b4a5d4fb2 --- /dev/null +++ b/queue-2.6.36/sched-cure-more-no_hz-load-average-woes.patch @@ -0,0 +1,259 @@ +From 0f004f5a696a9434b7214d0d3cbd0525ee77d428 Mon Sep 17 00:00:00 2001 +From: Peter Zijlstra +Date: Tue, 30 Nov 2010 19:48:45 +0100 +Subject: sched: Cure more NO_HZ load average woes + +From: Peter Zijlstra + +commit 0f004f5a696a9434b7214d0d3cbd0525ee77d428 upstream. + +There's a long-running regression that proved difficult to fix and +which is hitting certain people and is rather annoying in its effects. + +Damien reported that after 74f5187ac8 (sched: Cure load average vs +NO_HZ woes) his load average is unnaturally high, he also noted that +even with that patch reverted the load avgerage numbers are not +correct. + +The problem is that the previous patch only solved half the NO_HZ +problem, it addressed the part of going into NO_HZ mode, not of +comming out of NO_HZ mode. This patch implements that missing half. + +When comming out of NO_HZ mode there are two important things to take +care of: + + - Folding the pending idle delta into the global active count. + - Correctly aging the averages for the idle-duration. + +So with this patch the NO_HZ interaction should be complete and +behaviour between CONFIG_NO_HZ=[yn] should be equivalent. + +Furthermore, this patch slightly changes the load average computation +by adding a rounding term to the fixed point multiplication. + +Reported-by: Damien Wyart +Reported-by: Tim McGrath +Tested-by: Damien Wyart +Tested-by: Orion Poplawski +Tested-by: Kyle McMartin +Signed-off-by: Peter Zijlstra +Cc: Chase Douglas +LKML-Reference: <1291129145.32004.874.camel@laptop> +Signed-off-by: Ingo Molnar +Signed-off-by: Greg Kroah-Hartman + +--- + include/linux/sched.h | 2 + kernel/sched.c | 150 ++++++++++++++++++++++++++++++++++++++++++++++---- + kernel/timer.c | 2 + 3 files changed, 141 insertions(+), 13 deletions(-) + +--- a/include/linux/sched.h ++++ b/include/linux/sched.h +@@ -143,7 +143,7 @@ extern unsigned long nr_iowait_cpu(int c + extern unsigned long this_cpu_load(void); + + +-extern void calc_global_load(void); ++extern void calc_global_load(unsigned long ticks); + + extern unsigned long get_parent_ip(unsigned long addr); + +--- a/kernel/sched.c ++++ b/kernel/sched.c +@@ -2967,6 +2967,15 @@ static long calc_load_fold_active(struct + return delta; + } + ++static unsigned long ++calc_load(unsigned long load, unsigned long exp, unsigned long active) ++{ ++ load *= exp; ++ load += active * (FIXED_1 - exp); ++ load += 1UL << (FSHIFT - 1); ++ return load >> FSHIFT; ++} ++ + #ifdef CONFIG_NO_HZ + /* + * For NO_HZ we delay the active fold to the next LOAD_FREQ update. +@@ -2996,6 +3005,128 @@ static long calc_load_fold_idle(void) + + return delta; + } ++ ++/** ++ * fixed_power_int - compute: x^n, in O(log n) time ++ * ++ * @x: base of the power ++ * @frac_bits: fractional bits of @x ++ * @n: power to raise @x to. ++ * ++ * By exploiting the relation between the definition of the natural power ++ * function: x^n := x*x*...*x (x multiplied by itself for n times), and ++ * the binary encoding of numbers used by computers: n := \Sum n_i * 2^i, ++ * (where: n_i \elem {0, 1}, the binary vector representing n), ++ * we find: x^n := x^(\Sum n_i * 2^i) := \Prod x^(n_i * 2^i), which is ++ * of course trivially computable in O(log_2 n), the length of our binary ++ * vector. ++ */ ++static unsigned long ++fixed_power_int(unsigned long x, unsigned int frac_bits, unsigned int n) ++{ ++ unsigned long result = 1UL << frac_bits; ++ ++ if (n) for (;;) { ++ if (n & 1) { ++ result *= x; ++ result += 1UL << (frac_bits - 1); ++ result >>= frac_bits; ++ } ++ n >>= 1; ++ if (!n) ++ break; ++ x *= x; ++ x += 1UL << (frac_bits - 1); ++ x >>= frac_bits; ++ } ++ ++ return result; ++} ++ ++/* ++ * a1 = a0 * e + a * (1 - e) ++ * ++ * a2 = a1 * e + a * (1 - e) ++ * = (a0 * e + a * (1 - e)) * e + a * (1 - e) ++ * = a0 * e^2 + a * (1 - e) * (1 + e) ++ * ++ * a3 = a2 * e + a * (1 - e) ++ * = (a0 * e^2 + a * (1 - e) * (1 + e)) * e + a * (1 - e) ++ * = a0 * e^3 + a * (1 - e) * (1 + e + e^2) ++ * ++ * ... ++ * ++ * an = a0 * e^n + a * (1 - e) * (1 + e + ... + e^n-1) [1] ++ * = a0 * e^n + a * (1 - e) * (1 - e^n)/(1 - e) ++ * = a0 * e^n + a * (1 - e^n) ++ * ++ * [1] application of the geometric series: ++ * ++ * n 1 - x^(n+1) ++ * S_n := \Sum x^i = ------------- ++ * i=0 1 - x ++ */ ++static unsigned long ++calc_load_n(unsigned long load, unsigned long exp, ++ unsigned long active, unsigned int n) ++{ ++ ++ return calc_load(load, fixed_power_int(exp, FSHIFT, n), active); ++} ++ ++/* ++ * NO_HZ can leave us missing all per-cpu ticks calling ++ * calc_load_account_active(), but since an idle CPU folds its delta into ++ * calc_load_tasks_idle per calc_load_account_idle(), all we need to do is fold ++ * in the pending idle delta if our idle period crossed a load cycle boundary. ++ * ++ * Once we've updated the global active value, we need to apply the exponential ++ * weights adjusted to the number of cycles missed. ++ */ ++static void calc_global_nohz(unsigned long ticks) ++{ ++ long delta, active, n; ++ ++ if (time_before(jiffies, calc_load_update)) ++ return; ++ ++ /* ++ * If we crossed a calc_load_update boundary, make sure to fold ++ * any pending idle changes, the respective CPUs might have ++ * missed the tick driven calc_load_account_active() update ++ * due to NO_HZ. ++ */ ++ delta = calc_load_fold_idle(); ++ if (delta) ++ atomic_long_add(delta, &calc_load_tasks); ++ ++ /* ++ * If we were idle for multiple load cycles, apply them. ++ */ ++ if (ticks >= LOAD_FREQ) { ++ n = ticks / LOAD_FREQ; ++ ++ active = atomic_long_read(&calc_load_tasks); ++ active = active > 0 ? active * FIXED_1 : 0; ++ ++ avenrun[0] = calc_load_n(avenrun[0], EXP_1, active, n); ++ avenrun[1] = calc_load_n(avenrun[1], EXP_5, active, n); ++ avenrun[2] = calc_load_n(avenrun[2], EXP_15, active, n); ++ ++ calc_load_update += n * LOAD_FREQ; ++ } ++ ++ /* ++ * Its possible the remainder of the above division also crosses ++ * a LOAD_FREQ period, the regular check in calc_global_load() ++ * which comes after this will take care of that. ++ * ++ * Consider us being 11 ticks before a cycle completion, and us ++ * sleeping for 4*LOAD_FREQ + 22 ticks, then the above code will ++ * age us 4 cycles, and the test in calc_global_load() will ++ * pick up the final one. ++ */ ++} + #else + static void calc_load_account_idle(struct rq *this_rq) + { +@@ -3005,6 +3136,10 @@ static inline long calc_load_fold_idle(v + { + return 0; + } ++ ++static void calc_global_nohz(unsigned long ticks) ++{ ++} + #endif + + /** +@@ -3022,24 +3157,17 @@ void get_avenrun(unsigned long *loads, u + loads[2] = (avenrun[2] + offset) << shift; + } + +-static unsigned long +-calc_load(unsigned long load, unsigned long exp, unsigned long active) +-{ +- load *= exp; +- load += active * (FIXED_1 - exp); +- return load >> FSHIFT; +-} +- + /* + * calc_load - update the avenrun load estimates 10 ticks after the + * CPUs have updated calc_load_tasks. + */ +-void calc_global_load(void) ++void calc_global_load(unsigned long ticks) + { +- unsigned long upd = calc_load_update + 10; + long active; + +- if (time_before(jiffies, upd)) ++ calc_global_nohz(ticks); ++ ++ if (time_before(jiffies, calc_load_update + 10)) + return; + + active = atomic_long_read(&calc_load_tasks); +--- a/kernel/timer.c ++++ b/kernel/timer.c +@@ -1322,7 +1322,7 @@ void do_timer(unsigned long ticks) + { + jiffies_64 += ticks; + update_wall_time(); +- calc_global_load(); ++ calc_global_load(ticks); + } + + #ifdef __ARCH_WANT_SYS_ALARM diff --git a/queue-2.6.36/series b/queue-2.6.36/series index 9bec671cbc0..746eca4d0bb 100644 --- a/queue-2.6.36/series +++ b/queue-2.6.36/series @@ -77,3 +77,12 @@ net-fix-header-size-check-for-gso-case-in-recvmsg-af_packet.patch net-fix-skb_defer_rx_timestamp.patch net-packet-fix-information-leak-to-userland.patch pppoe.c-fix-kernel-panic-caused-by-__pppoe_xmit.patch +acpica-fix-scope-op-in-module-level-code.patch +nouveau-acknowledge-hpd-irq-in-handler-not-bottom-half.patch +printk-fix-wake_up_klogd-vs-cpu-hotplug.patch +xen-provide-a-variant-of-__ring_size-that-is-an-integer-constant-expression.patch +sched-cure-more-no_hz-load-average-woes.patch +acpi-ec-add-another-dmi-match-entry-for-msi-hardware.patch +mips-jz4740-qi_lb60-fix-gpio-for-the-6th-row-of-the-keyboard-matrix.patch +pm-runtime-fix-pm_runtime_suspended.patch +inotify-stop-kernel-memory-leak-on-file-creation-failure.patch diff --git a/queue-2.6.36/xen-provide-a-variant-of-__ring_size-that-is-an-integer-constant-expression.patch b/queue-2.6.36/xen-provide-a-variant-of-__ring_size-that-is-an-integer-constant-expression.patch new file mode 100644 index 00000000000..bb33ec3751b --- /dev/null +++ b/queue-2.6.36/xen-provide-a-variant-of-__ring_size-that-is-an-integer-constant-expression.patch @@ -0,0 +1,69 @@ +From 667c78afaec0ac500908e191e8f236e9578d7b1f Mon Sep 17 00:00:00 2001 +From: Jeremy Fitzhardinge +Date: Wed, 8 Dec 2010 12:39:12 -0800 +Subject: xen: Provide a variant of __RING_SIZE() that is an integer constant expression + +From: Jeremy Fitzhardinge + +commit 667c78afaec0ac500908e191e8f236e9578d7b1f upstream. + +Without this, gcc 4.5 won't compile xen-netfront and xen-blkfront, where +this is being used to specify array sizes. + +Signed-off-by: Jan Beulich +Signed-off-by: Jeremy Fitzhardinge +Cc: Jens Axboe +Cc: David Miller +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/block/xen-blkfront.c | 2 +- + drivers/net/xen-netfront.c | 4 ++-- + include/xen/interface/io/ring.h | 11 +++++++++-- + 3 files changed, 12 insertions(+), 5 deletions(-) + +--- a/drivers/block/xen-blkfront.c ++++ b/drivers/block/xen-blkfront.c +@@ -71,7 +71,7 @@ struct blk_shadow { + + static const struct block_device_operations xlvbd_block_fops; + +-#define BLK_RING_SIZE __RING_SIZE((struct blkif_sring *)0, PAGE_SIZE) ++#define BLK_RING_SIZE __CONST_RING_SIZE(blkif, PAGE_SIZE) + + /* + * We have one of these per vbd, whether ide, scsi or 'other'. They +--- a/drivers/net/xen-netfront.c ++++ b/drivers/net/xen-netfront.c +@@ -66,8 +66,8 @@ struct netfront_cb { + + #define GRANT_INVALID_REF 0 + +-#define NET_TX_RING_SIZE __RING_SIZE((struct xen_netif_tx_sring *)0, PAGE_SIZE) +-#define NET_RX_RING_SIZE __RING_SIZE((struct xen_netif_rx_sring *)0, PAGE_SIZE) ++#define NET_TX_RING_SIZE __CONST_RING_SIZE(xen_netif_tx, PAGE_SIZE) ++#define NET_RX_RING_SIZE __CONST_RING_SIZE(xen_netif_rx, PAGE_SIZE) + #define TX_MAX_TARGET min_t(int, NET_RX_RING_SIZE, 256) + + struct netfront_info { +--- a/include/xen/interface/io/ring.h ++++ b/include/xen/interface/io/ring.h +@@ -24,8 +24,15 @@ typedef unsigned int RING_IDX; + * A ring contains as many entries as will fit, rounded down to the nearest + * power of two (so we can mask with (size-1) to loop around). + */ +-#define __RING_SIZE(_s, _sz) \ +- (__RD32(((_sz) - (long)&(_s)->ring + (long)(_s)) / sizeof((_s)->ring[0]))) ++#define __CONST_RING_SIZE(_s, _sz) \ ++ (__RD32(((_sz) - offsetof(struct _s##_sring, ring)) / \ ++ sizeof(((struct _s##_sring *)0)->ring[0]))) ++ ++/* ++ * The same for passing in an actual pointer instead of a name tag. ++ */ ++#define __RING_SIZE(_s, _sz) \ ++ (__RD32(((_sz) - (long)&(_s)->ring + (long)(_s)) / sizeof((_s)->ring[0]))) + + /* + * Macros to make the correct C datatypes for a new kind of ring. -- 2.47.3