Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1323032 > unrolled thread

[PATCH] Xen/PCI: correct notifier used for device removal

Started by"Jan Beulich" <JBeulich@suse.com>
First post2016-02-01 13:00 +0100
Last post2016-02-01 14:20 +0100
Articles 5 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] Xen/PCI: correct notifier used for device removal "Jan Beulich" <JBeulich@suse.com> - 2016-02-01 13:00 +0100
    Re: [PATCH] Xen/PCI: correct notifier used for device removal David Vrabel <david.vrabel@citrix.com> - 2016-02-01 13:10 +0100
      Re: [PATCH] Xen/PCI: correct notifier used for device removal "Jan Beulich" <JBeulich@suse.com> - 2016-02-01 13:20 +0100
        Re: [PATCH] Xen/PCI: correct notifier used for device removal "Jan Beulich" <JBeulich@suse.com> - 2016-02-01 14:10 +0100
        Re: [PATCH] Xen/PCI: correct notifier used for device removal David Vrabel <david.vrabel@citrix.com> - 2016-02-01 14:20 +0100

#1323032 — [PATCH] Xen/PCI: correct notifier used for device removal

From"Jan Beulich" <JBeulich@suse.com>
Date2016-02-01 13:00 +0100
Subject[PATCH] Xen/PCI: correct notifier used for device removal
Message-ID<qXljc-25A-19@gated-at.bofh.it>
Commit 599bad38cf added BUS_NOTIFY_REMOVED_DEVICE in order to allow
avoiding removal of IOMMU mappings before the driver actually got
unbound from the device. Naturally we should be using this too.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
 drivers/xen/pci.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- 4.5-rc2/drivers/xen/pci.c
+++ 4.5-rc2-xen-PCI-remove-notifier/drivers/xen/pci.c
@@ -185,7 +185,7 @@ static int xen_pci_notifier(struct notif
 	case BUS_NOTIFY_ADD_DEVICE:
 		r = xen_add_device(dev);
 		break;
-	case BUS_NOTIFY_DEL_DEVICE:
+	case BUS_NOTIFY_REMOVED_DEVICE:
 		r = xen_remove_device(dev);
 		break;
 	default:

[toc] | [next] | [standalone]


#1323037

FromDavid Vrabel <david.vrabel@citrix.com>
Date2016-02-01 13:10 +0100
Message-ID<qXlsT-2sn-21@gated-at.bofh.it>
In reply to#1323032
On 01/02/16 11:58, Jan Beulich wrote:
> Commit 599bad38cf added BUS_NOTIFY_REMOVED_DEVICE in order to allow
> avoiding removal of IOMMU mappings before the driver actually got
> unbound from the device. Naturally we should be using this too.

Because otherwise...?  What happens if we don't make this change?

Removing IOMMU mappings for a device when the driver is still bound to
the device looks wrong to me. Surely the device is still active and may
still be performing DMA at this point?

David

> --- 4.5-rc2/drivers/xen/pci.c
> +++ 4.5-rc2-xen-PCI-remove-notifier/drivers/xen/pci.c
> @@ -185,7 +185,7 @@ static int xen_pci_notifier(struct notif
>  	case BUS_NOTIFY_ADD_DEVICE:
>  		r = xen_add_device(dev);
>  		break;
> -	case BUS_NOTIFY_DEL_DEVICE:
> +	case BUS_NOTIFY_REMOVED_DEVICE:
>  		r = xen_remove_device(dev);
>  		break;
>  	default:
> 
> 
> 

[toc] | [prev] | [next] | [standalone]


#1323043

From"Jan Beulich" <JBeulich@suse.com>
Date2016-02-01 13:20 +0100
Message-ID<qXlCy-2xe-11@gated-at.bofh.it>
In reply to#1323037
>>> On 01.02.16 at 13:01, <david.vrabel@citrix.com> wrote:
> On 01/02/16 11:58, Jan Beulich wrote:
>> Commit 599bad38cf added BUS_NOTIFY_REMOVED_DEVICE in order to allow
>> avoiding removal of IOMMU mappings before the driver actually got
>> unbound from the device. Naturally we should be using this too.
> 
> Because otherwise...?  What happens if we don't make this change?
> 
> Removing IOMMU mappings for a device when the driver is still bound to
> the device looks wrong to me. Surely the device is still active and may
> still be performing DMA at this point?

Exactly - you answered your own question (as does the commit
referred to).

Jan

[toc] | [prev] | [next] | [standalone]


#1323079

From"Jan Beulich" <JBeulich@suse.com>
Date2016-02-01 14:10 +0100
Message-ID<qXmoX-3eN-51@gated-at.bofh.it>
In reply to#1323043
>>> On 01.02.16 at 14:03, <david.vrabel@citrix.com> wrote:
> On 01/02/16 12:16, Jan Beulich wrote:
>>>>> On 01.02.16 at 13:01, <david.vrabel@citrix.com> wrote:
>>> On 01/02/16 11:58, Jan Beulich wrote:
>>>> Commit 599bad38cf added BUS_NOTIFY_REMOVED_DEVICE in order to allow
>>>> avoiding removal of IOMMU mappings before the driver actually got
>>>> unbound from the device. Naturally we should be using this too.
>>>
>>> Because otherwise...?  What happens if we don't make this change?
>>>
>>> Removing IOMMU mappings for a device when the driver is still bound to
>>> the device looks wrong to me. Surely the device is still active and may
>>> still be performing DMA at this point?
>> 
>> Exactly - you answered your own question (as does the commit
>> referred to).
> 
> I misread, sorry.  I think I will reword this as:
> 
> "Commit 599bad38cf added BUS_NOTIFY_REMOVED_DEVICE to defer the removal
> of IOMMU mappings until the driver has been unbound from the device
> (i.e., until it is guaranteed that there are no outstanding DMA
> transactions).

If you want this, then I think you should add "... or IRQs".

Thanks, Jan

[toc] | [prev] | [next] | [standalone]


#1323088

FromDavid Vrabel <david.vrabel@citrix.com>
Date2016-02-01 14:20 +0100
Message-ID<qXmoX-3eN-53@gated-at.bofh.it>
In reply to#1323043
On 01/02/16 12:16, Jan Beulich wrote:
>>>> On 01.02.16 at 13:01, <david.vrabel@citrix.com> wrote:
>> On 01/02/16 11:58, Jan Beulich wrote:
>>> Commit 599bad38cf added BUS_NOTIFY_REMOVED_DEVICE in order to allow
>>> avoiding removal of IOMMU mappings before the driver actually got
>>> unbound from the device. Naturally we should be using this too.
>>
>> Because otherwise...?  What happens if we don't make this change?
>>
>> Removing IOMMU mappings for a device when the driver is still bound to
>> the device looks wrong to me. Surely the device is still active and may
>> still be performing DMA at this point?
> 
> Exactly - you answered your own question (as does the commit
> referred to).

I misread, sorry.  I think I will reword this as:

"Commit 599bad38cf added BUS_NOTIFY_REMOVED_DEVICE to defer the removal
of IOMMU mappings until the driver has been unbound from the device
(i.e., until it is guaranteed that there are no outstanding DMA
transactions).

Naturally we should be using this too."

David

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web