From patchwork Wed Dec 26 13:14:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fengguang Wu X-Patchwork-Id: 10743077 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0E3F8924 for ; Wed, 26 Dec 2018 13:37:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F075628495 for ; Wed, 26 Dec 2018 13:37:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E223328938; Wed, 26 Dec 2018 13:37:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 82D8328495 for ; Wed, 26 Dec 2018 13:37:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EF8B48E0009; Wed, 26 Dec 2018 08:37:07 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id C5DF48E0003; Wed, 26 Dec 2018 08:37:07 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A4A338E0009; Wed, 26 Dec 2018 08:37:07 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by kanga.kvack.org (Postfix) with ESMTP id 2F0C08E0006 for ; Wed, 26 Dec 2018 08:37:07 -0500 (EST) Received: by mail-pg1-f197.google.com with SMTP id s22so15223477pgv.8 for ; Wed, 26 Dec 2018 05:37:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:message-id :user-agent:date:from:to:cc:cc:cc:cc:cc:cc:cc:cc:cc:cc:cc:subject :references:mime-version:content-disposition; bh=bLqbS/PT6+OZn4Cd5ognINxOjsGpaTLmfW4Gzyha0A4=; b=NM5AqxtgvI0sPCSC7eCYsY2rHc6pXdxWCyARWdzUQirD+yebcLW+wUhQDtOdqfI+1l QRx77MsjU6X/g1cebkC1cioPra6Zr/C11YTHD9Krn/ObbslnJ9reXtzkSNdvPXQnpd// Ddp3forWtX1Rsahl/pdzW7b3FFKpCjPzd9jPCSApWAFTq3ycOY3AySkqh6rjoSnOcn7J 4OhczEjTBR3iRDNTJ4lZfSoeqDYO4pD5+LQo4hen2KBR4EHrTa9GfR/Yty2X06nSdUlD VRBNe2vbkn/h70rH5kUozG5h3pVEpMb8yp6As4RJc7VtkLHUxugTFagHzHst2rW3gwB+ XwpA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of fengguang.wu@intel.com designates 192.55.52.115 as permitted sender) smtp.mailfrom=fengguang.wu@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Gm-Message-State: AA+aEWaxmL6qH5T4yaHndwjeIjlGS1Ik7CCdRLykf6ajQuGVFEobFsWz GnIfEf422rqBvTKYDaLc/9lCZd0Ulpm9fzM0qQ/e5AyiNHytjvkNJoEzgwXR1zOGTrF3ztUjcnD rCfpaw6D1r6mV4OYxbLys/CEB8ZQYjZiOqURnmZo26FYo8oHLVx4GwrNI5NMeC485MQ== X-Received: by 2002:aa7:8286:: with SMTP id s6mr19849796pfm.63.1545831426820; Wed, 26 Dec 2018 05:37:06 -0800 (PST) X-Google-Smtp-Source: AFSGD/WQ4B60GhMAduoRZhcDq54lJ66ohrTTN6e0JuJ1HGfD+xHUlIohYnwBU82oQ1LCgC3W/drH X-Received: by 2002:aa7:8286:: with SMTP id s6mr19849757pfm.63.1545831426118; Wed, 26 Dec 2018 05:37:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545831426; cv=none; d=google.com; s=arc-20160816; b=YGjs0E7YKjQD8P1I9uTbUB0hD+3JfO4B+tij/eDcVeX+a4dQh448qANYJnrqUUAlka 2mnthQw1RTMol3Pd6D8b6hBQlOKNsbBE4ZXkdT9VPuHlg9YI+pf0KxzfCVV4/z/pNgPA 0nWOuU1B+EpNfxTnMnhhaOVWZavHtcy67PmYtqb6yrgts51SCsWrY68p0po5lRLGxudj 3FvycUcfV45baAMzDRo5RCEEDGV8eull3F+EhZHGPu283iI/7Cimr50i9Eb4/TQ6KTAk Y5pJvDX6usx2yXGhLbNFdLpVuswCp/JvKeEreQDhciUGsySMdYhZ9pdS/j9eBkskRZRO Ekdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:references:subject:cc:cc:cc:cc:cc :cc:cc:cc:cc:cc:cc:to:from:date:user-agent:message-id; bh=bLqbS/PT6+OZn4Cd5ognINxOjsGpaTLmfW4Gzyha0A4=; b=pq8aQYkOMpFj9e10gitZIPllbb11Xfp9oinWxQhL+uMuH9acYiqN0N0gpdLnWy6BlD yTl6mOvlF2nVKl3V2TggL+Z03RNlMYcCulCuum++xjR4L64vuUhEQk4ynskLC8qn41y4 sGph6iKVWv3Ai3NU7hP5pegyJ3StEOiWQJYm8wVEo5opV+qLnzK71VNyUfqiNqexggB+ 7vo3Mhs7CotOg53IQ+BYhmO3293YUMpzfCtcajBWwkVXTtLCCMhiAPLsZBAHp+//60AW SRnT9CXEujLvrsj9Puxk58k3MBS83vJqjN1txc50vPajD3uBFMzsBKPQotz3r8P36nW+ O2tw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of fengguang.wu@intel.com designates 192.55.52.115 as permitted sender) smtp.mailfrom=fengguang.wu@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from mga14.intel.com (mga14.intel.com. [192.55.52.115]) by mx.google.com with ESMTPS id e68si15371744pfb.101.2018.12.26.05.37.05 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Dec 2018 05:37:06 -0800 (PST) Received-SPF: pass (google.com: domain of fengguang.wu@intel.com designates 192.55.52.115 as permitted sender) client-ip=192.55.52.115; Authentication-Results: mx.google.com; spf=pass (google.com: domain of fengguang.wu@intel.com designates 192.55.52.115 as permitted sender) smtp.mailfrom=fengguang.wu@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Dec 2018 05:37:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,400,1539673200"; d="scan'208";a="121185460" Received: from wangdan1-mobl1.ccr.corp.intel.com (HELO wfg-t570.sh.intel.com) ([10.254.210.154]) by FMSMGA003.fm.intel.com with ESMTP; 26 Dec 2018 05:37:01 -0800 Received: from wfg by wfg-t570.sh.intel.com with local (Exim 4.89) (envelope-from ) id 1gc9Mr-0005Nz-7S; Wed, 26 Dec 2018 21:37:01 +0800 Message-Id: <20181226133351.164047705@intel.com> User-Agent: quilt/0.65 Date: Wed, 26 Dec 2018 21:14:48 +0800 From: Fengguang Wu To: Andrew Morton cc: Linux Memory Management List , Fan Du , Fengguang Wu cc: kvm@vger.kernel.org Cc: LKML cc: Yao Yuan cc: Peng Dong cc: Huang Ying CC: Liu Jingqi cc: Dong Eddie cc: Dave Hansen cc: Zhang Yi cc: Dan Williams Subject: [RFC][PATCH v2 02/21] acpi/numa: memorize NUMA node type from SRAT table References: <20181226131446.330864849@intel.com> MIME-Version: 1.0 Content-Disposition: inline; filename=0002-acpi-Memorize-numa-node-type-from-SRAT-table.patch X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP From: Fan Du Mark NUMA node as DRAM or PMEM. This could happen in boot up state (see the e820 pmem type override patch), or on fly when bind devdax device with kmem driver. It depends on BIOS supplying PMEM NUMA proximity in SRAT table, that's current production BIOS does. Signed-off-by: Fan Du Signed-off-by: Fengguang Wu --- arch/x86/include/asm/numa.h | 2 ++ arch/x86/mm/numa.c | 2 ++ drivers/acpi/numa.c | 5 +++++ 3 files changed, 9 insertions(+) --- linux.orig/arch/x86/include/asm/numa.h 2018-12-23 19:20:39.890947888 +0800 +++ linux/arch/x86/include/asm/numa.h 2018-12-23 19:20:39.890947888 +0800 @@ -30,6 +30,8 @@ extern int numa_off; */ extern s16 __apicid_to_node[MAX_LOCAL_APIC]; extern nodemask_t numa_nodes_parsed __initdata; +extern nodemask_t numa_nodes_pmem; +extern nodemask_t numa_nodes_dram; extern int __init numa_add_memblk(int nodeid, u64 start, u64 end); extern void __init numa_set_distance(int from, int to, int distance); --- linux.orig/arch/x86/mm/numa.c 2018-12-23 19:20:39.890947888 +0800 +++ linux/arch/x86/mm/numa.c 2018-12-23 19:20:39.890947888 +0800 @@ -20,6 +20,8 @@ int numa_off; nodemask_t numa_nodes_parsed __initdata; +nodemask_t numa_nodes_pmem; +nodemask_t numa_nodes_dram; struct pglist_data *node_data[MAX_NUMNODES] __read_mostly; EXPORT_SYMBOL(node_data); --- linux.orig/drivers/acpi/numa.c 2018-12-23 19:20:39.890947888 +0800 +++ linux/drivers/acpi/numa.c 2018-12-23 19:20:39.890947888 +0800 @@ -297,6 +297,11 @@ acpi_numa_memory_affinity_init(struct ac node_set(node, numa_nodes_parsed); + if (ma->flags & ACPI_SRAT_MEM_NON_VOLATILE) + node_set(node, numa_nodes_pmem); + else + node_set(node, numa_nodes_dram); + pr_info("SRAT: Node %u PXM %u [mem %#010Lx-%#010Lx]%s%s\n", node, pxm, (unsigned long long) start, (unsigned long long) end - 1,