Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp292526imu; Mon, 10 Dec 2018 22:06:17 -0800 (PST) X-Google-Smtp-Source: AFSGD/VnRNG8XUBEMwHO88hiNRaQHEkUySYc8Vw3T+Ly561RI63KAlt1Sh/I3+1OpEUNhK45FyeB X-Received: by 2002:a17:902:bd92:: with SMTP id q18mr15008636pls.167.1544508377060; Mon, 10 Dec 2018 22:06:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544508377; cv=none; d=google.com; s=arc-20160816; b=tn0RvRfkL8mbaXwQGYpyhYJUhYM2OJ3gi5OJKq14abANM6hR/6APFyI1WKWKp2QTFz GRHwOUdJGh4Bil3Xqb0patazybCSueIa4oH4I40hqwZ18te/CF2lW44YsZoLYKmxRjos BsFkfu0AmNBepLceVAh/UugTSks9xvx1+iP5gudLJY4KqzzoT1NM+VYUvK8NxHdxqoYk mA/i1LQq5CftkgHc3mQbg0zhfgeyh2crXim81VW1t1Al5Zi2t+lt7lz4QI6eddsZBeMq DpXroyy0nNgZr/pTofANUd4Se0cmkUf49M2le8pP4oyfpgT51DOIOOq0ELcdmTTcAXWm M8eg== 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=KAFD67T1bQTHyMT2fYa4K5uz3QdtHC7VrPCD/cp84b4=; b=oReTO0T7OoOFb3M5ZAnEOcCLemRzeUAw16gIBmgmkgSVmPr1xrwoNN+WSS1sRUsyfs 3BDRnoU0XBmggWJTYX+08Eq/vZRaSK3JmsqnQa1G7PWc8gbg5TN5Uq9+kVMdEuSbXLED mCkn2JHmrKUJQHeqHs04KMbAHaGrY1kROCyt3X+z7aAWkxatR0p4KUuuL3TL1NlW47w6 a1wFUWegit7MbIKBO87CRHPe4ugIqXIYJY8CaKpOwgSr+YP7pJ81H2/gLPzeiJgNRh7w EQ8Ubmcl+kJIfa5/J+mBv8KvFMfE3Ntp9SCy7CPyWZGoqJTJexv/5O+Kwt5/lCqS1NZx ZEVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=DPUjT9ll; 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 g11si11349511pgu.347.2018.12.10.22.06.02; Mon, 10 Dec 2018 22:06:17 -0800 (PST) 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=DPUjT9ll; 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 S1728753AbeLKGDx (ORCPT + 99 others); Tue, 11 Dec 2018 01:03:53 -0500 Received: from mail-ot1-f65.google.com ([209.85.210.65]:35050 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727146AbeLKGDw (ORCPT ); Tue, 11 Dec 2018 01:03:52 -0500 Received: by mail-ot1-f65.google.com with SMTP id 81so12963330otj.2 for ; Mon, 10 Dec 2018 22:03:52 -0800 (PST) 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=KAFD67T1bQTHyMT2fYa4K5uz3QdtHC7VrPCD/cp84b4=; b=DPUjT9llzzo/SU7Hjl+tJqcJQDgjeLEonBvmhByw4RO2qzLHA6dl+cPKomDce+wYMM jvNfvT01n7fZyhlx6wSIIIHNc1xmlcCh8ta3aAqIB1gCkygSJpCbQ3urU7Lz46pRAV4s ydPOtP5pQhluXVHVfilt3R/GN5xNVY2rorS3+BYlg6rSxtCZbagLhyz3/tTC041tglC3 JkL0QWQsaLMF4qrb0CsR7td8k5MJGyDBxylPEjJMucI/gmGrUc5kw5b4PuxEVfpy7phT r2CkJuOD41FWPZQRX7hFBlQ3CskA3faQvVE/bxAW9C7085pfs0pHGD4Wv7xWDrBOLqyG dj3w== 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=KAFD67T1bQTHyMT2fYa4K5uz3QdtHC7VrPCD/cp84b4=; b=qPSEPWr9hTB2P1PiShWS/TKyaqClKq7dMn3rppM5o+V343MC06GkQMP4VizqIwlmwO Qtva+cA59VxE4cXeemnYPttEmVwXXJvbpdndMzAJSiO40sgmLFxGvguIHuuJImtUL6f6 kxfygv+43+lJIH+tAgesL46AN8auFA3fnH/L7CBd5VMKgFeS6u1tr4WmUaHmXwisnMWp zHvrGrY5snduUIg61zBPAFz5qy9+m9Y0xYrai/EL2+DjL5sqK4Ct4aPX8F5LGoljn52b Vl+z2ywJ0yKiJeinjsqpYnFLKJxeBchxGY+2joEV5CeMCcw43H1Hk6mAqpy7UTOOuBpq Te8g== X-Gm-Message-State: AA+aEWYWVUq+9psLHziURfaVeDZDvlZYA57PjLMixU/1nE9thmvDZiDn yw8rZNPAu7d6J/i8JeeK59z3gZP7ubECPqb32YNJmA== X-Received: by 2002:a9d:6ac2:: with SMTP id m2mr10153168otq.353.1544508231906; Mon, 10 Dec 2018 22:03:51 -0800 (PST) MIME-Version: 1.0 References: <20181211010310.8551-1-keith.busch@intel.com> <20181211010310.8551-3-keith.busch@intel.com> In-Reply-To: <20181211010310.8551-3-keith.busch@intel.com> From: Dan Williams Date: Mon, 10 Dec 2018 22:03:40 -0800 Message-ID: Subject: Re: [PATCHv2 02/12] acpi/hmat: Parse and report heterogeneous memory To: Keith Busch Cc: Linux Kernel Mailing List , Linux ACPI , Linux MM , Greg KH , "Rafael J. Wysocki" , Dave Hansen 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 Mon, Dec 10, 2018 at 5:05 PM Keith Busch wrote: > > Systems may provide different memory types and export this information > in the ACPI Heterogeneous Memory Attribute Table (HMAT). Parse these > tables provided by the platform and report the memory access and caching > attributes. > > Signed-off-by: Keith Busch > --- > drivers/acpi/Kconfig | 8 +++ > drivers/acpi/Makefile | 1 + > drivers/acpi/hmat.c | 192 ++++++++++++++++++++++++++++++++++++++++++++++++++ > drivers/acpi/tables.c | 9 +++ > include/linux/acpi.h | 1 + > 5 files changed, 211 insertions(+) > create mode 100644 drivers/acpi/hmat.c > > diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig > index 7cea769c37df..9a05af3a18cf 100644 > --- a/drivers/acpi/Kconfig > +++ b/drivers/acpi/Kconfig > @@ -327,6 +327,14 @@ config ACPI_NUMA > depends on (X86 || IA64 || ARM64) > default y if IA64_GENERIC || IA64_SGI_SN2 || ARM64 > > +config ACPI_HMAT > + bool "ACPI Heterogeneous Memory Attribute Table Support" > + depends on ACPI_NUMA > + help > + Parses representation of the ACPI Heterogeneous Memory Attributes > + Table (HMAT) and set the memory node relationships and access > + attributes. > + > config ACPI_CUSTOM_DSDT_FILE > string "Custom DSDT Table file to include" > default "" > diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile > index edc039313cd6..b5e13499f88b 100644 > --- a/drivers/acpi/Makefile > +++ b/drivers/acpi/Makefile > @@ -55,6 +55,7 @@ acpi-$(CONFIG_X86) += x86/apple.o > acpi-$(CONFIG_X86) += x86/utils.o > acpi-$(CONFIG_DEBUG_FS) += debugfs.o > acpi-$(CONFIG_ACPI_NUMA) += numa.o > +acpi-$(CONFIG_ACPI_HMAT) += hmat.o > acpi-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o > acpi-y += acpi_lpat.o > acpi-$(CONFIG_ACPI_LPIT) += acpi_lpit.o > diff --git a/drivers/acpi/hmat.c b/drivers/acpi/hmat.c > new file mode 100644 > index 000000000000..ef3881f0f370 > --- /dev/null > +++ b/drivers/acpi/hmat.c [..] > +static __init int hmat_init(void) > +{ > + struct acpi_subtable_proc subtable_proc; > + struct acpi_table_header *tbl; > + enum acpi_hmat_type i; > + acpi_status status; > + > + if (srat_disabled()) > + return 0; > + > + status = acpi_get_table(ACPI_SIG_HMAT, 0, &tbl); > + if (ACPI_FAILURE(status)) > + return 0; > + > + if (acpi_table_parse(ACPI_SIG_HMAT, parse_noop)) > + goto out_put; > + > + memset(&subtable_proc, 0, sizeof(subtable_proc)); > + subtable_proc.handler = hmat_parse_subtable; > + for (i = ACPI_HMAT_TYPE_ADDRESS_RANGE; i < ACPI_HMAT_TYPE_RESERVED; i++) { > + subtable_proc.id = i; > + if (acpi_table_parse_entries_array(ACPI_SIG_HMAT, > + sizeof(struct acpi_table_hmat), > + &subtable_proc, 1, 0) < 0) > + goto out_put; > + } > + out_put: > + acpi_put_table(tbl); > + return 0; > +} > +subsys_initcall(hmat_init); I have a use case to detect the presence of a memory-side-cache early at init time [1]. To me this means that hmat_init() needs to happen as a part of acpi_numa_init(). Subsequently I think that also means that the sysfs portion needs to be broken out to its own init path that can probably run at module_init() priority. Perhaps we should split this patch set into two? The table parsing with an in-kernel user is a bit easier to reason about and can go in first. Towards that end can I steal / refllow patches 1 & 2 into the memory randomization series? Other ideas how to handle this? [1]: https://lkml.org/lkml/2018/10/12/309