public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@bootlin.com>
To: Ladislav Michl <ladis@linux-mips.org>
Cc: Andreas Kemnade <andreas@kemnade.info>,
	Discussions about the Letux Kernel <letux-kernel@openphoenux.org>,
	Boris Brezillon <boris.brezillon@free-electrons.com>,
	Aaro Koskinen <aaro.koskinen@iki.fi>,
	Tony Lindgren <tony@atomide.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Peter Ujfalusi <peter.ujfalusi@ti.com>,
	linux-omap <linux-omap@vger.kernel.org>,
	Roger Quadros <rogerq@ti.com>
Subject: Re: [Letux-kernel] [Bug]: mtd: onenand: omap2plus: kernel panic with OneNAND on OMAP3 (DM3730) device GTA04A5
Date: Wed, 11 Apr 2018 10:52:01 +0200	[thread overview]
Message-ID: <20180411105201.5f126e94@bbrezillon> (raw)
In-Reply-To: <20180411082746.GA20164@lenoch>

On Wed, 11 Apr 2018 10:27:46 +0200
Ladislav Michl <ladis@linux-mips.org> wrote:

> On Wed, Apr 11, 2018 at 10:08:06AM +0200, Boris Brezillon wrote:
> > On Wed, 11 Apr 2018 09:36:56 +0200
> > Ladislav Michl <ladis@linux-mips.org> wrote:
> >   
> > > Hi Boris,
> > > 
> > > On Wed, Apr 11, 2018 at 09:15:28AM +0200, Boris Brezillon wrote:  
> [...]
> > > > Not sure this approach is safe on all archs: if the cache is VIVT or
> > > > VIPT, you may have several entries pointing to the same phys page, and
> > > > then, when dma_map_page() does its cache maintenance operations, it's
> > > > only taking one of these entries into account.    
> > > 
> > > Hmm, I used the same approach Samsung OneNAND driver does since commit
> > > dcf08227e964a53a2cb39130b74842c7dcb6adde.
> > > Both TI OMAP3630 and Samsung S5PC110 are using Cortex-A8 which
> > > is VIPT. In that case samsung's driver code has the same problem.
> > >   
> > > > In other parts of the MTD subsystem, we tend to not do DMA on buffers
> > > > that have been vmalloc-ed.
> > > > 
> > > > You can do something like
> > > > 
> > > > 		if (virt_addr_valid(buf))
> > > > 			/* Use DMA */
> > > > 		else
> > > > 			/*
> > > > 			 * Do not use DMA, or use a bounce buffer
> > > > 			 * allocated with kmalloc
> > > > 			 */    
> > > 
> > > Okay, I'll use this approach then, but first I'd like to be sure above is
> > > correct. Anyone?  
> > 
> > See this discussion [1]. The problem came up a few times already, so
> > might find other threads describing why it's not safe.
> > 
> > [1]https://lists.linuxfoundation.org/pipermail/iommu/2016-March/016240.html  
> 
> Question was more likely whenever there might exist more that one mapping
> of the same page.

I'm clearly not an expert, so I might be wrong, but I think a physical
page can be both in the identity mapping and mapped in the vmalloc
space. Now, is there a real risk that both ends are accessed in
parallel thus making different cache entries pointing to the same phys
page dirty, I'm not sure. Or maybe there are other corner case, but
you'll have to ask Russell (or any other ARM expert) to get a clearer
answer.

> But okay, I'll disable DMA for highmem. Patch will follow.
> 
> 	ladis

  reply	other threads:[~2018-04-11  8:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-10 16:25 [Bug]: mtd: onenand: omap2plus: kernel panic with OneNAND on OMAP3 (DM3730) device GTA04A5 H. Nikolaus Schaller
2018-04-10 20:56 ` Ladislav Michl
2018-04-11  4:59   ` [Letux-kernel] " Andreas Kemnade
2018-04-11  6:26     ` Ladislav Michl
2018-04-11  7:15       ` Boris Brezillon
2018-04-11  7:36         ` Ladislav Michl
2018-04-11  8:08           ` Boris Brezillon
2018-04-11  8:27             ` Ladislav Michl
2018-04-11  8:52               ` Boris Brezillon [this message]
2018-04-11  9:12                 ` Ladislav Michl
2018-04-11  9:44                   ` H. Nikolaus Schaller
2018-04-12 16:27                   ` Boris Brezillon
2018-04-11  7:03   ` H. Nikolaus Schaller
2018-04-12 15:03     ` Tony Lindgren
2018-04-12 15:51       ` H. Nikolaus Schaller

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=20180411105201.5f126e94@bbrezillon \
    --to=boris.brezillon@bootlin.com \
    --cc=aaro.koskinen@iki.fi \
    --cc=andreas@kemnade.info \
    --cc=boris.brezillon@free-electrons.com \
    --cc=ladis@linux-mips.org \
    --cc=letux-kernel@openphoenux.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=peter.ujfalusi@ti.com \
    --cc=rogerq@ti.com \
    --cc=tony@atomide.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