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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4EED5C54EED for ; Mon, 30 Jan 2023 08:35:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235658AbjA3Ifg (ORCPT ); Mon, 30 Jan 2023 03:35:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230232AbjA3Ifd (ORCPT ); Mon, 30 Jan 2023 03:35:33 -0500 Received: from mail-vs1-xe36.google.com (mail-vs1-xe36.google.com [IPv6:2607:f8b0:4864:20::e36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EE91EB49 for ; Mon, 30 Jan 2023 00:35:32 -0800 (PST) Received: by mail-vs1-xe36.google.com with SMTP id s24so4284784vsi.12 for ; Mon, 30 Jan 2023 00:35:32 -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=SDsKqyepeY63ocyMIwF8lZiaR+pOTU94INwLNWf/i/Q=; b=ev6TkzkN+oz3Pn2cqYjBSUtXogA5QDLvcoqgoNESO5OALKcVKunZ5BNPhAn9OKgoB4 J+T2sBUxdpcZpAOJxcBhw9LmGzLnIsuD+ImGdOHtBunOYmz3lYKdbYyejff7ZcgAY+bw LkIsBZ92PhyspTXo6Srnts7ZiMcO5R56TMmQyT+qGF9OZiSEqCGgJ+PxI8h7Z558UBj6 jezwKhML1nM20ptbwlF2YOAHFlYT6yTh+fwWxDjDUZPX+xMMV3RGMZbEdfxD9ZOujRmy o2HXcwknMXLTfXxJIbeKJlOkDTI9wxjXOB2dwo3wGGsHwPRjtPmqZPYbDHLdJ6B/OUGH gjwQ== 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=SDsKqyepeY63ocyMIwF8lZiaR+pOTU94INwLNWf/i/Q=; b=SB3dj/ED/bU6yz/pLc5dGFIlkVKSvKAS3MbbxXCCUcrDBUWDZHVPUcvttNolp627aX 7ItACBlKhL4tQFqGdiVY77sOwZHqE8ORL7fjfjo8tr/0xwP5B6/sxdCwzbRndCRz7w5P WGwtNxhCnCA1DCQHNn18bjYDif9IIcplKO/Rea0DAnVNjHJU2eq/aw8MCDrWwI+dlbZx Q/3/A5tEhdzMcHCRXrj4OFdgfVzEhzgeeFRM/dKqbcGSK2CDfbJ4MXEMCoPa7rcrnX6U wjl9Kq1PA0sHRQP1uAU8gi3U/SQTY112O5oVETckx8LYOGOZbhW0KaVf2TZtUb10zU+r ns9A== X-Gm-Message-State: AO0yUKUzJLzZgo0H9hj2qwt2rJ/onorYN1Fit9hxVsQKqNiaYd53lvmy 7NA8lVw4ZemqvrAZTN4sy67jt8YnAjaJh8lr2XCj1A== X-Google-Smtp-Source: AK7set87heiUfKYTTgXopGPXqNCq9oqyYQ7M4JyNrCHVP6v7DUboxKAd6easHm0O08SmEKEthX056v5+58w841VaRu0= X-Received: by 2002:a05:6102:3237:b0:3f4:eee1:d8c4 with SMTP id x23-20020a056102323700b003f4eee1d8c4mr514404vsf.19.1675067731131; Mon, 30 Jan 2023 00:35:31 -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> In-Reply-To: <63b74a6e6a909_c81f0294a5@dwillia2-xfh.jf.intel.com.notmuch> From: Alexander Potapenko Date: Mon, 30 Jan 2023 09:34:54 +0100 Message-ID: Subject: Re: [PATCH v4 10/45] libnvdimm/pfn_dev: increase MAX_STRUCT_PAGE_SIZE To: Dan Williams Cc: 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 , Greg Kroah-Hartman , 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 5, 2023 at 11:09 PM Dan Williams wrote: > > Alexander Potapenko wrote: > > (+ Dan Williams) > > (resending with patch context included) > > > > On Mon, Jul 11, 2022 at 6:27 PM Marco Elver wrote: > > > > > > On Fri, 1 Jul 2022 at 16:23, Alexander Potapenko wrote: > > > > > > > > KMSAN adds extra metadata fields to struct page, so it does not fit into > > > > 64 bytes anymore. > > > > > > Does this somehow cause extra space being used in all kernel configs? > > > If not, it would be good to note this in the commit message. > > > > > I actually couldn't verify this on QEMU, because the driver never got loaded. > > Looks like this increases the amount of memory used by the nvdimm > > driver in all kernel configs that enable it (including those that > > don't use KMSAN), but I am not sure how much is that. > > > > Dan, do you know how bad increasing MAX_STRUCT_PAGE_SIZE can be? > > Apologies I missed this several months ago. The answer is that this > causes everyone creating PMEM namespaces on v6.1+ to lose double the > capacity of their namespace even when not using KMSAN which is too > wasteful to tolerate. So, I think "6e9f05dc66f9 libnvdimm/pfn_dev: > increase MAX_STRUCT_PAGE_SIZE" needs to be reverted and replaced with > something like: > > diff --git a/drivers/nvdimm/Kconfig b/drivers/nvdimm/Kconfig > index 79d93126453d..5693869b720b 100644 > --- a/drivers/nvdimm/Kconfig > +++ b/drivers/nvdimm/Kconfig > @@ -63,6 +63,7 @@ config NVDIMM_PFN > bool "PFN: Map persistent (device) memory" > default LIBNVDIMM > depends on ZONE_DEVICE > + depends on !KMSAN > select ND_CLAIM > help > Map persistent memory, i.e. advertise it to the memory > Looks like we still don't have a resolution for this problem. I have the following options in mind: 1. Set MAX_STRUCT_PAGE_SIZE to 80 (i.e. increase it by 2*sizeof(struct page *) added by KMSAN) instead of 128. 2. Disable storing of struct pages on device for KMSAN builds. , but if those are infeasible, we can always go for: 3. Disable KMSAN for NVDIMM and reflect it in Documentation. I am happy to send the patch if we decide this is the best option.