Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp5197576ybb; Tue, 24 Mar 2020 12:43:25 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsJkvm+UnMy7tKgj4GzP0+M8n891mRt7oZrOFmPrVU5nT6qyvVgVfSdkIoupWeHJp5nNh6W X-Received: by 2002:a05:6808:8f:: with SMTP id s15mr4840962oic.110.1585079005668; Tue, 24 Mar 2020 12:43:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585079005; cv=none; d=google.com; s=arc-20160816; b=XGTCyuGaxCxTEYbpvmCEOo8HwYH9uvjsAKwoS0y7v5s2RIrPz/bV0Or8vQ+37CwbWu plXdWPceAhxuAKCVrVgPhh2bRJueOBVoMgUGFbLZT3mxHmIsCFJhqH+2yrBgDRCnZvQu RlX0sgHEAwBvSerupOMT+aFetUde5s+zDPrvqPF5MZ1ApZ98B6O771Cr689mV8H3nMTW pQOBR0UYJq7pO4fwn72IJP5wWqmGG25qL0YQA9AOFOjHodFXbZc5t0T3jVF0QpYA1vBO OaeXVZ55HTs52c2osrvIq1G3gV3Y+8uZ0u1Naaahtq2kjWFE9Q3NWMeO5sHCnlFAWKsl 3SFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:date:message-id :references:cc:to:subject:from:dkim-signature; bh=SKMZ5uOK7rxqU52BlZO7Pxf90rzulk8LlemNxxJfU/U=; b=o2B0CBAxPrNKOB+klsFZkTZj+hMl+MEs0zwa93lPid/udvyM/6XQcZS8GCtrVIfj6f Mpdl7/tV/GbJyl6Uld4igT05wyXMSH+cIxdssvN6EGAO0bTb/IR2JfVLFx+LFlUU2HPq Fo/CKcAiLSVNHxkcKdSw+JA++a46XE4NUUk3MkeezH9ERhsD4jdUf5Ebo/5tFa14vsO/ G9ireuzZk4KfMdIpen3agNURlJyiHq/RlE9g/HG+JDcxKg6GzGpVlR8xW2TNpr1zN5hG a/jNMp7pjbXNpkEfo+c6PLGN1n6EQsWGzoUuAyj67SHDmqg5suPbwSOI55i3517s40+q W/vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=FfGbH6iy; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r70si963119oor.49.2020.03.24.12.43.13; Tue, 24 Mar 2020 12:43:25 -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=@oracle.com header.s=corp-2020-01-29 header.b=FfGbH6iy; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727250AbgCXTlc (ORCPT + 99 others); Tue, 24 Mar 2020 15:41:32 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:37620 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725835AbgCXTlc (ORCPT ); Tue, 24 Mar 2020 15:41:32 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 02OJeRMV026868; Tue, 24 Mar 2020 19:41:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : subject : to : cc : references : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=SKMZ5uOK7rxqU52BlZO7Pxf90rzulk8LlemNxxJfU/U=; b=FfGbH6iy6YrP2iWlPBe7K/fdmbLJN0Q6DyZO7UhGNGoAFaRsQPSkZvQfcBJM4KpQc6uM bJqUwmAXgHnphm5hAf1MeLtiaHv8hsNnF3/WjY3xEC74BrO2T1UG1UIZGRa7OLudumGP Ao6pHe1jwIIGYKH8ynDIrHYcxGOkY9lwCwP/uLRKGv46nTInSYvF7FcDyjKx97FqhkhP YON4nrKul168SVxRVU5tFhjcutf4LNG45D++ch3m7PsWwettdYQJB3hjD1hiPV1tCV5n PWZjl+JrwWcM6GuM/NqiQ6oOp/UkSpqB1aauSIT3/VQFThqq7W244i8xGsR68W/FatXc hw== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 2yx8ac3a45-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 24 Mar 2020 19:41:10 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 02OJaM8T002084; Tue, 24 Mar 2020 19:41:09 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3020.oracle.com with ESMTP id 2yymbu70xq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 24 Mar 2020 19:41:09 +0000 Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 02OJf7QG024103; Tue, 24 Mar 2020 19:41:07 GMT Received: from [10.175.222.8] (/10.175.222.8) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 24 Mar 2020 12:41:07 -0700 From: Joao Martins Subject: Re: [PATCH v2 6/6] ACPI: HMAT: Attach a device for each soft-reserved range To: Dan Williams Cc: linux-acpi@vger.kernel.org, Jonathan Cameron , Brice Goglin , Ard Biesheuvel , "Rafael J. Wysocki" , Catalin Marinas , Will Deacon , peterz@infradead.org, dave.hansen@linux.intel.com, linux-nvdimm@lists.01.org, linux-kernel@vger.kernel.org, x86@kernel.org References: <158489354353.1457606.8327903161927980740.stgit@dwillia2-desk3.amr.corp.intel.com> <158489357825.1457606.17352509511987748598.stgit@dwillia2-desk3.amr.corp.intel.com> Message-ID: Date: Tue, 24 Mar 2020 19:41:02 +0000 MIME-Version: 1.0 In-Reply-To: <158489357825.1457606.17352509511987748598.stgit@dwillia2-desk3.amr.corp.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9570 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 suspectscore=5 adultscore=0 malwarescore=0 bulkscore=0 spamscore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2003240096 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9570 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1011 lowpriorityscore=0 suspectscore=5 priorityscore=1501 malwarescore=0 mlxscore=0 adultscore=0 phishscore=0 impostorscore=0 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2003240096 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/22/20 4:12 PM, 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/drivers/dax/hmem/device.c b/drivers/dax/hmem/device.c > index 99bc15a8b031..f9c5fa8b1880 100644 > --- a/drivers/dax/hmem/device.c > +++ b/drivers/dax/hmem/device.c > @@ -4,6 +4,9 @@ > #include > #include > > +static bool nohmem; > +module_param_named(disable, nohmem, bool, 0444); > + > void hmem_register_device(int target_nid, struct resource *r) > { > /* define a clean / non-busy resource for the platform device */ > @@ -16,6 +19,9 @@ void hmem_register_device(int target_nid, struct resource *r) > struct memregion_info info; > int rc, id; > > + if (nohmem) > + return; > + > rc = region_intersects(res.start, resource_size(&res), IORESOURCE_MEM, > IORES_DESC_SOFT_RESERVED); > if (rc != REGION_INTERSECTS) > @@ -62,3 +68,30 @@ void hmem_register_device(int target_nid, struct resource *r) > out_pdev: > memregion_free(id); > } > + > +static __init int hmem_register_one(struct resource *res, void *data) > +{ > + /* > + * If the resource is not a top-level resource it was already > + * assigned to a device by the HMAT parsing. > + */ > + if (res->parent != &iomem_resource) > + return 0; > + > + hmem_register_device(phys_to_target_node(res->start), res); > + > + return 0; Should we add an error returning value to hmem_register_device() perhaps this ought to be reflected in hmem_register_one(). > +} > + > +static __init int hmem_init(void) > +{ > + walk_iomem_res_desc(IORES_DESC_SOFT_RESERVED, > + IORESOURCE_MEM, 0, -1, NULL, hmem_register_one); > + return 0; > +} > + (...) and then perhaps here returning in the initcall if any of the resources failed hmem registration? > +/* > + * As this is a fallback for address ranges unclaimed by the ACPI HMAT > + * parsing it must be at an initcall level greater than hmat_init(). > + */ > +late_initcall(hmem_init); Regardless of the nit (which ties in to patch 4), looks good. So, FWIW: Reviewed-by: Joao Martins For the hmem changes. Joao