linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: toshi.kani@hp.com (Toshi Kani)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 08/25] arch: introduce memremap()
Date: Tue, 11 Aug 2015 16:40:57 -0600	[thread overview]
Message-ID: <1439332857.24434.37.camel@hp.com> (raw)
In-Reply-To: <20150811213021.GD30479@wotan.suse.de>

On Tue, 2015-08-11 at 23:30 +0200, Luis R. Rodriguez wrote:
> On Wed, Jul 29, 2015 at 06:00:04PM -0600, Toshi Kani wrote:
> > On Wed, 2015-07-29 at 23:43 +0200, Luis R. Rodriguez wrote:
> > > On Wed, Jul 29, 2015 at 03:00:38PM -0600, Toshi Kani wrote:
> > > > On Wed, 2015-07-29 at 11:33 -0700, Dan Williams wrote:
  :
> > > That would depend on the purpose of the region and the driver 
> > > developer should in theory know best. One issue with this of course is 
> > > that, as we've discovered, the semantics of on the ioremap*() variant 
> > > front regarding cache types is not clearly well defined, or at least 
> > > it may be only well defined implicitly on x86 only, so the driver 
> > > developer can only *hope* for the best across architectures. Our 
> > > ambiguity on our semantics on ioremap*() variants therefore means 
> > > driver developers can resonably be puzzled by what fallbacks to use. 
> > > That also means architectures maintainers should not whip driver 
> > > developers for any misuse. Such considerations are why although we're 
> > > now revisiting semantics for ioremap*() variants I was in hopes we 
> > > could be at least somewhat pedantic about memremap() semantics.
> > 
> > I agree.  However, there are a few exceptions like /dev/mem, which can 
> > map a target range without knowledge.
> 
> Still, the expectation to require support for overlapping ioremap() calls 
> would seem to be more of an exception than the norm, so I'd argue that 
> requiring callers who know they do need overlapping support to be explicit 
> about it may help us simplify expecations on semantics in other areas of 
> the kernel.

Again, I agree.  I am simply saying that the fallback in an overlapping case
may need to remain supported for such exceptional cases, possibly with a
separate interface.

> > > For instance since memremap() only has 2 types right now can a 
> > > respective fallback be documented as an alternative to help with this 
> > > ? Or can we not generalize this ?  One for MEMREMAP_WB and one for 
> > > MEMREMAP_WT ?
> > 
> > Yes, if a target range can be only mapped by memremap().  However, there 
> > is no restriction that a range can be mapped with a single interface 
> > alone.  For example, a range can be mapped with remap_pfn_range() to 
> > user space with any cache type.  So, in theory, memremap() can overlap 
> > with any other types.
> 
> Shouldn't that be an issue or area of concern ? It seems the flakiness on
> ioremap() and its wide array flexibility would spill over the any 
> semantics which folks would be trying to set out with memremap(). That 
> should not stop the evolution of memremap() though, just pointing out that 
> perhaps we should be a bit more restrictive over how things can criss
> -cross and who areas can do it.

reserve_pfn_range() allows the caller to specify if the fallback needs to be
enabled or disabled with 'strict_prot'.  track_pfn_remap() called from
remap_pfn_range() enables it, and track_pfn_copy() disables it.  I think we
can do similar for the memremap and ioremap families as well.  The fallback
could be set disabled in the regular interfaces, and enabled in some
interface as necessary.  This also allows gradual transition, ex. disable in
memremap while ioremap remains enabled for now. 

> > > > ioremap() falls back to the cache type of an existing mapping to 
> > > > avoid aliasing.
> > > 
> > > Does that assume an existing ioremap*() call was used on a bigger 
> > > range?  Do you know if that happens to only be the case for x86 (I'd 
> > > think so) or if its the same for other architectures ?
> > 
> > In the /dev/mem example, it is remap_pfn_range().  I think other archs 
> > have the same issue, but I do not know if they fall back in case of
> > overlapping call.
> 
> What should happen if remap_pfn_range() was used with 
> pgprot_writecombine() and later memremap() is used for instance with a 
> smaller overlappin section, or perhaps bigger?

With the fallback disabled, memremap() should fail in this case. 

