RE: [discuss] [OOPS] powernow on smp dual core amd64

Langsdorf, Mark
2005-06-14T00:21:26Z

[-- Attachment #1: Type: text/plain, Size: 3660 bytes --]

> powernow-k8: Found 8 AMD Athlon 64 / Opteron processors
> (version 1.40.2)
> powernow-k8: 0 : fid 0xe (2200 MHz), vid 0x8 (1350 mV)
> powernow-k8: 1 : fid 0xc (2000 MHz), vid 0xa (1300 mV)
> powernow-k8: 2 : fid 0xa (1800 MHz), vid 0xc (1250 mV)
> cpu_init done, current fid 0xe, vid 0x8
> powernow-k8: 0 : fid 0xe (2200 MHz), vid 0x8 (1350 mV)
> powernow-k8: 1 : fid 0xc (2000 MHz), vid 0xa (1300 mV)
> powernow-k8: 2 : fid 0xa (1800 MHz), vid 0xc (1250 mV)
> cpu_init done, current fid 0xe, vid 0x8
> powernow-k8: 0 : fid 0xe (2200 MHz), vid 0x8 (1350 mV)
> powernow-k8: 1 : fid 0xc (2000 MHz), vid 0xa (1300 mV)
> powernow-k8: 2 : fid 0xa (1800 MHz), vid 0xc (1250 mV)
> cpu_init done, current fid 0xe, vid 0x8
> powernow-k8: 0 : fid 0xe (2200 MHz), vid 0x8 (1350 mV)
> powernow-k8: 1 : fid 0xc (2000 MHz), vid 0xa (1300 mV)
> powernow-k8: 2 : fid 0xa (1800 MHz), vid 0xc (1250 mV)
> cpu_init done, current fid 0xe, vid 0x8

> sdb:<3>powernowk8_get() cpu is 1
> Unable to handle kernel NULL pointer dereference at
> 0000000000000024 RIP:
> <ffffffff8011d94c>{query_current_values_with_pending_wait+60}
> sdb1 sdb2
>
> PGD 3fe74067 PUD 3fd28067 PMD 0
> Oops: 0002 [1] SMP
> CPU 1
> Modules linked in: mptscsih mptbase sd_mod scsi_mod
> Pid: 25, comm: events/7 Not tainted 2.6.12-rc6andro
> RIP: 0010:[<ffffffff8011d94c>]
> <ffffffff8011d94c>{query_current_values_with_pending_wait+60}
> RSP: 0000:ffff81007fddbdc8 EFLAGS: 00010202
> RAX: 000000000000000e RBX: 0000000000000000 RCX: 00000000c0010042
> RDX: 0000000000000008 RSI: 0000000000000001 RDI: 0000000000000000
> RBP: 0000000000000080 R08: ffff81007fdda000 R09: ffff81003fd421f0
> R10: 000000000000001c R11: 0000000000000000 R12: 0000000000000000
> R13: 0000000000000000 R14: 0000000000000283 R15: ffffffff80112630
> FS: 000000000057d850(0000) GS:ffffffff80498180(0000)
> knlGS:0000000000000000
> CS: 0010 DS: 0018 ES: 0018 CR0: 000000008005003b
> CR2: 0000000000000024 CR3: 000000003f415000 CR4:
> 00000000000006e0 Process events/7 (pid: 25, threadinfo
> ffff81007fdda000, task ffff81003fd421f0)
> Stack: 0000000000000080 ffffffff8011dea1 0000000000000001
> ffff81003fd91430
> ffff81003fd91400 ffffffff802e2b90 0000000000000000
> 0000000000000003
> ffff81007fddbe48 0000000000000001
> Call Trace:<ffffffff8011dea1>{powernowk8_get+145}
> <ffffffff802e2b90>{cpufreq_get+96}
> <ffffffff8011266a>{handle_cpufreq_delayed_get+58}
> <ffffffff80148eec>{worker_thread+476}
> <ffffffff801326d0>{default_wake_function+0}
> <ffffffff80130733>{__wake_up_common+67}
> <ffffffff80148d10>{worker_thread+0}
> <ffffffff8014d7a9>{kthread+217}
> <ffffffff80133be0>{schedule_tail+64}
> <ffffffff8010f5b7>{child_rip+8}
> <ffffffff8011d4f0>{flat_send_IPI_mask+0}
> <ffffffff8014d6d0>{kthread+0}
> <ffffffff8010f5af>{child_rip+0}
>
> Code: 89 47 24 89 57 20 31 c0 48 83 c4 08 c3 66 66 66 90 66
> 66 90 RIP
> <ffffffff8011d94c>{query_current_values_with_pending_wait+60}
> RSP <ffff81007fddbdc8>
> CR2: 0000000000000024
> <5>Attached scsi disk sdb at scsi0, channel 0, id 1, lun 0

Okay, I think I have figured this out. During initialization,
the cpufreq infrastruture only initializes the first core of
each processor. When a request comes into the second core,
it's data structre is unitialized and we get the null point
dereference.

The solution is to assign the pointer to the data structure for
the first core to all the other cores.

Tom, could you try this patch and see if it helps?

-Mark Langsdorf
AMD, Inc.

[-- Attachment #2: jhpn-2.6.12-rc6.patch --]
[-- Type: application/octet-stream, Size: 837 bytes --]

--- linux-2.6.12-rc6/arch/i386/kernel/cpu/cpufreq/powernow-k8.c.old 2005-06-12 17:41:55.123651184 -0500
+++ linux-2.6.12-rc6/arch/i386/kernel/cpu/cpufreq/powernow-k8.c 2005-06-12 17:46:32.780440936 -0500
@@ -44,7 +44,7 @@

#define PFX "powernow-k8: "
#define BFX PFX "BIOS error: "
-#define VERSION "version 1.40.2"
+#define VERSION "version 1.40.4"
#include "powernow-k8.h"

/* serialize freq changes */
@@ -978,7 +978,7 @@
{
struct powernow_k8_data *data;
cpumask_t oldmask = CPU_MASK_ALL;
- int rc;
+ int rc, i;

if (!check_supported_cpu(pol->cpu))
return -ENODEV;
@@ -1064,7 +1064,9 @@
printk("cpu_init done, current fid 0x%x, vid 0x%x\n",
data->currfid, data->currvid);

- powernow_data[pol->cpu] = data;
+ for_each_cpu_mask(i, cpu_core_map[pol->cpu]) {
+ powernow_data[i] = data;
+ }

return 0;