git: kernel - Fix shared spin-lock starvation bug in VMs

Matthew Dillon dillon at crater.dragonflybsd.org
Tue Nov 24 11:58:19 PST 2020


commit aab1a0485cdec1b29a4208ff6b7c67fafa690464
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Tue Nov 24 11:51:38 2020 -0800

    kernel - Fix shared spin-lock starvation bug in VMs
    
    * 'indefinite_uses_rdtsc' is set to zero by default when running in
      a virtual machine (and set to 1 on a real machine).  However, this
      disables the windowing code in _spin_lock_shared_contested() and
      causes it to defer to pending execusive lock requests indefinitely
      under heavy-enough loads.
    
    * Add a comment and always use a windowing test w/rdtsc() in
      _spin_lock_shared_contested().
    
      We were trying to avoid using the rdtsc() in VMs because some of them
      apparently trap the rdtsc instruction.  However, this puts us in a
      no-win situation when it comes to dealing with spin-locks.  So take the
      hit and start using rdtsc again in some situations when operating in
      a VM.
    
    Reported-by: mjg

Summary of changes:
 sys/kern/kern_spinlock.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/aab1a0485cdec1b29a4208ff6b7c67fafa690464


-- 
DragonFly BSD source repository


More information about the Commits mailing list