Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1329610ybb; Wed, 1 Apr 2020 21:35:26 -0700 (PDT) X-Google-Smtp-Source: APiQypJKX7VFFJ3zA9eRHPATm0GFKMPRcpmp7TmayrnSLtjEv6Be1jGuqFDvPYW8qFct6WiurCRR X-Received: by 2002:a4a:e9fc:: with SMTP id w28mr1285060ooc.98.1585802126793; Wed, 01 Apr 2020 21:35:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585802126; cv=none; d=google.com; s=arc-20160816; b=xb2YR1kDNaFFzXlOJlo253YSUvCy6sLlykGanm9OLUH+W15HwYRls5K0y2lpy7BdUE u1yzZCoNuYKWbeL7btFMs6JT2M0xidCHJ6tSDqpEBqOwrkKHkK/x+2Citgpc+15ffRC7 nddAnnC63szXjQwZShOYgkp9sk8/hPziIaz8bS+lPtKgao3e16FOpirffbhm0MgP363L X6w/MOhzEFEuIYop55sPWXzTk1W+uY78E6V3t4ZWvu/JSBMKk7ONGFfEhkiZ77nLCmr4 bJpz7MRx2QfobhxtFWEjb5s96tgRcuIu9g4vxp+0rSv/+St0VX0zNSRZSzhYYKX6EdmO XaOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:thread-index:content-language :content-transfer-encoding:mime-version:message-id:date:subject :in-reply-to:references:cc:to:from:dkim-signature; bh=GpxGpAzW9L5BrlH2F8e/j1Md042MnPNWwOkKrhsln6w=; b=SH0OSEMSDmepqqBVhPplkAH2btXzVrFhH8cXW38Ol3o5CZDXKjQHXqvg7+CLg+vikG q/ydc4YUiUkjrMcHkvGDbhXD05MUqfB1zGS58Ph299L0GvDvOLvm/4WlbVl0YQgUnJ/S MQX/UzM8ZU9LF6o8nRgq+2GmrLk+N7nH3y9fZjZV33iGfLssE+r8z5XhMcS1GODBekJG 8b5dYrU06TIGIGjyUFY4AiXy/gxOU3FTnpQgNug23K9NZJYyx/wB/IcFC4kc4IhDPxjU Z46XIs7bTEWK5Dj2s7ekpT/H+gwcDNexoX50ZWFyIS1Sa6djva3XSZJuR6ErTUnvRZeK Nmqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@d-silva.org header.s=201810a header.b=BHYxjj87; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r205si1858575oig.174.2020.04.01.21.35.01; Wed, 01 Apr 2020 21:35:26 -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=@d-silva.org header.s=201810a header.b=BHYxjj87; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726841AbgDBEeA (ORCPT + 99 others); Thu, 2 Apr 2020 00:34:00 -0400 Received: from ushosting.nmnhosting.com ([66.55.73.32]:60628 "EHLO ushosting.nmnhosting.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726205AbgDBEeA (ORCPT ); Thu, 2 Apr 2020 00:34:00 -0400 Received: from mail2.nmnhosting.com (unknown [202.169.106.97]) by ushosting.nmnhosting.com (Postfix) with ESMTPS id 010C02DC3330; Thu, 2 Apr 2020 15:33:58 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=d-silva.org; s=201810a; t=1585802039; bh=WyxkApmW2+/IWEqXKjwy7I58nLQNzwtikErBlXfDT3Q=; h=From:To:Cc:References:In-Reply-To:Subject:Date:From; b=BHYxjj87wP/IsQs6UieDA8cxeJBZxTxKiSxENghzcmzSMZpSPhsAQQNVkHBCh/rfB g7ScGNmMgJ7TS1WAS8eRSlAlB/0Frr6pvG3vhjFR0f1uqYXfGiFITdSo5QG8C2DIsZ egC8SaZKrXrEf4Jz53nJWQoXMN602ZUir1fDzeogqVfh8ndQgtWVImAG76Mb9r3ycs u1GX8A3IMfWuGyThtQ7dbfhSafC/ftvCHMkyeL3L7t0GAaX8zstriWiChEa/m74230 4UWgA2ZNOXQ1B9ZJ/j3a7p7NaT3hmM6a4gFROh3gnorICAPY8P+n6M2noyxaDe8pr9 lQr7CiTU27DEK/GR/yTDRUncYTn/rvArwvxVAsL2CqIMn97cu0iIDtPUaVvFtGBhuc mKJnISs7kAV7HYQ+3GuwzPaGBpgip6Putd5qmUY5EYVd0D3UPKNCSMnk8nRbfa9UHz MAr514VjrJNrc9bjWIlTBWIUTr68ptMZE+KIx42jjSMcILhYAkBVitC8UcZSoejF14 MkO8kx+nwuCWs8zlTy79mK4KG76AiKxv24+67Y+OluJWLkTZY19Sto4NeUfpWtM1HH hrWuh2Gq2HwbwPM42+wEyE8mnZEicC17Te6snoR1CUo+UwUEHoWgJmSf76Mv4zfE9i JKLM9Nqj9TrfJlG6dIWn3tC8= Received: from Hawking (ntp.lan [10.0.1.1]) (authenticated bits=0) by mail2.nmnhosting.com (8.15.2/8.15.2) with ESMTPSA id 0324Xi8h089946 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 2 Apr 2020 15:33:46 +1100 (AEDT) (envelope-from alastair@d-silva.org) From: "Alastair D'Silva" To: "'Dan Williams'" Cc: "'Aneesh Kumar K . V'" , "'Oliver O'Halloran'" , "'Benjamin Herrenschmidt'" , "'Paul Mackerras'" , "'Michael Ellerman'" , "'Frederic Barrat'" , "'Andrew Donnellan'" , "'Arnd Bergmann'" , "'Greg Kroah-Hartman'" , "'Vishal Verma'" , "'Dave Jiang'" , "'Ira Weiny'" , "'Andrew Morton'" , "'Mauro Carvalho Chehab'" , "'David S. Miller'" , "'Rob Herring'" , "'Anton Blanchard'" , "'Krzysztof Kozlowski'" , "'Mahesh Salgaonkar'" , "'Madhavan Srinivasan'" , "=?utf-8?Q?'C=C3=A9dric_Le_Goater'?=" , "'Anju T Sudhakar'" , "'Hari Bathini'" , "'Thomas Gleixner'" , "'Greg Kurz'" , "'Nicholas Piggin'" , "'Masahiro Yamada'" , "'Alexey Kardashevskiy'" , "'Linux Kernel Mailing List'" , "'linuxppc-dev'" , "'linux-nvdimm'" , "'Linux MM'" References: <20200327071202.2159885-1-alastair@d-silva.org> <20200327071202.2159885-3-alastair@d-silva.org> In-Reply-To: Subject: RE: [PATCH v4 02/25] mm/memory_hotplug: Allow check_hotplug_memory_addressable to be called from drivers Date: Thu, 2 Apr 2020 15:33:43 +1100 Message-ID: <2e7501d608a7$ea00cd10$be026730$@d-silva.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Content-Language: en-au Thread-Index: AQJ5L4Hn/mp5p0p1jYAFWLJ+xmWSbgIN9vctASc14KCnBUc6gA== X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (mail2.nmnhosting.com [10.0.1.20]); Thu, 02 Apr 2020 15:33:54 +1100 (AEDT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > -----Original Message----- > From: Dan Williams > Sent: Wednesday, 1 April 2020 7:48 PM > To: Alastair D'Silva > Cc: Aneesh Kumar K . V ; Oliver O'Halloran > ; Benjamin Herrenschmidt > ; Paul Mackerras ; Michael > Ellerman ; Frederic Barrat = ; > Andrew Donnellan ; Arnd Bergmann > ; Greg Kroah-Hartman ; > Vishal Verma ; Dave Jiang > ; Ira Weiny ; Andrew Morton > ; Mauro Carvalho Chehab > ; David S. Miller ; > Rob Herring ; Anton Blanchard ; > Krzysztof Kozlowski ; Mahesh Salgaonkar > ; Madhavan Srinivasan > ; C=C3=A9dric Le Goater ; Anju = T > Sudhakar ; Hari Bathini > ; Thomas Gleixner ; Greg > Kurz ; Nicholas Piggin ; Masahiro > Yamada ; Alexey Kardashevskiy > ; Linux Kernel Mailing List = ; > linuxppc-dev ; linux-nvdimm nvdimm@lists.01.org>; Linux MM > Subject: Re: [PATCH v4 02/25] mm/memory_hotplug: Allow > check_hotplug_memory_addressable to be called from drivers >=20 > On Sun, Mar 29, 2020 at 10:23 PM Alastair D'Silva = > wrote: > > > > When setting up OpenCAPI connected persistent memory, the range = check > > may not be performed until quite late (or perhaps not at all, if the > > user does not establish a DAX device). > > > > This patch makes the range check callable so we can perform the = check > > while probing the OpenCAPI Persistent Memory device. > > > > Signed-off-by: Alastair D'Silva > > Reviewed-by: Andrew Donnellan > > --- > > include/linux/memory_hotplug.h | 5 +++++ > > mm/memory_hotplug.c | 4 ++-- > > 2 files changed, 7 insertions(+), 2 deletions(-) > > > > diff --git a/include/linux/memory_hotplug.h > > b/include/linux/memory_hotplug.h index f4d59155f3d4..9a19ae0d7e31 > > 100644 > > --- a/include/linux/memory_hotplug.h > > +++ b/include/linux/memory_hotplug.h > > @@ -337,6 +337,11 @@ static inline void __remove_memory(int nid, u64 > > start, u64 size) {} extern void set_zone_contiguous(struct zone > > *zone); extern void clear_zone_contiguous(struct zone *zone); > > > > +#ifdef CONFIG_MEMORY_HOTPLUG_SPARSE > > +int check_hotplug_memory_addressable(unsigned long pfn, > > + unsigned long nr_pages); #endif > > +/* CONFIG_MEMORY_HOTPLUG_SPARSE */ >=20 > Let's move this to include/linux/memory.h with the other > CONFIG_MEMORY_HOTPLUG_SPARSE declarations, and add a dummy > implementation for the CONFIG_MEMORY_HOTPLUG_SPARSE=3Dn case. >=20 > Also, this patch can be squashed with the next one, no need for it to = be > stand alone. >=20 Ok >=20 > > + > > extern void __ref free_area_init_core_hotplug(int nid); extern int > > __add_memory(int nid, u64 start, u64 size); extern int = add_memory(int > > nid, u64 start, u64 size); diff --git a/mm/memory_hotplug.c > > b/mm/memory_hotplug.c index 0a54ffac8c68..14945f033594 100644 > > --- a/mm/memory_hotplug.c > > +++ b/mm/memory_hotplug.c > > @@ -276,8 +276,8 @@ static int check_pfn_span(unsigned long pfn, > unsigned long nr_pages, > > return 0; > > } > > > > -static int check_hotplug_memory_addressable(unsigned long pfn, > > - unsigned long nr_pages) > > +int check_hotplug_memory_addressable(unsigned long pfn, > > + unsigned long nr_pages) > > { > > const u64 max_addr =3D PFN_PHYS(pfn + nr_pages) - 1; > > > > -- > > 2.24.1 > > --=20 Alastair D'Silva mob: 0423 762 819 skype: alastair_dsilva msn: alastair@d-silva.org blog: http://alastair.d-silva.org Twitter: @EvilDeece =20