From patchwork Wed Apr 1 14:25:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boaz Harrosh X-Patchwork-Id: 6140551 Return-Path: X-Original-To: patchwork-linux-nvdimm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5A1569F2EC for ; Wed, 1 Apr 2015 14:25:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 63DD5202E6 for ; Wed, 1 Apr 2015 14:25:28 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5810F202D1 for ; Wed, 1 Apr 2015 14:25:27 +0000 (UTC) Received: from ml01.vlan14.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 3586C80FCF; Wed, 1 Apr 2015 07:25:27 -0700 (PDT) X-Original-To: linux-nvdimm@ml01.01.org Delivered-To: linux-nvdimm@ml01.01.org Received: from mail-wg0-f49.google.com (mail-wg0-f49.google.com [74.125.82.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 891CB80FCC for ; Wed, 1 Apr 2015 07:25:26 -0700 (PDT) Received: by wgbdm7 with SMTP id dm7so55360265wgb.1 for ; Wed, 01 Apr 2015 07:25:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=lRaodEU5CWry0bAQLlqsjpPpW7yIE9xyL5aBW7jVMig=; b=KAYCN2uEmnhPeGC1jxdXTg6EL9tCasASKWkvykf+76rslis950W9tIGEtXNfTDPwhi is/UBpZmxvtOffmDqYfwI0E5GqO01olGc2BMrJ5AxVPKmYf1Av0I5l2oZxNl1O8VK6LD KpSeOLdGUwPXGzrrVThkzuuxvDqoGYF5ozsloyh9PdaQ18NzaZdoDnBW3L3Pq1wYnaXv ywDKtsUs4gb+c5U4peFhTAGK6HRfpNV2ENvOdcyuZa5SRUYm60zh3vCmWRuwu6OX6Rkz jlNkaHBxJnRqaHTMOh0KVeEjWVVt/BJ33sGYj9nD1ZZG4CO3WX5VklVVcfyef8PNy8tf ONUQ== X-Gm-Message-State: ALoCoQlFQbHcwa3eM7YHUMACsUxYs7I5l64dRWS1Jr0NfvWbO/kKVKQIuhPlPbdwlFfQhutu2+LS X-Received: by 10.194.222.135 with SMTP id qm7mr86544475wjc.14.1427898324832; Wed, 01 Apr 2015 07:25:24 -0700 (PDT) Received: from [10.0.0.5] ([207.232.55.62]) by mx.google.com with ESMTPSA id g2sm29469624wib.1.2015.04.01.07.25.23 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Apr 2015 07:25:23 -0700 (PDT) Message-ID: <551BFFD2.20608@plexistor.com> Date: Wed, 01 Apr 2015 17:25:22 +0300 From: Boaz Harrosh User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Christoph Hellwig , linux-nvdimm@ml01.01.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, axboe@kernel.dk References: <1427872339-6688-1-git-send-email-hch@lst.de> <1427872339-6688-2-git-send-email-hch@lst.de> In-Reply-To: <1427872339-6688-2-git-send-email-hch@lst.de> Subject: [Linux-nvdimm] [PATCH] SQUASHME: Fixes to e820 handling of pmem X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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++;