<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
On 2/16/10 8:42 PM, Myles Watson wrote:
<blockquote
 cite="mid:2831fecf1002161142x666e7884xb7c3e0ae287ef93b@mail.gmail.com"
 type="cite"><br>
  <br>
  <div class="gmail_quote">On Tue, Feb 16, 2010 at 12:02 PM, Stefan
Reinauer <span dir="ltr"><<a moz-do-not-send="true"
 href="mailto:stepan@coresystems.de">stepan@coresystems.de</a>></span>
wrote:<br>
  <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
    <div>
    <div class="h5">On 2/16/10 5:11 AM, Timothy Pearson wrote:<br>
> Here is a cleaned up and tested version of the SMP APIC autodetect
patch.<br>
><br>
> Signed-off-by: Timothy Pearson <<a moz-do-not-send="true"
 href="mailto:tpearson@raptorengineeringinc.com">tpearson@raptorengineeringinc.com</a>></div>
    </div>
  </blockquote>
  <div> </div>
  <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">And,
can you describe high level, what the patch changes? It looks to me<br>
as if you are recursing through the tree instead of just walking the<br>
"all_devices" list.<br>
So this implies that you don't catch all devices when running through<br>
all_devices. This sounds like a problem in the resource allocator and<br>
maybe it should be fixed there instead?<br>
  </blockquote>
  <div>I don't understand why this would be a resource allocator
problem.  Aren't we talking about the device tree?<br>
  </div>
  </div>
</blockquote>
<br>
Oh, sorry I didn't say more...  What the old code did was the following:<br>
<br>
    device_t cpu;<br>
    for(cpu = all_devices; cpu; cpu = cpu->next) {<br>
     ....<br>
     <- check if the device is an APIC and if it is, dump an APIC
entry in the mptable -><br>
     ....<br>
    }<br>
<br>
But it seems that the code does not see all devices -- anymore -- not
sure if it ever did, but I think to remember that's what happened at
some point, or was at least intended.<br>
<br>
So now the code looks l<br>
<br>
scan_for_apic_devices(parent)<br>
{<br>
    for(c_it=0; c_it < parent->links; c_it++) {<br>
        for (child = parent->link[c_it].children; child; child =
child->sibling) {<br>
....<br>
            if (child->path.type == DEVICE_PATH_APIC_CLUSTER) {<br>
                // Found an APIC cluster, scan it for APICs<br>
                smp_scan_for_apic_devices(child);<br>
            }<br>
        }<br>
    }<br>
}<br>
<br>
So two more steps are necessary: <br>
- check all the downwards links of a device instead of just walking
devices and checking their type.<br>
- run recursively in a special case on APIC clusters.<br>
<br>
This sounds a whole lot like something changed in the way "all_devices"
works. And if "all_devices" does not mean "all devices" I am sure there
are more places in our code that need similar fixes.<br>
<br>
<blockquote
 cite="mid:2831fecf1002161142x666e7884xb7c3e0ae287ef93b@mail.gmail.com"
 type="cite">
  <div class="gmail_quote">
  <div>Maybe the real problem is related to the memory corruption seen
with printk?<br>
  </div>
  </div>
</blockquote>
Not completely impossible, but I figured it's easier to ask the guy who
rewrote the resource allocator if he knows something about how the
intended behavior of "all_devices" ;-) <br>
- Maybe the behavior is intended, then we just need to check in
Timothy's patch.<br>
- Maybe the behavior is not intended, but that's how the code works
right now. Then we'd rather have to look at the resource allocator and
decide if we want "all_devices" to mean "all devices", or whether we
rename the variable, or redefine its meaning.<br>
- Maybe none of the above applies, then we need to do nasty stack
corruption debugging. In this case it would be fundamentally wrong to
touch either the device tree code or the mp table creation code until
we fix the corruption in order to make sure we don't create funny
special cases.<br>
<br>
So, if you have hints enlightening any of the maybes, please share!<br>
<br>
<br>
Stefan<br>
<br>
<br>
<br>
</body>
</html>