All of lore.kernel.org
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org>
To: Oleksandr Tyshchenko <olekstysh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Oleksandr Tyshchenko
	<oleksandr_tyshchenko-uRwfk40T5oI@public.gmane.org>,
	Volodymyr Babchuk
	<vlad.babchuk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
	Andrii Anisov
	<andrii.anisov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Oleksandr Andrushchenko
	<andr2000-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	al1img <al1img-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	Artem Mygaiev <joculator-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: [RFC PATCH v1] iommu/io-pgtable-arm-v7s: Check for leaf entry right after finding it
Date: Fri, 24 Feb 2017 15:18:23 +0000	[thread overview]
Message-ID: <20170224151823.GH20130@arm.com> (raw)
In-Reply-To: <CAPD2p-nPoiSanU4jYvnaYtAbbERE8c=4mLjTC3NX2bGYkZM5UA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Tue, Feb 21, 2017 at 03:31:26PM +0200, Oleksandr Tyshchenko wrote:
> On Tue, Feb 21, 2017 at 2:00 PM, Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org> wrote:
> > Would it not be more logical (and simpler) to just check that the thing
> > we dereference is valid to dereference when we dereference it? i.e.:
> >
> > -----8<-----
> > diff --git a/drivers/iommu/io-pgtable-arm-v7s.c
> > b/drivers/iommu/io-pgtable-arm-v7s.c
> > index 0769276c0537..f3112f9ff494 100644
> > --- a/drivers/iommu/io-pgtable-arm-v7s.c
> > +++ b/drivers/iommu/io-pgtable-arm-v7s.c
> > @@ -418,8 +418,10 @@ static int __arm_v7s_map(struct arm_v7s_io_pgtable
> > *data, unsigned long iova,
> >                         pte |= ARM_V7S_ATTR_NS_TABLE;
> >
> >                 __arm_v7s_set_pte(ptep, pte, 1, cfg);
> > -       } else {
> > +       } else if (ARM_V7S_PTE_IS_TABLE(pte, lvl)) {
> >                 cptep = iopte_deref(pte, lvl);
> > +       } else {
> > +               return -EEXIST;
> >         }
> >
> >         /* Rinse, repeat */
> > ----->8-----
> 
> Agree. Sounds reasonable.
> 
> >
> > I think the equivalent could be done in LPAE as well.
> 
> OK.
> 
> I will resend both modified patches without RFC prefix, right?

Sounds good to me.

Will

WARNING: multiple messages have this Message-ID (diff)
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH v1] iommu/io-pgtable-arm-v7s: Check for leaf entry right after finding it
Date: Fri, 24 Feb 2017 15:18:23 +0000	[thread overview]
Message-ID: <20170224151823.GH20130@arm.com> (raw)
In-Reply-To: <CAPD2p-nPoiSanU4jYvnaYtAbbERE8c=4mLjTC3NX2bGYkZM5UA@mail.gmail.com>

On Tue, Feb 21, 2017 at 03:31:26PM +0200, Oleksandr Tyshchenko wrote:
> On Tue, Feb 21, 2017 at 2:00 PM, Robin Murphy <robin.murphy@arm.com> wrote:
> > Would it not be more logical (and simpler) to just check that the thing
> > we dereference is valid to dereference when we dereference it? i.e.:
> >
> > -----8<-----
> > diff --git a/drivers/iommu/io-pgtable-arm-v7s.c
> > b/drivers/iommu/io-pgtable-arm-v7s.c
> > index 0769276c0537..f3112f9ff494 100644
> > --- a/drivers/iommu/io-pgtable-arm-v7s.c
> > +++ b/drivers/iommu/io-pgtable-arm-v7s.c
> > @@ -418,8 +418,10 @@ static int __arm_v7s_map(struct arm_v7s_io_pgtable
> > *data, unsigned long iova,
> >                         pte |= ARM_V7S_ATTR_NS_TABLE;
> >
> >                 __arm_v7s_set_pte(ptep, pte, 1, cfg);
> > -       } else {
> > +       } else if (ARM_V7S_PTE_IS_TABLE(pte, lvl)) {
> >                 cptep = iopte_deref(pte, lvl);
> > +       } else {
> > +               return -EEXIST;
> >         }
> >
> >         /* Rinse, repeat */
> > ----->8-----
> 
> Agree. Sounds reasonable.
> 
> >
> > I think the equivalent could be done in LPAE as well.
> 
> OK.
> 
> I will resend both modified patches without RFC prefix, right?

Sounds good to me.

Will

  parent reply	other threads:[~2017-02-24 15:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-16 13:52 [RFC PATCH v1] iommu/io-pgtable-arm-v7s: Check for leaf entry right after finding it Oleksandr Tyshchenko
2017-02-16 13:52 ` Oleksandr Tyshchenko
     [not found] ` <1487253137-13792-1-git-send-email-olekstysh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-02-16 13:58   ` Oleksandr Tyshchenko
2017-02-16 13:58     ` Oleksandr Tyshchenko
2017-02-21 12:00   ` Robin Murphy
2017-02-21 12:00     ` Robin Murphy
     [not found]     ` <bc24299c-748a-4b86-fead-a9ed6b5e5b9f-5wv7dgnIgG8@public.gmane.org>
2017-02-21 13:31       ` Oleksandr Tyshchenko
2017-02-21 13:31         ` Oleksandr Tyshchenko
     [not found]         ` <CAPD2p-nPoiSanU4jYvnaYtAbbERE8c=4mLjTC3NX2bGYkZM5UA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-02-24 15:18           ` Will Deacon [this message]
2017-02-24 15:18             ` Will Deacon

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=20170224151823.GH20130@arm.com \
    --to=will.deacon-5wv7dgnigg8@public.gmane.org \
    --cc=al1img-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=andr2000-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=andrii.anisov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=joculator-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=oleksandr_tyshchenko-uRwfk40T5oI@public.gmane.org \
    --cc=olekstysh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=vlad.babchuk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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 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.