From 62f38666d152eaf1e073c4f1d79565d5df4ad633 Mon Sep 17 00:00:00 2001 From: Chris Wright Date: Thu, 17 May 2007 14:15:33 -0700 Subject: [PATCH] queue up a few more patches to queue-2.6.21 --- ...orrect-revision-mask-for-powernow-k8.patch | 43 +++++++ ...-fix-mhz-rounding-issue-with-perflib.patch | 118 ++++++++++++++++++ ...y-copy-addresses-in-sctp_copy_laddrs.patch | 70 +++++++++++ queue-2.6.21/series | 4 + .../support-rev-h-amd64s-in-powernow-k8.patch | 38 ++++++ 5 files changed, 273 insertions(+) create mode 100644 queue-2.6.21/correct-revision-mask-for-powernow-k8.patch create mode 100644 queue-2.6.21/cpufreq-powernow-k7-fix-mhz-rounding-issue-with-perflib.patch create mode 100644 queue-2.6.21/sctp-correctly-copy-addresses-in-sctp_copy_laddrs.patch create mode 100644 queue-2.6.21/support-rev-h-amd64s-in-powernow-k8.patch diff --git a/queue-2.6.21/correct-revision-mask-for-powernow-k8.patch b/queue-2.6.21/correct-revision-mask-for-powernow-k8.patch new file mode 100644 index 00000000000..c069c8bf37d --- /dev/null +++ b/queue-2.6.21/correct-revision-mask-for-powernow-k8.patch @@ -0,0 +1,43 @@ +From 99fbe1ac217e8b9d4141504e879327cb4e42d4ff Mon Sep 17 00:00:00 2001 +From: Dave Jones +Date: Mon, 14 May 2007 18:27:29 -0400 +Subject: CPUFREQ: Correct revision mask for powernow-k8 + +Mark Langsdorf points out that the correct define for this +revision bump is 0x80000. Also to save us having to keep +renaming the #define, give it a more meaningful name. + +Signed-off-by: Dave Jones +Signed-off-by: Chris Wright +--- + arch/i386/kernel/cpu/cpufreq/powernow-k8.c | 2 +- + arch/i386/kernel/cpu/cpufreq/powernow-k8.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c +index 5c715f1..4ade55c 100644 +--- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c ++++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c +@@ -521,7 +521,7 @@ static int check_supported_cpu(unsigned int cpu) + + if ((eax & CPUID_XFAM) == CPUID_XFAM_K8) { + if (((eax & CPUID_USE_XFAM_XMOD) != CPUID_USE_XFAM_XMOD) || +- ((eax & CPUID_XMOD) > CPUID_XMOD_REV_H)) { ++ ((eax & CPUID_XMOD) > CPUID_XMOD_REV_MASK)) { + printk(KERN_INFO PFX "Processor cpuid %x not supported\n", eax); + goto out; + } +diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h +index ae2d9da..b06c812 100644 +--- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h ++++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h +@@ -46,7 +46,7 @@ struct powernow_k8_data { + #define CPUID_XFAM 0x0ff00000 /* extended family */ + #define CPUID_XFAM_K8 0 + #define CPUID_XMOD 0x000f0000 /* extended model */ +-#define CPUID_XMOD_REV_H 0x00070000 ++#define CPUID_XMOD_REV_MASK 0x00080000 + #define CPUID_XFAM_10H 0x00100000 /* family 0x10 */ + #define CPUID_USE_XFAM_XMOD 0x00000f00 + #define CPUID_GET_MAX_CAPABILITIES 0x80000000 + diff --git a/queue-2.6.21/cpufreq-powernow-k7-fix-mhz-rounding-issue-with-perflib.patch b/queue-2.6.21/cpufreq-powernow-k7-fix-mhz-rounding-issue-with-perflib.patch new file mode 100644 index 00000000000..6f2d673066f --- /dev/null +++ b/queue-2.6.21/cpufreq-powernow-k7-fix-mhz-rounding-issue-with-perflib.patch @@ -0,0 +1,118 @@ +From stable-bounces@linux.kernel.org Thu May 17 13:43:35 2007 +Date: Tue, 15 May 2007 19:59:03 GMT +Message-Id: <200705151959.l4FJx3wR025926@hera.kernel.org> +From: Linux Kernel Mailing List +To: stable@kernel.org +Resent-From: davej@redhat.com +Subject: CPUFREQ: powernow-k7: fix MHz rounding issue with perflib + +From: Daniel Drake + +When the PST tables are broken, powernow-k7 uses ACPI's processor_perflib to +deduce the available frequency multipliers from the _PSS tables. + +Upon frequency change, processor_perflib performs some verification on the +frequency (checks that it's within allowable bounds). + +powernow-k7 deals with absolute frequencies in KHz, whereas perflib only +deals with MHz values. When performing the above verification, perflib +multiplies the MHz values by 1000 to obtain the KHz value. + +We then end up with situations like the following: + - powernow-k7 multiplies the multiplier by the FSB, and obtains a value + such as 1266768 KHz + - perflib belives the same state has frequency of 1266 MHz + - acpi_processor_ppc_notifier calls cpufreq_verify_within_limits to verify + that 1266768 is in the allowable range of 0 to 1266000 (i.e. 1266 * 1000) + - it's not, so that frequency is rejected + - the maximum CPU frequency is not reachable + +This patch solves the problem by rounding up the MHz values stored in perflib's +tables. Additionally it corrects a broken URL. + +It also fixes http://bugzilla.kernel.org/show_bug.cgi?id=8255 although this +case is a bit different: the frequencies in the _PSS tables are wildly wrong, +but we get better results if we force ACPI to respect the fsb * multiplier +calculations (even though it seems that the multiplier values aren't entirely +correct either). + +Signed-off-by: Daniel Drake +Signed-off-by: Dave Jones +Signed-off-by: Chris Wright +--- + + arch/i386/kernel/cpu/cpufreq/powernow-k7.c | 36 ++++++++++++++++++++++------- + 1 file changed, 28 insertions(+), 8 deletions(-) + +--- linux-2.6.21.1.orig/arch/i386/kernel/cpu/cpufreq/powernow-k7.c ++++ linux-2.6.21.1/arch/i386/kernel/cpu/cpufreq/powernow-k7.c +@@ -341,15 +341,17 @@ static int powernow_acpi_init(void) + pc.val = (unsigned long) acpi_processor_perf->states[0].control; + for (i = 0; i < number_scales; i++) { + u8 fid, vid; +- unsigned int speed; ++ struct acpi_processor_px *state = ++ &acpi_processor_perf->states[i]; ++ unsigned int speed, speed_mhz; + +- pc.val = (unsigned long) acpi_processor_perf->states[i].control; ++ pc.val = (unsigned long) state->control; + dprintk ("acpi: P%d: %d MHz %d mW %d uS control %08x SGTC %d\n", + i, +- (u32) acpi_processor_perf->states[i].core_frequency, +- (u32) acpi_processor_perf->states[i].power, +- (u32) acpi_processor_perf->states[i].transition_latency, +- (u32) acpi_processor_perf->states[i].control, ++ (u32) state->core_frequency, ++ (u32) state->power, ++ (u32) state->transition_latency, ++ (u32) state->control, + pc.bits.sgtc); + + vid = pc.bits.vid; +@@ -360,6 +362,18 @@ static int powernow_acpi_init(void) + powernow_table[i].index |= (vid << 8); /* upper 8 bits */ + + speed = powernow_table[i].frequency; ++ speed_mhz = speed / 1000; ++ ++ /* processor_perflib will multiply the MHz value by 1000 to ++ * get a KHz value (e.g. 1266000). However, powernow-k7 works ++ * with true KHz values (e.g. 1266768). To ensure that all ++ * powernow frequencies are available, we must ensure that ++ * ACPI doesn't restrict them, so we round up the MHz value ++ * to ensure that perflib's computed KHz value is greater than ++ * or equal to powernow's KHz value. ++ */ ++ if (speed % 1000 > 0) ++ speed_mhz++; + + if ((fid_codes[fid] % 10)==5) { + if (have_a0 == 1) +@@ -368,10 +382,16 @@ static int powernow_acpi_init(void) + + dprintk (" FID: 0x%x (%d.%dx [%dMHz]) " + "VID: 0x%x (%d.%03dV)\n", fid, fid_codes[fid] / 10, +- fid_codes[fid] % 10, speed/1000, vid, ++ fid_codes[fid] % 10, speed_mhz, vid, + mobile_vid_table[vid]/1000, + mobile_vid_table[vid]%1000); + ++ if (state->core_frequency != speed_mhz) { ++ state->core_frequency = speed_mhz; ++ dprintk(" Corrected ACPI frequency to %d\n", ++ speed_mhz); ++ } ++ + if (latency < pc.bits.sgtc) + latency = pc.bits.sgtc; + +@@ -602,7 +622,7 @@ static int __init powernow_cpu_init (str + result = powernow_acpi_init(); + if (result) { + printk (KERN_INFO PFX "ACPI and legacy methods failed\n"); +- printk (KERN_INFO PFX "See http://www.codemonkey.org.uk/projects/cpufreq/powernow-k7.shtml\n"); ++ printk (KERN_INFO PFX "See http://www.codemonkey.org.uk/projects/cpufreq/powernow-k7.html\n"); + } + } else { + /* SGTC use the bus clock as timer */ diff --git a/queue-2.6.21/sctp-correctly-copy-addresses-in-sctp_copy_laddrs.patch b/queue-2.6.21/sctp-correctly-copy-addresses-in-sctp_copy_laddrs.patch new file mode 100644 index 00000000000..f240950aa4c --- /dev/null +++ b/queue-2.6.21/sctp-correctly-copy-addresses-in-sctp_copy_laddrs.patch @@ -0,0 +1,70 @@ +From 70b57b814ed5a93bf21d9dc5f8a7d23620a77e44 Mon Sep 17 00:00:00 2001 +Date: Wed, 9 May 2007 13:51:31 -0700 +Message-ID: <464C5462.4020407@hp.com> +From: Vlad Yasevich +Subject: SCTP: Correctly copy addresses in sctp_copy_laddrs + +I broke the non-wildcard case recently. This is to fixes it. +Now, explictitly bound addresses can ge retrieved using the API. + +Signed-off-by: Vlad Yasevich +Signed-off-by: David S. Miller +Signed-off-by: Chris Wright +--- + net/sctp/socket.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +--- linux-2.6.21.1.orig/net/sctp/socket.c ++++ linux-2.6.21.1/net/sctp/socket.c +@@ -4016,6 +4016,7 @@ static int sctp_getsockopt_local_addrs_o + rwlock_t *addr_lock; + int err = 0; + void *addrs; ++ void *buf; + int bytes_copied = 0; + + if (len != sizeof(struct sctp_getaddrs_old)) +@@ -4069,13 +4070,14 @@ static int sctp_getsockopt_local_addrs_o + } + } + ++ buf = addrs; + list_for_each(pos, &bp->address_list) { + addr = list_entry(pos, struct sctp_sockaddr_entry, list); + memcpy(&temp, &addr->a, sizeof(temp)); + sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp); + addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len; +- memcpy(addrs, &temp, addrlen); +- to += addrlen; ++ memcpy(buf, &temp, addrlen); ++ buf += addrlen; + bytes_copied += addrlen; + cnt ++; + if (cnt >= getaddrs.addr_num) break; +@@ -4118,6 +4120,7 @@ static int sctp_getsockopt_local_addrs(s + size_t space_left; + int bytes_copied = 0; + void *addrs; ++ void *buf; + + if (len <= sizeof(struct sctp_getaddrs)) + return -EINVAL; +@@ -4168,6 +4171,7 @@ static int sctp_getsockopt_local_addrs(s + } + } + ++ buf = addrs; + list_for_each(pos, &bp->address_list) { + addr = list_entry(pos, struct sctp_sockaddr_entry, list); + memcpy(&temp, &addr->a, sizeof(temp)); +@@ -4177,8 +4181,8 @@ static int sctp_getsockopt_local_addrs(s + err = -ENOMEM; /*fixme: right error?*/ + goto error; + } +- memcpy(addrs, &temp, addrlen); +- to += addrlen; ++ memcpy(buf, &temp, addrlen); ++ buf += addrlen; + bytes_copied += addrlen; + cnt ++; + space_left -= addrlen; diff --git a/queue-2.6.21/series b/queue-2.6.21/series index 0bf00fba288..0d02bb9539a 100644 --- a/queue-2.6.21/series +++ b/queue-2.6.21/series @@ -32,6 +32,7 @@ ipv6-fix-slab-corruption-running-ip6sic.patch netpoll-fix-tx-queue-overflow-in-trapped-mode.patch netpoll-remove-config_netpoll_rx.patch sctp-fix-sctp_getsockopt_local_addrs_old-to-use-local-storage.patch +sctp-correctly-copy-addresses-in-sctp_copy_laddrs.patch tcp-zero-out-rx_opt-in-tcp_disconnect.patch fix-leaky-resv_huge_pages-when-cpuset-is-in-use.patch clocksource-fix-resume-logic.patch @@ -62,3 +63,6 @@ sky2-fix-oops-on-shutdown.patch usb-hid-hiddev-fix-race-between-hiddev_send_event-and-hiddev_release.patch jfs-fix-race-waking-up-jfsio-kernel-thread.patch netfilter-ip-nf-_conntrack-fix-use-after-free-in-helper-destroy-callback-invocation.patch +support-rev-h-amd64s-in-powernow-k8.patch +correct-revision-mask-for-powernow-k8.patch +cpufreq-powernow-k7-fix-mhz-rounding-issue-with-perflib.patch diff --git a/queue-2.6.21/support-rev-h-amd64s-in-powernow-k8.patch b/queue-2.6.21/support-rev-h-amd64s-in-powernow-k8.patch new file mode 100644 index 00000000000..b892c3b28cd --- /dev/null +++ b/queue-2.6.21/support-rev-h-amd64s-in-powernow-k8.patch @@ -0,0 +1,38 @@ +From 30046e5885848fe5c2c66177dca6b277323e31ab Mon Sep 17 00:00:00 2001 +Message-ID: <20070517204101.GA30637@redhat.com> +From: Dave Jones +Date: Sun, 13 May 2007 11:55:14 -0400 +Subject: CPUFREQ: Support rev H AMD64s in powernow-k8 + +Reported-by: Calvin Dodge +Signed-off-by: Dave Jones +Signed-off-by: Chris Wright +--- + arch/i386/kernel/cpu/cpufreq/powernow-k8.c | 2 +- + arch/i386/kernel/cpu/cpufreq/powernow-k8.h | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +--- linux-2.6.21.1.orig/arch/i386/kernel/cpu/cpufreq/powernow-k8.c ++++ linux-2.6.21.1/arch/i386/kernel/cpu/cpufreq/powernow-k8.c +@@ -521,7 +521,7 @@ static int check_supported_cpu(unsigned + + if ((eax & CPUID_XFAM) == CPUID_XFAM_K8) { + if (((eax & CPUID_USE_XFAM_XMOD) != CPUID_USE_XFAM_XMOD) || +- ((eax & CPUID_XMOD) > CPUID_XMOD_REV_G)) { ++ ((eax & CPUID_XMOD) > CPUID_XMOD_REV_H)) { + printk(KERN_INFO PFX "Processor cpuid %x not supported\n", eax); + goto out; + } +--- linux-2.6.21.1.orig/arch/i386/kernel/cpu/cpufreq/powernow-k8.h ++++ linux-2.6.21.1/arch/i386/kernel/cpu/cpufreq/powernow-k8.h +@@ -46,8 +46,8 @@ struct powernow_k8_data { + #define CPUID_XFAM 0x0ff00000 /* extended family */ + #define CPUID_XFAM_K8 0 + #define CPUID_XMOD 0x000f0000 /* extended model */ +-#define CPUID_XMOD_REV_G 0x00060000 +-#define CPUID_XFAM_10H 0x00100000 /* family 0x10 */ ++#define CPUID_XMOD_REV_H 0x00070000 ++#define CPUID_XFAM_10H 0x00100000 /* family 0x10 */ + #define CPUID_USE_XFAM_XMOD 0x00000f00 + #define CPUID_GET_MAX_CAPABILITIES 0x80000000 + #define CPUID_FREQ_VOLT_CAPABILITIES 0x80000007 -- 2.47.3