Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3361756rdb; Wed, 13 Sep 2023 09:41:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGPqXEHMqMM/6UBGAe096gD+6SERclT66baA3hQkq34tRIHvUsRiZ8FjhoSCG+aA4+mkNjh X-Received: by 2002:a05:6870:73c7:b0:1d5:9eb7:8477 with SMTP id a7-20020a05687073c700b001d59eb78477mr3257434oan.37.1694623260112; Wed, 13 Sep 2023 09:41:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694623260; cv=none; d=google.com; s=arc-20160816; b=HQdK6fKvq+ItanL1JwOucMNToPVH1x10u8qxsOQAVBCm6+g2R9E0E2jbFSURnMZnhx S8vjZuE9XI37lgWD3XNgfcG2TovG4PRmKDVdU/NBT1Z4pRX7Fm1yt/AUylKEBqcJHy/r lrCN3mx1ylcf4E/U6CxjZg0XH54WzXbdeRyaSfzfyc2XLwWhnsLP1cpBk2qty7s9AOHH KUzjvskCvEOqf6OKX6/dqdyPlD3kKlC8Tl12HBhB2O9mZCEWL3mxOZJVuQdeulSiEjjV 8kSr7R9xDLeMlWGzCjW8PVkveVUDFYgKHBYTJzIsrw7oW/0WfFZ4bbVIYPNrALQ856V3 FSfg== 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; bh=VCWf3s5Lsd8r6Y8q0SB/0npjrt0ISnJGdBsvuDoxvK8=; fh=2nhVWB0fZ+8YH0lLFpnF/Mo8eq+n1VMLe+b+IpvS0g0=; b=YtBepQ67X3UB8Q0M/Ow0p3xKV9rnpTB6BI0miE1GQ9jhHNFqBX73hxlCx1B19iiYa5 hZsjUA78IKhmU/2vgw8eKFZeKR4VbStDyxHbzZcxCQi1hNv6R8LmSnvAk5Zm+tl/cufJ qkV7Xm7Xazr7W1MFzspUOFKikvMPctILx7xMJi37Oei4PVNjUKSp5ztkFO56SCcWvi9g xmQ5SBoMN2gGomFtZaaPdWh5gKlABWHH8D7exsh225vvFkvynTkRSCJg4CWImzqE2Ctd lrEIPwfLIzmjKSkZLRwIWta4Xf1L6dMQs58P3apv/elJ5Uv82h3UJNDtkw3lsjfn2fLv AO8g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id w6-20020a636206000000b0056aa105b6a4si10019712pgb.79.2023.09.13.09.40.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 09:41:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 91FC581C9AF9; Wed, 13 Sep 2023 09:39:30 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229472AbjIMQj1 (ORCPT + 99 others); Wed, 13 Sep 2023 12:39:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230441AbjIMQjL (ORCPT ); Wed, 13 Sep 2023 12:39:11 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 437541BCE; Wed, 13 Sep 2023 09:39:07 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 43985C15; Wed, 13 Sep 2023 09:39:44 -0700 (PDT) Received: from merodach.members.linode.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4845B3F5A1; Wed, 13 Sep 2023 09:39:05 -0700 (PDT) From: James Morse 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 Cc: x86@kernel.org, Salil Mehta , Russell King , Jean-Philippe Brucker , jianyong.wu@arm.com, justin.he@arm.com Subject: [RFC PATCH v2 07/35] x86: intel_epb: Don't rely on link order Date: Wed, 13 Sep 2023 16:37:55 +0000 Message-Id: <20230913163823.7880-8-james.morse@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230913163823.7880-1-james.morse@arm.com> References: <20230913163823.7880-1-james.morse@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 (fry.vger.email [0.0.0.0]); Wed, 13 Sep 2023 09:39:30 -0700 (PDT) X-Spam-Status: No, score=-0.8 required=5.0 tests=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 fry.vger.email 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 derefernce 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 --- 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.39.2