All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boaz Harrosh <boaz@plexistor.com>
To: Christoph Hellwig <hch@lst.de>,
	linux-nvdimm@ml01.01.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, x86@kernel.org, axboe@kernel.dk
Cc: ross.zwisler@linux.intel.com
Subject: [PATCH] SQUASHME: Fixes to e820 handling of pmem
Date: Wed, 01 Apr 2015 17:25:22 +0300	[thread overview]
Message-ID: <551BFFD2.20608@plexistor.com> (raw)
In-Reply-To: <1427872339-6688-2-git-send-email-hch@lst.de>


Finally with these fixes I'm able to define memmap=!
regions in NUMA machines. Any combination cross or
not cross NUMA boundary.

And not only the memmap=! regions had problems also
the real type-12 NvDIMMs had the same NUMA problems.
Now it all works.

Also
I have kept the "don't merge PRAM" regions for ease
of emulated NUMA setups.

Also I have reverted the change Ch did to
e820_mark_nosave_regions. From comment above the function
and if I'm reading register_nosave_region() correctly,
We certainly do not want the system to try and save any
pmem to swap or hibernate. (Actually it will be the
opposite right). Can we actually define swap on a /dev/pmemX ? ;-)

Signed-off-by: Boaz Harrosh <boaz@plexistor.com>
---
 Documentation/kernel-parameters.txt |  6 ++++++
 arch/x86/kernel/e820.c              | 20 +++++++++-----------
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index bfcb1a6..c87122d 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1965,6 +1965,12 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
 			         or
 			         memmap=0x10000$0x18690000
 
