<feed xmlns='http://www.w3.org/2005/Atom'>
<title>talos-skiboot/core/cpu.c, branch master</title>
<subtitle>Talos™ II skiboot sources</subtitle>
<id>https://git.raptorcs.com/git/talos-skiboot/atom?h=master</id>
<link rel='self' href='https://git.raptorcs.com/git/talos-skiboot/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-skiboot/'/>
<updated>2018-04-19T01:23:28+00:00</updated>
<entry>
<title>core: Fix iteration condition to skip garded cpu</title>
<updated>2018-04-19T01:23:28+00:00</updated>
<author>
<name>Vaidyanathan Srinivasan</name>
<email>svaidy@linux.vnet.ibm.com</email>
</author>
<published>2018-04-18T15:36:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-skiboot/commit/?id=e2cd78500b8ed0b8519083a36304804c6d658cf8'/>
<id>urn:sha1:e2cd78500b8ed0b8519083a36304804c6d658cf8</id>
<content type='text'>
Fix the logic error in the loop that iterated incorrectly
over garded cpu.

Signed-off-by: Vaidyanathan Srinivasan &lt;svaidy@linux.vnet.ibm.com&gt;
Reviewed-by: Nicholas Piggin &lt;npiggin@gmail.com&gt;
Signed-off-by: Stewart Smith &lt;stewart@linux.ibm.com&gt;
</content>
</entry>
<entry>
<title>core/opal: Emergency stack for re-entry</title>
<updated>2018-04-19T01:23:07+00:00</updated>
<author>
<name>Nicholas Piggin</name>
<email>npiggin@gmail.com</email>
</author>
<published>2018-04-08T06:49:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-skiboot/commit/?id=3fdd2629516dd8be2b52a3a13e7ef5713411c7bf'/>
<id>urn:sha1:3fdd2629516dd8be2b52a3a13e7ef5713411c7bf</id>
<content type='text'>
This detects OPAL being re-entered by the OS, and switches to an
emergency stack if it was. This protects the firmware's main stack
from re-entrancy and allows the OS to use NMI facilities for crash
/ debug functionality.

Further nested re-entry will destroy the previous emergency stack
and prevent returning, but those should be rare cases.

This stack is sized at 16kB, which doubles the size of CPU stacks,
so as not to introduce a regression in primary stack size. The 16kB
stack originally had a 4kB machine check stack at the top, which was
removed by 80eee1946 ("opal: Remove machine check interrupt patching
in OPAL."). So it is possible the size could be tightened again, but
that would require further analysis.

Signed-off-by: Nicholas Piggin &lt;npiggin@gmail.com&gt;
Signed-off-by: Stewart Smith &lt;stewart@linux.ibm.com&gt;
</content>
</entry>
<entry>
<title>opal/hmi: Rework HMI handling of TFAC errors</title>
<updated>2018-04-17T08:52:10+00:00</updated>
<author>
<name>Benjamin Herrenschmidt</name>
<email>benh@kernel.crashing.org</email>
</author>
<published>2018-04-16T17:33:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-skiboot/commit/?id=674f7696f7c1e51ab159d81a05a18c445f0c896d'/>
<id>urn:sha1:674f7696f7c1e51ab159d81a05a18c445f0c896d</id>
<content type='text'>
This patch reworks the HMI handling for TFAC errors by introducing
4 rendez-vous points improve the thread synchronization while handling
timebase errors that requires all thread to clear dirty data from TB/HDEC
register before clearing the errors.

Signed-off-by: Benjamin Herrenschmidt &lt;benh@kernel.crashing.org&gt;
Signed-off-by: Mahesh Salgaonkar &lt;mahesh@linux.vnet.ibm.com&gt;
Signed-off-by: Stewart Smith &lt;stewart@linux.ibm.com&gt;
</content>
</entry>
<entry>
<title>core/cpu: Prevent clobbering of stack guard for boot-cpu</title>
<updated>2018-04-05T02:35:56+00:00</updated>
<author>
<name>Vaibhav Jain</name>
<email>vaibhav@linux.vnet.ibm.com</email>
</author>
<published>2018-04-04T11:33:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-skiboot/commit/?id=cfe9d4416aab87103bb90e734abd8d329a168656'/>
<id>urn:sha1:cfe9d4416aab87103bb90e734abd8d329a168656</id>
<content type='text'>
Commit 90d53934c2da ("core/cpu: discover stack region size before
initialising memory regions") introduced memzero for struct cpu_thread
in init_cpu_thread(). This has an unintended side effect of clobbering
the stack-guard cannery of the boot_cpu stack. This results in opal
failing to init with this failure message:

CPU: P9 generation processor (max 4 threads/core)
CPU: Boot CPU PIR is 0x0004 PVR is 0x004e1200
Guard skip = 0
Stack corruption detected !
Aborting!
CPU 0004 Backtrace:
 S: 0000000031c13ab0 R: 0000000030013b0c   .backtrace+0x5c
 S: 0000000031c13b50 R: 000000003001bd18   ._abort+0x60
 S: 0000000031c13be0 R: 0000000030013bbc   .__stack_chk_fail+0x54
 S: 0000000031c13c60 R: 00000000300c5b70   .memset+0x12c
 S: 0000000031c13d00 R: 0000000030019aa8   .init_cpu_thread+0x40
 S: 0000000031c13d90 R: 000000003001b520   .init_boot_cpu+0x188
 S: 0000000031c13e30 R: 0000000030015050   .main_cpu_entry+0xd0
 S: 0000000031c13f00 R: 0000000030002700   boot_entry+0x1c0

So the patch provides a fix by tweaking the memset() call in
init_cpu_thread() to skip over the stack-guard cannery.

Fixes:90d53934c2da("core/cpu: discover stack region size before initialising memory regions")
Signed-off-by: Vaibhav Jain &lt;vaibhav@linux.vnet.ibm.com&gt;
Reviewed-by: Nicholas Piggin &lt;npiggin@gmail.com&gt;
Signed-off-by: Stewart Smith &lt;stewart@linux.vnet.ibm.com&gt;
</content>
</entry>
<entry>
<title>core/cpu: discover stack region size before initialising memory regions</title>
<updated>2018-03-27T06:37:01+00:00</updated>
<author>
<name>Nicholas Piggin</name>
<email>npiggin@gmail.com</email>
</author>
<published>2018-03-25T06:54:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-skiboot/commit/?id=90d53934c2dab214e8965e28070a67ed89f3e94c'/>
<id>urn:sha1:90d53934c2dab214e8965e28070a67ed89f3e94c</id>
<content type='text'>
Stack allocation first allocates a memory region sized to hold stacks
for all possible CPUs up to the maximum PIR of the architecture, zeros
the region, then initialises all stacks. Max PIR is 32768 on POWER9,
which is 512MB for stacks.

The stack region is then shrunk after CPUs are discovered, but this is
a bit of a hack, and it leaves a hole in the memory allocation regions
as it's done after mem regions are initialised.

  0x000000000000..00002fffffff : ibm,os-reserve - OS
  0x000030000000..0000303fffff : ibm,firmware-code - OPAL
  0x000030400000..000030ffffff : ibm,firmware-heap - OPAL
  0x000031000000..000031bfffff : ibm,firmware-data - OPAL
  0x000031c00000..000031c0ffff : ibm,firmware-stacks - OPAL
  *** gap ***
  0x000051c00000..000051d01fff : ibm,firmware-allocs-memory@0 - OPAL
  0x000051d02000..00007fffffff : ibm,firmware-allocs-memory@0 - OS
  0x000080000000..000080b3cdff : initramfs - OPAL
  0x000080b3ce00..000080b7cdff : ibm,fake-nvram - OPAL
  0x000080b7ce00..0000ffffffff : ibm,firmware-allocs-memory@0 - OS

This change moves zeroing into the per-cpu stack setup. The boot CPU
stack is set up based on the current PIR. Then the size of the stack
region is set, by discovering the maximum PIR of the system from the
device tree, before mem regions are intialised.

This results in all memory being accounted within memory regions,
and less memory fragmentation of OPAL allocations.

Signed-off-by: Nicholas Piggin &lt;npiggin@gmail.com&gt;
Signed-off-by: Stewart Smith &lt;stewart@linux.vnet.ibm.com&gt;
</content>
</entry>
<entry>
<title>cpu_idle_job: relax a bit</title>
<updated>2018-03-09T02:15:06+00:00</updated>
<author>
<name>Stewart Smith</name>
<email>stewart@linux.vnet.ibm.com</email>
</author>
<published>2018-03-09T02:15:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-skiboot/commit/?id=f88ffa66d1b4af17dca3e7c17955c096317c75e1'/>
<id>urn:sha1:f88ffa66d1b4af17dca3e7c17955c096317c75e1</id>
<content type='text'>
This *dramatically* improves kernel boot time with GCOV builds

from ~3minutes between loading kernel and switching the HILE
bit down to around 10 seconds.

Signed-off-by: Stewart Smith &lt;stewart@linux.vnet.ibm.com&gt;
</content>
</entry>
<entry>
<title>core/lock: Add deadlock detection</title>
<updated>2018-03-07T06:15:02+00:00</updated>
<author>
<name>Matt Brown</name>
<email>matthew.brown.dev@gmail.com</email>
</author>
<published>2017-07-07T01:52:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-skiboot/commit/?id=2d4c774c2a3ad5413272e9d17827e4eb3956be87'/>
<id>urn:sha1:2d4c774c2a3ad5413272e9d17827e4eb3956be87</id>
<content type='text'>
This adds simple deadlock detection. The detection looks for circular
dependencies in the lock requests. It will abort and display a stack trace
when a deadlock occurs.
The detection is enabled by DEBUG_LOCKS (enabled by default).
While the detection may have a slight performance overhead, as there are
not a huge number of locks in skiboot this overhead isn't significant.

Signed-off-by: Matt Brown &lt;matthew.brown.dev@gmail.com&gt;
[stewart: fix build with DEBUG_LOCKS off]
Signed-off-by: Stewart Smith &lt;stewart@linux.vnet.ibm.com&gt;
</content>
</entry>
<entry>
<title>Tie tm-suspend fw-feature and opal_reinit_cpus() together</title>
<updated>2018-03-05T03:22:29+00:00</updated>
<author>
<name>Michael Neuling</name>
<email>mikey@neuling.org</email>
</author>
<published>2018-03-05T00:49:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-skiboot/commit/?id=730bccbbb6154bd9bf7e98d3fcb121521f325996'/>
<id>urn:sha1:730bccbbb6154bd9bf7e98d3fcb121521f325996</id>
<content type='text'>
Currently opal_reinit_cpus(OPAL_REINIT_CPUS_TM_SUSPEND_DISABLED)
always returns OPAL_UNSUPPORTED.

This ties the tm suspend fw-feature to the
opal_reinit_cpus(OPAL_REINIT_CPUS_TM_SUSPEND_DISABLED) so that when tm
suspend is disabled, we correctly report it to the kernel.  For
backwards compatibility, it's assumed tm suspend is available if the
fw-feature is not present.

Currently hostboot will clear fw-feature(TM_SUSPEND_ENABLED) on P9N
DD2.1. P9N DD2.2 will set fw-feature(TM_SUSPEND_ENABLED).  DD2.0 and
below has TM disabled completely (not just suspend).

We are using opal_reinit_cpus() to determine this setting (rather than
the device tree/HDAT) as some future firmware may let us change this
dynamically after boot. That is not the case currently though.

Signed-off-by: Michael Neuling &lt;mikey@neuling.org&gt;
Reviewed-by: Cyril Bur &lt;cyril.bur@au1.ibm.com&gt;
Signed-off-by: Stewart Smith &lt;stewart@linux.vnet.ibm.com&gt;
</content>
</entry>
<entry>
<title>cpu_wait_job: Correctly report time spent waiting for job</title>
<updated>2018-02-19T03:29:21+00:00</updated>
<author>
<name>Stewart Smith</name>
<email>stewart@linux.vnet.ibm.com</email>
</author>
<published>2018-02-19T03:29:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-skiboot/commit/?id=9b67f73a59473c1076016055eb43dcc72b7109cb'/>
<id>urn:sha1:9b67f73a59473c1076016055eb43dcc72b7109cb</id>
<content type='text'>
Way back when, we got confused between timebase and ms,
so let's just use ms and be done with it.

Fixes: 514406fa44279996bfc9c85c1e4e53689d375e64
Signed-off-by: Stewart Smith &lt;stewart@linux.vnet.ibm.com&gt;
</content>
</entry>
<entry>
<title>lock: Add additional lock auditing code</title>
<updated>2017-12-21T04:15:36+00:00</updated>
<author>
<name>Benjamin Herrenschmidt</name>
<email>benh@kernel.crashing.org</email>
</author>
<published>2017-12-20T02:16:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-skiboot/commit/?id=76d9bcdca58936d761458f8f05960239c4dd8dec'/>
<id>urn:sha1:76d9bcdca58936d761458f8f05960239c4dd8dec</id>
<content type='text'>
Keep track of lock owner name and replace lock_depth counter
with a per-cpu list of locks held by the cpu.

This allows us to print the actual locks held in case we hit
the (in)famous message about opal_pollers being run with a
lock held.

It also allows us to warn (and drop them) if locks are still
held when returning to the OS or completing a scheduled job.

Signed-off-by: Benjamin Herrenschmidt &lt;benh@kernel.crashing.org&gt;
Reviewed-by: Nicholas Piggin &lt;npiggin@gmail.com&gt;
[stewart: fix unit tests]
Signed-off-by: Stewart Smith &lt;stewart@linux.vnet.ibm.com&gt;
</content>
</entry>
</feed>
