Re: [PATCH] iommu/amd: Fix IOMMU page flush when detach all devices from a domain

2019-01-24 Thread j...@8bytes.org
Hi Suravee, On Thu, Jan 24, 2019 at 03:25:19AM +, Suthikulpanit, Suravee wrote: > Actually, I just noticed that device_flush_dte() has already handled flushing > the DTE > for alias device as well. Please see the link below. > >

Re: [PATCH] iommu/amd: Fix IOMMU page flush when detach all devices from a domain

2019-01-23 Thread Suthikulpanit, Suravee
Joerg, On 1/23/19 2:56 PM, j...@8bytes.org wrote: > Hi Suravee, > > On Tue, Jan 22, 2019 at 03:53:18PM +, Suthikulpanit, Suravee wrote: >> Thanks for the detail. Alright then, let's just go with the version you >> sent on 1/16/19. Do you want me to resend V3 with that changes, or >> would

Re: [PATCH] iommu/amd: Fix IOMMU page flush when detach all devices from a domain

2019-01-22 Thread j...@8bytes.org
Hi Suravee, On Tue, Jan 22, 2019 at 03:53:18PM +, Suthikulpanit, Suravee wrote: > Thanks for the detail. Alright then, let's just go with the version you > sent on 1/16/19. Do you want me to resend V3 with that changes, or > would you be taking care of that? Please send me a v3 based on the

Re: [PATCH] iommu/amd: Fix IOMMU page flush when detach all devices from a domain

2019-01-22 Thread Suthikulpanit, Suravee
Joerg, On 1/22/19 5:44 PM, j...@8bytes.org wrote: > Hi Suravee, > > On Thu, Jan 17, 2019 at 08:44:36AM +, Suthikulpanit, Suravee wrote: >> Then, in __domain_flush_pages, we issue command when the dev_iommu[] >= 0. >> This should preserve previous behavior, and only add flushing condition to

Re: [PATCH] iommu/amd: Fix IOMMU page flush when detach all devices from a domain

2019-01-22 Thread j...@8bytes.org
Hi Suravee, On Thu, Jan 17, 2019 at 08:44:36AM +, Suthikulpanit, Suravee wrote: > Then, in __domain_flush_pages, we issue command when the dev_iommu[] >= 0. > This should preserve previous behavior, and only add flushing condition to > the specific IOMMU in detached state. Please let me know

Re: [PATCH] iommu/amd: Fix IOMMU page flush when detach all devices from a domain

2019-01-17 Thread Suthikulpanit, Suravee
Joerg, On 1/17/19 3:44 PM, Suravee Suthikulpanit wrote: > Joerg, > > On 1/17/19 12:08 AM, j...@8bytes.org wrote: >> On Wed, Jan 16, 2019 at 02:08:55PM +, Suthikulpanit, Suravee wrote: >>> Actually, I am not sure how we would be missing the flush on the last >>> device. >>> In my test, I am

Re: [PATCH] iommu/amd: Fix IOMMU page flush when detach all devices from a domain

2019-01-17 Thread Suthikulpanit, Suravee
Joerg, On 1/17/19 12:08 AM, j...@8bytes.org wrote: > On Wed, Jan 16, 2019 at 02:08:55PM +, Suthikulpanit, Suravee wrote: >> Actually, I am not sure how we would be missing the flush on the last device. >> In my test, I am seeing the flush command being issued correctly during >>

Re: [PATCH] iommu/amd: Fix IOMMU page flush when detach all devices from a domain

2019-01-16 Thread j...@8bytes.org
On Wed, Jan 16, 2019 at 02:40:59PM +, Suthikulpanit, Suravee wrote: > Actually, device_flush_dte(alias) should be needed regardless of this patch. > Are you planning to add this? Yes, I stumbled over this while writing the diff. I'll submit that as a separate patch. Thanks, Joerg

Re: [PATCH] iommu/amd: Fix IOMMU page flush when detach all devices from a domain

2019-01-16 Thread j...@8bytes.org
On Wed, Jan 16, 2019 at 02:08:55PM +, Suthikulpanit, Suravee wrote: > Actually, I am not sure how we would be missing the flush on the last device. > In my test, I am seeing the flush command being issued correctly during > vfio_unmap_unpin(), which is after all devices are detached. >

Re: [PATCH] iommu/amd: Fix IOMMU page flush when detach all devices from a domain

2019-01-16 Thread Suthikulpanit, Suravee
Joerg, On 1/16/19 8:26 PM, j...@8bytes.org wrote: > How about the attached diff? If > I understand the problem correctly, it should fix the problem more > reliably. > > Thanks, > > Joerg > > diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c > index

Re: [PATCH] iommu/amd: Fix IOMMU page flush when detach all devices from a domain

2019-01-16 Thread Suthikulpanit, Suravee
Joerg, On 1/16/19 8:26 PM, j...@8bytes.org wrote: > On Wed, Jan 16, 2019 at 04:16:25AM +, Suthikulpanit, Suravee wrote: >> diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c >> index 525659b88ade..ab31ba75da1b 100644 >> --- a/drivers/iommu/amd_iommu.c >> +++

Re: [PATCH] iommu/amd: Fix IOMMU page flush when detach all devices from a domain

2019-01-16 Thread j...@8bytes.org
On Wed, Jan 16, 2019 at 04:16:25AM +, Suthikulpanit, Suravee wrote: > diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c > index 525659b88ade..ab31ba75da1b 100644 > --- a/drivers/iommu/amd_iommu.c > +++ b/drivers/iommu/amd_iommu.c > @@ -1248,7 +1248,13 @@ static void

[PATCH] iommu/amd: Fix IOMMU page flush when detach all devices from a domain

2019-01-15 Thread Suthikulpanit, Suravee
From: Suravee Suthikulpanit When a VM is terminated, the VFIO driver detaches all pass-through devices from VFIO domain by clearing domain id and page table root pointer from each device table entry (DTE), and then invalidates the DTE. Then, the VFIO driver unmap pages and invalidate IOMMU