<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://www.coreboot.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://www.coreboot.org/index.php?title=Early_SMP_startup&amp;feed=atom&amp;action=history</id>
		<title>Early SMP startup - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://www.coreboot.org/index.php?title=Early_SMP_startup&amp;feed=atom&amp;action=history"/>
		<link rel="alternate" type="text/html" href="http://www.coreboot.org/index.php?title=Early_SMP_startup&amp;action=history"/>
		<updated>2013-05-20T16:41:47Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.20.5</generator>

	<entry>
		<id>http://www.coreboot.org/index.php?title=Early_SMP_startup&amp;diff=8647&amp;oldid=prev</id>
		<title>Hailfinger at 21:47, 20 June 2009</title>
		<link rel="alternate" type="text/html" href="http://www.coreboot.org/index.php?title=Early_SMP_startup&amp;diff=8647&amp;oldid=prev"/>
				<updated>2009-06-20T21:47:19Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 21:47, 20 June 2009&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;This is an excerpt of an email exchange with the subject &amp;quot;locking...&amp;quot; on the coreboot mailing list. Not all the info below is guaranteed to be correct, but it serves as a great source of distilled knowledge.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;After CAR the APs should be stopped until CPU init time, which is relatively short.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;After CAR the APs should be stopped until CPU init time, which is relatively short.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 90:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 92:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;this early...?&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;this early...?&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;it&lt;/del&gt;'s more than spinlock.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;It&lt;/ins&gt;'s more than spinlock.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;you &lt;/del&gt;must also fix the use of the console_drivers struct. There are&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;You &lt;/ins&gt;must also fix the use of the console_drivers struct. There are&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;several things you need to get right to make this work.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;several things you need to get right to make this work.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;If you want locking in do_printk, it will have to work in CAR.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Hailfinger</name></author>	</entry>

	<entry>
		<id>http://www.coreboot.org/index.php?title=Early_SMP_startup&amp;diff=8646&amp;oldid=prev</id>
		<title>Hailfinger at 21:44, 20 June 2009</title>
		<link rel="alternate" type="text/html" href="http://www.coreboot.org/index.php?title=Early_SMP_startup&amp;diff=8646&amp;oldid=prev"/>
				<updated>2009-06-20T21:44:57Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 21:44, 20 June 2009&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 84:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 84:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;5-10. But the ram is all there at this point, and can be transparently&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;5-10. But the ram is all there at this point, and can be transparently&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;accessed by all CPUs.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;accessed by all CPUs.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Other than that, we could unify those versions (of printk) by just defining an empty&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;(for now) version of the spinlock functions in raminit stage. Then think&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;about where we can place our locking for those platforms that need it&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;this early...?&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;it's more than spinlock.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;you must also fix the use of the console_drivers struct. There are&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;several things you need to get right to make this work.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Hailfinger</name></author>	</entry>

	<entry>
		<id>http://www.coreboot.org/index.php?title=Early_SMP_startup&amp;diff=8641&amp;oldid=prev</id>
		<title>Hailfinger: Snippets from an email exchange on the coreboot list.</title>
		<link rel="alternate" type="text/html" href="http://www.coreboot.org/index.php?title=Early_SMP_startup&amp;diff=8641&amp;oldid=prev"/>
				<updated>2009-06-19T22:39:56Z</updated>
		
		<summary type="html">&lt;p&gt;Snippets from an email exchange on the coreboot list.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;After CAR the APs should be stopped until CPU init time, which is relatively short.&lt;br /&gt;
&lt;br /&gt;
v2 has / used to have working locking code since it was first ported to&lt;br /&gt;
opteron. It may be that it broke while adding 5 more printks but it is&lt;br /&gt;
there somewhere.&lt;br /&gt;
&lt;br /&gt;
Making the BSP poll for the APs (which is what we would do if we need to&lt;br /&gt;
check the APs shared memory) basically renders the BSP unusable to do&lt;br /&gt;
stuff while waiting for the APs.&lt;br /&gt;
&lt;br /&gt;
With simple locking, everything can run in parallel, and only serial&lt;br /&gt;
output needs to get synced. Which is what we actually want.&lt;br /&gt;
&lt;br /&gt;
There's no real problem, we've just&lt;br /&gt;
been doing too much cut and paste in the past without testing the new&lt;br /&gt;
code. This made us end up with different versions of printk, some with&lt;br /&gt;
locking, some without.&lt;br /&gt;
&lt;br /&gt;
And, no, porting the code from v3 over is not an option at this point.&lt;br /&gt;
It does too much different stuff. Let's rather start dropping unneeded&lt;br /&gt;
implementations in v2 until things look sane again and then we can&lt;br /&gt;
decide what implementation we want.&lt;br /&gt;
&lt;br /&gt;
So each AP has some part of RAM to copy the buffer to?&lt;br /&gt;
&lt;br /&gt;
The way SMP works, the BSP sets up its ram. At that point, the APs can&lt;br /&gt;
use the BSP ram. That's why APs have a stack in the first place.&lt;br /&gt;
&lt;br /&gt;
APs have a working stack when they are setting up their own RAM.&lt;br /&gt;
&lt;br /&gt;
The way this works on amd64 is that the AP comes up, goes to cache as&lt;br /&gt;
ram, finds it is an AP and goes to sleep again.&lt;br /&gt;
Then it wakes up again in stage2 when the BSP sends an IPI. At this&lt;br /&gt;
point (at least remote) RAM is available. They never set up their own&lt;br /&gt;
ram (in terms of Jedec init, or setting up a ram controller), but only&lt;br /&gt;
have to clear it, in case of ECC memory.&lt;br /&gt;
&lt;br /&gt;
* the pre-ram locking can't be done with a stack, because the cache between CPUs is not always necessarily in the same state.&lt;br /&gt;
&lt;br /&gt;
well, that may be true on intel stuff. The AMD startup (at least as I&lt;br /&gt;
understand it) depends on the BSP memory&lt;br /&gt;
being functional enough to provide the APs with a stack.&lt;br /&gt;
&lt;br /&gt;
* the post-ram code does not need it, works quite nicely already.&lt;br /&gt;
&lt;br /&gt;
actually, this is only partially true. It is still possible for a&lt;br /&gt;
malfunctioning AP to lock the BSP out. It's just not something we've&lt;br /&gt;
seen much of.&lt;br /&gt;
&lt;br /&gt;
The point (of the v3 early init code and stack structure) was to stay as much the same, but also&lt;br /&gt;
allow the BSP to better monitor (and control)&lt;br /&gt;
what was going on. I would still claim the structure of the code is a&lt;br /&gt;
big improvement. The v2 SMP startup is not an easy read.&lt;br /&gt;
&lt;br /&gt;
I was wondering how you make the APs not conflict in the part of RAM they&lt;br /&gt;
copy their buffers to.  I was also wondering how it would affect&lt;br /&gt;
interleaving, etc.  That kind of thing seems difficult to debug, and is the&lt;br /&gt;
reason I'd want to see the APs messages.&lt;br /&gt;
&lt;br /&gt;
You give each AP a seperate stack. All that code is in there already.&lt;br /&gt;
&lt;br /&gt;
The struct-based stack is a direct copy of the v2 startup. Rather than&lt;br /&gt;
using lots of fiddly offsets onto a memory area, it provides a struct&lt;br /&gt;
which contains variables and a stack. The variables are shared between&lt;br /&gt;
the AP and the BSP. It is a more C-like way to do it.&lt;br /&gt;
Once I did it I realized that the on-stack variables could be used as&lt;br /&gt;
a communications path from the AP to the BSP, most important one being&lt;br /&gt;
a POST variable that could be set by the AP&lt;br /&gt;
and monitored by the BSP. This is a bit better than what we have in&lt;br /&gt;
v2, where we get one bit back from the AP which tells us &amp;quot;done&amp;quot; or&lt;br /&gt;
&amp;quot;not done&amp;quot;. No real progress indication&lt;br /&gt;
is available. At some point, the BSP times out the AP, but there is no&lt;br /&gt;
error code. Plus, the way in which the shared variable is set up in v2&lt;br /&gt;
is not very straightforward.&lt;br /&gt;
&lt;br /&gt;
Many systems only have&lt;br /&gt;
one memory controller. But on all coreboot systems, even those with&lt;br /&gt;
multiple memory controllers, the controllers are all set up by the BSP.&lt;br /&gt;
Parallelizing here makes only very little sense.&lt;br /&gt;
The reason we're parallelizing is you have to clear memory if you have&lt;br /&gt;
ECC on some (older?) systems where the memory controller is incapable of&lt;br /&gt;
doing that automatically. So when we have to clear 32G at a rate of 3 or&lt;br /&gt;
6GB/s we want to put that load on several CPUs, so it's 1-2s instead of&lt;br /&gt;
5-10. But the ram is all there at this point, and can be transparently&lt;br /&gt;
accessed by all CPUs.&lt;/div&gt;</summary>
		<author><name>Hailfinger</name></author>	</entry>

	</feed>