Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3410030rwa; Tue, 23 Aug 2022 04:25:54 -0700 (PDT) X-Google-Smtp-Source: AA6agR4mMO8TiTH/+hn233kCky7eftlPj9BX93ozQLeaLgJD00A3JJA12R0B+QeBjcZ7V3xAYegL X-Received: by 2002:a63:f1b:0:b0:42a:2ad:9528 with SMTP id e27-20020a630f1b000000b0042a02ad9528mr20168714pgl.197.1661253954600; Tue, 23 Aug 2022 04:25:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661253954; cv=none; d=google.com; s=arc-20160816; b=0WVBRrsAP02bEZlX0eCpL2+y127gvqrDUJ2pR/o9AerRUPYm29ULnTPcMImgrEl6E4 ekd2VShoqzLOdfuzJ2ylbafglxKXYpPECRlw3TRsYIuIBePMSsg2OmKToFIXdkoSefDO pwrE5Cvli14NZVECuKfJo6q9K7eaUt/t9AbLbcZ1o1yi9rDaSAp2qm6QChL8UnTOMU0j 9b1tqe0NMal9uPTH6X5sXQy9MIANL8m6JuZTNsm4MiQDRK7f0fDKCL9IqKLQfPjrSEWK MmRh0cbHySdSsW83KY77Mid8cbhtpb4svbr0B1QOaTizEX7W0tC9UcpIgIBbpTKfOswX Gddw== 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=V6EvZv0poEMzFYx0sZpafNjKKob2SOxt6Wz+lBUKh14=; b=OHXu8cDPnZIxGBmwitVGK4FOIl5R2DOBzADUv1Ba2n0LG3P6XTZ0g677pj3tXNoLsq B7DsuZIi/idGdFNfj56Qv5i2r54Rq2LOpx7C9mefrxf7+aHoasIPqamrGjgAWtPicYRN JkFScRU5U22lw1wRzl/0xEUR0OpZE8iPslsQ5Lqj/d/nk0hCeXLy80hEAxs2twlUur5G 0+zI2WfQNWAlb8E/jw3+W7l0DfFHJ4mWCHcicQq0eJpsCc6vEVTIBH7Xta4XcqosHNwy /MarsotlM6XtDNO3OFC4GVdbIlXc21rLuvqG48Fn0DYWg0uHbTvHfwvlspFEMLoa01ue hKPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NjwVIHoY; 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 oc2-20020a17090b1c0200b001faa7b96ca0si14269069pjb.13.2022.08.23.04.25.43; Tue, 23 Aug 2022 04:25:54 -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=NjwVIHoY; 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 S1352728AbiHWK3A (ORCPT + 99 others); Tue, 23 Aug 2022 06:29:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353161AbiHWKNB (ORCPT ); Tue, 23 Aug 2022 06:13:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58AED5A3EF; Tue, 23 Aug 2022 01:59:04 -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 08924B81C3A; Tue, 23 Aug 2022 08:59:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4BB2DC433D6; Tue, 23 Aug 2022 08:59:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661245141; bh=N7M27V8fymx9YQ0cu679lBp3rKcTvEjT1A/r51VGSMM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NjwVIHoYlWRg4osZp2xryCrB4gvxruM0CofMx4MI7d5m4yCiGGJOJV65Bho+eeE08 LIwV75S8AZTtUCgad0yJMsowXml7te7pz9ABu97IIXK++FhHfYm7ttpL1VSdTo0baT 4m4NPaJyY3FgqX4+wFMNKF308lPkEYq0BcFXjZeM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Ellerman , Zhouyi Zhou , Sasha Levin Subject: [PATCH 5.15 230/244] powerpc/64: Init jump labels before parse_early_param() Date: Tue, 23 Aug 2022 10:26:29 +0200 Message-Id: <20220823080107.229537128@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080059.091088642@linuxfoundation.org> References: <20220823080059.091088642@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: Zhouyi Zhou [ Upstream commit ca829e05d3d4f728810cc5e4b468d9ebc7745eb3 ] On 64-bit, calling jump_label_init() in setup_feature_keys() is too late because static keys may be used in subroutines of parse_early_param() which is again subroutine of early_init_devtree(). For example booting with "threadirqs": static_key_enable_cpuslocked(): static key '0xc000000002953260' used before call to jump_label_init() WARNING: CPU: 0 PID: 0 at kernel/jump_label.c:166 static_key_enable_cpuslocked+0xfc/0x120 ... NIP static_key_enable_cpuslocked+0xfc/0x120 LR static_key_enable_cpuslocked+0xf8/0x120 Call Trace: static_key_enable_cpuslocked+0xf8/0x120 (unreliable) static_key_enable+0x30/0x50 setup_forced_irqthreads+0x28/0x40 do_early_param+0xa0/0x108 parse_args+0x290/0x4e0 parse_early_options+0x48/0x5c parse_early_param+0x58/0x84 early_init_devtree+0xd4/0x518 early_setup+0xb4/0x214 So call jump_label_init() just before parse_early_param() in early_init_devtree(). Suggested-by: Michael Ellerman Signed-off-by: Zhouyi Zhou [mpe: Add call trace to change log and minor wording edits.] Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220726015747.11754-1-zhouzhouyi@gmail.com Signed-off-by: Sasha Levin --- arch/powerpc/kernel/prom.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index 2e67588f6f6e..86ffbabd26c6 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c @@ -751,6 +751,13 @@ void __init early_init_devtree(void *params) of_scan_flat_dt(early_init_dt_scan_root, NULL); of_scan_flat_dt(early_init_dt_scan_memory_ppc, NULL); + /* + * As generic code authors expect to be able to use static keys + * in early_param() handlers, we initialize the static keys just + * before parsing early params (it's fine to call jump_label_init() + * more than once). + */ + jump_label_init(); parse_early_param(); /* make sure we've parsed cmdline for mem= before this */ -- 2.35.1