From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E3A5C2D0F2 for ; Wed, 1 Apr 2020 08:48:30 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3F6CF21775 for ; Wed, 1 Apr 2020 08:48:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=intel-com.20150623.gappssmtp.com header.i=@intel-com.20150623.gappssmtp.com header.b="Bh1JR39j" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3F6CF21775 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nvdimm-bounces@lists.01.org Received: from ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id D18CF10FC3BAD; Wed, 1 Apr 2020 01:49:19 -0700 (PDT) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:20::544; helo=mail-ed1-x544.google.com; envelope-from=dan.j.williams@intel.com; receiver= Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 4810510FC3BAA for ; Wed, 1 Apr 2020 01:49:18 -0700 (PDT) Received: by mail-ed1-x544.google.com with SMTP id cf14so28670123edb.13 for ; Wed, 01 Apr 2020 01:48:28 -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=VsKauORKbCWtjKTj1mXNODpykYvJLq975jFFvso4PxfiE9U31mYM4iebpj0x6B4bYx cHPOSjqXu1em1Tc8Ku6VqgmySRfMlMvK8+gN9Dx88PBHkvWT/6AFHsIHTasHAnJ3CTzO QbGkrBu0ZxjCB3U0a6R03rzxFfpsCt2e9m6FbRa4GtWPdOkxN6xVcODK09AcotOyqc1A OErcljCpAbQfuk5c6FVam6IazdhtqWwLXV76I7B1pJIVIH2CaVXmSzUduRjpQVp4s+tz pkP+LdXDEHiJDPwnFFy4dWgc9R1NAcRscDGR5d/9q++aDWoQGeHJubd7k6e4Hb/nB0mc PTKA== X-Gm-Message-State: ANhLgQ1oC+PieV5IjJc7Eh2CmYyCH9AHhhF00cjgzQq4sp3u9bGhcYa4 Iqtwh461O0m7yTfNM2iOYqCZiS/I+BEc7OGO/5eI+A== X-Google-Smtp-Source: ADFU+vuVdufBykICW7DqF15W3KALGotPW1gMa6p2yo6taAqlQuWcuvysMS1tCXsRtLbaLnYvh0bX4T16tZYwkhRj3fU= 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" Message-ID-Hash: KFIEKKY67XUEM7VEONODYMLZPLOYBKI5 X-Message-ID-Hash: KFIEKKY67XUEM7VEONODYMLZPLOYBKI5 X-MailFrom: dan.j.williams@intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: "Aneesh Kumar K . V" , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Frederic Barrat , Andrew Donnellan , Arnd Bergmann , Greg Kroah-Hartman , 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 X-Mailman-Version: 3.1.1 Precedence: list List-Id: "Linux-nvdimm developer list." Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 > _______________________________________________ Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org To unsubscribe send an email to linux-nvdimm-leave@lists.01.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1A98C2D0E7 for ; Wed, 1 Apr 2020 08:48:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AA074215A4 for ; Wed, 1 Apr 2020 08:48:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=intel-com.20150623.gappssmtp.com header.i=@intel-com.20150623.gappssmtp.com header.b="Bh1JR39j" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731885AbgDAIs3 (ORCPT ); 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-Google-Smtp-Source: ADFU+vuVdufBykICW7DqF15W3KALGotPW1gMa6p2yo6taAqlQuWcuvysMS1tCXsRtLbaLnYvh0bX4T16tZYwkhRj3fU= 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 > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F3E1C43331 for ; Wed, 1 Apr 2020 08:55:58 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8A6A620784 for ; Wed, 1 Apr 2020 08:55:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=intel-com.20150623.gappssmtp.com header.i=@intel-com.20150623.gappssmtp.com header.b="Bh1JR39j" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8A6A620784 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 48sg5l1dRzzDqXV for ; Wed, 1 Apr 2020 19:55:55 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=intel.com (client-ip=2a00:1450:4864:20::544; helo=mail-ed1-x544.google.com; envelope-from=dan.j.williams@intel.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=intel-com.20150623.gappssmtp.com header.i=@intel-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=Bh1JR39j; dkim-atps=neutral Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 48sfx96kFWzDr1D for ; Wed, 1 Apr 2020 19:48:29 +1100 (AEDT) Received: by mail-ed1-x544.google.com with SMTP id w26so28677610edu.7 for ; Wed, 01 Apr 2020 01:48:29 -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=AFy8KFuezl77wpKxdYGLwBj1Ml8GHGnJEPLQQV2cYPdvIbtSmaYWMIRalr/pMoPysB CwQZNFwLXbZUNtWJaWiTSrnf0k+TgCQioOr+mKe5Dx+usGH7E3LLuTgebloHUsMRqjlz iuhN2AB+TbCJfrKYMWT8sjHNkYnPEpyfNDJSdpXJRf0vrdQmDIbix/PqBhZiizP1P6iW pch85r4ALHcGqYuX+OXkJmvU9segKg4QIi/JPPAWTtG1E0g5Z2GWk4FLMTif7Cy6KU33 DrTSLvtK4wEspi8uyRkr0HScRbgICgCn1hnDe9X6zU3jP6LwdgV6iboWsEJquJ3GykaF uHlQ== X-Gm-Message-State: ANhLgQ2ufhuCXRXJupjEVlFegXq4a3MP19/SczJquskiVIs9HkPSORUR io6RANaZ0UdHXMSTAUhRbJ594fmUBumrjRqNEl90QA== X-Google-Smtp-Source: ADFU+vuVdufBykICW7DqF15W3KALGotPW1gMa6p2yo6taAqlQuWcuvysMS1tCXsRtLbaLnYvh0bX4T16tZYwkhRj3fU= 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" Content-Type: text/plain; charset="UTF-8" X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Madhavan Srinivasan , Alexey Kardashevskiy , Masahiro Yamada , Oliver O'Halloran , Mauro Carvalho Chehab , Ira Weiny , Rob Herring , Dave Jiang , linux-nvdimm , "Aneesh Kumar K . V" , Krzysztof Kozlowski , Anju T Sudhakar , Mahesh Salgaonkar , Andrew Donnellan , Arnd Bergmann , Greg Kurz , Nicholas Piggin , =?UTF-8?Q?C=C3=A9dric_Le_Goater?= , Thomas Gleixner , Hari Bathini , Linux MM , Greg Kroah-Hartman , Linux Kernel Mailing List , Vishal Verma , Frederic Barrat , Paul Mackerras , Andrew Morton , linuxppc-dev , "David S. Miller" Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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 >