Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp5996394rwl; Mon, 9 Jan 2023 02:49:19 -0800 (PST) X-Google-Smtp-Source: AMrXdXvAXJiH2KvTxEaiQ9f4A93qZN0iWKsMtcXrTFFLMW1wqLcJIgzkebOAuA87J0DTSGi4u6Di X-Received: by 2002:a17:902:eb85:b0:192:fc94:2839 with SMTP id q5-20020a170902eb8500b00192fc942839mr13624558plg.23.1673261359608; Mon, 09 Jan 2023 02:49:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673261359; cv=none; d=google.com; s=arc-20160816; b=qfywHklL+oyTQyV5CrZsJ44+qTi52TnL6NXy1rGoOuEzBcgPqkm1dqEjp/qzp9eLh/ 7hVJOIQzawT5flovM3NlsDEuwdflkzsPQ103vrSCBqJIVehltQzS7c5D9gDQrc1HUECi mRG7P33ssUvRn+mxAobysA1waaIauVYWF0QTVw1S8fKOqA1NRXIyyW5H8q5HwiHGHdhm n7d8xUrZhKNsNHrebK9t2D0fFMV040f+9J1yr9pO8JzQluiER1/lbb6gKzKBcPWd0J1k NzDBPCs0n1wk0B8liACBwo9zlO6X/IM/tRrJzzhTWuaUXc1udgxlQYIjT7uiSccVUNDr LA1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=HAQX3MqHqmIeeOrJpELRmG+wNnU+MpmXY1sRh1DUmgw=; b=Uv/rXZoWfSJ6eqbRw5bKYxvVljrTR5rdqE6gjGULwVe1xwJSmoUEYAwLpFFBlHgbAY xr4ITzuzIWPXKo10Az9DoBlSTpEUurBOyajW8k3mXlnB7Ry5w4MW+v9clTWOfmC3znZQ wZPIV0FvcH7H9aV8s7RBRB28xbKA7FJktfZZM3gv41qGINc2q2c05EgYtLtkvIIjCKkJ nuFuUpebPbHcTMHgli5VQlMUrDwTm/KD7NIXnz5oBsQzAMJyFbXtkuqUrMsFWVLHPa6l O0B07NAiGyHy8UlQ6lfa85TFQMtRaaaSGS1P0jcPtTvqz4pUA9n9aADYMExjMur/vDIp +/sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=DVfCyJ6P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x10-20020a1709027c0a00b0018994e35cbfsi8361621pll.364.2023.01.09.02.49.12; Mon, 09 Jan 2023 02:49:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=DVfCyJ6P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236835AbjAIJxi (ORCPT + 54 others); Mon, 9 Jan 2023 04:53:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236818AbjAIJwx (ORCPT ); Mon, 9 Jan 2023 04:52:53 -0500 Received: from mail-yw1-x112a.google.com (mail-yw1-x112a.google.com [IPv6:2607:f8b0:4864:20::112a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CD2CDDA for ; Mon, 9 Jan 2023 01:52:08 -0800 (PST) Received: by mail-yw1-x112a.google.com with SMTP id 00721157ae682-4bf16baa865so105509017b3.13 for ; Mon, 09 Jan 2023 01:52:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=HAQX3MqHqmIeeOrJpELRmG+wNnU+MpmXY1sRh1DUmgw=; b=DVfCyJ6P3zydmckWF8seSRRw/mz6qUyyH0LrKVrsvYJAZ/YNG6Mq5wFaD140cl5+Ib KiwpsqJymIId+h5o6qdfMB7wX7OXUI2ziy601EpVhnGbLTKmKyVlreUcACXdSKp2UX1X OEsiE8fMyPqTic7T67qLgNRVijQzlvX36bNwYY6KadKvfTzd04RqtNTnUybSKV0q0opJ AyOtbJ0FhWJZOqZK9RWfIz6xTGeFVie2Br5pGFEwBS2NK3FWOS897lhpxVuX91WtQmTt uABX3Qfc1ng4EIsFPSNo2PrSp4Lu0ObHJmsT0hTGTqxBNz1sN2YYnL5uU+/N+w1QdPZW tL9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding: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=HAQX3MqHqmIeeOrJpELRmG+wNnU+MpmXY1sRh1DUmgw=; b=5Naki/36ev2bmRKIUiaVJB3hvMbPuGmKCq+53UFGyYzSj1p106kXaMp6u/kJ+umum6 hPAdYMRMJ8CW+IqyUFWwaj+DoOz6RjlzF5hHbhJY1I+BcsLLhZ5KsvYZO+fkCSrE4BeR By5UzOK44xZEYGvdZ4wMHOHIr6I+ec+th2I/sawGQ75Z8lY0Pf+UTkSnFqPX5+I6TU3l 1kfUyTlVea5jnMRKYJggdbFsiZxffsDGbEipLRIJjnw/eGgHvOMk3U3VsyRKcNFUWcai abDxb4BQa6dolpAQU0NcB9atEaK20LcaJRHfX3fxW+RnzA9k1zHIPjiLvnW8Nyqng6nq pZUw== X-Gm-Message-State: AFqh2kp1cdJ8THLelQE2NszEgE99pJXaxZPs4taOdBLT77fOmp3VFJtq 5DQ2BQ+X5WxrLtBocuRqnjPAZx2/OZpSDnfcMjuOQw== X-Received: by 2002:a0d:f084:0:b0:4c2:51b:796c with SMTP id z126-20020a0df084000000b004c2051b796cmr993316ywe.144.1673257927353; Mon, 09 Jan 2023 01:52:07 -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, 9 Jan 2023 10:51:30 +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" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 5, 2023 at 11:09 PM Dan Williams wro= te: > > 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 l= oaded. > > 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 > > > ...otherwise, what was the rationale for increasing this value? Were you > actually trying to use KMSAN for DAX pages? I was just building the kernel with nvdimm driver and KMSAN enabled. Because KMSAN adds extra data to every struct page, it immediately hit the following assert: drivers/nvdimm/pfn_devs.c:796:3: error: call to __compiletime_assert_330 declared with 'error' attribute: BUILD_BUG_ON fE BUILD_BUG_ON(sizeof(struct page) > MAX_STRUCT_PAGE_SIZE); The comment before MAX_STRUCT_PAGE_SIZE declaration says "max struct page size independent of kernel config", but maybe we can afford making it dependent on CONFIG_KMSAN (and possibly other config options that increase struct page size)? I don't mind disabling the driver under KMSAN, but having an extra ifdef to keep KMSAN support sounds reasonable, WDYT? --=20 Alexander Potapenko Software Engineer Google Germany GmbH Erika-Mann-Stra=C3=9Fe, 33 80636 M=C3=BCnchen Gesch=C3=A4ftsf=C3=BChrer: Paul Manicle, Liana Sebastian Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg