All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Luis R. Rodriguez" <mcgrof@suse.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: tglx@linutronix.de, mingo@kernel.org, hpa@zytor.com,
	linux-arch@vger.kernel.org, toshi.kani@hp.com,
	linux-nvdimm@lists.01.org, linux-kernel@vger.kernel.org,
	rmk+kernel@arm.linux.org.uk, hch@lst.de,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3 01/24] mm: enhance region_is_ram() to region_intersects()
Date: Thu, 30 Jul 2015 22:58:02 +0200	[thread overview]
Message-ID: <20150730205802.GP30479@wotan.suse.de> (raw)
In-Reply-To: <20150730165345.33962.80299.stgit@dwillia2-desk3.amr.corp.intel.com>

On Thu, Jul 30, 2015 at 12:53:45PM -0400, Dan Williams wrote:
> region_is_ram() is used to prevent the establishment of aliased mappings
> to physical "System RAM" with incompatible cache settings.  However, it
> uses "-1" to indicate both "unknown" memory ranges (ranges not described
> by platform firmware) and "mixed" ranges (where the parameters describe
> a range that partially overlaps "System RAM").
> 
> Fix this up by explicitly tracking the "unknown" vs "mixed" resource
> cases and returning REGION_INTERSECTS, REGION_MIXED, or REGION_DISJOINT.
> This re-write also adds support for detecting when the requested region
> completely eclipses all of a resource.  Note, the implementation treats
> overlaps between "unknown" and the requested memory type as
> REGION_INTERSECTS.
> 
> Finally, other memory types can be passed in by name, for now the only
> usage "System RAM".
> 
> Suggested-by: Luis R. Rodriguez <mcgrof@suse.com>
> Reviewed-by: Toshi Kani <toshi.kani@hp.com>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
>  include/linux/mm.h |    9 +++++++-
>  kernel/resource.c  |   61 +++++++++++++++++++++++++++++++---------------------
>  2 files changed, 44 insertions(+), 26 deletions(-)
> 
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 2e872f92dbac..84b05ebedb2d 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -369,7 +369,14 @@ static inline int put_page_unless_one(struct page *page)
>  }
>  
>  extern int page_is_ram(unsigned long pfn);
> -extern int region_is_ram(resource_size_t phys_addr, unsigned long size);
> +
> +enum {

If you gave the enum a name, say enum region_intersect_type, you could then
use that for the return type of region_intersects.

> +	REGION_INTERSECTS,
> +	REGION_DISJOINT,
> +	REGION_MIXED,
> +};
> +
> +int region_intersects(resource_size_t offset, size_t size, const char *type);


If you used say a return type enum region_intersect_type, at compile time you'd
get a complaint if any branch was not handled for the different enum types.

  Luis

WARNING: multiple messages have this Message-ID (diff)
From: mcgrof@suse.com (Luis R. Rodriguez)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 01/24] mm: enhance region_is_ram() to region_intersects()
Date: Thu, 30 Jul 2015 22:58:02 +0200	[thread overview]
Message-ID: <20150730205802.GP30479@wotan.suse.de> (raw)
In-Reply-To: <20150730165345.33962.80299.stgit@dwillia2-desk3.amr.corp.intel.com>

On Thu, Jul 30, 2015 at 12:53:45PM -0400, Dan Williams wrote:
> region_is_ram() is used to prevent the establishment of aliased mappings
> to physical "System RAM" with incompatible cache settings.  However, it
> uses "-1" to indicate both "unknown" memory ranges (ranges not described
> by platform firmware) and "mixed" ranges (where the parameters describe
> a range that partially overlaps "System RAM").
> 
> Fix this up by explicitly tracking the "unknown" vs "mixed" resource
> cases and returning REGION_INTERSECTS, REGION_MIXED, or REGION_DISJOINT.
> This re-write also adds support for detecting when the requested region
> completely eclipses all of a resource.  Note, the implementation treats
> overlaps between "unknown" and the requested memory type as
> REGION_INTERSECTS.
> 
> Finally, other memory types can be passed in by name, for now the only
> usage "System RAM".
> 
> Suggested-by: Luis R. Rodriguez <mcgrof@suse.com>
> Reviewed-by: Toshi Kani <toshi.kani@hp.com>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
>  include/linux/mm.h |    9 +++++++-
>  kernel/resource.c  |   61 +++++++++++++++++++++++++++++++---------------------
>  2 files changed, 44 insertions(+), 26 deletions(-)
> 
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 2e872f92dbac..84b05ebedb2d 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -369,7 +369,14 @@ static inline int put_page_unless_one(struct page *page)
>  }
>  
>  extern int page_is_ram(unsigned long pfn);
> -extern int region_is_ram(resource_size_t phys_addr, unsigned long size);
> +
> +enum {

If you gave the enum a name, say enum region_intersect_type, you could then
use that for the return type of region_intersects.

> +	REGION_INTERSECTS,
> +	REGION_DISJOINT,
> +	REGION_MIXED,
> +};
> +
> +int region_intersects(resource_size_t offset, size_t size, const char *type);


If you used say a return type enum region_intersect_type, at compile time you'd
get a complaint if any branch was not handled for the different enum types.

  Luis

WARNING: multiple messages have this Message-ID (diff)
From: "Luis R. Rodriguez" <mcgrof@suse.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: tglx@linutronix.de, mingo@kernel.org, hpa@zytor.com,
	linux-arch@vger.kernel.org, toshi.kani@hp.com,
	linux-nvdimm@ml01.01.org, linux-kernel@vger.kernel.org,
	rmk+kernel@arm.linux.org.uk, hch@lst.de,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3 01/24] mm: enhance region_is_ram() to region_intersects()
Date: Thu, 30 Jul 2015 22:58:02 +0200	[thread overview]
Message-ID: <20150730205802.GP30479@wotan.suse.de> (raw)
In-Reply-To: <20150730165345.33962.80299.stgit@dwillia2-desk3.amr.corp.intel.com>

On Thu, Jul 30, 2015 at 12:53:45PM -0400, Dan Williams wrote:
> region_is_ram() is used to prevent the establishment of aliased mappings
> to physical "System RAM" with incompatible cache settings.  However, it
> uses "-1" to indicate both "unknown" memory ranges (ranges not described
> by platform firmware) and "mixed" ranges (where the parameters describe
> a range that partially overlaps "System RAM").
> 
> Fix this up by explicitly tracking the "unknown" vs "mixed" resource
> cases and returning REGION_INTERSECTS, REGION_MIXED, or REGION_DISJOINT.
> This re-write also adds support for detecting when the requested region
> completely eclipses all of a resource.  Note, the implementation treats
> overlaps between "unknown" and the requested memory type as
> REGION_INTERSECTS.
> 
> Finally, other memory types can be passed in by name, for now the only
> usage "System RAM".
> 
> Suggested-by: Luis R. Rodriguez <mcgrof@suse.com>
> Reviewed-by: Toshi Kani <toshi.kani@hp.com>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
>  include/linux/mm.h |    9 +++++++-
>  kernel/resource.c  |   61 +++++++++++++++++++++++++++++++---------------------
>  2 files changed, 44 insertions(+), 26 deletions(-)
> 
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 2e872f92dbac..84b05ebedb2d 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -369,7 +369,14 @@ static inline int put_page_unless_one(struct page *page)
>  }
>  
>  extern int page_is_ram(unsigned long pfn);
> -extern int region_is_ram(resource_size_t phys_addr, unsigned long size);
> +
> +enum {

If you gave the enum a name, say enum region_intersect_type, you could then
use that for the return type of region_intersects.

> +	REGION_INTERSECTS,
> +	REGION_DISJOINT,
> +	REGION_MIXED,
> +};
> +
> +int region_intersects(resource_size_t offset, size_t size, const char *type);


If you used say a return type enum region_intersect_type, at compile time you'd
get a complaint if any branch was not handled for the different enum types.

  Luis

  parent reply	other threads:[~2015-07-30 20:58 UTC|newest]

