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 5AC2CC54EAA for ; Mon, 30 Jan 2023 16:29:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 67BBF6B0074; Mon, 30 Jan 2023 11:29:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6299A6B0075; Mon, 30 Jan 2023 11:29:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4F2986B0078; Mon, 30 Jan 2023 11:29:57 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 3CB1D6B0074 for ; Mon, 30 Jan 2023 11:29:57 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 086CA40B32 for ; Mon, 30 Jan 2023 16:29:57 +0000 (UTC) X-FDA: 80412002034.04.D38799A Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) by imf29.hostedemail.com (Postfix) with ESMTP id 1D037120002 for ; Mon, 30 Jan 2023 16:29:53 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=omWAmCYO; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf29.hostedemail.com: domain of alexander.duyck@gmail.com designates 209.85.210.173 as permitted sender) smtp.mailfrom=alexander.duyck@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675096194; 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=DCJsC41WTA2Nb50A59T+Svhhje166vY6Y2FIvFXfkhQ=; b=cWCsBLcfi2LBlRyHaCqsGJyEArSl8GnwzNOgGVCwyBTvbkt5wY3nKObgELPOX5dCI3nbn6 yUlTfjFt2uiLY2rMS1gwSONV574m+UB2rYQNPvwyBCVzOkCTLZZ0+u8gIQZk/GaVJ5ArUG sNb8L9IAvh4RLAGw4FQnjHSHzGwV8J0= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=omWAmCYO; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf29.hostedemail.com: domain of alexander.duyck@gmail.com designates 209.85.210.173 as permitted sender) smtp.mailfrom=alexander.duyck@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675096194; a=rsa-sha256; cv=none; b=TJ7O/AWrKPkDtiSCJQgXnqS37NPDZJt+SiWZogWXpGxy9grpuyeM/+Avtqhw7Ay0XJgghw ueC0XrreXIVfC87cRoROWJvQk/QHCW1sNpULXp38PthS31RauZy94te1lYhBpGxUYLPleT 95o7J8NKN00gNAyz1LPSgubJubIYGZI= Received: by mail-pf1-f173.google.com with SMTP id g9so8171818pfo.5 for ; Mon, 30 Jan 2023 08:29:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.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=DCJsC41WTA2Nb50A59T+Svhhje166vY6Y2FIvFXfkhQ=; b=omWAmCYOFTjlyeKuVcOLF/g9MigvZFVMIfHMF7gww41fzEkp0D8jt95LUNIypO7+ou pjhptiRYrBrAsaR8Xvf+KithypDPLb923bOqPte6b2b82ZIuocElMx1v22pKEx7GwAa0 BqiKJLfJoe+o2pJUi8FuIMphYk1ny8i0A85RmTCYwZ64djbH73TER2Zqu6bmTHwg5QqB IMSzmQ5TO1TGnk9ZP39z6WK9hqqctqjOsxYslCGtTC8IDNldGwIm0UNFkXPMRPmJovQt LHRVZB1ENz73f87E3JXJTg1Q61v1CgaAOG2VLe+PFaVfG8zgaquuFftZntfwjYNW7szc laow== 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=DCJsC41WTA2Nb50A59T+Svhhje166vY6Y2FIvFXfkhQ=; b=J/0XM7SpkOcwOPtuVgXVguDFsfcGcWTqUeag4z1NeBdcn8hM4nT0WNmBuMAaMy9tsB c5JcdsjMaLK1/M5zh0EhyG+uUkc3yfy6s2jbwY2uzUXYkXTCdmUgfTh40P0tSMJHrDhk Ks7Dwh2rACn1zfZ0XB9My7kQ4ZLLCZ9DiY9kd9hpuzo+Uj+mFBGEzL8yV6a4qkLXPuae AxzlA2+O2D+SUaYRcDIJA3Koejauzq+aqRRzj0xhD/lCXhOytLxZMPKUUxhC1Gyq8q76 Fs/rtZgbrjdJFn6/Mw/arLQRpgPOFnPtMtKI5sHs/hZAZliA2G1NU5/rAeoNouWmTuIs DKPQ== X-Gm-Message-State: AO0yUKUR5bWLVmWjNLycjY0pkI2ckLnSvy7oNuD5IBrfjjsVM+FMVKD3 kLkzDx88slqwVROf5jH9dT6RNz2mkQDXRFI8+34= X-Google-Smtp-Source: AK7set+go3Xqpm0FoM/LSmfC/xJ8FAfFE40vdewv1suyrUoGUHZYEderoGE5WRdJvXORuGIbvwujwFT8yKJDHYvW4vw= X-Received: by 2002:a62:830d:0:b0:592:7c9a:1236 with SMTP id h13-20020a62830d000000b005927c9a1236mr2110205pfe.26.1675096192769; Mon, 30 Jan 2023 08:29:52 -0800 (PST) MIME-Version: 1.0 References: <20230130130739.563628-1-arnd@kernel.org> In-Reply-To: <20230130130739.563628-1-arnd@kernel.org> From: Alexander Duyck Date: Mon, 30 Jan 2023 08:29:41 -0800 Message-ID: Subject: Re: [PATCH] mm: extend max struct page size for kmsan To: Arnd Bergmann Cc: Andrew Morton , Michal Hocko , Pavel Tatashin , Alexander Potapenko , 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 Content-Type: text/plain; charset="UTF-8" X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 1D037120002 X-Stat-Signature: fas1eahc4k7uwnwqaiwxwadnjwdzu3wz X-HE-Tag: 1675096193-149328 X-HE-Meta: U2FsdGVkX18j/N6h7H/uRbsr3WhMEywWH/wyCtq4/CDEZPNBUa7NOTElVX2q/48ARdY0n19lfXjSv78fuPtgIs/T7CzZdiAceV/kQ5TeCPNF2e2VulmuOx2Mg6MtF/IAdLrc3CungL+VXCoL7mmyRxLv5NZ4zQ1TW59cMrXfTHSUgm7IGf6twAp2dl28fuYBMyQveDgg4mmZVgqz9MBdQmABUKHmPUWXr6QDd3YxQSnA4wDMEXBANBaJf0JVYrNbjekKgwgXc+Xk7HWOvUeTaNRq3RIOAqDeUBn4pbF0yGAplOsk7GRhgh+o13acMSFjzyIMZynn3payHqUEFI7oxGdq3r/CHwV5r47zGOgEvcj+eViQEqLcE+LuQMhqQeulml+bCttPk4TiAP1+pl6c8r2qLCauAJ7F0IIUdDhgs5iJb5hlZq739p0+zZoPD2EjFsbgDg28wzZwwfCKgVt8uiG5DKw+wnr/7a0OP7szIPGgafxdkkUQ5o0YXYBcfta99vonWKPnlLgsIlGjFNRjoQUIT6VL5Zw2PRn3cGqeDm+E5393EAJp2n1K9C0mAuBn+D3BP1VmqJ60FmaxaGsd/bGF9+OXTSka7/gzEIp8xwR7PIeXCjyGM8ASAEu1srf2oRK3io3nyJegCMwwS4YytF6kmboMRPjnxXWELU01J83DhUgOFJm7G8B5rgyl9m4FkzH1Ikc8VqBFgkWwcSjvYIhPNVwSzmt/RMnIHw9lNUW/WbCazZuiOle0bTBcdZvGBTkFsW2sWQOdxjlhy+T8E0FYWtKlqSo10Td8tMRR9kfRN9CydNYqDlhTgiAuoyuyPmm04P/IrVub/MmLqXXNFgmMYwPNmzOZw7vMUBYDnz3sBxgSpgOYSZPw/cq2dUtA0SAhFg3LxJ92/LVrS3rziUSdAptTkB7y+1Uv8lsdtvM/Vy63aiCPp1nzgYcvYS5fAK6ryYC85yJZVS1hqra qGcihOdO QJpVVJ8dM+0AANd9VFDtsKpXhgaN/VL3I/IWbPuhLYsHAJDF7BQmIhJwBaLtCTecrB2595RgRntd02D2QNPoNXzLQq6w6sZ/x5OOqATjNI3uLNYwJTUxPKfWQz/2tWE16/2Eu+yCRzY87EmOWRcjk1QYa+fDc3zCwFSlRldqBfrC2ebplGhFosmBtp2tRsn/qEtSqwTH1PKj6gPF+olxiJdPwMUu2cvVMAYVKNdlknm5iUecO8dt/voI9VvYeuTS7NK4FIqFPKIVDkIM+VQmiW/bfZak54JuCDOhjnDiXetoLUNMEE/OVDeqLumadNuvP1kHk5Wwpdj4FNuBF6s4TgUjQ0zO12D6lT3AXs7kc2Sgg1XgOryafP22OrX05aeb4prTju1nC+3enoW8+ONAtp/Mr+ZyUiFFoF9Xsirot7chnty933evwBGCsQxKCZj4FUThuoSmNRgvD4hgTbHOmrBydlB1xvUyUJGkUOeKp9vYYvLH97luI50zGgSeLH9H2oZu5DAZrW6WGEJYtA4wc46EcChXtDCmCvsF6xYxhfo9jAG8= 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: On Mon, Jan 30, 2023 at 5:07 AM Arnd Bergmann wrote: > > 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") Rather than saying this fixes the code that enables the config flags I might be more comfortable with listing the commit that added the two pointers to the struct: Fixes: f80be4571b19 ("kmsan: add KMSAN runtime core") It will make it easier to identify where the lines where added that actually increased the size of the page struct. > Signed-off-by: Arnd Bergmann > --- > 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; Otherwise the code itself looks good to me. Reviewed-by: Alexander Duyck