linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: David Woodhouse <dwmw2@infradead.org>
Cc: Yinghai Lu <yinghai.lu@oracle.com>, Kalle Valo <kvalo@adurom.com>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	"iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Jesse Barnes <jbarnes@virtuousgeek.org>
Subject: Re: [PATCH] pci, dmar: flush IOTLB before exit domain
Date: Tue, 17 May 2011 13:41:02 -0600	[thread overview]
Message-ID: <1305661262.29268.27.camel@x201> (raw)
In-Reply-To: <1305558798.3146.48.camel@x201>

On Mon, 2011-05-16 at 09:13 -0600, Alex Williamson wrote:
> On Mon, 2011-05-09 at 15:48 +0100, David Woodhouse wrote:
> > On Thu, 2011-05-05 at 18:13 -0700, Yinghai Lu wrote:
> > > @@ -3252,6 +3252,9 @@ static int device_notifier(struct notifi
> > >                 return 0;
> > >  
> > >         if (action == BUS_NOTIFY_UNBOUND_DRIVER && !iommu_pass_through) {
> > > +               /* before we remove dev with domain, flush IOTLB */
> > > +               flush_unmaps();
> > > +
> > >                 domain_remove_one_dev_info(domain, pdev);
> > >  
> > >                 if (!(domain->flags & DOMAIN_FLAG_VIRTUAL_MACHINE) && 
> > 
> > That calls flush_unmaps() without the async_umap_flush_lock held,
> > doesn't it? A few days ago I asked someone else to test this candidate
> > patch for a similar issue:
> > 
> > http://david.woodhou.se/flush-unmaps-on-unbind.patch
> 
> Copying here:
> 
> > diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
> > index d552d2c..7e606d6 100644
> > --- a/drivers/pci/intel-iommu.c
> > +++ b/drivers/pci/intel-iommu.c
> > @@ -3256,8 +3259,10 @@ static int device_notifier(struct notifier_block *nb,
> >  
> >  		if (!(domain->flags & DOMAIN_FLAG_VIRTUAL_MACHINE) &&
> >  		    !(domain->flags & DOMAIN_FLAG_STATIC_IDENTITY) &&
> > -		    list_empty(&domain->devices))
> > +		    list_empty(&domain->devices)) {
> > +			flush_unmaps_timeout(0);
> >  			domain_exit(domain);
> > +		}
> >  	}
> >  
> >  	return 0;
> > @@ -3587,6 +3592,7 @@ static void intel_iommu_domain_destroy(struct iommu_domain *domain)
> >  	struct dmar_domain *dmar_domain = domain->priv;
> >  
> >  	domain->priv = NULL;
> > +	flush_unmaps_timeout(0);
> >  	vm_domain_exit(dmar_domain);
> > }
> 
> David, would it be worthwhile to push the unmaps into the
> {vm_}domain_exit() functions to avoid races like this in the future?  I
> can verify the above resolves a panic after unbinding a device from
> snd_hda_intel that I hit recently.  Do you plan to push this for .39?

BTW, is this second chunk really needed?  VM iommu mappings don't seem
to use the lazy unmap path.  Thanks,

Alex



  reply	other threads:[~2011-05-17 19:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-06  1:13 [PATCH] pci, dmar: flush IOTLB before exit domain Yinghai Lu
2011-05-09 14:48 ` David Woodhouse
2011-05-09 20:56   ` Yinghai Lu
2011-05-16 15:13   ` Alex Williamson
2011-05-17 19:41     ` Alex Williamson [this message]
2011-05-18  1:57       ` Alex Williamson
2011-05-21 14:38         ` Jan Kiszka
2011-05-24 11:04         ` Woodhouse, David
2011-05-24 16:29           ` Alex Williamson

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=1305661262.29268.27.camel@x201 \
    --to=alex.williamson@redhat.com \
    --cc=dwmw2@infradead.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jbarnes@virtuousgeek.org \
    --cc=kvalo@adurom.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=yinghai.lu@oracle.com \
    /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).