Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp384352ybb; Wed, 1 Apr 2020 01:49:17 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvnV0uCLnAQGiplJylrToIy4MSdYj23mryS+gc1q291H0bIoo4ej1UWilViGiPc9k/CJBsL X-Received: by 2002:a9d:18f:: with SMTP id e15mr5803142ote.42.1585730957283; Wed, 01 Apr 2020 01:49:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585730957; cv=none; d=google.com; s=arc-20160816; b=h0JrO6iF87Nq1dvHQpVN0CKGqd33UnShUKIwktsSYEy7hOspEV4X1c9lJh6PVfL5rs yEvNJzqNhJEVO7f1SI43YQ6Knin22l9dXtYE3CkYcIf0nRr5B+1Z1w1ZtDcQIKkZEFue mLw8FAR5tqmNKEPUhrrbNbXlK/T+s3qchc/fLk2Mw77Zj45+wobjbXMJvSqGRtfBnWGA Kt4rGZnUty1fEiVbUyX7b/qxY7w4uiL0DmpVjlAH1e0Hyev1AOSuW7hYw4Voe4YjefGt 8oww2XGbVRnzFbIbihY7gv2y5hY+oRcrqGVMbo8wiO/MdI892tbjKYBUNpgs//+1tiLD MMTw== 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=feZj/1ocB6XIjJoDVsEEUrA2KaXFHt0B9wSHktP2ddQ=; b=STJjkIqNHAcWCgyPrhTTToM1c+tD03gXbF+QUYPwCUjtIvLhL5mJXif1Zb4M5mxVZ1 jgntGxkdk3IPZLON4ccNSVB7ACii4uooIO8l2/mkpMLb3/3XnoKAEHU2VtuaoGgKs9js sweLEeoxDjRrRrRVIZV8aRrqqdbBNvmCIT9UTL6GcbZZTTrCoAo5SjzXboruJ/oj1XLx 9t2YWJ7M10UagWRZ+mEmLd8NmGK4zZzvQwMNc5n3GCBarx/Vb/MN2z7uDz1jeyzIXg3y JJelo6KRbhQiDAPkVCQTU8ivlb+LuX/jvmCuVkwBkSYiqX0v6vF+jNbx+LwpAJUV6SKh BfWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=Bh1JR39j; 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 y25si706774otj.304.2020.04.01.01.49.05; Wed, 01 Apr 2020 01:49:17 -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=Bh1JR39j; 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 S1731862AbgDAIs3 (ORCPT + 99 others); Wed, 1 Apr 2020 04:48:29 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:38264 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726536AbgDAIs3 (ORCPT ); Wed, 1 Apr 2020 04:48:29 -0400 Received: by mail-ed1-f66.google.com with SMTP id e5so28685206edq.5 for ; Wed, 01 Apr 2020 01:48:27 -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=feZj/1ocB6XIjJoDVsEEUrA2KaXFHt0B9wSHktP2ddQ=; b=Bh1JR39j+h1CpltTDW6HGFEOaXTLaNjNFTs/HHcXupyutEFcwNSNmspuDLCGf1ngc3 3JpOjmwFyMJKqlOxTzogrVowaOb1QIi3j8ZxAAP5+dTIDs2wrDYNiFzAC1pNenb81J4x Y0o8J2WvYge0HdtQtAaBdaJuC6fhVWSw5yAjGewymen6zoiqepG1Pu2f2Syh3qjkbnM9 63NpYqgZavpVqDdE02NRa8sgSS+1zoZJSGdCFyiEDE6u1Wuo2Qc2ha1yyqNmK6L2A0tu +GaivKSH2OYfiaNQXJyXBJPXwLpUUs6miQI82ISI/kufkqup77wKyM4fD8QUJdtlbmOJ Hi9Q== 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=feZj/1ocB6XIjJoDVsEEUrA2KaXFHt0B9wSHktP2ddQ=; b=FIJ+tzB/xDzRQmNjCMfO80PV90VbmPhrcghoI5kuD3PdJgW0Y7DKaAeSUfe9N8rma6 JPGn8nPsKLC6ELERRoRdRtPBXrenFzbZORjxoLePSX0nvdCZoApuQOnRK19JkvgEMriT W5QwgpchIn00Db9z07SFsZ2ok4ra/RlcPgOcSRgvg+TSJcdPa20qm7Kbkrt7GQq0h/w6 TBbGilIR//UE0d79n5oaRh9H55Oh9Pcu7uo2yvBELQYlzwu67rT7m+W5Ux9dJ/JZ8iuk J5ilvMGSgSOUrMaGuuSHOLnUx9c7rAg13o6XArTyTny75xDrxmyiLRAisUScUOVVtREP XPiA== X-Gm-Message-State: ANhLgQ1XszQdRHhxoQvFkdZ8dScVII3LJfN7OP2NhglzccG7j9QJQwbJ 6Up7SJC0XM6ELMdIEUMTSJqvs0Zmx3HuCoC3xekNxA== X-Received: by 2002:a05:6402:b17:: with SMTP id bm23mr19586972edb.165.1585730907196; Wed, 01 Apr 2020 01:48:27 -0700 (PDT) MIME-Version: 1.0 References: <20200327071202.2159885-1-alastair@d-silva.org> <20200327071202.2159885-3-alastair@d-silva.org> In-Reply-To: <20200327071202.2159885-3-alastair@d-silva.org> From: Dan Williams Date: Wed, 1 Apr 2020 01:48:16 -0700 Message-ID: Subject: Re: [PATCH v4 02/25] mm/memory_hotplug: Allow check_hotplug_memory_addressable to be called from drivers 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 , =?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 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 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 */ 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=n case. Also, this patch can be squashed with the next one, no need for it to be stand alone. > + > 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 = PFN_PHYS(pfn + nr_pages) - 1; > > -- > 2.24.1 >