From: "Xu, Quan" <quan.xu@intel.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: "dario.faggioli@citrix.com" <dario.faggioli@citrix.com>,
"Wu, Feng" <feng.wu@intel.com>,
"Tian, Kevin" <kevin.tian@intel.com>,
"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [PATCH v10 3/3] vt-d: fix vt-d Device-TLB flush timeout issue
Date: Wed, 18 May 2016 13:11:05 +0000 [thread overview]
Message-ID: <945CA011AD5F084CBEA3E851C0AB28894B8B1F4A@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <573B400A02000078000EC34E@prv-mh.provo.novell.com>
On May 17, 2016 10:00 PM, Jan Beulich <JBeulich@suse.com> wrote:
> >>> On 22.04.16 at 12:54, <quan.xu@intel.com> wrote:
> > --- a/xen/drivers/passthrough/vtd/qinval.c
> > +++ b/xen/drivers/passthrough/vtd/qinval.c
> > @@ -206,10 +206,71 @@ static int invalidate_sync(struct iommu *iommu)
> > return 0;
> > }
> >
> > +static void dev_invalidate_iotlb_timeout(struct iommu *iommu, u16 did,
> > + u16 seg, u8 bus, u8 devfn) {
> > + struct domain *d = NULL;
> > + struct pci_dev *pdev;
> > +
> > + if ( test_bit(did, iommu->domid_bitmap) )
> > + d = rcu_lock_domain_by_id(iommu->domid_map[did]);
> > +
> > + /*
> > + * In case the domain has been freed or the IOMMU domid bitmap is
> > + * not valid, the device no longer belongs to this domain.
> > + */
> > + if ( d == NULL )
> > + return;
> > +
> > + pcidevs_lock();
> > +
> > + for_each_pdev(d, pdev)
> > + {
> > + if ( (pdev->seg == seg) &&
> > + (pdev->bus == bus) &&
> > + (pdev->devfn == devfn) )
> > + {
> > + ASSERT(pdev->domain);
> > + list_del(&pdev->domain_list);
> > + pdev->domain = NULL;
> > + pci_hide_existing_device(pdev);
> > + break;
> > + }
> > + }
>
> A loop like this is of course not ideal (especially for Dom0, which may have
> many devices). And I wonder why you, ...
>
> > @@ -134,8 +133,9 @@ int dev_invalidate_iotlb(struct iommu *iommu, u16
> did,
> > /* invalidate all translations: sbit=1,bit_63=0,bit[62:12]=1 */
> > sbit = 1;
> > addr = (~0UL << PAGE_SHIFT_4K) & 0x7FFFFFFFFFFFFFFF;
> > - rc = qinval_device_iotlb_sync(iommu, pdev->ats_queue_depth,
> > - sid, sbit, addr);
> > + rc = qinval_device_iotlb_sync(iommu, pdev->ats_queue_depth, did,
> > + pdev->seg, pdev->bus, pdev->devfn,
> > + sbit, addr);
> > break;
> > case DMA_TLB_PSI_FLUSH:
> > if ( !device_in_domain(iommu, pdev, did) ) @@ -154,8
> > +154,9 @@ int dev_invalidate_iotlb(struct iommu *iommu, u16 did,
> > addr |= (((u64)1 << (size_order - 1)) - 1) << PAGE_SHIFT_4K;
> > }
> >
> > - rc = qinval_device_iotlb_sync(iommu, pdev->ats_queue_depth,
> > - sid, sbit, addr);
> > + rc = qinval_device_iotlb_sync(iommu, pdev->ats_queue_depth, did,
> > + pdev->seg, pdev->bus, pdev->devfn,
> > + sbit, addr);
> > break;
>
> ... holding pdev in your hands here, don't just pass it down (which at once
> would make the function signature less convoluted: you could even eliminate
> the currently 2nd parameter that way).
>
Good idea!!
Quan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-05-18 13:11 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-22 10:54 [PATCH v10 0/3] VT-d Device-TLB flush issue Quan Xu
2016-04-22 10:54 ` [PATCH v10 1/3] vt-d: add a timeout parameter for Queued Invalidation Quan Xu
2016-05-13 15:27 ` Jan Beulich
2016-05-16 15:25 ` Xu, Quan
2016-05-17 3:19 ` Tian, Kevin
2016-05-17 7:47 ` Jan Beulich
2016-05-18 12:53 ` Xu, Quan
2016-05-18 15:05 ` Jan Beulich
2016-05-19 0:32 ` Tian, Kevin
2016-05-19 1:35 ` Xu, Quan
2016-05-19 6:13 ` Jan Beulich
2016-05-19 11:26 ` Xu, Quan
2016-05-19 11:35 ` Jan Beulich
2016-05-19 15:14 ` Xu, Quan
2016-04-22 10:54 ` [PATCH v10 2/3] vt-d: synchronize for Device-TLB flush one by one Quan Xu
2016-05-17 12:36 ` Jan Beulich
2016-05-18 8:53 ` Xu, Quan
2016-05-18 9:29 ` Jan Beulich
2016-05-18 12:02 ` Xu, Quan
2016-04-22 10:54 ` [PATCH v10 3/3] vt-d: fix vt-d Device-TLB flush timeout issue Quan Xu
2016-05-17 14:00 ` Jan Beulich
2016-05-18 13:11 ` Xu, Quan [this message]
2016-05-20 7:15 ` Xu, Quan
2016-05-20 9:58 ` Jan Beulich
2016-05-23 14:00 ` Xu, Quan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=945CA011AD5F084CBEA3E851C0AB28894B8B1F4A@SHSMSX101.ccr.corp.intel.com \
--to=quan.xu@intel.com \
--cc=JBeulich@suse.com \
--cc=dario.faggioli@citrix.com \
--cc=feng.wu@intel.com \
--cc=kevin.tian@intel.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).