Skip to contentSkip to conversation

livepatch: Wrong usage of spinlock on debug console.

PATCH In review Konrad Rzeszutek Wilk 5 participants 6 messages Jun 9, 2017 – Jun 12, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 <[email protected]>
CC Boris Ostrovsky <[email protected]>
CC Jan Beulich <[email protected]>
CC Andrew Cooper <[email protected]>
CC Julien Grall <[email protected]>
---
 xen/common/livepatch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/common/livepatch.c +1 -1
index f14bcbc..df67a1a 100644
@@ -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;
Signature · 7 lines
2.9.3


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines
Quoted 1 line
Quoted 1 line · On 09.06.17 at 16:16, <[email protected]> wrote:

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!

Quoted 6 lines
CC Ross Lagerwall <[email protected]>
CC Boris Ostrovsky <[email protected]>
CC Jan Beulich <[email protected]>
CC Andrew Cooper <[email protected]>
CC Julien Grall <[email protected]>

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Reviewed-by on v1 1/1
#2 lore raw
In reply to Konrad Rzeszutek Wilk
Quoted 14 lines · Konrad Rzeszutek Wilk

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!

Quoted 7 lines
CC Ross Lagerwall <[email protected]>
CC Boris Ostrovsky <[email protected]>
CC Jan Beulich <[email protected]>
CC Andrew Cooper <[email protected]>
CC Julien Grall <[email protected]>

---

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#3 lore raw
In reply to Konrad Rzeszutek Wilk
Quoted 14 lines · Konrad Rzeszutek Wilk

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!

Quoted 6 lines
CC Ross Lagerwall <[email protected]>
CC Boris Ostrovsky <[email protected]>
CC Jan Beulich <[email protected]>
CC Andrew Cooper <[email protected]>
CC Julien Grall <[email protected]>

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#4 lore raw

Is: Release-ack for 4.9, Is:Re: [PATCH for v4.9] livepatch: Wrong usage of spinlock on debug console.

Quoted 12 lines · Boris Ostrovsky
Quoted 11 lines · Konrad Rzeszutek Wilk

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
Quoted 8 lines
Quoted 8 lines

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

CC Ross Lagerwall <[email protected]>
CC Boris Ostrovsky <[email protected]>
CC Jan Beulich <[email protected]>
CC Andrew Cooper <[email protected]>
CC Julien Grall <[email protected]>

Julien, could you Release-Ack it for 4.9 please?

Quoted 6 lines
Quoted 1 line

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#5 lore raw

Re: Is: Release-ack for 4.9, Is:Re: [PATCH for v4.9] livepatch: Wrong usage of spinlock on debug console.

Hi Konrad,

Quoted 16 lines · Konrad Rzeszutek Wilk
Quoted 15 lines · Boris Ostrovsky
Quoted 14 lines · Konrad Rzeszutek Wilk

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!

Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
CC Ross Lagerwall <[email protected]>
CC Boris Ostrovsky <[email protected]>
CC Jan Beulich <[email protected]>
CC Andrew Cooper <[email protected]>
CC Julien Grall <[email protected]>

Julien, could you Release-Ack it for 4.9 please?

Sure:

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel