Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp820989ybb; Wed, 25 Mar 2020 10:12:45 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtUH8HYxeYI8rawLrZgevwcRxF5ywPquMFsKc7l6Ftr6eV1hLYVbPslBzIBcX+RBDhCGiEP X-Received: by 2002:a4a:84c2:: with SMTP id o2mr1755917oog.47.1585156364984; Wed, 25 Mar 2020 10:12:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585156364; cv=none; d=google.com; s=arc-20160816; b=o9x0CsN9UuSwdT4dLIYNz07nWoM4LKcVLwRzFqaAqZ1As3Rx2HHa8KVMzbTRhGCENu DvlKKbLRcXI4LHmVPlD5La49mqx3LdBDhA4QNkIpocoozTxp4IiRMXpIHR8TiXBGubOF X7j6EqM+m9DlbeTJbGnVA/+Idme7sucYPaV7QJ0U0T6n2ZmINaFeKZHpZE2gL7LYEd03 +PmOUivphjIXxTCjGDlJdp9Wj8i4YNCUoaH1Mylgre54mV9tEPH5hmHXm386lYOD9bu6 dZa63BB+kHP0pCR7Qi/7YMvd1adM+1gfcAAmQGIMI8J/IsgQx8iw7hG3uUSD5Z2l7JNq t1iA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=3TB/V3cS5dQRTb7u6NS+KlfC79/CqRkvKXs/fm6g34w=; b=nQ17tp2NsIKbW9KsghnUbhdpoa438d3VG/eo6eRXZrYKe21DeMBFXdWg0Sq58pF/8+ 29c5WApxFUmiSV0WHoSN360AvOpEy3fmIvP3h5ro27JBv1C3ZW5lDniPYbl2psURX/Mm +4NE32sNzScYA6mqyB+iMYjG333Ei+ZvvQ520J5bxyq9UgiW8ngOUZeJeb32XsSNlQY9 38oZt4ZswVDfj20+uLNwtsPly3iWCtIUcr2mwBvE4mRZDQrxXSihvvxPh7Taeg9M5MV7 9SrhaC3KHFmJVBbELey4UgfOCWtIhpIXAcFp4GHLG+TuMYa25Q0Xsvt/QxE0gm8VOnxg 9a+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=eHcC+28q; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l18si10972284otb.312.2020.03.25.10.12.26; Wed, 25 Mar 2020 10:12:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=eHcC+28q; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727683AbgCYRKx (ORCPT + 99 others); Wed, 25 Mar 2020 13:10:53 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:42422 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727357AbgCYRKx (ORCPT ); Wed, 25 Mar 2020 13:10:53 -0400 Received: by mail-ed1-f66.google.com with SMTP id cw6so2697617edb.9 for ; Wed, 25 Mar 2020 10:10:51 -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=3TB/V3cS5dQRTb7u6NS+KlfC79/CqRkvKXs/fm6g34w=; b=eHcC+28qlTy7M88OlVi6MBXlOrqK6YikB2zKmxyH4Yh1II3FzBdkQrjEEUT5Zt3lJu ckS7jpRPAdgt6whblMJd4ptrhZCQL79TrQz8EbzL0SeL83J/LyAjkzbRTsOj4IE/KEeE s2Cx4bQIQCOK5OekxWCKafQD5/kxGKWTNVCCl4E/5W9kzq593H6wZiiDm60ecwOxStL2 LeujouVThMSlNjsaf48F3Yw3But0ebd1m3dEIw4LmAEfh2yIpX1peWDg7aUtH9KwQIa8 ruxLdm7gd+iIRBKXSIwL4KQlpkNOOyUGpbdyDdyC5u5j4vY/p7zfHHalqOU/fQZAlsKW n5lQ== 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=3TB/V3cS5dQRTb7u6NS+KlfC79/CqRkvKXs/fm6g34w=; b=kiq1jCdFX74+k2/W+RuLfn4bVZE16/xNos6fMAUR6/QS74SREAWOfOPOLQ0aPMZDvW JrJqXoM01T/d+rJjoKkrk7ON1AHjNkFYlIFHPfwvqYpTjFgvdkisUe9Uk+5YxGE6bSvw vsR/qiMLupad9/3s9GWkDjLZ+zFu7VCFWjLJBvYEJTo8m8vtw1mi7mNMYGFNGNQyCs/D CC+8mO4G3mDeWwBggkFqFE7OwnUy1GXPkwhCsozh8qC79fjBOt4VPDqPi+uobVw/fl6N 2W/VVViI10z7di+PNhaynkc86MDVIbnHqLk01c6NDlHkjUU+E/QXrZd9Orc1qkgnLkv2 16ig== X-Gm-Message-State: ANhLgQ15EpiuWCCQ8FY2+aNEc1YyIrOMLEu5ItiYWLMqZQR4Bq2H0N0H iYfx48viZAi/8fH9zi6ktgEYH0iJwkZPTymrEwU89g== X-Received: by 2002:a17:906:1e8a:: with SMTP id e10mr4231020ejj.56.1585156250955; Wed, 25 Mar 2020 10:10:50 -0700 (PDT) MIME-Version: 1.0 References: <158489354353.1457606.8327903161927980740.stgit@dwillia2-desk3.amr.corp.intel.com> <158489357825.1457606.17352509511987748598.stgit@dwillia2-desk3.amr.corp.intel.com> <20200325111039.GA32109@willie-the-truck> In-Reply-To: <20200325111039.GA32109@willie-the-truck> From: Dan Williams Date: Wed, 25 Mar 2020 10:10:36 -0700 Message-ID: Subject: Re: [PATCH v2 6/6] ACPI: HMAT: Attach a device for each soft-reserved range To: Will Deacon Cc: Linux ACPI , Jonathan Cameron , Brice Goglin , Ard Biesheuvel , "Rafael J. Wysocki" , Jeff Moyer , Catalin Marinas , Peter Zijlstra , Dave Hansen , linux-nvdimm , Linux Kernel Mailing List , X86 ML , Joao Martins Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 25, 2020 at 4:10 AM Will Deacon wrote: > > On Sun, Mar 22, 2020 at 09:12:58AM -0700, Dan Williams wrote: > > The hmem enabling in commit 'cf8741ac57ed ("ACPI: NUMA: HMAT: Register > > "soft reserved" memory as an "hmem" device")' only registered ranges to > > the hmem driver for each soft-reservation that also appeared in the > > HMAT. While this is meant to encourage platform firmware to "do the > > right thing" and publish an HMAT, the corollary is that platforms that > > fail to publish an accurate HMAT will strand memory from Linux usage. > > Additionally, the "efi_fake_mem" kernel command line option enabling > > will strand memory by default without an HMAT. > > > > Arrange for "soft reserved" memory that goes unclaimed by HMAT entries > > to be published as raw resource ranges for the hmem driver to consume. > > > > Include a module parameter to disable either this fallback behavior, or > > the hmat enabling from creating hmem devices. The module parameter > > requires the hmem device enabling to have unique name in the module > > namespace: "device_hmem". > > > > Rather than mark this x86-only, include an interim phys_to_target_node() > > implementation for arm64. > > > > Cc: Jonathan Cameron > > Cc: Brice Goglin > > Cc: Ard Biesheuvel > > Cc: "Rafael J. Wysocki" > > Cc: Jeff Moyer > > Cc: Catalin Marinas > > Cc: Will Deacon > > Signed-off-by: Dan Williams > > --- > > arch/arm64/mm/numa.c | 13 +++++++++++++ > > drivers/dax/Kconfig | 1 + > > drivers/dax/hmem/Makefile | 3 ++- > > drivers/dax/hmem/device.c | 33 +++++++++++++++++++++++++++++++++ > > 4 files changed, 49 insertions(+), 1 deletion(-) > > > > diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c > > index 4decf1659700..00fba21eaec0 100644 > > --- a/arch/arm64/mm/numa.c > > +++ b/arch/arm64/mm/numa.c > > @@ -468,3 +468,16 @@ int memory_add_physaddr_to_nid(u64 addr) > > pr_warn("Unknown node for memory at 0x%llx, assuming node 0\n", addr); > > return 0; > > } > > + > > +/* > > + * device-dax instance registrations want a valid target-node in case > > + * they are ever onlined as memory (see hmem_register_device()). > > + * > > + * TODO: consult cached numa info > > + */ > > +int phys_to_target_node(phys_addr_t addr) > > +{ > > + pr_warn_once("Unknown target node for memory at 0x%llx, assuming node 0\n", > > + addr); > > + return 0; > > +} > > Could you implement a generic version of this by iterating over the nodes > with for_each_{,online_}node() and checking for intersection with > node_{start,end}_pfn()? Interesting. The gap is that node_{start,end}_pfn() requires node_data[] which to date architectures have only setup for online nodes. Recall a target node is an offline node that could come online later. However, reworking offline data into node_data could be the local solution for arm64, I'd just ask that each of the 6 memory-hotplug capable archs go make that opt-in decision themselves.