From patchwork Mon Jan 30 13:07:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 50277 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2172585wrn; Mon, 30 Jan 2023 05:16:33 -0800 (PST) X-Google-Smtp-Source: AK7set9uIWpTogt+th3l1T+qGOEtF2+4WA/TJBDBaS8sxprNm6ufsNisH0c/cZRRfXiAsyUgZIZF X-Received: by 2002:a05:6402:381a:b0:4a2:3633:952d with SMTP id es26-20020a056402381a00b004a23633952dmr6656562edb.41.1675084593778; Mon, 30 Jan 2023 05:16:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675084593; cv=none; d=google.com; s=arc-20160816; b=LlKRsJYiNg/30aBqQVT4k53YKYITgDeMpoXGoZEkZ4eZJc/3gQCn3yWwkBgs66qyrJ noFVrZiHQH8J4atTraWzi/zbf/2QVNF7Iar82vcXipr+I4+0VHeta62mAn20Xk15Wa4H 9MhPD7ecptRMlvOv/3O2Degc5ysCoskpQILmDfRj38sjStfVcCFi8dVr+6DpsaFlvkXe 7k6sogl5XWTIjn0zYup8aR5Q+hewr9ztWmAaTu8+lwqOcYpkJrj9FypigtBeuq96dEQv febyei44WE8n3BaQhh955HApuxinBH6PNVZSghk8thlw91GJq8W/bmGfbQh4n/Ssm0pw mNQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=kV8SHKhbiV+TDEdIzyA1MSLd1YXW0AOlZbJnzeoTnzU=; b=dTitzkuh5dF+4A85vC/19PK8ypvUWEOd5XVo0DsIXv4WwzOa6bskrAlsgPZmLmmQaS D8oyvqBk8bv+wftS5iJBNPIBxLRIKHqQB1iLlzUziYGwuPDAdSILaPNYcOvxDqyQ1hMG TBtgtIKg3Cc2SELGmUBVKf5zhk/bKbLdkBNeTfDIGin+dS7h2V5+1sGmnUiWuoGcxK2U jXVVB7aV9xpi0NyUQwnpkj1DGYp4YVYpszHHnmq3d/oamQCR3vonIcbQnxBcMaTfKoaJ NIQokBEqq2g539dsVWJtxkpGfCMiQJud20GjZHIBGq0Lfc1dgsTLyoGG6tlp4rbV2UfM K5Qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MeM4klGK; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p10-20020a056402500a00b004a0e06e4371si14348459eda.19.2023.01.30.05.16.09; Mon, 30 Jan 2023 05:16:33 -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=@kernel.org header.s=k20201202 header.b=MeM4klGK; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235466AbjA3NHz (ORCPT + 99 others); Mon, 30 Jan 2023 08:07:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230416AbjA3NHv (ORCPT ); Mon, 30 Jan 2023 08:07:51 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 441F72ED43 for ; Mon, 30 Jan 2023 05:07:46 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9D97B60FC9 for ; Mon, 30 Jan 2023 13:07:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ABB31C433EF; Mon, 30 Jan 2023 13:07:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1675084065; bh=82pzv7nUQ7xEKOT9LUE7jHsMtpD/ZVzFzf10YTQKDDM=; h=From:To:Cc:Subject:Date:From; b=MeM4klGK6M3/EzB+GGzqaj/trET6jVqY4qqcULNKq3uaclfWxZWK6C15RoifjV4kR 9t7hqvmSE296+5YIb/xkXzrljjFiwjS78ZFpBRsHruwS6WwU6lBt4t1Fed+Twq0XjB LSvAcWmYqL72kM+EibA2sgVUB8Au6Q2jlp07F+DN0a8Xlpmq315CXuGdkk0CbC36fp NYNVv7Cdu5J1FVHJC1E2nHrz5+BNp1f/QrqVVtqOmw9HHEykLtrr4HLeQn3DiUrL+X He7mo9886bCxvdCsLgb5D7ehlT1pM/obD/rRLVfkptqEKlLiHDsRnQOdj7FeVMDjUo psjK/JhIS7NzQ== From: Arnd Bergmann To: Andrew Morton , Alexander Duyck , Michal Hocko , Pavel Tatashin , Alexander Potapenko Cc: Arnd Bergmann , "Matthew Wilcox (Oracle)" , David Hildenbrand , "Liam R. Howlett" , John Hubbard , Naoya Horiguchi , Hugh Dickins , Suren Baghdasaryan , Alex Sierra , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] mm: extend max struct page size for kmsan Date: Mon, 30 Jan 2023 14:07:26 +0100 Message-Id: <20230130130739.563628-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756453502940947338?= X-GMAIL-MSGID: =?utf-8?q?1756453502940947338?= From: Arnd Bergmann After x86 has enabled support for KMSAN, it has become possible to have larger 'struct page' than was expected when commit 5470dea49f53 ("mm: use mm_zero_struct_page from SPARC on all 64b architectures") was merged: include/linux/mm.h:156:10: warning: no case matching constant switch condition '96' switch (sizeof(struct page)) { Extend the maximum accordingly. Fixes: 5470dea49f53 ("mm: use mm_zero_struct_page from SPARC on all 64b architectures") Fixes: 4ca8cc8d1bbe ("x86: kmsan: enable KMSAN builds for x86") Signed-off-by: Arnd Bergmann Acked-by: Michal Hocko Reviewed-by: Alexander Duyck Reviewed-by: Pasha Tatashin --- This seems to show up extremely rarely in randconfig builds, but enough to trigger my build machine. I saw a related discussion at [1] about raising MAX_STRUCT_PAGE_SIZE, but as I understand it, that needs to be addressed separately. [1] https://lore.kernel.org/lkml/20220701142310.2188015-11-glider@google.com/ --- include/linux/mm.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index b73ba2e5cfd2..aa39d5ddace1 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -137,7 +137,7 @@ extern int mmap_rnd_compat_bits __read_mostly; * define their own version of this macro in */ #if BITS_PER_LONG == 64 -/* This function must be updated when the size of struct page grows above 80 +/* This function must be updated when the size of struct page grows above 96 * or reduces below 56. The idea that compiler optimizes out switch() * statement, and only leaves move/store instructions. Also the compiler can * combine write statements if they are both assignments and can be reordered, @@ -148,12 +148,18 @@ static inline void __mm_zero_struct_page(struct page *page) { unsigned long *_pp = (void *)page; - /* Check that struct page is either 56, 64, 72, or 80 bytes */ + /* Check that struct page is either 56, 64, 72, 80, 88 or 96 bytes */ BUILD_BUG_ON(sizeof(struct page) & 7); BUILD_BUG_ON(sizeof(struct page) < 56); - BUILD_BUG_ON(sizeof(struct page) > 80); + BUILD_BUG_ON(sizeof(struct page) > 96); switch (sizeof(struct page)) { + case 96: + _pp[11] = 0; + fallthrough; + case 88: + _pp[10] = 0; + fallthrough; case 80: _pp[9] = 0; fallthrough;