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 25551C433EF for ; Sun, 24 Apr 2022 05:17:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 509886B0074; Sun, 24 Apr 2022 01:17:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4B8C76B0075; Sun, 24 Apr 2022 01:17:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 37FA46B0078; Sun, 24 Apr 2022 01:17:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.28]) by kanga.kvack.org (Postfix) with ESMTP id 29C256B0074 for ; Sun, 24 Apr 2022 01:17:11 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id E825C22048 for ; Sun, 24 Apr 2022 05:17:10 +0000 (UTC) X-FDA: 79390613820.05.A942470 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by imf18.hostedemail.com (Postfix) with ESMTP id 66D4E1C0031 for ; Sun, 24 Apr 2022 05:17:07 +0000 (UTC) Received: by mail-pl1-f171.google.com with SMTP id s14so19895785plk.8 for ; Sat, 23 Apr 2022 22:17:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ZFmcLn/pFDeMh7htjVTnOwoz+IWHDFfopBWIvebvgp0=; b=YGE4UXFLnip6exfD2cJSFWxbiaj7cAu6LzDoNlPoMrLOxxldp0fZz7H0jHfW45wkgp jNJCH2lk+KZN5gcKDnTJs0+2mx7jfrn5Z96zDe0oLk1jZGZm4ZmgTiHIIN+46omPKruq 0teFHFOA8bUCBxk6dQNd2OTw+8EOtS9gr5xL4R/MMJtizZ13s2AIMWPTeCdmsDY0zltO t8kahNA2gIF1wDoHq89e7oRgnp900/YNk5lAsMpmC0e6w5eMwgKW0xY0HvQU+fLkXnq/ 0JSHw8BxCY7rl56qY6pOIeHlfFf9Fy9LWEDCUCHJfArtoYg1vNpcyhM1GDOZK7947ozH 7B8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ZFmcLn/pFDeMh7htjVTnOwoz+IWHDFfopBWIvebvgp0=; b=qSFnOmqhpZKUy4mSYrODycE8JUNLs+/UkE4WyxipudH6MQwMKi6j80BXOIHHSf4JaA bSHEWLjLViMGKCSPihyjE3NspUM13U5LDBkQia2VTS+SrLGZfKNsRC9OA+u+hSKVAd0+ aW3H6l/ZEqP2EfZAOAYfKVIsAgBSByxekVBJsYyho0mh30J8IKyRHCzz+PCJm6PgFhJI nvgulWWedJqn4N7P3wHQXjVub2sHtARqddgymNeR2BxcxXoyaYB/qmjIzNwqS/3sLcQD xkjjDhNxbp/Tz2mt89VK2QQIXc0IkCoeYxTdtkreJyrqxy3oiBiq6fUDHAIsbVbKLegN N86Q== X-Gm-Message-State: AOAM531FO0qBnx9fTjXdXc22/ldr/S5IO7BKetZuOpm5Hmf488mrHicU zZ/8L68eJPFGMKXms0jfXko= X-Google-Smtp-Source: ABdhPJzvC57/wrSdVCHMu1tWX2JdBDgQh+aIgHUgOyKw5Vbvc9NKP12PEMhkj6DEpT0WJv4E0DoC+g== X-Received: by 2002:a17:90a:730c:b0:1d9:3f5:9a00 with SMTP id m12-20020a17090a730c00b001d903f59a00mr8862014pjk.109.1650777429249; Sat, 23 Apr 2022 22:17:09 -0700 (PDT) Received: from hyeyoo ([114.29.24.243]) by smtp.gmail.com with ESMTPSA id x129-20020a623187000000b0050835f6d6a1sm7109881pfx.9.2022.04.23.22.17.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Apr 2022 22:17:07 -0700 (PDT) Date: Sun, 24 Apr 2022 14:16:58 +0900 From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: Peter Collingbourne Cc: Andrey Konovalov , Andrew Morton , Linux ARM , Linux Memory Management List , Linux Kernel Mailing List , Vlastimil Babka , Pekka Enberg , cl@linux.org, roman.gushchin@linux.dev, Joonsoo Kim , David Rientjes , Catalin Marinas , Herbert Xu , Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , kasan-dev , Eric Biederman , Kees Cook Subject: Re: [PATCH] mm: make minimum slab alignment a runtime property Message-ID: References: <20220421031738.3168157-1-pcc@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 66D4E1C0031 X-Stat-Signature: niybzakaf1c7w99scwcn4b6bxngxswjw Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=YGE4UXFL; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf18.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.214.171 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1650777427-788450 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 Fri, Apr 22, 2022 at 10:40:08AM -0700, Peter Collingbourne wrote: > On Fri, Apr 22, 2022 at 9:09 AM Andrey Konovalov wrote: > > > > On Fri, Apr 22, 2022 at 2:39 PM Hyeonggon Yoo <42.hyeyoo@gmail.com> wrote: > > > > > > > > kasan_hw_tags_enabled() is also false when kasan is just not initialized yet. > > > > > What about writing a new helper something like kasan_is_disabled() > > > > > instead? > > > > > > > > The decision of whether to enable KASAN is made early, before the slab > > > > allocator is initialized (start_kernel -> smp_prepare_boot_cpu -> > > > > kasan_init_hw_tags vs start_kernel -> mm_init -> kmem_cache_init). If > > > > you think about it, this needs to be the case for KASAN to operate > > > > correctly because it influences the behavior of the slab allocator via > > > > the kasan_*poison* hooks. So I don't think we can end up calling this > > > > function before then. > > > > > > Sounds not bad. I wanted to make sure the value of arch_slab_minaligned() > > > is not changed during its execution. > > > > > > Just some part of me thought something like this would be more > > > intuitive/robust. > > > > > > if (systems_supports_mte() && kasan_arg != KASAN_ARG_OFF) > > > return MTE_GRANULE_SIZE; > > > else > > > return __alignof__(unsigned long long); > > > > Hi Hyeonggon, > > > > We could add and use kasan_hw_rags_requested(), which would return > > (systems_supports_mte() && kasan_arg != KASAN_ARG_OFF). > > > > However, I'm not sure we will get a fully static behavior: > > systems_supports_mte() also only starts returning proper result at > > some point during CPU bring-up if I'm not mistaken. > > > > Thanks! > > Yes, either way we are going to rely on something that hasn't > obviously been initialized yet, so I think we should stick with what I > have since it's used by the rest of the KASAN code as well. > Okay then we should anyway rely on something not initialized at early stage of boot process. And I don't expect much problem on current version. Thanks! > Peter -- Thanks, Hyeonggon