From patchwork Fri Aug 16 11:18:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin He X-Patchwork-Id: 11097497 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 0254D14F7 for ; Fri, 16 Aug 2019 11:18:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E4946289EB for ; Fri, 16 Aug 2019 11:18:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D920C289ED; Fri, 16 Aug 2019 11:18:58 +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=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id 984F4289EB for ; Fri, 16 Aug 2019 11:18:58 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 22DFE202E2D57; Fri, 16 Aug 2019 04:20:49 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=217.140.110.172; helo=foss.arm.com; envelope-from=justin.he@arm.com; receiver=linux-nvdimm@lists.01.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by ml01.01.org (Postfix) with ESMTP id 00AB5202E292C for ; Fri, 16 Aug 2019 04:20:47 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C706C360; Fri, 16 Aug 2019 04:18:56 -0700 (PDT) Received: from localhost.localdomain (unknown [10.169.40.54]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 09FE13F706; Fri, 16 Aug 2019 04:18:54 -0700 (PDT) From: Jia He To: Dan Williams , Vishal Verma Subject: [PATCH 1/2] drivers/dax/kmem: use default numa_mem_id if target_node is invalid Date: Fri, 16 Aug 2019 19:18:43 +0800 Message-Id: <20190816111844.87442-2-justin.he@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190816111844.87442-1-justin.he@arm.com> References: <20190816111844.87442-1-justin.he@arm.com> X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jia He , linux-kernel@vger.kernel.org, linux-nvdimm@lists.01.org MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP In some platforms(e.g arm64 guest), the NFIT info might not be ready. Then target_node might be -1. But if there is a default numa_mem_id(), we can use it to avoid unnecessary fatal EINVL error. devm_memremap_pages() also uses this logic if nid is invalid, we can keep the same page with it. Signed-off-by: Jia He --- drivers/dax/kmem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/dax/kmem.c b/drivers/dax/kmem.c index a02318c6d28a..ad62d551d94e 100644 --- a/drivers/dax/kmem.c +++ b/drivers/dax/kmem.c @@ -33,9 +33,9 @@ int dev_dax_kmem_probe(struct device *dev) */ numa_node = dev_dax->target_node; if (numa_node < 0) { - dev_warn(dev, "rejecting DAX region %pR with invalid node: %d\n", - res, numa_node); - return -EINVAL; + dev_warn(dev, "DAX %pR with invalid node, assume it as %d\n", + res, numa_node, numa_mem_id()); + numa_node = numa_mem_id(); } /* Hotplug starting at the beginning of the next block: */