Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp1133935rdh; Fri, 27 Oct 2023 05:54:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFQwSfpsXQ8j/S6REkAiXzDVOToaQ6ikbvnLcbAMdeF7n/P7diGnaE8eVuVhw4FHRFl7IaS X-Received: by 2002:a25:f828:0:b0:d9a:3d72:bfab with SMTP id u40-20020a25f828000000b00d9a3d72bfabmr2333237ybd.40.1698411287907; Fri, 27 Oct 2023 05:54:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698411287; cv=none; d=google.com; s=arc-20160816; b=fxYkHVhpVzF60rDQWS7EzKc/dJGBG7MAliFTr2mQSTaYwmMKCwFe581UiRIuS2XiZ8 368sSNr+odg/OlA3XAj7XRlNCjN8wZViDV15Vy8OBw1YteG6FoHwAjvWWPAR4AlUbM7B zzMvIaaWN+PqYZRDF3mHfOFEy8H90TlKYztewDIXsavz+yOVs5fOedrbGGQ69WQ8rvN/ +X71JAhNm1jE7w3sp1tt3Y0F/cypVDt/lHkJ3gX3fGxWJQRMWXkSBoOyS5FHQU7S5VRg BCm3Ied31+m9PA8LTTS0fyfash43lkpudfoyg02x1Roae4VXTRYGTz+kXiH7wqnaZKDe IM0Q== 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=DwNfFFS57QhT5eEqPbXTCH8wXRCZS40xeP0h1OwCxS4=; fh=kVNHuK6sH0u+sBJWWlQLGzcqa7WwSE0AcR3KrlGWuEY=; b=Au/1qNJtenaYFRL1S1j09NfO88mVUeunx29a99n7zMVhf7xjFv0J4FtW7bjTa+cU+1 dKbrKWpaOoD8Q5sweh/YdSM4cAoO4rqFSnK6JBsUkVRh+nkZuLDJVoup6cvIimLjF4YH b75WZKkO2MJqfKHbPsVOYetyWNUjkvFrr1lpfAD7libFOxzwNM60vciyjYHZ3KTL1kDm cX0q/6tjAtwe8Gl5PZfxbnHnAhvh6WCwA9K+LvvWCKgdK5kWfKwes25G6QeXY3yXZhxS I5x637G4VkkARmkEe2w0Y3A3j7Wzem7DsiYNOfwzLNajpK2wi8xBxDw5zTCNaG+DOwUW ajHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=tv1vLeGn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id 200-20020a2505d1000000b00da0ce7e8a38si2343543ybf.245.2023.10.27.05.54.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 05:54:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=tv1vLeGn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 236E98338411; Fri, 27 Oct 2023 05:54:45 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231345AbjJ0Myj (ORCPT + 99 others); Fri, 27 Oct 2023 08:54:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229503AbjJ0Myi (ORCPT ); Fri, 27 Oct 2023 08:54:38 -0400 Received: from mail-vs1-xe2d.google.com (mail-vs1-xe2d.google.com [IPv6:2607:f8b0:4864:20::e2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0DF410E for ; Fri, 27 Oct 2023 05:54:35 -0700 (PDT) Received: by mail-vs1-xe2d.google.com with SMTP id ada2fe7eead31-45853ab5556so904536137.2 for ; Fri, 27 Oct 2023 05:54:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1698411275; x=1699016075; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=DwNfFFS57QhT5eEqPbXTCH8wXRCZS40xeP0h1OwCxS4=; b=tv1vLeGnXlb957cOI6Et6F+jXA08XWVBnR+R4+w7VdFHcj2pjUaoFlYLMrbyfe/hdt ElG8Esn522M/ft4KKqBmexhM1x1jbYC/zmR1DFwJ2MQxvZTcsrkPkiB/NI/pLTQFsCL7 4BFLe4zvvorKhv3Ql5ty1u3trEyR6XL04ckqk+6S5WmBIiJUBWNsyAcHNae3++W2f6uM WWxqGxFuTdCONHYQ144ebauRzwDnNo8ne3YR3QFNgLybo1IjJYS+V1xdPG4MNk8BP7M0 1eNeaM2Do+04QpVRbrPe1VBBdETlaxh148xsAQyFXoDn85AJR1CwII4XJY9CqlNC2a24 RyyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698411275; x=1699016075; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=DwNfFFS57QhT5eEqPbXTCH8wXRCZS40xeP0h1OwCxS4=; b=vy/a1rbqe083GicMUG+0NnTL/eF3gijxyhHvUq4XbCf2mEZ+NHjLM/P8p3aVmN0pOM t6ZZE10/j7NBokHY6lfzR5nAkUCIdwqdBb+65Xvvfl3nOmMTI5nTZp7Tj2vQDtPYgn7I /WSYQzTHNX2MJAxXH2PZa0ooC+2yint/04MYuu+Lij1ZChyI6QmX0d9gdqvPxWa2JUD6 lJYwEHeR6Qv8ssg7mv/nhOQomJp0Y3nvsXhV5EFrWDwL+nxcAHI14qzpQYtbm0oxIjQ1 mcsUxkqXkqGm4CAdvLxzwd0CZ5vgmJlwizbkKiPAxptMTeg6hUESE8dO34AnJ89EhdX4 tbTQ== X-Gm-Message-State: AOJu0Yz+1mkjcWR5MJYoCmvN63rtlcLpAZ2ofpm/zp1ctZu+HAqNEE+Q 0PH6yiZ1wZSGVcYkcd9eTLyLavlGD9Qr1wox7g6jRgXk7DCxr5jezL4LnQ== X-Received: by 2002:a67:c105:0:b0:44d:4a41:893f with SMTP id d5-20020a67c105000000b0044d4a41893fmr2921932vsj.9.1698411274739; Fri, 27 Oct 2023 05:54:34 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Marco Elver Date: Fri, 27 Oct 2023 14:53:57 +0200 Message-ID: Subject: Re: [PATCH 1/1] lib/stackdepot: print disabled message only if truly disabled To: andrey.konovalov@linux.dev Cc: Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Vlastimil Babka , kasan-dev@googlegroups.com, Evgenii Stepanov , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 27 Oct 2023 05:54:45 -0700 (PDT) On Thu, 26 Oct 2023 at 22:28, wrote: > > From: Andrey Konovalov > > Currently, if stack_depot_disable=off is passed to the kernel > command-line after stack_depot_disable=on, stack depot prints a message > that it is disabled, while it is actually enabled. > > Fix this by moving printing the disabled message to > stack_depot_early_init. Place it before the > __stack_depot_early_init_requested check, so that the message is printed > even if early stack depot init has not been requested. > > Also drop the stack_table = NULL assignment from disable_stack_depot, > as stack_table is NULL by default. > > Fixes: e1fdc403349c ("lib: stackdepot: add support to disable stack depot") > Signed-off-by: Andrey Konovalov Reviewed-by: Marco Elver for the change here, but there's a way to make it simpler (see below). > --- > lib/stackdepot.c | 24 +++++++++++++++--------- > 1 file changed, 15 insertions(+), 9 deletions(-) > > diff --git a/lib/stackdepot.c b/lib/stackdepot.c > index 2f5aa851834e..0eeaef4f2523 100644 > --- a/lib/stackdepot.c > +++ b/lib/stackdepot.c > @@ -101,14 +101,7 @@ static int next_pool_required = 1; > > static int __init disable_stack_depot(char *str) > { > - int ret; > - > - ret = kstrtobool(str, &stack_depot_disabled); > - if (!ret && stack_depot_disabled) { > - pr_info("disabled\n"); > - stack_table = NULL; > - } > - return 0; > + return kstrtobool(str, &stack_depot_disabled); > } > early_param("stack_depot_disable", disable_stack_depot); > > @@ -130,6 +123,15 @@ int __init stack_depot_early_init(void) > return 0; > __stack_depot_early_init_passed = true; > > + /* > + * Print disabled message even if early init has not been requested: > + * stack_depot_init() will not print one. > + */ > + if (stack_depot_disabled) { > + pr_info("disabled\n"); > + return 0; > + } > + > /* > * If KASAN is enabled, use the maximum order: KASAN is frequently used > * in fuzzing scenarios, which leads to a large number of different > @@ -138,7 +140,11 @@ int __init stack_depot_early_init(void) > if (kasan_enabled() && !stack_bucket_number_order) > stack_bucket_number_order = STACK_BUCKET_NUMBER_ORDER_MAX; stack_bucket_number_order seems like a redundant variable, that should at least be __ro_after_init. All code that does "if (stack_bucket_number_order) ..." could just do "if (kasan_enabled()) ..." and use STACK_BUCKET_NUMBER_ORDER_MAX constant directly instead. The code here could be simplified if it was removed. No idea why it was introduced in the first place. I think f9987921cb541 introduced it and there it said "complemented with a boot-time kernel parameter", but that never happened. So I'd be in favor of removing that variable, which will also simplify this code.