From: "Shilimkar, Santosh" <santosh.shilimkar@ti.com>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>,
"stepanm@codeaurora.org" <stepanm@codeaurora.org>
Cc: "linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
"dwalker@codeaurora.org" <dwalker@codeaurora.org>,
"mel@csn.ul.ie" <mel@csn.ul.ie>,
"linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"andi@firstfloor.org" <andi@firstfloor.org>,
Zach Pfeffer <zpfeffer@codeaurora.org>,
Michael Bohan <mbohan@codeaurora.org>,
Tim HRM <zt.tmzt@gmail.com>,
"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"ebiederm@xmission.com" <ebiederm@xmission.com>
Subject: RE: [RFC 1/3 v3] mm: iommu: An API to unify IOMMU, CPU and device memory management
Date: Wed, 21 Jul 2010 11:19:58 +0530 [thread overview]
Message-ID: <EAF47CD23C76F840A9E7FCE10091EFAB02C61C5FCA@dbde02.ent.ti.com> (raw)
In-Reply-To: <20100720222952.GD10553@n2100.arm.linux.org.uk>
> -----Original Message-----
> From: linux-arm-kernel-bounces@lists.infradead.org [mailto:linux-arm-
> kernel-bounces@lists.infradead.org] On Behalf Of Russell King - ARM Linux
> Sent: Wednesday, July 21, 2010 4:00 AM
> To: stepanm@codeaurora.org
> Cc: linux-arch@vger.kernel.org; dwalker@codeaurora.org; mel@csn.ul.ie;
> linux-arm-msm@vger.kernel.org; linux-kernel@vger.kernel.org; FUJITA
> Tomonori; linux-mm@kvack.org; andi@firstfloor.org; Zach Pfeffer; Michael
> Bohan; Tim HRM; linux-omap@vger.kernel.org; linux-arm-
> kernel@lists.infradead.org; ebiederm@xmission.com
> Subject: Re: [RFC 1/3 v3] mm: iommu: An API to unify IOMMU, CPU and device
> memory management
>
> On Tue, Jul 20, 2010 at 03:02:34PM -0700, stepanm@codeaurora.org wrote:
> > Russell-
> >
> > If a driver wants to allow a device to access memory (and cache
> coherency
> > is off/not present for device addesses), the driver needs to remap that
> > memory as non-cacheable.
>
> If that memory is not part of the kernel's managed memory, then that's
> fine. But if it _is_ part of the kernel's managed memory, then it is
> not permitted by the ARM architecture specification to allow maps of
> the memory with differing [memory type, sharability, cache] attributes.
>
> Basically, if a driver wants to create these kinds of mappings, then
> they should expect the system to become unreliable and unpredictable.
> That's not something any sane person should be aiming to do.
>
> > Suppose there exists a chunk of
> > physically-contiguous memory (say, memory reserved for device use) that
> > happened to be already mapped into the kernel as normal memory
> (cacheable,
> > etc). One way to remap this memory is to use ioremap (and then never
> touch
> > the original virtual mapping, which would now have conflicting
> > attributes).
>
> This doesn't work, and is unpredictable on ARMv6 and ARMv7. Not touching
> the original mapping is _not_ _sufficient_ to guarantee that the mapping
> is not used. (We've seen problems on OMAP as a result of this.)
>
> Any mapping which exists can be speculatively prefetched by such CPUs
> at any time, which can lead it to be read into the cache. Then, your
> different attributes for your "other" mapping can cause problems if you
> hit one of these cache lines - and then you can have (possibly silent)
> data corruption.
>
> > I feel as if there should be a better way to remap memory for
> > device access, either by altering the attributes on the original
> mapping,
> > or removing the original mapping and creating a new one with attributes
> > set to non-cacheable.
>
> This is difficult to achieve without remapping kernel memory using L2
> page tables, so we can unmap pages on 4K page granularity. That's
> going to increase TLB overhead and result in lower system performance
> as there'll be a greater number of MMU misses.
>
> However, one obvious case would be to use highmem-only pages for
> remapping - but you then have to ensure that those pages are never
> kmapped in any way, because those mappings will fall into the same
> unpredictable category that we're already trying to avoid. This
> may be possible, but you'll have to ensure that most of the system
> RAM is in highmem - which poses other problems (eg, if lowmem gets
> low.)
>
Why can't we consider an option of removing the old mappings when
we need to create new ones with different attributes as suggested
by Catalin on similar thread previously. This will avoid the duplicate
mapping with different attributes issue on newer ARMs.
Is this something can't be worked out?
Regards,
Santosh
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2010-07-21 5:50 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-03 5:38 Zach Pfeffer
2010-07-03 19:06 ` Eric W. Biederman
2010-07-07 22:44 ` Zach Pfeffer
2010-07-07 23:07 ` Russell King - ARM Linux
2010-07-08 23:59 ` Zach Pfeffer
2010-07-12 1:25 ` FUJITA Tomonori
2010-07-13 5:57 ` Zach Pfeffer
2010-07-13 6:03 ` FUJITA Tomonori
2010-07-13 12:14 ` Zach Pfeffer
2010-07-14 1:59 ` FUJITA Tomonori
2010-07-14 20:11 ` Zach Pfeffer
2010-07-14 22:05 ` Russell King - ARM Linux
2010-07-15 1:29 ` Zach Pfeffer
2010-07-15 1:47 ` Eric W. Biederman
2010-07-15 5:40 ` Zach Pfeffer
2010-07-15 5:35 ` Zach Pfeffer
2010-07-15 8:55 ` Russell King - ARM Linux
2010-07-16 0:48 ` Tim HRM
2010-07-16 7:58 ` Russell King - ARM Linux
2010-07-17 0:01 ` Larry Bassel
2010-07-19 9:21 ` Tim HRM
2010-07-21 0:44 ` Zach Pfeffer
2010-07-21 1:44 ` Timothy Meade
2010-07-22 4:06 ` Zach Pfeffer
2010-07-19 17:55 ` Michael Bohan
2010-07-19 18:40 ` Russell King - ARM Linux
2010-07-20 22:02 ` stepanm
2010-07-20 22:29 ` Russell King - ARM Linux
2010-07-21 5:49 ` Shilimkar, Santosh [this message]
2010-07-21 7:28 ` Russell King - ARM Linux
2010-07-21 7:45 ` Shilimkar, Santosh
2010-07-21 18:04 ` stepanm
2010-07-20 20:45 ` Zach Pfeffer
2010-07-20 20:54 ` Russell King - ARM Linux
2010-07-20 21:56 ` Zach Pfeffer
2010-07-19 6:52 ` Zach Pfeffer
2010-07-19 7:44 ` Eric W. Biederman
2010-07-22 4:25 ` Zach Pfeffer
2010-07-22 7:34 ` Russell King - ARM Linux
2010-07-22 16:25 ` Zach Pfeffer
2010-07-14 23:07 ` FUJITA Tomonori
2010-07-15 1:41 ` Zach Pfeffer
2010-07-19 8:22 ` Russell King - ARM Linux
2010-07-20 10:09 ` FUJITA Tomonori
2010-07-20 22:20 ` Zach Pfeffer
2010-07-21 1:44 ` FUJITA Tomonori
2010-07-22 4:30 ` Zach Pfeffer
2010-07-22 4:43 ` FUJITA Tomonori
2010-07-22 16:44 ` Zach Pfeffer
2010-07-22 7:39 ` Russell King - ARM Linux
2010-07-22 16:28 ` Zach Pfeffer
2010-07-06 15:42 Zach Pfeffer
2010-07-21 5:18 stepanm
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=EAF47CD23C76F840A9E7FCE10091EFAB02C61C5FCA@dbde02.ent.ti.com \
--to=santosh.shilimkar@ti.com \
--cc=andi@firstfloor.org \
--cc=dwalker@codeaurora.org \
--cc=ebiederm@xmission.com \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=mbohan@codeaurora.org \
--cc=mel@csn.ul.ie \
--cc=stepanm@codeaurora.org \
--cc=zpfeffer@codeaurora.org \
--cc=zt.tmzt@gmail.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