Author: bdragon
Date: Wed Sep 23 02:28:19 2020
New Revision: 366057
URL: https://svnweb.freebsd.org/changeset/base/366057

Log:
  [PowerPC64LE] Fix sleeping on POWER8.
  
  Due to enter_idle_powerx fabricating a MSR from scratch, it is necessary
  for it to care about the endianness, so we don't accidentally switch
  endian the first time we idle a thread.
  
  Took about five seconds to spot after seeing an unmangled backtrace.
  
  The hard bit was needing to temporarily set up a mutex to sort out the
  logjam that happens when every thread simultaneously wakes up in the wrong
  endian due to the panic IPI and panics, leaving what I can best describe as
  "alphabet soup" on the console.
  
  Luckily, I already had a patch sitting around to do that.
  
  This brings POWER8 up to equivilence with POWER9 on PPC64LE.
  
  Sponsored by: Tag1 Consulting, Inc.

Modified:
  head/sys/powerpc/powerpc/cpu_subr64.S

Modified: head/sys/powerpc/powerpc/cpu_subr64.S
==============================================================================
--- head/sys/powerpc/powerpc/cpu_subr64.S       Wed Sep 23 02:17:44 2020        
(r366056)
+++ head/sys/powerpc/powerpc/cpu_subr64.S       Wed Sep 23 02:28:19 2020        
(r366057)
@@ -71,7 +71,11 @@ ENTRY(enter_idle_powerx)
 
        /* Set MSR */
        li      %r3,0
+#ifdef __LITTLE_ENDIAN__
+       ori     %r3,%r3,(PSL_ME | PSL_RI | PSL_LE)
+#else
        ori     %r3,%r3,(PSL_ME | PSL_RI)
+#endif
        li      %r8,0x9                 /* PSL_SF and PSL_HV */
        insrdi  %r3,%r8,4,0
        mtsrr1  %r3
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to