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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65EE1C46467 for ; Tue, 10 Jan 2023 08:53:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E128C900002; Tue, 10 Jan 2023 03:53:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DC2748E0001; Tue, 10 Jan 2023 03:53:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C8A9E900002; Tue, 10 Jan 2023 03:53:09 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id BAA1F8E0001 for ; Tue, 10 Jan 2023 03:53:09 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 7B12F4025E for ; Tue, 10 Jan 2023 08:53:09 +0000 (UTC) X-FDA: 80338274898.12.1AA1654 Received: from mail-yb1-f172.google.com (mail-yb1-f172.google.com [209.85.219.172]) by imf30.hostedemail.com (Postfix) with ESMTP id EEDF680009 for ; Tue, 10 Jan 2023 08:53:07 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=lbCmyLed; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf30.hostedemail.com: domain of glider@google.com designates 209.85.219.172 as permitted sender) smtp.mailfrom=glider@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1673340788; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=19QYjJTilGk/RhxRe6+HhMCtJmIsJ5ED63/iAKX6oJs=; b=baTfGPZcQ/TOBvNNh0N5TnJQf9B6bxZwHOoCqbRTphXdBBto+sQE8h2fgtMBhyASYtFh4M pbg4QIapalh5A3X15QcR+1xYDY8ok4O1sTJNKQqqadswmNtOqfiWs4/VyijvvauXO1y9NS PmOFg8hQKLIZ2MVQJQvWpo6PkrkrXAU= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=lbCmyLed; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf30.hostedemail.com: domain of glider@google.com designates 209.85.219.172 as permitted sender) smtp.mailfrom=glider@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1673340788; a=rsa-sha256; cv=none; b=ot2dhMH2AUU1KeQ3lYP1No+LgQB/mSKaRTyCml0MoD+5t/YY5yRHKZwZXBtzC0cwJXLCXA H0riJIrz+8E9hAHwL+9TDON9X6ZKJNTCfmFZigUKE1IOuJ3VHLHRvinZrvpNGxuLh4/b+X TV0EylUmIzv0DeI+xmiut1X0JSeUz+U= Received: by mail-yb1-f172.google.com with SMTP id 194so8844041ybf.8 for ; Tue, 10 Jan 2023 00:53:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=19QYjJTilGk/RhxRe6+HhMCtJmIsJ5ED63/iAKX6oJs=; b=lbCmyLed2VvMiWlAcFE73mcQDp5etVdnVHUJB0fOIywFthZ8lU7tD2PGNO2HC3zSAc dWKpNjNnenpRB/dYUu/Bi9UKnr53swijKGeB+DGMJw/CtYP9CyD/TXtTQ84qKtpOqa1B we5SLgjXbaeHfSmWsG3ddc7582JJaXXNPM0ZVcUZvBZvkBf1GjtFGD4jByY9MTuwdTZQ LqlMAkCjgFRNQ11MujIamnA4f5V112faxZSPfRUJ3D5SWQ8SxH5+y7WVLOCty9zTEV4H 9x6AtFdn5fE2ZaudYTtWp4NSrDa4id6ZpWxndwXOdsPPP03SkrZFtgTmG+ErjTOg9i05 S0iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=19QYjJTilGk/RhxRe6+HhMCtJmIsJ5ED63/iAKX6oJs=; b=OTtlsji7Vr+UJE59SXije4dd+c/K3bG03g9UsOJyZ3Z+SdiDZmTEDd7dAySKvz8Oxp LqNCIMXtXp21G2kDoMw/Ebw4DFFOniUEsSYnuRQ9SYJJY2YLOzTC/h7GVEZtzvTomyxU m8xdwuM77fuRa0cS46YHpkl7hrkqECjvc17zSKl4s/h1N9obR0HYPfocrKvOGnZpnAO9 WPHb6kt4TlTx8p6ZfZ8kBGw27Kzh5oHocEc+lByBBBincUOvyMGxn7SRQODQ1jsb/0Sy NCZ5xN2L01Ii2JarrIlaLYZv2nfJvpLJEoUI3RfII9Fv2Vw2ivWh+ghylomsfyDMs+eO nYCg== X-Gm-Message-State: AFqh2kpPcTyovAKWPAV0uX+kspISkLJ/J62C5ioKWraE3t4tbVBZUCvq EHSlD/Yh6Vaimr0isYRHGl2QBglFWdKb0i09bM55EQ== X-Google-Smtp-Source: AMrXdXu1bywcmD2nBhn/vstGOcfd/CgtS7Mz2N+xJM/cbJTPId17VbthxQeFl64wwFgwjQNUfbOac2B/yqrJaq2AdY4= X-Received: by 2002:a5b:b47:0:b0:6fe:1625:f1f5 with SMTP id b7-20020a5b0b47000000b006fe1625f1f5mr6647952ybr.549.1673340786873; Tue, 10 Jan 2023 00:53:06 -0800 (PST) MIME-Version: 1.0 References: <20220701142310.2188015-1-glider@google.com> <20220701142310.2188015-11-glider@google.com> <63b74a6e6a909_c81f0294a5@dwillia2-xfh.jf.intel.com.notmuch> <63bc8fec4744a_5178e29467@dwillia2-xfh.jf.intel.com.notmuch> <63bd0be8945a0_5178e29414@dwillia2-xfh.jf.intel.com.notmuch> In-Reply-To: From: Alexander Potapenko Date: Tue, 10 Jan 2023 09:52:30 +0100 Message-ID: Subject: Re: [PATCH v4 10/45] libnvdimm/pfn_dev: increase MAX_STRUCT_PAGE_SIZE To: Dan Williams Cc: Greg Kroah-Hartman , Marco Elver , Alexander Viro , Alexei Starovoitov , Andrew Morton , Andrey Konovalov , Andy Lutomirski , Arnd Bergmann , Borislav Petkov , Christoph Hellwig , Christoph Lameter , David Rientjes , Dmitry Vyukov , Eric Dumazet , Herbert Xu , Ilya Leoshkevich , Ingo Molnar , Jens Axboe , Joonsoo Kim , Kees Cook , Mark Rutland , Matthew Wilcox , "Michael S. Tsirkin" , Pekka Enberg , Peter Zijlstra , Petr Mladek , Steven Rostedt , Thomas Gleixner , Vasily Gorbik , Vegard Nossum , Vlastimil Babka , kasan-dev , Linux Memory Management List , Linux-Arch , LKML Content-Type: text/plain; charset="UTF-8" X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: EEDF680009 X-Stat-Signature: p43s3shojtyarrf9hpntrar6emhphhy1 X-HE-Tag: 1673340787-771420 X-HE-Meta: U2FsdGVkX1+KvTMDjlFtZrooFJIduqawkXyAIUb1TxSmvkWdc+nGtdrJajDyEKDKLSIB8QVWTKgPj8qcJCXiT1xQuUWu5DaTkQGM3ry3oPtafgLcdoGA9afwUoFV+MvInG/cUcIfN/yWmDb+bxI6ybV5QSscvLFmMhKTaS4XNhsOu3Kwu4Ck+712XKxRFnGoeI/2tscMiurWYExfMePFlTBxiWN52KPrtVRBT5G7tRnF96SQ9v6Xz2T0yLLhM4FqZ1gVWMFWkXcSDFhmkplEtXRjZ6grv5vbLeYBdKQvL3G9RK9XJElv8/vd1UWNOSS4/Zh+F8apPttx1J0NkkAHZaiUG2SGhtMJSQ6o16s3+z97EKtN243QbqYxVNmj8AVe/Jn3cLHI0B4Xr2tAogC7N3pzkgSL7k/mCVvcC0X5SO6quUz770rrwTz3V2n6aPFCNTQyw9RFOLhu8Mc7b+Epxewo63OQ/wzErCPmtqYr1g68IwXUGSdFmjxShK+4pC91+txEeaW94iNoo6oqkzO8A/jSz48200F7xV0ySZ1as4xqkvKNLoqk4vDeylH/L+j9lx1bqn8BPX5rv9RY0WjnGcxYjiHsQzQKJjAxPPdULmbKcehj0V9yj0sXNSnQCSsSx6OYbS3tnx1rsX+PC6Y9OEtsdlRTnL/H9V+SguJJ5JPweA6jm5+7rkmApYBM1rDhVyRUdwV5anhuMh5k2p4/9cqP3gv3Txq0u1QE3ekFv6Pu2/Pr9LHiBle/6R+ZFB9BSCJHgXYAeeeIWqguA+3FupRTfJUIY3juqoDiROUqxAD9EZ3GEcpTJUhkW041I1V82kKAtAP5lv9HsyOd74EzKRGI8xxGalHlWbXvo05v9j59N3AIXQhIyvchyyjCuaBvsvPeZZcbJgswavrKtbagUlxGRREBrRKbkza3hrXKuv25Qt1vQKHXXUqCHyMhjpn971VXbUgI0qkJ7WGOVEN IXYveG93 Neph35kJtvGRI22uYcHP06Z1g6dNBUe0IWie9foMnFGHLkN3L+sF/IclC13/BhPuBQnY1 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: > > > > > > > > > > > -- >8 -- > > > > >From 693563817dea3fd8f293f9b69ec78066ab1d96d2 Mon Sep 17 00:00:00 2001 > > > > From: Dan Williams > > > > Date: Thu, 5 Jan 2023 13:27:34 -0800 > > > > Subject: [PATCH] nvdimm: Support sizeof(struct page) > MAX_STRUCT_PAGE_SIZE > > > > > > > > Commit 6e9f05dc66f9 ("libnvdimm/pfn_dev: increase MAX_STRUCT_PAGE_SIZE") > > > > > > > > ...updated MAX_STRUCT_PAGE_SIZE to account for sizeof(struct page) > > > > potentially doubling in the case of CONFIG_KMSAN=y. Unfortunately this > > > > doubles the amount of capacity stolen from user addressable capacity for > > > > everyone, regardless of whether they are using the debug option. Revert > > > > that change, mandate that MAX_STRUCT_PAGE_SIZE never exceed 64, but > > > > allow for debug scenarios to proceed with creating debug sized page maps > > > > with a new 'libnvdimm.page_struct_override' module parameter. > > > > > > > > Note that this only applies to cases where the page map is permanent, > > > > i.e. stored in a reservation of the pmem itself ("--map=dev" in "ndctl > > > > create-namespace" terms). For the "--map=mem" case, since the allocation > > > > is ephemeral for the lifespan of the namespace, there are no explicit > > > > restriction. However, the implicit restriction, of having enough > > > > available "System RAM" to store the page map for the typically large > > > > pmem, still applies. > > > > > > > > Fixes: 6e9f05dc66f9 ("libnvdimm/pfn_dev: increase MAX_STRUCT_PAGE_SIZE") > > > > Cc: > > > > Cc: Alexander Potapenko > > > > Cc: Marco Elver > > > > Reported-by: Jeff Moyer > > > > --- > > > > drivers/nvdimm/nd.h | 2 +- > > > > drivers/nvdimm/pfn_devs.c | 45 ++++++++++++++++++++++++++------------- > > > > 2 files changed, 31 insertions(+), 16 deletions(-) > > > > > > > > diff --git a/drivers/nvdimm/nd.h b/drivers/nvdimm/nd.h > > > > index 85ca5b4da3cf..ec5219680092 100644 > > > > --- a/drivers/nvdimm/nd.h > > > > +++ b/drivers/nvdimm/nd.h > > > > @@ -652,7 +652,7 @@ void devm_namespace_disable(struct device *dev, > > > > struct nd_namespace_common *ndns); > > > > #if IS_ENABLED(CONFIG_ND_CLAIM) > > > > /* max struct page size independent of kernel config */ > > > > -#define MAX_STRUCT_PAGE_SIZE 128 > > > > +#define MAX_STRUCT_PAGE_SIZE 64 > > > > int nvdimm_setup_pfn(struct nd_pfn *nd_pfn, struct dev_pagemap *pgmap); > > > > #else > > > > static inline int nvdimm_setup_pfn(struct nd_pfn *nd_pfn, > > > > diff --git a/drivers/nvdimm/pfn_devs.c b/drivers/nvdimm/pfn_devs.c > > > > index 61af072ac98f..978d63559c0e 100644 > > > > --- a/drivers/nvdimm/pfn_devs.c > > > > +++ b/drivers/nvdimm/pfn_devs.c > > > > @@ -13,6 +13,11 @@ > > > > #include "pfn.h" > > > > #include "nd.h" > > > > > > > > +static bool page_struct_override; > > > > +module_param(page_struct_override, bool, 0644); > > > > +MODULE_PARM_DESC(page_struct_override, > > > > + "Force namespace creation in the presence of mm-debug."); > > > > > > I can't figure out from this description what this is for so perhaps it > > > should be either removed and made dynamic (if you know you want to debug > > > the mm core, why not turn it on then?) or made more obvious what is > > > happening? > > > > I'll kill it and update the KMSAN Documentation that KMSAN has > > interactions with the NVDIMM subsystem that may cause some namespaces to > > fail to enable. That Documentation needs to be a part of this patch > > regardless as that would be the default behavior of this module > > parameter. > > > > Unfortunately, it can not be dynamically enabled because the size of > > 'struct page' is unfortunately recorded in the metadata of the device. > > Recall this is for supporting platform configurations where the capacity > > of the persistent memory exceeds or consumes too much of System RAM. > > Consider 4TB of PMEM consumes 64GB of space just for 'struct page'. So, > > NVDIMM subsystem has a mode to store that page array in a reservation on > > the PMEM device itself. > > Sorry, I might be missing something, but why cannot we have > > #ifdef CONFIG_KMSAN > #define MAX_STRUCT_PAGE_SIZE 128 By the way, KMSAN only adds 16 bytes to struct page - would it help to reduce MAX_STRUCT_PAGE_SIZE to 80 bytes? > #else > #define MAX_STRUCT_PAGE_SIZE 64 > #endif >