[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH for v4.9] livepatch: Wrong usage of spinlock on debug console.



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!

CC: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
CC: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
CC: Jan Beulich <jbeulich@xxxxxxxx>
CC: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CC: Julien Grall <julien.grall@xxxxxxx>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
---
 xen/common/livepatch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c
index f14bcbc..df67a1a 100644
--- a/xen/common/livepatch.c
+++ b/xen/common/livepatch.c
@@ -1642,7 +1642,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;
-- 
2.9.3


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.