xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/MSI: fix locking in pci_restore_msi_state()
@ 2013-10-11  8:46 Jan Beulich
  2013-10-11  9:02 ` Andrew Cooper
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2013-10-11  8:46 UTC (permalink / raw)
  To: xen-devel; +Cc: Keir Fraser, Kristoffer Egefelt

[-- Attachment #1: Type: text/plain, Size: 819 bytes --]

Right after the loop the lock is being dropped, so all loop exits
should happen with the lock still held.

Reported-by: Kristoffer Egefelt <kristoffer@itoc.dk>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Kristoffer Egefelt <kristoffer@itoc.dk>

--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -1158,11 +1158,11 @@ int pci_restore_msi_state(struct pci_dev
         for ( i = 0; ; )
         {
             msi_set_mask_bit(desc, entry[i].msi_attrib.masked);
-            spin_unlock_irqrestore(&desc->lock, flags);
 
             if ( !--nr )
                 break;
 
+            spin_unlock_irqrestore(&desc->lock, flags);
             desc = &irq_desc[entry[++i].irq];
             spin_lock_irqsave(&desc->lock, flags);
             if ( desc->msi_desc != entry + i )




[-- Attachment #2: x86-MSI-restore-locking.patch --]
[-- Type: text/plain, Size: 864 bytes --]

x86/MSI: fix locking in pci_restore_msi_state()

Right after the loop the lock is being dropped, so all loop exits
should happen with the lock still held.

Reported-by: Kristoffer Egefelt <kristoffer@itoc.dk>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Kristoffer Egefelt <kristoffer@itoc.dk>

--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -1158,11 +1158,11 @@ int pci_restore_msi_state(struct pci_dev
         for ( i = 0; ; )
         {
             msi_set_mask_bit(desc, entry[i].msi_attrib.masked);
-            spin_unlock_irqrestore(&desc->lock, flags);
 
             if ( !--nr )
                 break;
 
+            spin_unlock_irqrestore(&desc->lock, flags);
             desc = &irq_desc[entry[++i].irq];
             spin_lock_irqsave(&desc->lock, flags);
             if ( desc->msi_desc != entry + i )

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

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

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

* Re: [PATCH] x86/MSI: fix locking in pci_restore_msi_state()
  2013-10-11  8:46 [PATCH] x86/MSI: fix locking in pci_restore_msi_state() Jan Beulich
@ 2013-10-11  9:02 ` Andrew Cooper
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Cooper @ 2013-10-11  9:02 UTC (permalink / raw)
  To: Jan Beulich; +Cc: xen-devel, Keir Fraser, Kristoffer Egefelt


[-- Attachment #1.1: Type: text/plain, Size: 1075 bytes --]

On 11/10/2013 09:46, Jan Beulich wrote:
> Right after the loop the lock is being dropped, so all loop exits
> should happen with the lock still held.
>
> Reported-by: Kristoffer Egefelt <kristoffer@itoc.dk>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> Tested-by: Kristoffer Egefelt <kristoffer@itoc.dk>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

>
> --- a/xen/arch/x86/msi.c
> +++ b/xen/arch/x86/msi.c
> @@ -1158,11 +1158,11 @@ int pci_restore_msi_state(struct pci_dev
>          for ( i = 0; ; )
>          {
>              msi_set_mask_bit(desc, entry[i].msi_attrib.masked);
> -            spin_unlock_irqrestore(&desc->lock, flags);
>  
>              if ( !--nr )
>                  break;
>  
> +            spin_unlock_irqrestore(&desc->lock, flags);
>              desc = &irq_desc[entry[++i].irq];
>              spin_lock_irqsave(&desc->lock, flags);
>              if ( desc->msi_desc != entry + i )
>
>
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel


[-- Attachment #1.2: Type: text/html, Size: 2135 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

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

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

end of thread, other threads:[~2013-10-11  9:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-11  8:46 [PATCH] x86/MSI: fix locking in pci_restore_msi_state() Jan Beulich
2013-10-11  9:02 ` Andrew Cooper

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).