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 CED9CC54EE9 for ; Fri, 16 Sep 2022 09:13:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 414A28D0002; Fri, 16 Sep 2022 05:13:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 39E4C8D0001; Fri, 16 Sep 2022 05:13:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 216CB8D0002; Fri, 16 Sep 2022 05:13:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 0B6638D0001 for ; Fri, 16 Sep 2022 05:13:22 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id D7C7A80AE6 for ; Fri, 16 Sep 2022 09:13:21 +0000 (UTC) X-FDA: 79917385002.25.7D9419C Received: from mail-yw1-f169.google.com (mail-yw1-f169.google.com [209.85.128.169]) by imf23.hostedemail.com (Postfix) with ESMTP id 82C4C1400C5 for ; Fri, 16 Sep 2022 09:13:21 +0000 (UTC) Received: by mail-yw1-f169.google.com with SMTP id 00721157ae682-333a4a5d495so252056777b3.10 for ; Fri, 16 Sep 2022 02:13:21 -0700 (PDT) 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; bh=St+IQCWJacJKbPUwjmk2zZiPvZUfUUJhCu0g3DwZrPg=; b=Tq8+3NsAcC3hZkWZbN2XInttxNbHcPBxQHaxd6kqBbQ+vcToc+f9RVGIsc931BWVYv 4QDsKLv0z+ustpPusPz/B9AlixdY/+20yLQ3Nb+Fa7rupRd0naGOVpYYufmEQtlM5DII sx51DqRcgBgYykDI/ks3MxB7qjaAYnoqogbo/7wSk2d8PHFC9DklV/sGJpb1YdiGvdgE cPjNWVgiTi2YeBUpLJNpIVMferIDI3FBXMUngw00uukIFnVZglD7gSlfWfoPoLRHl1sl niGM24A+pcobtBMSFxFNvKxFgeoq4A8ILvrdqwFIbIlpjTDArgzldYkHsYo+IATVq7eN 72WA== 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; bh=St+IQCWJacJKbPUwjmk2zZiPvZUfUUJhCu0g3DwZrPg=; b=imeGs74kkdC9zkTdqgY10WjyriQv47ke1DtPa/Pfct8F8j5u32Vuo2E6DFGSSIkubW nLKLOYYrKnFxgiFpKtxsYaYZrH7grSVgN0Bhiy/ioRNFLoQo32wz3iYWyowSrMzKWCx6 iVGit0EqtAmrsuElkF4iFAD9su6k0n3luwa7jOFqY8U6dHRhePCLBMC7z43y+0Io0tkO mr6/ArXxJdXU2KPCYLO7IrL3veuXRl+HLiGkHJMugyDaYvAVuNQl3234L6vnbxXPQYbS DZkAlhZ1M8z0Eddw7NPl7JEmZCGYfbf2MWwpgA9Q40iLDG0Gpu3/Dg35eD6bTPA7xvh3 x5oA== X-Gm-Message-State: ACrzQf3aflrJ2LtXCM80doXIaLqUDUbm3uk7lKZm1AIty1FxajIBpbRQ vl67bF0ORF2dKnITIybEumxrgIFdyF1pK42HZNEgJA== X-Google-Smtp-Source: AMsMyM6QGrLkBXMbfIPe1G5TGsi0HWQVWE4tx9McXMeIqkGsZpi9tdQNue2OLJQyPpOK052xbeGm8HDCACIsAHD0xIk= X-Received: by 2002:a81:1409:0:b0:349:e8bb:1fdb with SMTP id 9-20020a811409000000b00349e8bb1fdbmr3573010ywu.299.1663319600558; Fri, 16 Sep 2022 02:13:20 -0700 (PDT) MIME-Version: 1.0 References: <20220915150417.722975-1-glider@google.com> <20220915150417.722975-28-glider@google.com> <20220915135838.8ad6df0363ccbd671d9641a1@linux-foundation.org> In-Reply-To: <20220915135838.8ad6df0363ccbd671d9641a1@linux-foundation.org> From: Alexander Potapenko Date: Fri, 16 Sep 2022 11:12:44 +0200 Message-ID: Subject: Re: [PATCH v7 27/43] kmsan: disable physical page merging in biovec To: Andrew Morton Cc: Alexander Viro , Alexei Starovoitov , Andrey Konovalov , Andy Lutomirski , Arnd Bergmann , Borislav Petkov , Christoph Hellwig , Christoph Lameter , David Rientjes , Dmitry Vyukov , Eric Biggers , Eric Dumazet , Greg Kroah-Hartman , Herbert Xu , Ilya Leoshkevich , Ingo Molnar , Jens Axboe , Joonsoo Kim , Kees Cook , Marco Elver , Mark Rutland , Matthew Wilcox , "Michael S. Tsirkin" , Pekka Enberg , Peter Zijlstra , Petr Mladek , Stephen Rothwell , 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 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663319601; a=rsa-sha256; cv=none; b=XqGoIXJi2gSm2A51J8Lb3+S1OeEh3Zv61VJ4NXxnPvh0l4CyahE42EXDc8HhC+E27C9MYJ ddD6uU6PDNfn+/sHMpsIOoX17LO/fkKeS708R5+PU9Wj6oTC1lowrv5GzP7CJKvrtb5CPh 5kIGdugOCzn5LhDxDSJ/uIBdt6T+EZc= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=Tq8+3NsA; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf23.hostedemail.com: domain of glider@google.com designates 209.85.128.169 as permitted sender) smtp.mailfrom=glider@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663319601; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=St+IQCWJacJKbPUwjmk2zZiPvZUfUUJhCu0g3DwZrPg=; b=wC2D/e4vEcNcWHfLteZDxjXN7H+4HyKVJD/dySMpU1Gl+DO448MqppcUuU396nzUrj8Yfi xva9cK0Ugvj6YxHfZNzmIT2+7hhfvmLmRUID5lkqO/wk3fG90Y+oL8Ip/dea9FVqkiQ5Um sIDkdsH3J6s+mhTmaHAW3oCpGTHrW6I= X-Stat-Signature: kzkdoqarcj577tuozwccx6dnrpezk7ag X-Rspamd-Queue-Id: 82C4C1400C5 Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=Tq8+3NsA; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf23.hostedemail.com: domain of glider@google.com designates 209.85.128.169 as permitted sender) smtp.mailfrom=glider@google.com X-Rspamd-Server: rspam01 X-Rspam-User: X-HE-Tag: 1663319601-5906 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 Thu, Sep 15, 2022 at 10:58 PM Andrew Morton wrote: > > On Thu, 15 Sep 2022 17:04:01 +0200 Alexander Potapenko wrote: > > > KMSAN metadata for adjacent physical pages may not be adjacent, > > therefore accessing such pages together may lead to metadata > > corruption. > > We disable merging pages in biovec to prevent such corruptions. > > > > ... > > > > --- a/block/blk.h > > +++ b/block/blk.h > > @@ -88,6 +88,13 @@ static inline bool biovec_phys_mergeable(struct requ= est_queue *q, > > phys_addr_t addr1 =3D page_to_phys(vec1->bv_page) + vec1->bv_offs= et; > > phys_addr_t addr2 =3D page_to_phys(vec2->bv_page) + vec2->bv_offs= et; > > > > + /* > > + * Merging adjacent physical pages may not work correctly under K= MSAN > > + * if their metadata pages aren't adjacent. Just disable merging. > > + */ > > + if (IS_ENABLED(CONFIG_KMSAN)) > > + return false; > > + > > if (addr1 + vec1->bv_len !=3D addr2) > > return false; > > if (xen_domain() && !xen_biovec_phys_mergeable(vec1, vec2->bv_pag= e)) > > What are the runtime effects of this? In other words, how much > slowdown is this likely to cause in a reasonable worst-case? To be honest, I have no idea. KMSAN already introduces a lot of runtime overhead to every memory access, it's unlikely that disabling some filesystem optimization will add anything on top of that. Anyway, KMSAN is a debugging tool that is not supposed to be used in production (there's a big boot-time warning about that now :) ) --=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