[Qemu-devel] [PATCH] e1000e: correctly tear down MSI-X memory regions

Paolo Bonzini posted 1 patch 7 years, 1 month ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20170309115830.3860-1-pbonzini@redhat.com
Test checkpatch passed
Test docker passed
hw/net/e1000e.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[Qemu-devel] [PATCH] e1000e: correctly tear down MSI-X memory regions
Posted by Paolo Bonzini 7 years, 1 month ago
MSI-X has been disabled by the time the e1000e device is unrealized, hence
msix_uninit is never called.  This causes the object to be leaked, which
shows up as a RAMBlock with empty name when attempting migration.

Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/net/e1000e.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c
index b0f429b..6e23493 100644
--- a/hw/net/e1000e.c
+++ b/hw/net/e1000e.c
@@ -306,7 +306,7 @@ e1000e_init_msix(E1000EState *s)
 static void
 e1000e_cleanup_msix(E1000EState *s)
 {
-    if (msix_enabled(PCI_DEVICE(s))) {
+    if (msix_present(PCI_DEVICE(s))) {
         e1000e_unuse_msix_vectors(s, E1000E_MSIX_VEC_NUM);
         msix_uninit(PCI_DEVICE(s), &s->msix, &s->msix);
     }
-- 
2.9.3


Re: [Qemu-devel] [PATCH] e1000e: correctly tear down MSI-X memory regions
Posted by Laurent Vivier 7 years, 1 month ago
On 09/03/2017 12:58, Paolo Bonzini wrote:
> MSI-X has been disabled by the time the e1000e device is unrealized, hence
> msix_uninit is never called.  This causes the object to be leaked, which
> shows up as a RAMBlock with empty name when attempting migration.
> 
> Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> Cc: Jason Wang <jasowang@redhat.com>
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  hw/net/e1000e.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c
> index b0f429b..6e23493 100644
> --- a/hw/net/e1000e.c
> +++ b/hw/net/e1000e.c
> @@ -306,7 +306,7 @@ e1000e_init_msix(E1000EState *s)
>  static void
>  e1000e_cleanup_msix(E1000EState *s)
>  {
> -    if (msix_enabled(PCI_DEVICE(s))) {
> +    if (msix_present(PCI_DEVICE(s))) {
>          e1000e_unuse_msix_vectors(s, E1000E_MSIX_VEC_NUM);
>          msix_uninit(PCI_DEVICE(s), &s->msix, &s->msix);
>      }
> 

Tested-by: Laurent Vivier <lvivier@redhat.com>


Re: [Qemu-devel] [PATCH] e1000e: correctly tear down MSI-X memory regions
Posted by Jason Wang 7 years, 1 month ago

On 2017年03月09日 20:05, Laurent Vivier wrote:
> On 09/03/2017 12:58, Paolo Bonzini wrote:
>> MSI-X has been disabled by the time the e1000e device is unrealized, hence
>> msix_uninit is never called.  This causes the object to be leaked, which
>> shows up as a RAMBlock with empty name when attempting migration.
>>
>> Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
>> Cc: Jason Wang <jasowang@redhat.com>
>> Cc: qemu-stable@nongnu.org
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> ---
>>   hw/net/e1000e.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c
>> index b0f429b..6e23493 100644
>> --- a/hw/net/e1000e.c
>> +++ b/hw/net/e1000e.c
>> @@ -306,7 +306,7 @@ e1000e_init_msix(E1000EState *s)
>>   static void
>>   e1000e_cleanup_msix(E1000EState *s)
>>   {
>> -    if (msix_enabled(PCI_DEVICE(s))) {
>> +    if (msix_present(PCI_DEVICE(s))) {
>>           e1000e_unuse_msix_vectors(s, E1000E_MSIX_VEC_NUM);
>>           msix_uninit(PCI_DEVICE(s), &s->msix, &s->msix);
>>       }
>>
> Tested-by: Laurent Vivier <lvivier@redhat.com>
>

Applied, thanks.