Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp941368pxb; Fri, 22 Apr 2022 14:56:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7L9WPyX2G3Txf3dXmFiHeQjztjKa5aVabwgdPhwxQ6V9LslGyRRJgfUYOFT+E47yeJ8kY X-Received: by 2002:a17:90b:3b4b:b0:1d2:e3fe:e1a1 with SMTP id ot11-20020a17090b3b4b00b001d2e3fee1a1mr18663048pjb.239.1650664602190; Fri, 22 Apr 2022 14:56:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650664602; cv=none; d=google.com; s=arc-20160816; b=E1n3XHojs5e7gI6MFzEYHxysWfH/pobEeevV74EvUpuNVCTBgyDtaMgFXcmBiRGqLd qEcoeOGuuCYuF7Hhx2Adk8YsNirZBTNC5ngnDgn+/0+SxlwslC94/ofX9gBsq3pzcv1Y svV90t7lR/QLSCwEr2wb/4qWq6ts27lXrqHD3uSYE3CnuXrTdCGvtY4CzwZKOA0rmdgp SKulk/Zz7J1I46pShXH+TUmCIFqF3lc03noFuKpcyW5b6BCA4bVMffFuVcLidUSdtFqt trwwA3dVp4/JLXJ35ZOkPSDzhy3pxHdIT/dFAKZvrks7DoWTWKq0hzxs73JfD64rS8Mg ypQA== 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=7ywngeaPOxck8z+da0Rb5cHl7IWBnc+HuyghQxZLcVk=; b=t+u0BpL/XbXHDqHqk2uy+A0LLwsCZqFdiP2v1tQ8K0zlI7/3yO56QhNzYKyZ0a2RlZ O/zLSSegDs+SOo6dgRPCcNKJg2jmwrMDOBKkBNSHH5hqb1gyJBp4wc+8MDIednWEQixc aYCreFYtlx5TJhs/yl6IcBmS/nnmPYZ5HxTL4pquxLwNErBm8N/OvLNMSMY8pFMzvl7p RPZsNgkhGtOTiGLHeI0tVhwClnZ2c/YnKd1340PONHF6LAUW9611RBCEOUtaBDHBt4Cr HSPvo6gwTpBfhyCQ6HZvfXz3y6bps2vEw6qg9rjRJxMICcIx1u8ToBKdwLA775bOGXhw HaJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=oG1haJS5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id z9-20020a170902ccc900b00153b2d164b0si9235478ple.184.2022.04.22.14.56.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 14:56:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=oG1haJS5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2465E36450B; Fri, 22 Apr 2022 13:05:01 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355235AbiDVQML (ORCPT + 99 others); Fri, 22 Apr 2022 12:12:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229574AbiDVQMJ (ORCPT ); Fri, 22 Apr 2022 12:12:09 -0400 Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 582C45E161 for ; Fri, 22 Apr 2022 09:09:16 -0700 (PDT) Received: by mail-io1-xd34.google.com with SMTP id q22so9095224iod.2 for ; Fri, 22 Apr 2022 09:09:16 -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=7ywngeaPOxck8z+da0Rb5cHl7IWBnc+HuyghQxZLcVk=; b=oG1haJS5hmczkwWbyWqWbIQaUylnKJJUnzf14PdQs7QjktBBhU9YQSVIFpfGm8F1RJ A3p1lsqVP5QDbT7NEnVUml3TwvhnPfRRU+pq8FwWMksiYbc7BXjHZQhVLz71LSIKH7DF xeDLcInX5J6paNdMWEqpbYQg/JX/BdrznAnRH4TB20PgkpDWy3N5AaxLehVf/qY/Qxa/ 1GI5+1Eq6ZsSznd6mrEWnsgZGHzos/iR+voO3zTbfBArFy9D0r9uhbe6x/YeYFS6qk2+ FY0QedT2lpEcnbhin5BCJMx3i/ot7yBiZbNx5G1qvaD7V3m+CMqlhRCwjoh8hIVuoYRn NJTg== 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=7ywngeaPOxck8z+da0Rb5cHl7IWBnc+HuyghQxZLcVk=; b=dcQjlsgNjX9PXNRjKmwgHcVgyuonZYNCqdl+39kMGTVNj7Z84aqmUjOP/0q4QwRiTj JnZLRuj4woXjf2qmucKgP1nXLDPC4hCubBq1R0rrdaoxGvAmGRA/qPOCgKeg/acjLhAW lKOO9DcrCtW2UZ1fE5Bm/DYML85I++d/DJpyUb2uvUS1UctrFakpWWMxCnnYELlNsUNd C91ARboBJmDfLnYJTTZzKwX8JIylmqfLbLvF779T6hicAlGcn8X9b+cLbSahXNl45dQm tyF+mflKampneir5edZU+UM9tIifPjy43Ukksswzl7aZgWEC4fjoZnmIw8Sh2GbuEBIZ 6BjQ== X-Gm-Message-State: AOAM5333dJ7xpP7/3ZMqC+DaM9uth/5vGA11hYwHoRwpQoCfqSWoRawT NGQpTFMeUrOMedwzG2BiencDXIpz41ebEZvcExk= X-Received: by 2002:a05:6638:dd3:b0:32a:7bdd:799b with SMTP id m19-20020a0566380dd300b0032a7bdd799bmr2474463jaj.117.1650643755556; Fri, 22 Apr 2022 09:09:15 -0700 (PDT) MIME-Version: 1.0 References: <20220421031738.3168157-1-pcc@google.com> In-Reply-To: From: Andrey Konovalov Date: Fri, 22 Apr 2022 18:09:04 +0200 Message-ID: Subject: Re: [PATCH] mm: make minimum slab alignment a runtime property To: Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: Peter Collingbourne , 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-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE autolearn=no 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 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!