Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3271628iog; Mon, 20 Jun 2022 15:50:02 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uo9XAkPHtD9kb4uV1AqdCSFc4Tpg1tzFX1/5Kx/R9OiAYEFsV4VF1C5SsbTzUKf2PE/KRr X-Received: by 2002:a63:4914:0:b0:408:415a:3a15 with SMTP id w20-20020a634914000000b00408415a3a15mr23380359pga.596.1655765402276; Mon, 20 Jun 2022 15:50:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655765402; cv=none; d=google.com; s=arc-20160816; b=ww1neCmwYO7T097MmtnoKIA6EHjUvsbEZ8oMDyLmNlOCILc8Qdhq1QHAKnth0GNRqr 3SLEPmsAgW2/K5XMXjz1hKOt6/mUTA7DweRvXGMUYfPELUoTaZa/dkwzhtK3Yjv9XGHo txhwzV8uR5kvToAMQvpUnFe79n7m0mRqp6gtFFXYa2WkhF1uygn0VqcbiPafJuHiLqIy btqO4Dr839O7pDHRQRxheebjabfXocvaFsr55W0PR/Qfxa+COFHLZB/PjGFsKXPlVfX2 r+J/OeUC63XP3uXSoW2S/ZnxybbaMcz7ItYmCaI0VlcSTSOkMcgkIYiFbMb9zOBplV3Q CZ/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wrBLWJ6whjJJonXuTnI9rTm1B10YGOox0sJ8f6EjeJk=; b=Evi6Q9iofEOrNno/yCYeQW4si5qMNWioVZXxWbR39VpYaAOiOVXPik6qQRe+32favT SeSCgl5Gm0YUdtmeqXq2mN4V9XS7/1Jvg+DSBFCsYbdDNUIEqozI8lCrwW0tauVDrCFo h6lul+2DTFsFtjnL6IMTM4dee0L9A6uYh1qRMt5PTuPI958j/I/25mLZKjaIHJfQy/xi a0JM3zmwvCezzFJyLl39bMUe+XLM5oVGld4/YXlZWtuxlP+1njJ2qZkXx0ObjTT7RqKU SCJiZ36dhS0nVBh9RHx2GdJHQfIqJCcElnRpveSoEVYDv50hHaTMwFPNLCFicSwJWVXM DyNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AjIFk5Yx; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l64-20020a638843000000b0040ca14525b3si6500000pgd.805.2022.06.20.15.49.47; Mon, 20 Jun 2022 15:50:02 -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=@kernel.org header.s=k20201202 header.b=AjIFk5Yx; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344171AbiFTWVL (ORCPT + 99 others); Mon, 20 Jun 2022 18:21:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244759AbiFTWUn (ORCPT ); Mon, 20 Jun 2022 18:20:43 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF7191BE82; Mon, 20 Jun 2022 15:20:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2ABB7B8164E; Mon, 20 Jun 2022 22:20:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F8C3C341CF; Mon, 20 Jun 2022 22:20:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655763634; bh=lyNCAIvYhX/+kHwlAad/y9gHMFmiZO/u932Jluyi4aA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AjIFk5YxhEODc2yYfvgjOXXFHf3Ik38rQd+LeQZ+Oek9uUtSZ38cy8J4RZ5+l8XFm VaGTwCO0bXakKzgxFSgEVtK9UY2il7+RWQB5d4UhfLFHZ2CpRVi2ae9cVhnm/gQNbF G5UKOuoFendHYd+tezPrBS6rqLpFqaoU6c3BWoiKv1sdt223xkCpQ2ukK7mY8z8HRq HPvGFZRgHmnCv3Vov0EbAtgGgrnE168NzYsNNwSbZgpVYDQypzNhn5ntHLf1DbaWcW pbOaB5ccgWHX/Mce4mAr+4kwdYKKRkZSymeKTQzMnIij7QUwx+cTX/X/h0vEZAC9Ji ugsXHrG/y59Tg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 078495C0B06; Mon, 20 Jun 2022 15:20:34 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@fb.com, rostedt@goodmis.org, Chen Zhongjin , stable@vger.kernel.org, Chen jingwen , "Paul E . McKenney" Subject: [PATCH rcu 06/12] locking/csd_lock: Change csdlock_debug from early_param to __setup Date: Mon, 20 Jun 2022 15:20:26 -0700 Message-Id: <20220620222032.3839547-6-paulmck@kernel.org> X-Mailer: git-send-email 2.31.1.189.g2e36527f23 In-Reply-To: <20220620222022.GA3839466@paulmck-ThinkPad-P17-Gen-1> References: <20220620222022.GA3839466@paulmck-ThinkPad-P17-Gen-1> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 From: Chen Zhongjin The csdlock_debug kernel-boot parameter is parsed by the early_param() function csdlock_debug(). If set, csdlock_debug() invokes static_branch_enable() to enable csd_lock_wait feature, which triggers a panic on arm64 for kernels built with CONFIG_SPARSEMEM=y and CONFIG_SPARSEMEM_VMEMMAP=n. With CONFIG_SPARSEMEM_VMEMMAP=n, __nr_to_section is called in static_key_enable() and returns NULL, resulting in a NULL dereference because mem_section is initialized only later in sparse_init(). This is also a problem for powerpc because early_param() functions are invoked earlier than jump_label_init(), also resulting in static_key_enable() failures. These failures cause the warning "static key 'xxx' used before call to jump_label_init()". Thus, early_param is too early for csd_lock_wait to run static_branch_enable(), so changes it to __setup to fix these. Fixes: 8d0968cc6b8f ("locking/csd_lock: Add boot parameter for controlling CSD lock debugging") Cc: stable@vger.kernel.org Reported-by: Chen jingwen Signed-off-by: Chen Zhongjin Signed-off-by: Paul E. McKenney --- kernel/smp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/smp.c b/kernel/smp.c index dd215f4394264..650810a6f29b3 100644 --- a/kernel/smp.c +++ b/kernel/smp.c @@ -174,9 +174,9 @@ static int __init csdlock_debug(char *str) if (val) static_branch_enable(&csdlock_debug_enabled); - return 0; + return 1; } -early_param("csdlock_debug", csdlock_debug); +__setup("csdlock_debug=", csdlock_debug); static DEFINE_PER_CPU(call_single_data_t *, cur_csd); static DEFINE_PER_CPU(smp_call_func_t, cur_csd_func); -- 2.31.1.189.g2e36527f23