<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Haren Myneni wrote:
<blockquote TYPE=CITE> 
<br><font face="sans-serif"><font size=-1>Olaf,</font></font>
<br><font face="sans-serif"><font size=-1>       
I was looking in 2.6.16-rc5-git8, but did not find the patch that you mentioned.</font></font>
<br> 
<p><font face="sans-serif"><font size=-1>arch/powerpc/kernel/setup_64.c:</font></font>
<p><font face="sans-serif"><font size=-1>#ifdef CONFIG_SMP</font></font>
<br><font face="sans-serif"><font size=-1>void __init setup_per_cpu_areas(void)</font></font>
<br><font face="sans-serif"><font size=-1>{</font></font>
<br><font face="sans-serif"><font size=-1>       
int i;</font></font>
<br><font face="sans-serif"><font size=-1>       
unsigned long size;</font></font>
<br><font face="sans-serif"><font size=-1>       
char *ptr;</font></font>
<p><font face="sans-serif"><font size=-1>       
/* Copy section for each CPU (we discard the original) */</font></font>
<br><font face="sans-serif"><font size=-1>       
size = ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES);</font></font>
<br><font face="sans-serif"><font size=-1>#ifdef CONFIG_MODULES</font></font>
<br><font face="sans-serif"><font size=-1>       
if (size < PERCPU_ENOUGH_ROOM)</font></font>
<br><font face="sans-serif"><font size=-1>               
size = PERCPU_ENOUGH_ROOM;</font></font>
<br><font face="sans-serif"><font size=-1>#endif</font></font>
<p><font face="sans-serif"><font size=-1>       
for_each_cpu(i) {</font></font>
<br><font face="sans-serif"><font size=-1>               
ptr = alloc_bootmem_node(NODE_DATA(cpu_to_node(i)), size);</font></font>
<br><font face="sans-serif"><font size=-1>               
if (!ptr)</font></font>
<br><font face="sans-serif"><font size=-1>                       
panic("Cannot allocate cpu data for CPU %d\n", i);</font></font>
<p><font face="sans-serif"><font size=-1>               
paca[i].data_offset = ptr - __per_cpu_start;</font></font>
<br><font face="sans-serif"><font size=-1>               
memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start);</font></font>
<br><font face="sans-serif"><font size=-1>     }</font></font>
<br><font face="sans-serif"><font size=-1>}</font></font>
<br> 
<p><font face="sans-serif"><font size=-1> Instead of depending on
paca[#].data_offset, my fix will use cpu_online_map to read the valid cpu
paca structs. But, if the kernel sets 0xeeeeeeeeeeeeeeeeULL, yes, using
this value will be the better solution.</font></font>
<p><tt><font size=-1>Dave, the attached patch contains both fixes that
Rachita reported.</font></tt>
<br><tt><font size=-1>        - Report
an error message if the thread is running in user space and print regs.</font></tt>
<br><tt><font size=-1>        - Finding
the valid per_cpu_offset values</font></tt>
<p><font face="sans-serif"><font size=-1>Thanks</font></font>
<br><font face="sans-serif"><font size=-1>Haren</font></font>
<br> </blockquote>
<tt></tt>
<p><br><tt>Haren,</tt><tt></tt>
<p><tt>Is this right?  NR_CPUS is hardcoded (in crash) to 32 for ppc64,</tt>
<br><tt>and BITS_FOR_LONG is 64, making it "ulong cpu_online_map[0]":</tt><tt></tt>
<p><tt>@@ -2282,21 +2298,22 @@ parse_cmdline_arg(void)</tt>
<br><tt> static void</tt>
<br><tt> ppc64_paca_init(void)</tt>
<br><tt> {</tt>
<br><tt>+#define BITS_FOR_LONG sizeof(ulong)*8</tt>
<br><tt>        int i, cpus, nr_paca;</tt>
<br><tt>        char *cpu_paca_buf;</tt>
<br><tt>        ulong data_offset;</tt>
<br><tt>-       ulong per_cpu_offset;</tt>
<br><tt>-       ulong cpuid_offset;</tt>
<br><tt>-       signed short cpuid;</tt>
<br><tt>+       ulong cpu_online_map[NR_CPUS/BITS_FOR_LONG];</tt><tt></tt>
<p><tt>Or am I missing something obvious?</tt><tt></tt>
<p><tt>Also, I get a little nervous about depending upon the NR_CPUS</tt>
<br><tt>value compiled into crash being the same as the configured</tt>
<br><tt>NR_CPUS in the kernel.  As far as crash is concerned, NR_CPUS</tt>
<br><tt>means the "largest possible" cpu configuration that this version</tt>
<br><tt>of *crash* will support; it's not meant to be aligned with</tt>
<br><tt>the kernel's value.</tt><tt></tt>
<p><tt>But if you guys are happy with that, it's fine with me.</tt><tt></tt>
<p><tt>Dave</tt>
<br><tt></tt> </html>