Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp646884pxb; Thu, 24 Mar 2022 04:31:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxddwxZtDhJRrw4fns5QrB3Ut5LoSKDBKrmtV4nd2XVP2jRm7VlAD+I8ZgaR8ShyN7bU2R X-Received: by 2002:a63:af02:0:b0:386:5aa9:a88c with SMTP id w2-20020a63af02000000b003865aa9a88cmr295245pge.533.1648121477374; Thu, 24 Mar 2022 04:31:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648121477; cv=none; d=google.com; s=arc-20160816; b=o53Gq3gpwW2RkNCEw3YsUD7Sdx5KT3DnkFiWDuh0iE7phLJAoXJAHFGIiFhi4tahgx gLfXGHXXs7V4a45EtqJugttxP75XWYE3cW7z7ktwvipAK4mLqB8LMQ7Ng/8TY1OsCS2i yEfxadl/5/l6I09xEf3esX0oOthzIljASOKuNbXRKVP4z++0SiKmBiGNv44Y+UDklQsd n9IaZprTArQKGj73iZcxqx/W3huk9ilhw8p5DVlb9RRyciWDlLZioKHXWfWxhPSaKEnF Q9aE5ClvLT1gJ5fVJLgSf6gtdokbwsejBnmfbmZ2d50oXCrbrEjwX5Sr/L4/gDebEkm2 tz0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=0FQgYBAsErSA0oer7QMlQ/bPAVMnnC+mA8O5EU9gYhE=; b=GSFfYmIXmrWgp47W9eqxAIA4JqBgiNOZU7VAGfZ0XLpRLspwHEUd4TvFV7A0xBvipP WiY/6QO64RsYnL+kNY9wOM4yHbOhoHTkgs/Iaw5wfz+o5yT44L98qDFHQy+s7Li/DCnu bPXmMgjgFUpKdKUdA6jV6zbZf5LGl+xKcHGBA5Klfuy+ll3pfwpP7mblPJE1MziFYRZS 8thUx7ct2/x/x4g5QE9Iojx5sjTG5wM+HRNARNEXBOn7jR3rqCxlpXp5SeiaFL4Ba3in ammmEY9iOzTO6S43Am53TqCjiygN7E3ldB2FBe3Uf46QaG/gpUs1YcRcvQAfUfYIgA2H lmdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="NRryz7C/"; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 6-20020a630c46000000b0038171da8ae5si24731641pgm.661.2022.03.24.04.30.58; Thu, 24 Mar 2022 04:31:17 -0700 (PDT) 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=@gmail.com header.s=20210112 header.b="NRryz7C/"; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244341AbiCWNiX (ORCPT + 99 others); Wed, 23 Mar 2022 09:38:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244320AbiCWNiK (ORCPT ); Wed, 23 Mar 2022 09:38:10 -0400 Received: from mail-io1-xd36.google.com (mail-io1-xd36.google.com [IPv6:2607:f8b0:4864:20::d36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B076E7890E for ; Wed, 23 Mar 2022 06:36:40 -0700 (PDT) Received: by mail-io1-xd36.google.com with SMTP id h63so1655205iof.12 for ; Wed, 23 Mar 2022 06:36:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0FQgYBAsErSA0oer7QMlQ/bPAVMnnC+mA8O5EU9gYhE=; b=NRryz7C/CBrDgsQBcaN2kMLAwOzoDH2ug5A383MR3vdPIM05sEaWuMxYA+dWsnERtd WEF3wo/5Ggo92cgi4BjRtv9NYLZlx6mGxAkPDRtcL+eDzmhIPAvM7SoLiRLPpSGrQckb mqXoB1djf+8/rdhZ1rwqKIKZZqmoixyaRhzX1mhxaCDvtl1tUZ3q0/QgMe46t6fa6fTo blojXPt48hKe8DzkMltRNkP7i5qekdL/bi0RZYA10fK/EGfeEkI8/Ie2hMr8kl/oBKTb sozfGvxECdMjZtgsoRIFkPPmnu2LBB3fz+09DaSryPwEctuNmKI32yvZKOZSFLpMCFNU TAlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0FQgYBAsErSA0oer7QMlQ/bPAVMnnC+mA8O5EU9gYhE=; b=QZxcFmKD7YKmQdHUVuds35gzjt/4g/MDnKbszMyNzTLNSVeLM1lnHpEQO4fY64pWLu /qTmbo+UwGddoqMKMxESQRaDKh5MoeIkuzO+66pEMsRRV2dmAUVx7AERli/q/MaEq1wQ FzXdSPPC8RCISxkjLeF1jeKREdzENlyTL9se6uWAbKnzgIltdL8wlj6CxW0MjYTb3ImJ kHfv+AMkz5/PNz/aU/c6Y/uRzJHg7mK2mqg7Dixc0NNXazWmk/wi19czZRUwoqIsjKDs sNDGr8FMHLl3cyblgHgLBjwzRPaaqWXYytZC6eK7uy2cT4hityOMqejvoDQCl84tght6 oIOg== X-Gm-Message-State: AOAM530wZwgg2tmRE5e5lhX3VCnhuIXRprXILdSzwAtkBulEnP1m9vRO XPRXQT8sBNBia3oYasKIA2Tl914TqSIn7Y8MCf8= X-Received: by 2002:a05:6638:4881:b0:321:6522:2cbd with SMTP id ct1-20020a056638488100b0032165222cbdmr3282446jab.9.1648042600126; Wed, 23 Mar 2022 06:36:40 -0700 (PDT) MIME-Version: 1.0 References: <44e5738a584c11801b2b8f1231898918efc8634a.1643047180.git.andreyknvl@google.com> <63704e10-18cf-9a82-cffb-052c6046ba7d@suse.cz> In-Reply-To: From: Andrey Konovalov Date: Wed, 23 Mar 2022 14:36:29 +0100 Message-ID: Subject: Re: [PATCH v6 27/39] kasan, mm: only define ___GFP_SKIP_KASAN_POISON with HW_TAGS To: Sebastian Andrzej Siewior , Andrew Morton , Vlastimil Babka Cc: andrey.konovalov@linux.dev, Marco Elver , Alexander Potapenko , Dmitry Vyukov , Andrey Ryabinin , kasan-dev , Linux Memory Management List , Vincenzo Frascino , Catalin Marinas , Will Deacon , Mark Rutland , Linux ARM , Peter Collingbourne , Evgenii Stepanov , LKML , Andrey Konovalov Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Wed, Mar 23, 2022 at 2:02 PM Sebastian Andrzej Siewior wrote: > > On 2022-03-23 12:48:29 [+0100], Vlastimil Babka wrote: > > > +#ifdef CONFIG_KASAN_HW_TAGS > > > #define ___GFP_SKIP_KASAN_POISON 0x1000000u > > > +#else > > > +#define ___GFP_SKIP_KASAN_POISON 0 > > > +#endif > > > #ifdef CONFIG_LOCKDEP > > > #define ___GFP_NOLOCKDEP 0x2000000u > > > #else > > > @@ -251,7 +255,9 @@ struct vm_area_struct; > > > #define __GFP_NOLOCKDEP ((__force gfp_t)___GFP_NOLOCKDEP) > > > > > > /* Room for N __GFP_FOO bits */ > > > -#define __GFP_BITS_SHIFT (25 + IS_ENABLED(CONFIG_LOCKDEP)) > > > +#define __GFP_BITS_SHIFT (24 + \ > > > + IS_ENABLED(CONFIG_KASAN_HW_TAGS) + \ > > > + IS_ENABLED(CONFIG_LOCKDEP)) > > > > This breaks __GFP_NOLOCKDEP, see: > > https://lore.kernel.org/all/YjoJ4CzB3yfWSV1F@linutronix.de/ > > This could work because ___GFP_NOLOCKDEP is still 0x2000000u. In > ("kasan, page_alloc: allow skipping memory init for HW_TAGS") > https://lore.kernel.org/all/0d53efeff345de7d708e0baa0d8829167772521e.1643047180.git.andreyknvl@google.com/ > > This is replaced with 0x8000000u which breaks lockdep. > > Sebastian Hi Sebastian, Indeed, sorry for breaking lockdep. Thank you for the report! I wonder what's the proper fix for this. Perhaps, don't hide KASAN GFP bits under CONFIG_KASAN_HW_TAGS? And then do: #define __GFP_BITS_SHIFT (27 + IS_ENABLED(CONFIG_LOCKDEP)) Vlastimil, Andrew do you have any preference? If my suggestion sounds good, Andrew, could you directly apply the changes? They are needed for these 3 patches: kasan, page_alloc: allow skipping memory init for HW_TAGS kasan, page_alloc: allow skipping unpoisoning for HW_TAGS kasan, mm: only define ___GFP_SKIP_KASAN_POISON with HW_TAGS As these depend on each other, I can't send separate patches that can be folded for all 3. Thanks!