Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1961985rda; Tue, 24 Oct 2023 08:19:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEuIIwOkNdFI4p5NL8gD3VHeKzI6FTA40/G9PRKInx75YWjxCj1O2K3kfRfU9vX6x27oMXC X-Received: by 2002:a17:902:74c2:b0:1ca:71:ea43 with SMTP id f2-20020a17090274c200b001ca0071ea43mr13069602plt.9.1698160785408; Tue, 24 Oct 2023 08:19:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698160785; cv=none; d=google.com; s=arc-20160816; b=boj75WVAC7WcJ5p4wNk6Dr4W0xsMzXOisVQKt3n1vAFDroGTkNyrwVRk6OVmWfWCgx Tu4nxqI5ETdnn9LFIel4COjXekSk2EJnrFbDrPXq7fAjh0AyCu+0gXvoQyrEfkKue+xA gK322XdnjNkndNV43LFnv8n6rDiXUqyGcI28FPkE0Hsl0YHW34XV6mDFJNQhIS2G7R9q zI5P+BvvEm1MDOMN8kR8LSGAhggigZXBsJY6nO0LOtNIscI2nHFNcNcbPPLMym2H5khy Ch5/YUVURPUafRxLXpxb6n+tLmmysgFqgXj/LRCqGrNQ7tTBFRt+8/TPElb4UG6mf+ZG SfAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:sender:message-id:content-transfer-encoding :content-disposition:mime-version:subject:cc:to:from:references :in-reply-to:dkim-signature; bh=+gACgpTQj8OpvruPj/p3shExXAIg9qVB65uOYbGxgdU=; fh=pBRrH9R0jn/tw414lsKbebjvUFyOrcd69gD7eKz3EjE=; b=HjY98rSdJs34N1W02TAFOWc+FtAaw5gcBysdbUi7sG8bSIdLUT1oPHLdXhBzzA6TsP SgovU8E8Q/UG0YYU3zKvIBsNzc29gbgBacyN+kGIZzsTW2FCfzbNtSpHg2rwSGXzhMpz iZ3Vl0pZLe6IWv8s6JAJVGjWb9WcQ0Lw6BR+pAxYAdhBkLvR4LD6az/W6mlV43NWk/di EKjupWWX4h+xvJE/ozkzL/+m2Fg9m+3P1RCVVghgoJ/30b7cmOuwfN7QEZKq1YsCWU8T 0xtS8Z/Ou5/rUbTAAPyvXhbPsj1TpQrLt54RDEmvaakXm8hIaEptHunr/VpO5vntW2cb uPbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=S+hMwPD1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id d13-20020a170902654d00b001c5f0fd51bfsi8199280pln.100.2023.10.24.08.19.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 08:19:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=S+hMwPD1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 1BE1F8049053; Tue, 24 Oct 2023 08:19:40 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234830AbjJXPT0 (ORCPT + 99 others); Tue, 24 Oct 2023 11:19:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234734AbjJXPS0 (ORCPT ); Tue, 24 Oct 2023 11:18:26 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C88D2198E; Tue, 24 Oct 2023 08:17:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=+gACgpTQj8OpvruPj/p3shExXAIg9qVB65uOYbGxgdU=; b=S+hMwPD1b9oQ/RqKbnhw1l9eHh B5f+XBLR8a9qXl8fH2rLn1s6mfbARa4b9U6prgqxT3kAF5/t7lW8FVuiVE0g4iWDxuaMel/MnTKcl cNt8zlbqh3Td1sLM/Qe/hT6rUp3qsPThS8Ffp1E9er9heuQqHfLJMZCIrdGWVrxXqLdTK8eG4GjBh fawV+SO4XGkk8Sw9U7RkxiPTsv8nmLQs7ydSMjvkhp1MYiTFVMRya3EPZdkR91BPLwRgyXw4H0dMy iDr8dmnkOcHbcaTVLbYtp0eQIcv7M4EvJ9RiSiidyLEzaFqHhqZmQNTh+700LPffqertf8Nz6fyaZ S6Yjv1xw==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:34484 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1qvJ9e-0004Ox-2H; Tue, 24 Oct 2023 16:17:15 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1qvJ9g-00AqQ5-5y; Tue, 24 Oct 2023 16:17:16 +0100 In-Reply-To: References: From: Russell King (Oracle) To: linux-pm@vger.kernel.org, loongarch@lists.linux.dev, linux-acpi@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, kvmarm@lists.linux.dev, x86@kernel.org, linux-csky@vger.kernel.org, linux-doc@vger.kernel.org, linux-ia64@vger.kernel.org, linux-parisc@vger.kernel.org Cc: Salil Mehta , Jean-Philippe Brucker , jianyong.wu@arm.com, justin.he@arm.com, James Morse , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" Subject: [PATCH 13/39] x86: intel_epb: Don't rely on link order MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" Message-Id: Sender: Russell King Date: Tue, 24 Oct 2023 16:17:16 +0100 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.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 (howler.vger.email [0.0.0.0]); Tue, 24 Oct 2023 08:19:40 -0700 (PDT) From: James Morse intel_epb_init() is called as a subsys_initcall() to register cpuhp callbacks. The callbacks make use of get_cpu_device() which will return NULL unless register_cpu() has been called. register_cpu() is called from topology_init(), which is also a subsys_initcall(). This is fragile. Moving the register_cpu() to a different subsys_initcall() leads to a NULL dereference during boot. Make intel_epb_init() a late_initcall(), user-space can't provide a policy before this point anyway. Signed-off-by: James Morse Signed-off-by: Russell King (Oracle) --- subsys_initcall_sync() would be an option, but moving the register_cpu() calls into ACPI also means adding a safety net for CPUs that are online but not described properly by firmware. This lives in subsys_initcall_sync(). --- arch/x86/kernel/cpu/intel_epb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/intel_epb.c b/arch/x86/kernel/cpu/intel_epb.c index e4c3ba91321c..f18d35fe27a9 100644 --- a/arch/x86/kernel/cpu/intel_epb.c +++ b/arch/x86/kernel/cpu/intel_epb.c @@ -237,4 +237,4 @@ static __init int intel_epb_init(void) cpuhp_remove_state(CPUHP_AP_X86_INTEL_EPB_ONLINE); return ret; } -subsys_initcall(intel_epb_init); +late_initcall(intel_epb_init); -- 2.30.2