From: Joerg Roedel <jroedel@suse.de>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: linux-pci@vger.kernel.org, David Woodhouse <dwmw2@infradead.org>,
iommu@lists.linux-foundation.org,
Gregor Dick <gdick@solarflare.com>
Subject: Re: [PATCH v2 01/11] iommu/vt-d: Cache PCI ATS state and Invalidate Queue Depth
Date: Tue, 28 Jul 2015 09:14:18 +0200 [thread overview]
Message-ID: <20150728071417.GK27614@suse.de> (raw)
In-Reply-To: <20150727225453.GB24401@google.com>
Hi Bjorn,
On Mon, Jul 27, 2015 at 05:54:53PM -0500, Bjorn Helgaas wrote:
> > Hmm, this is a place where the relaxed error handling in
> > pci_enable_ats() can get problematic.
>
> By "relaxed error handling," do you mean the fact that in v4.1,
> pci_enable_ats() has a BUG_ON(is_enabled), while now it merely
> returns -EINVAL?
>
> (BTW, I did change it to add a WARN_ON and return -EBUSY as you suggested.)
Okay, great.
> > If ATS is (by accident or a bug
> > elsewhere) already enabled an the function returns -EINVAL, the IOMMU
> > driver considers ATS disabled and doesn't flush the IO/TLBs of the
> > device. This can cause data corruption later on, so we should make sure
> > that info->ats.enabled is consistent with pdev->ats_enabled.
>
> I'm not quite sure I understand this. In the patch above, we only set
> "info->ats.enabled = 1" if pci_enable_ats() has succeeded. The amd_iommu.c
> code is similar.
>
> Are you concerned about the case where future code enables ATS before
> intel-iommu, the pci_enable_ats() in intel-iommu fails, intel-iommu
> believes ATS is disabled, intel-iommu calls iommu_flush_dev_iotlb(), but it
> doesn't flush the IOTLB?
>
> I guess I could make intel-iommu handle -EBUSY differently from -EINVAL.
> Would that help? It seems sort of clumsy, but ...?
I was concerned that it was harder now to spot bugs in ATS
enabling/disabling, when pci_enable_ats just returns -EINVAL when ATS is
already enabled.
But with the WARN_ON now we will notice these bugs early again, thanks
for adding it.
Joerg
next prev parent reply other threads:[~2015-07-28 7:14 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-21 0:13 [PATCH v2 00/11] PCI: Fix ATS deadlock Bjorn Helgaas
2015-07-21 0:13 ` [PATCH v2 01/11] iommu/vt-d: Cache PCI ATS state and Invalidate Queue Depth Bjorn Helgaas
2015-07-27 13:08 ` Joerg Roedel
2015-07-27 22:54 ` Bjorn Helgaas
2015-07-28 7:14 ` Joerg Roedel [this message]
2015-07-21 0:14 ` [PATCH v2 02/11] PCI: Allocate ATS struct during enumeration Bjorn Helgaas
2015-07-27 12:40 ` Joerg Roedel
2015-07-21 0:14 ` [PATCH v2 03/11] PCI: Embed ATS info directly into struct pci_dev Bjorn Helgaas
2015-07-27 12:45 ` Joerg Roedel
2015-07-21 0:14 ` [PATCH v2 04/11] PCI: Reduce size of ATS structure elements Bjorn Helgaas
2015-07-21 0:14 ` [PATCH v2 05/11] PCI: Rationalize pci_ats_queue_depth() error checking Bjorn Helgaas
2015-07-21 0:14 ` [PATCH v2 06/11] PCI: Inline the ATS setup code into pci_ats_init() Bjorn Helgaas
2015-07-21 0:14 ` [PATCH v2 07/11] PCI: Use pci_physfn() rather than looking up physfn by hand Bjorn Helgaas
2015-07-21 0:14 ` [PATCH v2 08/11] PCI: Clean up ATS error handling Bjorn Helgaas
2015-07-27 12:56 ` Joerg Roedel
2015-07-21 0:15 ` [PATCH v2 09/11] PCI: Move ATS declarations to linux/pci.h so they're all together Bjorn Helgaas
2015-07-21 0:15 ` [PATCH v2 10/11] PCI: Stop caching ATS Invalidate Queue Depth Bjorn Helgaas
2015-07-27 12:57 ` Joerg Roedel
2015-07-27 14:00 ` Don Dutile
2015-07-27 22:27 ` Bjorn Helgaas
2015-07-27 23:13 ` Don Dutile
2015-07-21 0:15 ` [PATCH v2 11/11] PCI: Remove pci_ats_enabled() Bjorn Helgaas
2015-07-27 12:58 ` Joerg Roedel
2015-07-28 15:16 ` [PATCH v2 00/11] PCI: Fix ATS deadlock Joerg Roedel
2015-07-29 16:07 ` Bjorn Helgaas
2015-08-06 16:03 ` Yinghai Lu
2015-08-07 1:06 ` Yinghai Lu
2015-08-10 17:33 ` Bjorn Helgaas
2015-08-10 22:54 ` Yinghai Lu
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=20150728071417.GK27614@suse.de \
--to=jroedel@suse.de \
--cc=bhelgaas@google.com \
--cc=dwmw2@infradead.org \
--cc=gdick@solarflare.com \
--cc=iommu@lists.linux-foundation.org \
--cc=linux-pci@vger.kernel.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).