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=-6.7 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 7E259C433E0 for ; Thu, 9 Jul 2020 03:38:45 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 40DE320775 for ; Thu, 9 Jul 2020 03:38:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=intel-com.20150623.gappssmtp.com header.i=@intel-com.20150623.gappssmtp.com header.b="raobTJTp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 40DE320775 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id EB93D6B0006; Wed, 8 Jul 2020 23:38:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E6AD06B0007; Wed, 8 Jul 2020 23:38:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D592C6B000A; Wed, 8 Jul 2020 23:38:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0068.hostedemail.com [216.40.44.68]) by kanga.kvack.org (Postfix) with ESMTP id BF9A86B0006 for ; Wed, 8 Jul 2020 23:38:43 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 6880E180AD811 for ; Thu, 9 Jul 2020 03:38:43 +0000 (UTC) X-FDA: 77017130526.30.side08_1d0bd4626ec2 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin30.hostedemail.com (Postfix) with ESMTP id 41863180B3C8E for ; Thu, 9 Jul 2020 03:38:43 +0000 (UTC) X-HE-Tag: side08_1d0bd4626ec2 X-Filterd-Recvd-Size: 6099 Received: from mail-ed1-f68.google.com (mail-ed1-f68.google.com [209.85.208.68]) by imf29.hostedemail.com (Postfix) with ESMTP for ; Thu, 9 Jul 2020 03:38:42 +0000 (UTC) Received: by mail-ed1-f68.google.com with SMTP id n2so670765edr.5 for ; Wed, 08 Jul 2020 20:38:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=YtjuErNIKJPKt6mfJPuDEE1udY89MBwcN8YDulEHHpA=; b=raobTJTpMajWWh1DB67I4/ixIZuCT8w3vl86Q6iXHe8AqyCsaVIQnEjEhi3xpXUVSY 0sZ63uK1kh4Jq4GNjXjq1PXyhJBnXNVLrXeQybYWn7zcn8nuVxunI9SJNMAwua0zTL/6 N1PoXUBA2cUrSZwgk8tTruN0Pzjo+BpZWuk8YT47mWs7NxF6eN2RJOPiPqaA5CBkqCrA cWuPO9IW3sP/7mhUWgqHI7r2h3+L5G+GEZ+152hw2pOUVzrPYQCm4q8Mtc4j2RtD39xc 14zCSHFmqrXrZ7K1jR+L5WFLLufK7fsNNpNlnIegsjGENi2QENndj1DW7a2O57jMVMkS Kh8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=YtjuErNIKJPKt6mfJPuDEE1udY89MBwcN8YDulEHHpA=; b=AORkYmZkmYJR1REN9L4EKS/GcCOpFx4CFc7cJ9oybUksRg4RT2MeBL0xJ6XcSZd8ZV 9tijCTb6dJm801LQnaLnamC1dN0UibD6ZkCmVZUwYO/K5NykVBcnHXnCXlXrgElYkA52 K2V+chlqUuHblhHks8h0rn+6segq7gfR8Jdr9lSo+wZXVNoK/8R9fodA8yGjGvZhu4X5 aOegBScMNoJp/Ow11R6Nhbh6Yzgv3KnAD5F4dhuM5pGJ+tmn+U7J8mtJfsoedUdpL/OW lwjlVLvD2GYC0dcKGWhCpio5iGcfB/vu6LQOWFPCibWcjsGjfB40Soq9hCq0xCVuy71m GWIQ== X-Gm-Message-State: AOAM5338QPMIp/HqoDAeIDRH54d7g5ONOrWzS7RtWgKVskyvrD7gb/Xn hm0jkak1HMvckUJM/bowZYzhFM3g1u7PBH7RvjWGEw== X-Google-Smtp-Source: ABdhPJw5nGGUvNN51Fg2qfZAUYpiFgoQEWbsf39bUBkbdSfrldAhGBNqQDnuvj5zNJ0UqJqM9lo3PWsVoNPxBGZ10fU= X-Received: by 2002:a05:6402:b79:: with SMTP id cb25mr49015887edb.154.1594265921222; Wed, 08 Jul 2020 20:38:41 -0700 (PDT) MIME-Version: 1.0 References: <20200709020629.91671-1-justin.he@arm.com> <20200709020629.91671-6-justin.he@arm.com> In-Reply-To: <20200709020629.91671-6-justin.he@arm.com> From: Dan Williams Date: Wed, 8 Jul 2020 20:38:30 -0700 Message-ID: Subject: Re: [PATCH v3 5/6] device-dax: use fallback nid when numa_node is invalid To: Jia He Cc: Catalin Marinas , Will Deacon , Tony Luck , Fenghua Yu , Yoshinori Sato , Rich Felker , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , David Hildenbrand , X86 ML , "H. Peter Anvin" , Vishal Verma , Dave Jiang , Andrew Morton , Baoquan He , Chuhong Yuan , Mike Rapoport , Logan Gunthorpe , Masahiro Yamada , Michal Hocko , Linux ARM , Linux Kernel Mailing List , linux-ia64@vger.kernel.org, Linux-sh , linux-nvdimm , Linux MM , Jonathan Cameron , Kaly Xin Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 41863180B3C8E X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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: On Wed, Jul 8, 2020 at 7:07 PM Jia He wrote: > > numa_off is set unconditionally at the end of dummy_numa_init(), > even with a fake numa node. ACPI detects node id as NUMA_NO_NODE(-1) in > acpi_map_pxm_to_node() because it regards numa_off as turning off the numa > node. Hence dev_dax->target_node is NUMA_NO_NODE on arm64 with fake numa. > > 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 using fallback memory_add_physaddr_to_nid() as nid. > > Suggested-by: David Hildenbrand > Signed-off-by: Jia He > --- > drivers/dax/kmem.c | 21 +++++++++++++-------- > 1 file changed, 13 insertions(+), 8 deletions(-) > > diff --git a/drivers/dax/kmem.c b/drivers/dax/kmem.c > index 275aa5f87399..218f66057994 100644 > --- a/drivers/dax/kmem.c > +++ b/drivers/dax/kmem.c > @@ -31,22 +31,23 @@ int dev_dax_kmem_probe(struct device *dev) > int numa_node; > int rc; > > + /* Hotplug starting at the beginning of the next block: */ > + kmem_start = ALIGN(res->start, memory_block_size_bytes()); > + > /* > * Ensure good NUMA information for the persistent memory. > * Without this check, there is a risk that slow memory > * could be mixed in a node with faster memory, causing > - * unavoidable performance issues. > + * unavoidable performance issues. Furthermore, fallback node > + * id can be used when numa_node is invalid. > */ > 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; > + numa_node = memory_add_physaddr_to_nid(kmem_start); I think this fixup belongs to the core to set a fallback value for dev_dax->target_node. I'm close to having patches to provide a functional phys_addr_to_target_node() for arm64.