Thread overview: 118+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-30 16:53 [PATCH v3 00/24] replace ioremap_{cache|wt} with memremap Dan Williams
2015-07-30 16:53 ` Dan Williams
2015-07-30 16:53 ` Dan Williams
2015-07-30 16:53 ` Dan Williams
2015-07-30 16:53 ` Dan Williams
2015-07-30 16:53 ` [PATCH v3 01/24] mm: enhance region_is_ram() to region_intersects() Dan Williams
2015-07-30 16:53   ` Dan Williams
2015-07-30 16:53   ` Dan Williams
2015-07-30 20:42   ` Luis R. Rodriguez
2015-07-30 20:42     ` Luis R. Rodriguez
2015-07-30 20:42     ` Luis R. Rodriguez
2015-07-30 20:44     ` Dan Williams
2015-07-30 20:44       ` Dan Williams
2015-07-30 20:44       ` Dan Williams
2015-07-30 20:54       ` Luis R. Rodriguez
2015-07-30 20:54         ` Luis R. Rodriguez
2015-07-30 20:54         ` Luis R. Rodriguez
2015-07-30 20:59         ` Dan Williams
2015-07-30 20:59           ` Dan Williams
2015-07-30 20:59           ` Dan Williams
2015-07-30 21:10           ` Luis R. Rodriguez
2015-07-30 21:10             ` Luis R. Rodriguez
2015-07-30 21:10             ` Luis R. Rodriguez
2015-07-30 20:58   ` Luis R. Rodriguez [this message]
2015-07-30 20:58     ` Luis R. Rodriguez
2015-07-30 20:58     ` Luis R. Rodriguez
2015-07-30 16:53 ` [PATCH v3 02/24] arch, drivers: don't include <asm/io.h> directly, use <linux/io.h> instead Dan Williams
2015-07-30 16:53   ` Dan Williams
2015-07-30 16:53   ` Dan Williams
2015-07-30 16:53 ` [PATCH v3 03/24] cleanup IORESOURCE_CACHEABLE vs ioremap() Dan Williams
2015-07-30 16:53   ` Dan Williams
2015-07-30 16:53   ` Dan Williams
2015-07-30 16:54 ` [PATCH v3 04/24] intel_iommu: fix leaked ioremap mapping Dan Williams
2015-07-30 16:54   ` Dan Williams
2015-07-30 16:54   ` Dan Williams
2015-08-03 14:26   ` Joerg Roedel
2015-08-03 14:26     ` Joerg Roedel
2015-08-03 14:26     ` Joerg Roedel
2015-07-30 16:54 ` [PATCH v3 05/24] arch: introduce memremap() Dan Williams
2015-07-30 16:54   ` Dan Williams
2015-07-30 16:54   ` Dan Williams
2015-07-30 21:02   ` Luis R. Rodriguez
2015-07-30 21:02     ` Luis R. Rodriguez
2015-07-30 21:02     ` Luis R. Rodriguez
2015-07-30 21:11     ` Dan Williams
2015-07-30 21:11       ` Dan Williams
2015-07-30 21:11       ` Dan Williams
2015-07-30 16:54 ` [PATCH v3 06/24] arm: switch from ioremap_cache to memremap Dan Williams
2015-07-30 16:54   ` Dan Williams
2015-07-30 16:54   ` Dan Williams
2015-07-30 16:54 ` [PATCH v3 07/24] x86: " Dan Williams
2015-07-30 16:54   ` Dan Williams
2015-07-30 16:54   ` Dan Williams
2015-07-30 16:54 ` [PATCH v3 08/24] gma500: switch from acpi_os_ioremap " Dan Williams
2015-07-30 16:54   ` Dan Williams
2015-07-30 16:54   ` Dan Williams
2015-07-30 16:54 ` [PATCH v3 09/24] i915: " Dan Williams
2015-07-30 16:54   ` Dan Williams
2015-07-30 16:54   ` Dan Williams
2015-07-30 16:54   ` Dan Williams
2015-07-30 16:54 ` [PATCH v3 10/24] acpi: switch from ioremap_cache " Dan Williams
2015-07-30 16:54   ` Dan Williams
2015-07-30 16:54   ` Dan Williams
2015-07-30 16:54 ` [PATCH v3 11/24] toshiba laptop: replace ioremap_cache with ioremap Dan Williams
2015-07-30 16:54   ` Dan Williams
2015-07-30 16:54   ` Dan Williams
2015-07-30 16:54 ` [PATCH v3 12/24] memconsole: fix __iomem mishandling, switch to memremap Dan Williams
2015-07-30 16:54   ` Dan Williams
2015-07-30 16:54   ` Dan Williams
2015-07-30 16:54 ` [PATCH v3 13/24] visorbus: switch from ioremap_cache " Dan Williams
2015-07-30 16:54   ` Dan Williams
2015-07-30 16:54   ` Dan Williams
2015-08-06  0:27   ` Greg Kroah-Hartman
2015-08-06  0:27     ` Greg Kroah-Hartman
2015-08-06  0:27     ` Greg Kroah-Hartman
2015-07-30 16:54 ` [PATCH v3 14/24] intel-iommu: " Dan Williams
2015-07-30 16:54   ` Dan Williams
2015-07-30 16:54   ` Dan Williams
2015-07-30 16:55 ` [PATCH v3 15/24] libnvdimm, pmem: push call to ioremap_cache out of line Dan Williams
2015-07-30 16:55   ` Dan Williams
2015-07-30 16:55   ` Dan Williams
2015-07-30 16:55 ` [PATCH v3 16/24] pxa2xx-flash: switch from ioremap_cache to memremap Dan Williams
2015-07-30 16:55   ` Dan Williams
2015-07-30 16:55   ` Dan Williams
2015-07-30 16:55 ` [PATCH v3 17/24] sfi: " Dan Williams
2015-07-30 16:55   ` Dan Williams
2015-07-30 16:55   ` Dan Williams
2015-07-30 16:55 ` [PATCH v3 18/24] fbdev: switch from ioremap_wt " Dan Williams
2015-07-30 16:55   ` Dan Williams
2015-07-30 16:55   ` Dan Williams
2015-07-30 16:55   ` Dan Williams
2015-07-30 16:55 ` [PATCH v3 19/24] pmem: " Dan Williams
2015-07-30 16:55   ` Dan Williams
2015-07-30 16:55   ` Dan Williams
2015-07-30 16:55 ` [PATCH v3 20/24] arch: kill ioremap_cached() Dan Williams
2015-07-30 16:55   ` Dan Williams
2015-07-30 16:55   ` Dan Williams
2015-07-30 16:55 ` [PATCH v3 21/24] arch: kill ioremap_fullcache() Dan Williams
2015-07-30 16:55   ` Dan Williams
2015-07-30 16:55   ` Dan Williams
2015-07-30 16:55 ` [PATCH v3 22/24] arch: remove ioremap_cache, replace with arch_memremap Dan Williams
2015-07-30 16:55   ` Dan Williams
2015-07-30 16:55   ` Dan Williams
2015-07-30 16:55 ` [PATCH v3 23/24] arch: remove ioremap_wt, optionally " Dan Williams
2015-07-30 16:55   ` Dan Williams
2015-07-30 16:55   ` Dan Williams
2015-07-30 16:55 ` [PATCH v3 24/24] pmem: convert to generic memremap Dan Williams
2015-07-30 16:55   ` Dan Williams
2015-07-30 16:55   ` Dan Williams
2015-08-03 17:21   ` Ross Zwisler
2015-08-03 17:21     ` Ross Zwisler
2015-08-03 17:21     ` Ross Zwisler
2015-08-03 18:01     ` Dan Williams
2015-08-03 18:01       ` Dan Williams
2015-08-03 18:01       ` Dan Williams
2015-08-04 16:53       ` Ross Zwisler
2015-08-04 16:53         ` Ross Zwisler
2015-08-04 16:53         ` Ross Zwisler

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=20150730205802.GP30479@wotan.suse.de \
    --to=mcgrof@suse.com \
    --cc=dan.j.williams@intel.com \
    --cc=hch@lst.de \
    --cc=hpa@zytor.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvdimm@lists.01.org \
    --cc=mingo@kernel.org \
    --cc=rmk+kernel@arm.linux.org.uk \
    --cc=tglx@linutronix.de \
    --cc=toshi.kani@hp.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 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.