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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7582C54EBE for ; Mon, 9 Jan 2023 09:54:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236878AbjAIJxj (ORCPT ); Mon, 9 Jan 2023 04:53:39 -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-Google-Smtp-Source: AMrXdXuGvJK/Z2GNIYTIcilU/lRPpom25Exjk2m/eTsYGxQGzPycGsZ6tbA4IcBTD/gP8jy9E/3DFgSf/xXGY41i0OE= 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 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