Subject: Re: [PATCH] powerpc: fix os-term usage on kernel panic

From: Mike Strosaker <[email-masked]>
Date: Fri, 30 Nov 2007 13:26:50 -0600

Will Schmidt wrote:
>>>From my reading of the papr, I've got the impression that there are two
> possibilities.    
> 
> First, the os-term never returns, and it's up to the service processor
> to do whatever it's going to do.  (call home, dump, something else).
> Nothing we can do there. 
> 
> Second, os-term returns, and it's up to the OS to call into power-off or
> system-reboot.
> I think this is more likely.   I havn't followed the path back from
> machine_restart to see exactly how we got there, but probably means a
> bit more logic to decide whether to call into rtas_restart() or
> pSeries_power_off() after the call to machine_shutdown.

My understanding was that os-term is supposed to indicate an "abnormal" 
termination, which is why it was initially only associated with a panic.

The os-term behavior is kind of complex; there is both a standard behavior, and 
an "extended" behavior.  You can determine if the extended behavior will be used 
by looking for the ibm,extended-os-term property.  I think POWER5 largely uses 
the older behavior, and POWER6 uses the extended behavior.

I've never seen os-term return using the old behavior.  Whether the partition 
reboots after calling os-term depends on the setting of the 
partition_auto_restart RTAS parameter.  If partition_auto_restart is 1 when 
os-term is called, the hypervisor will restart the partition and reset 
partition_auto_restart to 0.  The OS is supposed to set partition_auto_restart 
back to 1 after it boots; that way, if the OS is failing to boot, the hypervisor 
won't continually try to restart the partition without any hope of success. 
That's why Linas sent a patch with a pSeries_auto_restart routine.

If the extended os-term behavior is used, the os-term call is supposed to return 
unless the ibm,configure-kernel-dump call was previously used (to prepare for a 
PHYP assisted dump).  Would that explain why Linas and Will are seeing different 
behaviors?  I may have missed it, but I don't see a check for 
ibm,extended-os-term anywhere.

- Mike