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 A07C3C433EF for ; Fri, 22 Apr 2022 17:40:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 173EB6B0073; Fri, 22 Apr 2022 13:40:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0FD036B0074; Fri, 22 Apr 2022 13:40:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EB8B76B0075; Fri, 22 Apr 2022 13:40:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id D5C0D6B0073 for ; Fri, 22 Apr 2022 13:40:20 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id C629860D95 for ; Fri, 22 Apr 2022 17:40:20 +0000 (UTC) X-FDA: 79385229000.17.8E01E48 Received: from mail-vs1-f53.google.com (mail-vs1-f53.google.com [209.85.217.53]) by imf02.hostedemail.com (Postfix) with ESMTP id BE5CC80002 for ; Fri, 22 Apr 2022 17:40:18 +0000 (UTC) Received: by mail-vs1-f53.google.com with SMTP id f32so8125092vsv.1 for ; Fri, 22 Apr 2022 10:40:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1B5OLyPzDad+a9/JvoswRLL9dkqWt3XLCqj2yVlzJ3g=; b=EXx39caVzrDVxXmzeFHNJ/VpA0Vf9nhcaUODJblSmmzfQCqSIclIq3k/72jlhOe7xU mxS7DiSX8wD9WeA0yp1NbvWAVdMNUxuU4gaIzQh8JJ8fyCnu0l5lwI1ZT5DQmvo3o/GL giMkmhaOpRIcD3Pxc/WQ0G8uNs49u4slv1VqwwKj8ILUDMpg4P2Gy0pNs+Rl8wxHkt2u AaT3fwMdeZX7l84TVbveI7BoObbfwdo20kpJqU2PgPdBHaSHTHXSz6+BpCsCPepPwYib Pzvv+mS2caK2fXnFrZHgiNJflVFXQzaIMwIiG9huu4nfjIBK80wyF276rcBbBNxqduav T9FQ== 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=1B5OLyPzDad+a9/JvoswRLL9dkqWt3XLCqj2yVlzJ3g=; b=lGyL/2DZbDLFmRd2sDD6RKYJxdNTHVwjYS4BQc/8ExKi6gFV1O+nPc+covP9MeZjim 1L87kTpRLS/HpxuLjFBq1CdqId7pwYU5OLzeUM7HWFzxU1A9NOdAk/9hmbCIyM5IZ+Gl SZ4JnmRrAzGuqj9d/bvpop28xaS8ynHT2JNl/NkKlHK1F7hZqdhKDwOemZPRuoyPVvkY rXmM+TV9SXjKtsRMoW/mYdt2Rs2dcHpGkH1SwUS7N2wqX5dTj+qt3rFVcu3tzbaOLww1 wDwjQ1dj99BhW41AqiNZoE0VAlIVgRjnLU12lHPL5DyQFrb6L4KzuzCt+j3MkfmZxtJ7 bmPw== X-Gm-Message-State: AOAM533NyZ9ItmboQkWZKsUIL4AD6m/vYYc6aC89lAMuTmx3sAjaQpLP eVTPFiFMaXXRxS+icUbnOx8/FzbO/KVVPXfywhebXQ== X-Google-Smtp-Source: ABdhPJy/drKzRgAnJKsyet9UFIFe9YFVUJ6n+nx0nVlvY8ge39RLxem+hEvlIrX4RwcQ7fJ7ieneEfTfETa2SyrnmFY= X-Received: by 2002:a05:6102:390e:b0:324:c2b1:f077 with SMTP id e14-20020a056102390e00b00324c2b1f077mr1825856vsu.67.1650649219372; Fri, 22 Apr 2022 10:40:19 -0700 (PDT) MIME-Version: 1.0 References: <20220421031738.3168157-1-pcc@google.com> In-Reply-To: From: Peter Collingbourne Date: Fri, 22 Apr 2022 10:40:08 -0700 Message-ID: Subject: Re: [PATCH] mm: make minimum slab alignment a runtime property To: Andrey Konovalov Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>, 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 Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: BE5CC80002 X-Stat-Signature: igigzf1n31a116tbj88rcotnz84c9dq8 X-Rspam-User: Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=EXx39caV; spf=pass (imf02.hostedemail.com: domain of pcc@google.com designates 209.85.217.53 as permitted sender) smtp.mailfrom=pcc@google.com; dmarc=pass (policy=reject) header.from=google.com X-HE-Tag: 1650649218-450135 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 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. Peter