From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751425AbcFWLwN (ORCPT ); Thu, 23 Jun 2016 07:52:13 -0400 Received: from mail-wm0-f48.google.com ([74.125.82.48]:36719 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750809AbcFWLwM (ORCPT ); Thu, 23 Jun 2016 07:52:12 -0400 Message-ID: <576BCD68.8010500@plexistor.com> Date: Thu, 23 Jun 2016 14:52:08 +0300 From: Boaz Harrosh User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Yigal Korman , tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, linux-kernel@vger.kernel.org CC: linux-nvdimm@ml01.01.org Subject: Re: [PATCH] x86/mm: only allow memmap=XX!YY over existing RAM References: <1466408039-7497-1-git-send-email-yigal@plexistor.com> In-Reply-To: <1466408039-7497-1-git-send-email-yigal@plexistor.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/20/2016 10:33 AM, Yigal Korman wrote: > Before this patch, passing a range that is beyond the physical memory > range will succeed, the user will see a /dev/pmem0 and will be able to > access it. Reads will always return 0 and writes will be silently > ignored. > > I've gotten more than one bug report about mkfs.{xfs,ext4} or nvml > failing that were eventually tracked down to be wrong values passed to > memmap. > > This patch prevents the above issue by instead of adding a new memory > range, only update a RAM memory range with the PRAM type. This way, > passing the wrong memmap will either not give you a pmem at all or give > you a smaller one that actually has RAM behind it. > > And if someone still needs to fake a pmem that doesn't have RAM behind > it, they can simply do memmap=XX@YY,XX!YY. > We are running with this patch for a while in the lab and it does solve the problem above with no maleffects so: Tested-by: Boaz Harrosh > Signed-off-by: Yigal Korman > --- > arch/x86/kernel/e820.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c > index 621b501..4bd4207 100644 > --- a/arch/x86/kernel/e820.c > +++ b/arch/x86/kernel/e820.c > @@ -878,7 +878,7 @@ static int __init parse_memmap_one(char *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); > + e820_update_range(start_at, mem_size, E820_RAM, E820_PRAM); > } else > e820_remove_range(mem_size, ULLONG_MAX - mem_size, E820_RAM, 1); > >