Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3474185rwa; Tue, 23 Aug 2022 05:28:42 -0700 (PDT) X-Google-Smtp-Source: AA6agR5JauSkxdjeQ2SKRt9Yp7kVoO1ULD4GtJ6v9Oq0ODVczI491HzXQlo1UCHNysLk2v+adNyx X-Received: by 2002:a17:902:d58c:b0:172:db86:b6ef with SMTP id k12-20020a170902d58c00b00172db86b6efmr12851326plh.45.1661257721915; Tue, 23 Aug 2022 05:28:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661257721; cv=none; d=google.com; s=arc-20160816; b=YOz/CqHrGtGbXCF6Ty4RIJ/gecHdymWOizng9cC+RqQbHxNBwfu3PliNsS7Yb5mx10 PHCQMtcuD8RNLABA+dtMf5YmBO9muTWCVIfrHd5qMWivSYQGK/aP7BwLe2X6j+wJcTUO AN49w52DkF2VfBzS+hUPwN8F7/IndF28bZgUPoXMqFxeJ8/+U8jXK5L0UUfBXRjCudqS zjHMjLf0zh5IcbMDgwehPOwNO3+Ohk1Y9yPQxmGVCEeqyLcOh7P2cjksGkP7aXsGVBhc L/nHomPlJjO9lIth1OeU5sXJEjQaF6eG9yLVIeHMu2J4/JGpBbwJQ2wJKZ39upiPswLp Znyw== 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=KbI5xIpmOXZF7U55L89lJsMfY4nvr2BL/4IixXsgRZk=; b=yVfQOVa8yik8lp/DpiZFaqkmLXy8O2RwzQ/54Vbsx3Oy0fUF9RbbJvQGqqxAG5+rH0 7/DHnWba8huR978oCyAB7O7oxvagHEXv0iTD4+Joc/qEIrvNoM/ZFh0O4/7axWW4R6lS UJlkmWx6Z3cMunhdiyiNEcec8iQ11FHl1/Lv/MIqeJfv+2s+mNfvWWYQ/i/jUaXStrFJ 0hxnMQsOWKyso1GmUj25fgdkk4EzUqpNRMW8xBRJFKY7qUj1rUbS/rdNnyDzZ3xE7mHb vW3zo2ndfWS59K5h7jOkmQzJ8KI5jDv8ubWxA5VSa2OZHmKudBHIaZT9qpDATt5UaNes bZxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1yFNHqw9; 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 n8-20020a63a508000000b0041ce0452540si15485848pgf.330.2022.08.23.05.28.30; Tue, 23 Aug 2022 05:28:41 -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=1yFNHqw9; 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 S1355220AbiHWKXO (ORCPT + 99 others); Tue, 23 Aug 2022 06:23:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353379AbiHWKLV (ORCPT ); Tue, 23 Aug 2022 06:11:21 -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 27F297F086; Tue, 23 Aug 2022 01:56:39 -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 C3475B81C35; Tue, 23 Aug 2022 08:56:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A68FC433C1; Tue, 23 Aug 2022 08:56:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661244996; bh=SMPKi7JYN8lXUwX1rq7vek4IGXoJO6A+YLX7BvVgKCE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1yFNHqw9V63m3CwyBOX+oBxcn/UqOytTIqNEhIYiKqpkbgNI1odLYUaMAoUP81p5N raXaUj2fsRiMNrZGbEXBhCE6Mcw7zmtG3d04EoYF4vAYzOoJVmH0x2HH+QK+w3GAT9 NLDtGhRDVkTgZQ26t9C1uazq+PIRrFqqsU28lgjw= 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 4.14 227/229] powerpc/64: Init jump labels before parse_early_param() Date: Tue, 23 Aug 2022 10:26:28 +0200 Message-Id: <20220823080101.744991620@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080053.202747790@linuxfoundation.org> References: <20220823080053.202747790@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 99409d0420d2..ffc571edac28 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c @@ -710,6 +710,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