]> xenbits.xensource.com Git - xen.git/commitdiff
livepatch: Wrong usage of spinlock on debug console.
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Fri, 23 Jun 2017 13:12:44 +0000 (15:12 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 23 Jun 2017 13:12:44 +0000 (15:12 +0200)
If we have a large amount of livepatches and want to print them
on the console using 'xl debug-keys x' we eventually hit
the preemption check:

  if ( i && !(i % 64) )
  {
spin_unlock(&payload_lock);
process_pending_softirqs();
if ( spin_trylock(&payload_lock) )
return

<facepalm> The effect is that we have just effectively
taken the lock and returned without unlocking!

Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Reviewed-and-tested-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
master commit: 75dfe7c566c36e0af4714557a666827f49b69191
master date: 2017-06-12 08:59:33 -0400

xen/common/livepatch.c

index fc8ef9999ad3cb67fad4f638eb048d324363774a..8aaaad289eaf558f23df10dd6c8b314e2b39b845 100644 (file)
@@ -1641,7 +1641,7 @@ static void livepatch_printall(unsigned char key)
             {
                 spin_unlock(&payload_lock);
                 process_pending_softirqs();
-                if ( spin_trylock(&payload_lock) )
+                if ( !spin_trylock(&payload_lock) )
                 {
                     printk("Couldn't reacquire lock. Try again.\n");
                     return;