+	memmap=nn[KMG]!ss[KMG]
+			[KNL,X86] Mark specific memory as protected.
+			Region of memory to be used, from ss to ss+nn.
+			The memory region may be marked as e820 type 12 (0xc)
+			and is NVDIMM or ADR memory.
+
 	memory_corruption_check=0/1 [X86]
 			Some BIOSes seem to corrupt the first 64k of
 			memory when doing things like suspend/resume.
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index e26ca56..3572a22 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -346,7 +346,7 @@ int __init sanitize_e820_map(struct e820entry *biosmap, int max_nr_map,
 		 * continue building up new bios map based on this
 		 * information
 		 */
-		if (current_type != last_type)	{
+		if (current_type != last_type || current_type == E820_PRAM) {
 			if (last_type != 0)	 {
 				new_bios[new_bios_entry].size =
 					change_point[chgidx]->addr - last_addr;
@@ -692,14 +692,8 @@ void __init e820_mark_nosave_regions(unsigned long limit_pfn)
 
 		pfn = PFN_DOWN(ei->addr + ei->size);
 
-		switch (ei->type) {
-		case E820_RAM:
-		case E820_PRAM:
-		case E820_RESERVED_KERN:
-			break;
-		default:
+		if (ei->type != E820_RAM && ei->type != E820_RESERVED_KERN)
 			register_nosave_region(PFN_UP(ei->addr), pfn);
-		}
 
 		if (pfn >= limit_pfn)
 			break;
@@ -880,6 +874,9 @@ static int __init parse_memmap_one(char *p)
 	} else if (*p == '$') {
 		start_at = memparse(p+1, &p);
 		e820_add_region(start_at, mem_size, E820_RESERVED);
+	} else if (*p == '!') {
+		start_at = memparse(p+1, &p);
+		e820_add_region(start_at, mem_size, E820_PRAM);
 	} else
 		e820_remove_range(mem_size, ULLONG_MAX - mem_size, E820_RAM, 1);
 
@@ -955,9 +952,10 @@ void __init e820_reserve_resources(void)
 		 * pci device BAR resource and insert them later in
 		 * pcibios_resource_survey()
 		 */
-		if (e820.map[i].type != E820_RESERVED || res->start < (1ULL<<20)) {
-			if (e820.map[i].type != E820_PRAM)
-				res->flags |= IORESOURCE_BUSY;
+		if (((e820.map[i].type != E820_RESERVED) &&
+		     (e820.map[i].type != E820_PRAM)) ||
+		     res->start < (1ULL<<20)) {
+			res->flags |= IORESOURCE_BUSY;
 			insert_resource(&iomem_resource, res);
 		}
 		res++;
-- 
1.9.3



  reply	other threads:[~2015-04-01 14:25 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-01  7:12 another pmem variant V3 Christoph Hellwig
2015-04-01  7:12 ` [PATCH 1/2] x86: add support for the non-standard protected e820 type Christoph Hellwig
2015-04-01 14:25   ` Boaz Harrosh [this message]
2015-04-02  9:30     ` [PATCH] SQUASHME: Fixes to e820 handling of pmem Christoph Hellwig
2015-04-02  9:37       ` Ingo Molnar
2015-04-02  9:40         ` Christoph Hellwig
2015-04-02 11:18         ` Christoph Hellwig
2015-04-02 11:20       ` Boaz Harrosh
2015-04-02 12:31   ` [tip:x86/pmem] x86/mm: Add support for the non-standard protected e820 type tip-bot for Christoph Hellwig
2015-04-02 19:08     ` Andy Lutomirski
2015-04-02 19:13       ` Ingo Molnar
2015-04-02 19:51         ` Andy Lutomirski
2015-04-16 22:31           ` Andy Lutomirski
2015-04-17  0:55             ` Elliott, Robert (Server Storage)
2015-04-17  0:59               ` Andy Lutomirski
2015-04-02 20:28     ` Yinghai Lu
2015-04-02 20:23   ` [PATCH 1/2] x86: add " Yinghai Lu
2015-04-03 16:14   ` [Linux-nvdimm] " Toshi Kani
2015-04-03 17:12     ` Yinghai Lu
2015-04-03 20:54       ` Toshi Kani
2015-04-04  9:40         ` Ingo Molnar
2015-04-05  7:44           ` Yinghai Lu
2015-04-06  7:27             ` Ingo Molnar
2015-04-06 17:29           ` Toshi Kani
2015-04-06 18:26             ` Yinghai Lu
2015-04-06 18:23               ` Toshi Kani
2015-04-05  9:18       ` Boaz Harrosh
2015-04-05 20:06         ` Yinghai Lu
2015-04-06  7:16           ` Boaz Harrosh
2015-04-06 15:55       ` Christoph Hellwig
2015-04-01  7:12 ` [PATCH 2/2] pmem: add a driver for persistent memory Christoph Hellwig
2015-04-01 15:18   ` Boaz Harrosh
2015-04-02  9:32     ` Christoph Hellwig
2015-04-02 12:31   ` [tip:x86/pmem] drivers/block/pmem: Add " tip-bot for Ross Zwisler
2015-04-02 15:31 ` [PATCH] pmem: Add prints at module load and unload Boaz Harrosh
2015-04-02 15:39   ` [Linux-nvdimm] " Dan Williams
2015-04-02 15:47     ` Boaz Harrosh
2015-04-02 16:01       ` Dan Williams
2015-04-02 16:44         ` Christoph Hellwig
2015-04-05  8:50           ` Boaz Harrosh
2015-04-07 15:19             ` Christoph Hellwig
2015-04-07 15:34               ` Boaz Harrosh
2015-04-07 15:46 ` [PATCH A+B] " Boaz Harrosh
2015-04-07 15:47   ` [PATCH 1A] pmem: Add prints at pmem_probe/remove Boaz Harrosh
2015-04-07 15:47   ` [PATCH 1B] pmem: Add prints at module load and unload Boaz Harrosh
2015-04-13  9:05   ` [PATCH A+B] " Greg KH
2015-04-13 12:05     ` Boaz Harrosh
2015-04-13 12:36       ` Greg KH
2015-04-13 13:20         ` Boaz Harrosh
2015-04-13 13:36           ` Greg KH

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=551BFFD2.20608@plexistor.com \
    --to=boaz@plexistor.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvdimm@ml01.01.org \
    --cc=ross.zwisler@linux.intel.com \
    --cc=x86@kernel.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.