Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3084682rwb; Mon, 15 Aug 2022 17:45:14 -0700 (PDT) X-Google-Smtp-Source: AA6agR4JjgGdSYwQXM2shr7xeN0V+YFgvj6dESTliF6WX4yeFCQ3Jduuouv/3eXAenBmd83REPPj X-Received: by 2002:aa7:8f13:0:b0:52d:fe17:ce11 with SMTP id x19-20020aa78f13000000b0052dfe17ce11mr19082627pfr.26.1660610714429; Mon, 15 Aug 2022 17:45:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660610714; cv=none; d=google.com; s=arc-20160816; b=AUFWzldChygc2Cr7zexxjC/erQCQzyMN113dklo8kOxLz4mR81DCodDwfsv/LXGwW7 b8TumhnfFhiPGkTzU4U1/i3hatk495u6JWokbzeZcFF5X8veL3vb18u+JKJ0QbhEUjos 8cXnEI6Q69JrStrpLcjGO9p7zwqcgadWILBhGAFD3XrD96RdO7gmMECNI1yLVeQk28HH pSv1ak5fJchvd3Todqv49OAlyTvdLRx6NH3nhChLzKRb47DFbEoeU2lzt/EudUBKBe8V YbfMPnmNOT1WKvQ2sfBlgaEQn+M2qH1UfLJ1Bmjdu70h0t2H0ejJU5AEIFpIVl7WXGz9 sLJw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=q6grr4DV0sQmhiZcmOXBw9d6rEKL8oi2oh9TMgHZDVA=; b=HyLO/Jxf0g3m86YeiZwrfU/jKR7b6F+V0YOWOWpATG/weMzzp2Bc+swXhMp89Kq6sv ijOqDmGbvHdh4cRuBmfQ/uqIY6f3mEKlseNxWmbop66iyKfDOR1ysSI9F9ldlpVYDKBp K+/qSOEK6ENy2EdXyzMaH0wxuxgENAfdyeNUzLuHuUN6vVsb83Ve4aoUUyUBdi8EDZe3 HqXwpTCGKgttfH8ANHANJW3nKw/ESxx5F2zmFfcvhAx3TlFu6mOntzbgEyrlEvnDysuS eIyYscpSIBvoPX8BiO/0KS04lAFNhdYVylbk5slSSM0emyhrTok9nWyuE73TuWr3VaZo earQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zFRsddy7; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h19-20020a056a00219300b00525b292ccf0si12923437pfi.124.2022.08.15.17.45.03; Mon, 15 Aug 2022 17:45:14 -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=@linuxfoundation.org header.s=korg header.b=zFRsddy7; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346095AbiHOXVV (ORCPT + 99 others); Mon, 15 Aug 2022 19:21:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353534AbiHOXQw (ORCPT ); Mon, 15 Aug 2022 19:16:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C57B5AF497; Mon, 15 Aug 2022 13:03:30 -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 3C328B80EAD; Mon, 15 Aug 2022 20:03:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FF78C433D6; Mon, 15 Aug 2022 20:03:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593807; bh=1UQTlE+KgZKe/65niCjLYaTpKD6QDiBXlSIHeo+yO74=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zFRsddy7MwPZ1e2RdZ/FPyqAjjFX/Vwn2sftMAmEDMyZcwBnmdKjAPZx7l8tAoAAH xX3XHzK9+rBpqUlnRS8xyFP6kKBI+FYwH+pjI27wbJMnVbr4I9rG1E7YCgUageFnVI /ERYh115uEl0WzGgEOJk9qbjxGaISP0TIiRZRlIo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen jingwen , Chen Zhongjin , "Paul E. McKenney" , Sasha Levin Subject: [PATCH 5.18 1009/1095] locking/csd_lock: Change csdlock_debug from early_param to __setup Date: Mon, 15 Aug 2022 20:06:48 +0200 Message-Id: <20220815180510.844804678@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 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 [ Upstream commit 9c9b26b0df270d4f9246e483a44686fca951a29c ] 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 Signed-off-by: Sasha Levin --- kernel/smp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/smp.c b/kernel/smp.c index 65a630f62363..381eb15cd28f 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.35.1