Thanks,
-Toshi

  reply	other threads:[~2015-08-11 22:40 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-25  2:37 [PATCH v2 00/25] replace ioremap_{cache|wt} with memremap Dan Williams
2015-07-25  2:38 ` [PATCH v2 01/25] mm, x86: Fix warning in ioremap RAM check Dan Williams
2015-07-25  2:38 ` [PATCH v2 02/25] mm, x86: Remove region_is_ram() call from ioremap Dan Williams
2015-07-25  2:38 ` [PATCH v2 03/25] mm: Fix bugs in region_is_ram() Dan Williams
2015-07-25  2:38 ` [PATCH v2 04/25] mm: enhance region_is_ram() to distinguish 'unknown' vs 'mixed' Dan Williams
2015-07-27 22:50   ` Luis R. Rodriguez
2015-07-28 21:33   ` Toshi Kani
2015-07-25  2:38 ` [PATCH v2 05/25] arch, drivers: don't include <asm/io.h> directly, use <linux/io.h> instead Dan Williams
2015-07-25  2:38 ` [PATCH v2 06/25] cleanup IORESOURCE_CACHEABLE vs ioremap() Dan Williams
2015-07-25  2:38 ` [PATCH v2 07/25] intel_iommu: fix leaked ioremap mapping Dan Williams
2015-07-25  2:38 ` [PATCH v2 08/25] arch: introduce memremap() Dan Williams
2015-07-26 17:25   ` Christoph Hellwig
2015-07-26 17:49     ` Dan Williams
2015-07-27  5:12       ` Christoph Hellwig
2015-07-27  5:12       ` Christoph Hellwig
2015-07-27 23:26         ` Dan Williams
2015-07-29  6:50           ` Christoph Hellwig
2015-07-29 18:27             ` Luis R. Rodriguez
2015-07-29 18:33               ` Dan Williams
2015-07-29 21:00                 ` Toshi Kani
2015-07-29 21:11                   ` Toshi Kani
2015-07-29 21:43                   ` Luis R. Rodriguez
2015-07-29 21:47                     ` Dan Williams
2015-07-29 21:52                       ` Luis R. Rodriguez
2015-07-30  0:00                     ` Toshi Kani
2015-08-11 21:30                       ` Luis R. Rodriguez
2015-08-11 22:40                         ` Toshi Kani [this message]
2015-08-11 22:52                           ` Luis R. Rodriguez
2015-08-11 23:13                             ` Dan Williams
2016-04-21 12:47                               ` Luis R. Rodriguez
2015-07-27 23:17   ` Luis R. Rodriguez
2015-07-27 23:31     ` Dan Williams
2015-07-27 23:43       ` Luis R. Rodriguez
2015-07-28  0:32         ` Dan Williams
2015-07-25  2:38 ` [PATCH v2 09/25] arm: switch from ioremap_cache to memremap Dan Williams
2015-07-25  2:38 ` [PATCH v2 10/25] x86: " Dan Williams
2015-07-25  2:38 ` [PATCH v2 11/25] gma500: switch from acpi_os_ioremap to ioremap Dan Williams
2015-07-25  2:39 ` [PATCH v2 12/25] i915: " Dan Williams
2015-07-27  7:50   ` [Intel-gfx] " Daniel Vetter
2015-07-25  2:39 ` [PATCH v2 13/25] acpi: switch from ioremap_cache to memremap Dan Williams
2015-07-25 23:55   ` Rafael J. Wysocki
2015-07-25  2:39 ` [PATCH v2 14/25] toshiba laptop: replace ioremap_cache with ioremap Dan Williams
2015-07-25  2:39 ` [PATCH v2 15/25] memconsole: fix __iomem mishandling, switch to memremap Dan Williams
2015-07-25 22:02   ` Sergei Shtylyov
2015-07-25  2:39 ` [PATCH v2 16/25] visorbus: switch from ioremap_cache " Dan Williams
2015-07-25  2:39 ` [PATCH v2 17/25] intel-iommu: " Dan Williams
2015-08-03 14:27   ` Joerg Roedel
2015-07-25  2:39 ` [PATCH v2 18/25] libnvdimm, pmem: " Dan Williams
2015-07-28 22:51   ` Ross Zwisler
2015-07-28 23:06     ` Dan Williams
2015-07-25  2:39 ` [PATCH v2 19/25] pxa2xx-flash: " Dan Williams
2015-10-02 17:51   ` Brian Norris
2015-10-09 21:33     ` Dan Williams
2015-07-25  2:39 ` [PATCH v2 20/25] sfi: " Dan Williams
2015-07-25  2:39 ` [PATCH v2 21/25] fbdev: switch from ioremap_wt " Dan Williams
2015-07-25  2:40 ` [PATCH v2 22/25] pmem: " Dan Williams
2015-07-29 19:12   ` Ross Zwisler
2015-07-25  2:40 ` [PATCH v2 23/25] arch: remove ioremap_cache, replace with arch_memremap Dan Williams
2015-07-26 17:31   ` Christoph Hellwig
2015-07-25  2:40 ` [PATCH v2 24/25] arch: remove ioremap_wt, " Dan Williams
2015-07-26 17:31   ` Christoph Hellwig
2015-07-27  8:03   ` Christoph Hellwig
2015-07-29 22:21     ` Dan Williams
2015-07-25  2:40 ` [PATCH v2 25/25] pmem: convert to generic memremap Dan Williams
2015-07-26 17:33   ` Christoph Hellwig
2015-07-26 18:11     ` Dan Williams
2015-07-27  5:14       ` Christoph Hellwig

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=1439332857.24434.37.camel@hp.com \
    --to=toshi.kani@hp.com \
    --cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).