From: Will Deacon <will.deacon@arm.com>
To: Robin Murphy <robin.murphy@arm.com>
Cc: joro@8bytes.org, thunder.leizhen@huawei.com,
iommu@lists.linux-foundation.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linuxarm@huawei.com,
guohanjun@huawei.com, huawei.libin@huawei.com,
john.garry@huawei.com
Subject: Re: [PATCH v8 5/7] iommu/arm-smmu-v3: Add support for non-strict mode
Date: Fri, 28 Sep 2018 14:55:32 +0100 [thread overview]
Message-ID: <20180928135532.GA1581@brain-police> (raw)
In-Reply-To: <20180928124704.GC1577@brain-police>
On Fri, Sep 28, 2018 at 01:47:04PM +0100, Will Deacon wrote:
> On Fri, Sep 28, 2018 at 01:26:00PM +0100, Robin Murphy wrote:
> > On 28/09/18 13:19, Will Deacon wrote:
> > > On Thu, Sep 20, 2018 at 05:10:25PM +0100, Robin Murphy wrote:
> > > > diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
> > > > index f10c852479fc..db402e8b068b 100644
> > > > --- a/drivers/iommu/arm-smmu-v3.c
> > > > +++ b/drivers/iommu/arm-smmu-v3.c
> > > > @@ -612,6 +612,7 @@ struct arm_smmu_domain {
> > > > struct mutex init_mutex; /* Protects smmu pointer */
> > > > struct io_pgtable_ops *pgtbl_ops;
> > > > + bool non_strict;
> > > > enum arm_smmu_domain_stage stage;
> > > > union {
> > > > @@ -1407,6 +1408,12 @@ static void arm_smmu_tlb_inv_context(void *cookie)
> > > > cmd.tlbi.vmid = smmu_domain->s2_cfg.vmid;
> > > > }
> > > > + /*
> > > > + * NOTE: when io-pgtable is in non-strict mode, we may get here with
> > > > + * PTEs previously cleared by unmaps on the current CPU not yet visible
> > > > + * to the SMMU. We are relying on the DSB implicit in queue_inc_prod()
> > > > + * to guarantee those are observed before the TLBI. Do be careful, 007.
> > > > + */
> > >
> > > Good, so you can ignore my comment on the previous patch :)
> >
> > Well, I suppose that comment in io-pgtable *could* have explicitly noted
> > that same-CPU order is dealt with elsewhere - feel free to fix it up if you
> > think it would be a helpful reminder for the future.
>
> I think I'll move it into the documentation for the new attribute, so that
> any driver authors wanting to enable lazy invalidation know that they need
> to provide this guarantee in their full TLB invalidation callback.
Hmm, so I started doing this but then realised we already required this
behaviour for tlb_add_flush() afaict. That would mean that mainline
currently has a bug for arm-smmu.c, because we use the _relaxed I/O
accessors in there and there's no DSB after clearing the PTE on unmap().
Am I missing something?
Will
WARNING: multiple messages have this Message-ID (diff)
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v8 5/7] iommu/arm-smmu-v3: Add support for non-strict mode
Date: Fri, 28 Sep 2018 14:55:32 +0100 [thread overview]
Message-ID: <20180928135532.GA1581@brain-police> (raw)
In-Reply-To: <20180928124704.GC1577@brain-police>
On Fri, Sep 28, 2018 at 01:47:04PM +0100, Will Deacon wrote:
> On Fri, Sep 28, 2018 at 01:26:00PM +0100, Robin Murphy wrote:
> > On 28/09/18 13:19, Will Deacon wrote:
> > > On Thu, Sep 20, 2018 at 05:10:25PM +0100, Robin Murphy wrote:
> > > > diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
> > > > index f10c852479fc..db402e8b068b 100644
> > > > --- a/drivers/iommu/arm-smmu-v3.c
> > > > +++ b/drivers/iommu/arm-smmu-v3.c
> > > > @@ -612,6 +612,7 @@ struct arm_smmu_domain {
> > > > struct mutex init_mutex; /* Protects smmu pointer */
> > > > struct io_pgtable_ops *pgtbl_ops;
> > > > + bool non_strict;
> > > > enum arm_smmu_domain_stage stage;
> > > > union {
> > > > @@ -1407,6 +1408,12 @@ static void arm_smmu_tlb_inv_context(void *cookie)
> > > > cmd.tlbi.vmid = smmu_domain->s2_cfg.vmid;
> > > > }
> > > > + /*
> > > > + * NOTE: when io-pgtable is in non-strict mode, we may get here with
> > > > + * PTEs previously cleared by unmaps on the current CPU not yet visible
> > > > + * to the SMMU. We are relying on the DSB implicit in queue_inc_prod()
> > > > + * to guarantee those are observed before the TLBI. Do be careful, 007.
> > > > + */
> > >
> > > Good, so you can ignore my comment on the previous patch :)
> >
> > Well, I suppose that comment in io-pgtable *could* have explicitly noted
> > that same-CPU order is dealt with elsewhere - feel free to fix it up if you
> > think it would be a helpful reminder for the future.
>
> I think I'll move it into the documentation for the new attribute, so that
> any driver authors wanting to enable lazy invalidation know that they need
> to provide this guarantee in their full TLB invalidation callback.
Hmm, so I started doing this but then realised we already required this
behaviour for tlb_add_flush() afaict. That would mean that mainline
currently has a bug for arm-smmu.c, because we use the _relaxed I/O
accessors in there and there's no DSB after clearing the PTE on unmap().
Am I missing something?
Will
next prev parent reply other threads:[~2018-09-28 13:55 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-20 16:10 [PATCH v8 0/7] Add non-strict mode support for iommu-dma Robin Murphy
2018-09-20 16:10 ` Robin Murphy
[not found] ` <cover.1537458163.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>
2018-09-20 16:10 ` [PATCH v8 1/7] iommu/arm-smmu-v3: Implement flush_iotlb_all hook Robin Murphy
2018-09-20 16:10 ` Robin Murphy
2018-09-20 16:10 ` Robin Murphy
2018-09-20 16:10 ` [PATCH v8 2/7] iommu/dma: Add support for non-strict mode Robin Murphy
2018-09-20 16:10 ` Robin Murphy
2018-09-20 16:10 ` Robin Murphy
2018-09-20 16:10 ` [PATCH v8 3/7] iommu: Add "iommu.strict" command line option Robin Murphy
2018-09-20 16:10 ` Robin Murphy
2018-09-28 12:51 ` Will Deacon
2018-09-28 12:51 ` Will Deacon
2018-09-28 14:25 ` Robin Murphy
2018-09-28 14:25 ` Robin Murphy
2018-09-28 14:25 ` Robin Murphy
2018-09-20 16:10 ` [PATCH v8 4/7] iommu/io-pgtable-arm: Add support for non-strict mode Robin Murphy
2018-09-20 16:10 ` Robin Murphy
2018-09-28 12:17 ` Will Deacon
2018-09-28 12:17 ` Will Deacon
2018-09-20 16:10 ` [PATCH v8 5/7] iommu/arm-smmu-v3: " Robin Murphy
2018-09-20 16:10 ` Robin Murphy
[not found] ` <b98f8f695178c9c9ac6e081680090d5ac97e8d7c.1537458163.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>
2018-09-28 12:19 ` Will Deacon
2018-09-28 12:19 ` Will Deacon
2018-09-28 12:19 ` Will Deacon
2018-09-28 12:26 ` Robin Murphy
2018-09-28 12:26 ` Robin Murphy
2018-09-28 12:26 ` Robin Murphy
2018-09-28 12:47 ` Will Deacon
2018-09-28 12:47 ` Will Deacon
2018-09-28 13:55 ` Will Deacon [this message]
2018-09-28 13:55 ` Will Deacon
2018-09-28 14:01 ` Robin Murphy
2018-09-28 14:01 ` Robin Murphy
2018-09-28 14:01 ` Robin Murphy
2018-09-20 16:10 ` [PATCH v8 6/7] iommu/io-pgtable-arm-v7s: " Robin Murphy
2018-09-20 16:10 ` Robin Murphy
2018-09-20 16:10 ` [PATCH v8 7/7] iommu/arm-smmu: Support " Robin Murphy
2018-09-20 16:10 ` Robin Murphy
2018-09-21 9:20 ` [PATCH v8 0/7] Add non-strict mode support for iommu-dma John Garry
2018-09-21 9:20 ` John Garry
2018-09-21 9:20 ` John Garry
2018-09-21 9:29 ` Robin Murphy
2018-09-21 9:29 ` Robin Murphy
2018-09-21 11:03 ` Robin Murphy
2018-09-21 11:03 ` Robin Murphy
[not found] ` <61fb0f8f-a353-8ab6-f03d-b261da435c94-5wv7dgnIgG8@public.gmane.org>
2018-09-24 14:35 ` John Garry
2018-09-24 14:35 ` John Garry
2018-09-24 14:35 ` John Garry
2018-09-28 13:36 ` Will Deacon
2018-09-28 13:36 ` Will Deacon
2018-09-28 13:42 ` Robin Murphy
2018-09-28 13:42 ` Robin Murphy
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=20180928135532.GA1581@brain-police \
--to=will.deacon@arm.com \
--cc=guohanjun@huawei.com \
--cc=huawei.libin@huawei.com \
--cc=iommu@lists.linux-foundation.org \
--cc=john.garry@huawei.com \
--cc=joro@8bytes.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=robin.murphy@arm.com \
--cc=thunder.leizhen@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.