[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] x86/vtd: fix IOMMU share PT destruction path
> -----Original Message----- > From: Wei Liu [mailto:wei.liu2@xxxxxxxxxx] > Sent: 09 October 2018 15:26 > To: xen-devel@xxxxxxxxxxxxxxxxxxxx > Cc: Jan Beulich <JBeulich@xxxxxxxx>; Roger Pau Monne > <roger.pau@xxxxxxxxxx>; Paul Durrant <Paul.Durrant@xxxxxxxxxx>; Wei Liu > <wei.liu2@xxxxxxxxxx>; Kevin Tian <kevin.tian@xxxxxxxxx> > Subject: Re: [PATCH] x86/vtd: fix IOMMU share PT destruction path > > On Tue, Oct 09, 2018 at 11:42:17AM +0100, Wei Liu wrote: > > Commit 2916951c1 ("mm / iommu: include need_iommu() test in > > iommu_use_hap_pt()") included need_iommu() in iommu_use_hap_pt and > > 91d4eca7add (" mm / iommu: split need_iommu() into has_iommu_pt() and > > need_iommu_pt_sync()") made things finer grain by spliting need_iommu > > into three states. > > > > The destruction path can't use iommu_use_hap_pt because at the point > > platform op is called, IOMMU is already switched to disabled state and > > the shared PT test would always be false. > > > > Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> > > --- > > xen/drivers/passthrough/vtd/iommu.c | 8 +++++++- > > 1 file changed, 7 insertions(+), 1 deletion(-) > > > > diff --git a/xen/drivers/passthrough/vtd/iommu.c > b/xen/drivers/passthrough/vtd/iommu.c > > index f94b522c73..d66d9e8ad0 100644 > > --- a/xen/drivers/passthrough/vtd/iommu.c > > +++ b/xen/drivers/passthrough/vtd/iommu.c > > @@ -1752,7 +1752,13 @@ static void iommu_domain_teardown(struct domain > *d) > > xfree(mrmrr); > > } > > > > - if ( iommu_use_hap_pt(d) ) > > + ASSERT(hap_enabled(d)); > > This needs to be moved into the predicate below because PV domain can > enter this path too. > > > + > > + /* > > + * We can't use iommu_use_hap_pt here because the IOMMU state is > already > > + * changed to IOMMU_STATUS_disabled at this point. > > + */ > > + if ( iommu_hap_pt_share ) > > return; I guess the other option is to track whether there is anything to tear down in the iommu struct and test that. We have status and need_sync now, but maybe that's too simplistic. Paul > > > > spin_lock(&hd->arch.mapping_lock); > > -- > > 2.11.0 > > _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |