From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B161C433DF for ; Mon, 6 Jul 2020 10:48:37 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DA9022075B for ; Mon, 6 Jul 2020 10:48:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="kVWUQZpz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DA9022075B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=Huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=HEgrJUMIbtymPNa4uUot8bBom2sdg/hN70hRnErq8Mk=; b=kVWUQZpzS9TP8IQpgf02A+bzD NWTXi6f35kbaAWAH/4ryoYf3RfUG7TWjtTVjuM7S3nT/ObJXz6mknsRzAEAVqhMGcsL7iyfDqcEfL ASIAtw/VkiyxrzigABNW+swFCSYmuXhY8T3m7Zu9HVppOmXyRVpZZq5tqcc6ZdIo2YAS+kkKue05R iBWMQ2GdVsJ3es094/24Uq34cpTL3qfVapu+jPiVMZe4Jp5YwMFeenoHHF6g2tFWr40z7bo7YId00 icSKEjALV4RScT2GxvlFdpFn1SzpxwNJK1oqXUqFqVgJYFzfyNbOVZD+nSitEUGN2HXerOFJSBKI5 0vt868d4g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jsOeY-0004HW-2j; Mon, 06 Jul 2020 10:47:14 +0000 Received: from lhrrgout.huawei.com ([185.176.76.210] helo=huawei.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jsOeV-0004F8-4z for linux-arm-kernel@lists.infradead.org; Mon, 06 Jul 2020 10:47:12 +0000 Received: from lhreml710-chm.china.huawei.com (unknown [172.18.7.106]) by Forcepoint Email with ESMTP id 6BF1FF7319A1771C71D1; Mon, 6 Jul 2020 11:47:09 +0100 (IST) Received: from localhost (10.52.123.111) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Mon, 6 Jul 2020 11:47:08 +0100 Date: Mon, 6 Jul 2020 11:46:05 +0100 From: Jonathan Cameron To: Jia He Subject: Re: [PATCH 1/3] arm64/numa: set numa_off to false when numa node is fake Message-ID: <20200706114605.000050ac@Huawei.com> In-Reply-To: <20200706112921.00006f7f@Huawei.com> References: <20200706011947.184166-1-justin.he@arm.com> <20200706011947.184166-2-justin.he@arm.com> <20200706112921.00006f7f@Huawei.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; i686-w64-mingw32) MIME-Version: 1.0 X-Originating-IP: [10.52.123.111] X-ClientProxiedBy: lhreml717-chm.china.huawei.com (10.201.108.68) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200706_064711_368373_9FF3ACE8 X-CRM114-Status: GOOD ( 29.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Baoquan He , Kaly Xin , Catalin Marinas , Chuhong Yuan , linux-kernel@vger.kernel.org, Mike Rapoport , linux-mm@kvack.org, Andrew Morton , Will Deacon , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, 6 Jul 2020 11:29:21 +0100 Jonathan Cameron wrote: > On Mon, 6 Jul 2020 09:19:45 +0800 > Jia He wrote: > > Hi, > > > Previously, numa_off is set to true unconditionally in dummy_numa_init(), > > even if there is a fake numa node. > > > > But acpi will translate node id to NUMA_NO_NODE(-1) in acpi_map_pxm_to_node() > > because it regards numa_off as turning off the numa node. > > That is correct. It is operating exactly as it should, if SRAT hasn't been parsed > and you are on ACPI platform there are no nodes. They cannot be created at > some later date. The dummy code doesn't change this. It just does enough to carry > on operating with no specified nodes. > > > > > Without this patch, pmem can't be probed as a RAM device on arm64 if SRAT table > > isn't present. > > > > $ndctl create-namespace -fe namespace0.0 --mode=devdax --map=dev -s 1g -a 64K > > kmem dax0.0: rejecting DAX region [mem 0x240400000-0x2bfffffff] with invalid node: -1 > > kmem: probe of dax0.0 failed with error -22 > > > > This fixes it by setting numa_off to false. > > Without the SRAT protection patch [1] you may well run into problems > because someone somewhere will have _PXM in a DSDT but will > have a non existent SRAT. We had this happen on an AMD platform when we > tried to introduce working _PXM support for PCI. [2] > > So whilst this seems superficially safe, I'd definitely be crossing your fingers. > Note, at that time I proposed putting the numa_off = false into the x86 code > path precisely to cut out that possibility (was rejected at the time, at least > partly because the clarifications to the ACPI spec were not pubilc.) > > The patch in [1] should sort things out however by ensuring we only create > new domains where we should actually be doing so. However, in your case > it will return NUMA_NO_NODE anyway so this isn't the right way to fix things. > > [1] https://patchwork.kernel.org/patch/11632063/ > [2] https://patchwork.kernel.org/patch/10597777/ Thinking a bit more on this... I'd like to understand more on what your use case is. Do you have an NFIT that is setting the proximity domain for the non-volatile memory in SPA structures? If so the ACPI spec (6.3 makes this clear) requires those match with domains described in SRAT. If SRAT isn't there, then we can't expect sensible results from using these values from NFIT. If SRAT is there and numa=off is set then we should probably also rule out parsing NFIT, or make all nfit handling fine with NO_NUMA_NODE, preferably with explicit checks to ensure we don't try to use the Proximity Node values as they have no meaning with numa=off. I note that the core NFIT parsing is fine with the value not being supplied in the first place. https://elixir.bootlin.com/linux/latest/source/drivers/acpi/nfit/core.c#L2947 Thanks, Jonathan > > Thanks, > > Jonathan > > > > > Signed-off-by: Jia He > > --- > > arch/arm64/mm/numa.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c > > index aafcee3e3f7e..7689986020d9 100644 > > --- a/arch/arm64/mm/numa.c > > +++ b/arch/arm64/mm/numa.c > > @@ -440,7 +440,8 @@ static int __init dummy_numa_init(void) > > return ret; > > } > > > > - numa_off = true; > > + /* force numa_off to be false since we have a fake numa node here */ > > + numa_off = false; > > return 0; > > } > > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel