All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
To: Suman Anna <s-anna-l0cyMroinI0@public.gmane.org>
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
	linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	sakari.ailus-X3B1VOXEql0@public.gmane.org,
	Florian Vaussard <florian.vaussard-p8DiymsW2f8@public.gmane.org>
Subject: Re: [PATCH 3/5] iommu/omap: Flush the TLB only after updating translation table entries
Date: Fri, 14 Mar 2014 10:58:40 +0100	[thread overview]
Message-ID: <7972929.biQkBVMjd1@avalon> (raw)
In-Reply-To: <532230DA.30302-l0cyMroinI0@public.gmane.org>

Hi Suman,

On Thursday 13 March 2014 17:27:38 Suman Anna wrote:
> Hi Laurent,
> 
> On 03/07/2014 06:46 PM, Laurent Pinchart wrote:
> > Flushing the TLB before updating translation entries creates a race
> > condition and can lead to stale TLB entries if a translation request
> > arrives between flushing the TLB and updating the translation entries.
> > As there's no requirement to flush the TLB before updating the entries,
> > flush it after only.
> 
> I do not expect a device to be actively using a region if we are about
> to change its mapping, we expect the access from the device to be only
> between a map and an unmap. The race condition (if any in such
> scenarios) would exist even after this patch, like after you programmed
> the entry, and the translation request comes before you flush the page.
> Then it is still operating on an older address, while you have already
> programmed a new one. An unmap currently clears the entry and flushes
> any TLB as well, so I don't think this patch makes a big difference.

I agree that the patch won't make a difference in practice. Should I drop it 
from v2 ? 

> > Signed-off-by: Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
> > ---
> > 
> >   drivers/iommu/omap-iommu.c | 5 +++--
> >   1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
> > index cb1e1de..fedd303 100644
> > --- a/drivers/iommu/omap-iommu.c
> > +++ b/drivers/iommu/omap-iommu.c
> > @@ -662,10 +662,11 @@ int omap_iopgtable_store_entry(struct omap_iommu
> > *obj, struct iotlb_entry *e)> 
> >   {
> >   	int err;
> > 
> > -	flush_iotlb_page(obj, e->da);
> > 
> >   	err = iopgtable_store_entry_core(obj, e);
> > -	if (!err)
> > +	if (!err) {
> > +		flush_iotlb_page(obj, e->da);
> >   		prefetch_iotlb_entry(obj, e);
> > +	}
> > 
> >   	return err;
> >   }
> >   EXPORT_SYMBOL_GPL(omap_iopgtable_store_entry);

-- 
Regards,

Laurent Pinchart

  parent reply	other threads:[~2014-03-14  9:58 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-08  0:46 [PATCH 0/5] OMAP IOMMU fixes and IOMMU architecture questions Laurent Pinchart
2014-03-08  0:46 ` [PATCH 1/5] iommu/omap: Use the cache cleaning API Laurent Pinchart
     [not found]   ` <1394239574-2389-2-git-send-email-laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
2014-03-14  2:47     ` Suman Anna
2014-03-14 16:15       ` Santosh Shilimkar
2014-03-14 16:38         ` Laurent Pinchart
2014-03-14 17:51           ` Santosh Shilimkar
     [not found]             ` <5323418B.90805-l0cyMroinI0@public.gmane.org>
2014-03-15  1:49               ` Suman Anna
2014-03-15 17:54                 ` Santosh Shilimkar
     [not found]                   ` <532493DF.5010409-l0cyMroinI0@public.gmane.org>
2014-03-17 19:16                     ` Suman Anna
2014-03-17 22:56                 ` Laurent Pinchart
2014-03-14 16:57         ` Arnd Bergmann
2014-03-14 17:59           ` Santosh Shilimkar
     [not found]           ` <201403141757.48824.arnd-r2nGTMty4D4@public.gmane.org>
2014-03-17 23:12             ` Laurent Pinchart
2014-03-18  1:20               ` Suman Anna
2014-03-08  0:46 ` [PATCH 4/5] iommu/omap: Remove comment about supporting single page mappings only Laurent Pinchart
2014-03-08  0:46 ` [PATCH 5/5] iommu/omap: Fix map protection value handling Laurent Pinchart
     [not found]   ` <1394239574-2389-6-git-send-email-laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
2014-03-14  0:07     ` Suman Anna
2014-03-14  9:46       ` Laurent Pinchart
2014-03-15  0:16         ` Suman Anna
2014-03-08 11:04 ` [PATCH 0/5] OMAP IOMMU fixes and IOMMU architecture questions Sakari Ailus
2014-03-12 15:26 ` Laurent Pinchart
     [not found] ` <1394239574-2389-1-git-send-email-laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
2014-03-08  0:46   ` [PATCH 2/5] iommu/omap: Fix 'no page for' debug message in flush_iotlb_page() Laurent Pinchart
     [not found]     ` <1394239574-2389-3-git-send-email-laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
2014-03-13 22:16       ` Suman Anna
2014-03-14  9:50         ` Laurent Pinchart
2014-03-08  0:46   ` [PATCH 3/5] iommu/omap: Flush the TLB only after updating translation table entries Laurent Pinchart
     [not found]     ` <1394239574-2389-4-git-send-email-laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
2014-03-13 22:27       ` Suman Anna
     [not found]         ` <532230DA.30302-l0cyMroinI0@public.gmane.org>
2014-03-14  9:58           ` Laurent Pinchart [this message]
2014-03-15  0:18             ` Suman Anna
2014-03-14  2:33   ` [PATCH 0/5] OMAP IOMMU fixes and IOMMU architecture questions Suman Anna
2014-03-14 11:00     ` Laurent Pinchart
2014-03-16 21:54       ` Sakari Ailus
     [not found]         ` <20140316215455.GA2108-S+BSfZ9RZZmRSg0ZkenSGLdO1Tsj/99ntUK59QYPAWc@public.gmane.org>
2014-03-17 19:58           ` Suman Anna
2014-03-17 22:44             ` Laurent Pinchart
2014-04-04 12:23               ` Marek Szyprowski
     [not found]                 ` <533EA45D.70002-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-04-08 13:09                   ` Laurent Pinchart
2014-04-04 10:18       ` Joerg Roedel
     [not found]         ` <20140404101811.GR13491-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2014-04-08 12:50           ` Laurent Pinchart
2014-04-08 13:43             ` Joerg Roedel
2014-04-08 15:02               ` Laurent Pinchart
2014-04-09 15:08                 ` Joerg Roedel
2014-04-10 23:30                   ` Laurent Pinchart

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=7972929.biQkBVMjd1@avalon \
    --to=laurent.pinchart-rylnwiuwjnjg/c1bvhzhaw@public.gmane.org \
    --cc=florian.vaussard-p8DiymsW2f8@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=s-anna-l0cyMroinI0@public.gmane.org \
    --cc=sakari.ailus-X3B1VOXEql0@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.