xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH for v4.9] livepatch: Wrong usage of spinlock on debug console.
@ 2017-06-09 14:16 Konrad Rzeszutek Wilk
  2017-06-09 14:53 ` Jan Beulich
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Konrad Rzeszutek Wilk @ 2017-06-09 14:16 UTC (permalink / raw)
  To: xen-devel
  Cc: Konrad Rzeszutek Wilk, Andrew Cooper, Ross Lagerwall,
	Julien Grall, Jan Beulich, Boris Ostrovsky

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@citrix.com>
CC: Boris Ostrovsky <boris.ostrovsky@oracle.com>
CC: Jan Beulich <jbeulich@suse.com>
CC: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Julien Grall <julien.grall@arm.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 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@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH for v4.9] livepatch: Wrong usage of spinlock on debug console.
  2017-06-09 14:16 [PATCH for v4.9] livepatch: Wrong usage of spinlock on debug console Konrad Rzeszutek Wilk
@ 2017-06-09 14:53 ` Jan Beulich
  2017-06-09 15:05 ` Ross Lagerwall
  2017-06-09 17:12 ` Boris Ostrovsky
  2 siblings, 0 replies; 6+ messages in thread
From: Jan Beulich @ 2017-06-09 14:53 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk
  Cc: Boris Ostrovsky, Andrew Cooper, Julien Grall, xen-devel, Ross Lagerwall

>>> On 09.06.17 at 16:16, <konrad.wilk@oracle.com> 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!
> 
> CC: Ross Lagerwall <ross.lagerwall@citrix.com>
> CC: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> CC: Jan Beulich <jbeulich@suse.com>
> CC: Andrew Cooper <andrew.cooper3@citrix.com>
> CC: Julien Grall <julien.grall@arm.com>
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH for v4.9] livepatch: Wrong usage of spinlock on debug console.
  2017-06-09 14:16 [PATCH for v4.9] livepatch: Wrong usage of spinlock on debug console Konrad Rzeszutek Wilk
  2017-06-09 14:53 ` Jan Beulich
@ 2017-06-09 15:05 ` Ross Lagerwall
  2017-06-09 17:12 ` Boris Ostrovsky
  2 siblings, 0 replies; 6+ messages in thread
From: Ross Lagerwall @ 2017-06-09 15:05 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk, xen-devel
  Cc: Andrew Cooper, Boris Ostrovsky, Julien Grall, Jan Beulich

On 06/09/2017 03:16 PM, Konrad Rzeszutek Wilk 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!
> 
> CC: Ross Lagerwall <ross.lagerwall@citrix.com>
> CC: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> CC: Jan Beulich <jbeulich@suse.com>
> CC: Andrew Cooper <andrew.cooper3@citrix.com>
> CC: Julien Grall <julien.grall@arm.com>
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> ---

Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH for v4.9] livepatch: Wrong usage of spinlock on debug console.
  2017-06-09 14:16 [PATCH for v4.9] livepatch: Wrong usage of spinlock on debug console Konrad Rzeszutek Wilk
  2017-06-09 14:53 ` Jan Beulich
  2017-06-09 15:05 ` Ross Lagerwall
@ 2017-06-09 17:12 ` Boris Ostrovsky
  2017-06-11 12:15   ` Is: Release-ack for 4.9, Is:Re: " Konrad Rzeszutek Wilk
  2 siblings, 1 reply; 6+ messages in thread
From: Boris Ostrovsky @ 2017-06-09 17:12 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk, xen-devel
  Cc: Ross Lagerwall, Julien Grall, Jan Beulich, Andrew Cooper

On 06/09/2017 10:16 AM, Konrad Rzeszutek Wilk 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!
>
> CC: Ross Lagerwall <ross.lagerwall@citrix.com>
> CC: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> CC: Jan Beulich <jbeulich@suse.com>
> CC: Andrew Cooper <andrew.cooper3@citrix.com>
> CC: Julien Grall <julien.grall@arm.com>
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>


Reviewed-and-tested-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>



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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Is: Release-ack for 4.9, Is:Re: [PATCH for v4.9] livepatch: Wrong usage of spinlock on debug console.
  2017-06-09 17:12 ` Boris Ostrovsky
@ 2017-06-11 12:15   ` Konrad Rzeszutek Wilk
  2017-06-12 11:08     ` Julien Grall
  0 siblings, 1 reply; 6+ messages in thread
From: Konrad Rzeszutek Wilk @ 2017-06-11 12:15 UTC (permalink / raw)
  To: Boris Ostrovsky
  Cc: xen-devel, Julien Grall, Andrew Cooper, Jan Beulich, Ross Lagerwall

On Fri, Jun 09, 2017 at 01:12:10PM -0400, Boris Ostrovsky wrote:
> On 06/09/2017 10:16 AM, Konrad Rzeszutek Wilk 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!
> >
> > CC: Ross Lagerwall <ross.lagerwall@citrix.com>
> > CC: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> > CC: Jan Beulich <jbeulich@suse.com>
> > CC: Andrew Cooper <andrew.cooper3@citrix.com>
> > CC: Julien Grall <julien.grall@arm.com>

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

> > Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> 
> 
> Reviewed-and-tested-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> 
> 

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Is: Release-ack for 4.9, Is:Re: [PATCH for v4.9] livepatch: Wrong usage of spinlock on debug console.
  2017-06-11 12:15   ` Is: Release-ack for 4.9, Is:Re: " Konrad Rzeszutek Wilk
@ 2017-06-12 11:08     ` Julien Grall
  0 siblings, 0 replies; 6+ messages in thread
From: Julien Grall @ 2017-06-12 11:08 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk, Boris Ostrovsky
  Cc: xen-devel, Andrew Cooper, Jan Beulich, Ross Lagerwall

Hi Konrad,

On 11/06/17 13:15, Konrad Rzeszutek Wilk wrote:
> On Fri, Jun 09, 2017 at 01:12:10PM -0400, Boris Ostrovsky wrote:
>> On 06/09/2017 10:16 AM, Konrad Rzeszutek Wilk 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!
>>>
>>> CC: Ross Lagerwall <ross.lagerwall@citrix.com>
>>> CC: Boris Ostrovsky <boris.ostrovsky@oracle.com>
>>> CC: Jan Beulich <jbeulich@suse.com>
>>> CC: Andrew Cooper <andrew.cooper3@citrix.com>
>>> CC: Julien Grall <julien.grall@arm.com>
>
> Julien, could you Release-Ack it for 4.9 please?

Sure:

Release-acked-by: Julien Grall <julien.grall@arm.com>

Cheers,

-- 
Julien Grall

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-06-12 11:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-09 14:16 [PATCH for v4.9] livepatch: Wrong usage of spinlock on debug console Konrad Rzeszutek Wilk
2017-06-09 14:53 ` Jan Beulich
2017-06-09 15:05 ` Ross Lagerwall
2017-06-09 17:12 ` Boris Ostrovsky
2017-06-11 12:15   ` Is: Release-ack for 4.9, Is:Re: " Konrad Rzeszutek Wilk
2017-06-12 11:08     ` Julien Grall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).