Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp6073128rdb; Mon, 18 Sep 2023 03:25:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHv9nAwbQxHkB/5WdECuvWqMH9T2iI1/anZ6HMx/SgR4E9TdOyg+AJHoYX60XRwUlDsOxR7 X-Received: by 2002:a17:903:1112:b0:1bf:34fb:3085 with SMTP id n18-20020a170903111200b001bf34fb3085mr8997572plh.14.1695032708655; Mon, 18 Sep 2023 03:25:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695032708; cv=none; d=google.com; s=arc-20160816; b=XfmMcJvbvNsfEqrfayiY0OVbKeXhfHeZsMT7V7lEPU3nlBRRwfJ1M9GrbiQulFZd1a sXh6xEsZWMAAVyc3f76+pDjMX1WUddhcn3l4fMUqMN6Qi+vg57VkXTjvz3dxAcFoiMwo Zr4/bE2L7T7hLwBd7XJTS34YfowbFsalVXXH4qD3EPl8TRnWn/O6WfM87lkEy5TdsGBd lTQUZ1ECf2ctenolUzHUr4F9PPUotjInoFaa5GnzVwzKYhfbgwoB6dkUN+cj5ejxoHfk irwcVyiznw6eOxogkUGO8+S7T67cPvZXXEtgsTL2eFvfC2KcXUM7mZOw3iGj2nFq13qF fvIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=tf1afM7/bTwRaF6MhWk6NmsY4pxpFUisMFOko6iFoOg=; fh=PXJ1nrAkwnzNPHtj0xILXFW28d5sEdNuBWEBRL0T4wA=; b=vPfjR/Tankb3f1uaEUGQm+0nTe45RnbK/5d4thhopmF0eWVQxBML48tPZkRl5/Q9FB pR8fBm7EFOoTdS5HzisPsYW48qwROzQ8P660tSoGArQS9RdqrObbfX3Bdav+KFm6+9Y1 dK0wfMq6sIWlLSEE6BRQgtZpcqcuXbgJ+RDTryIX2jQYf7/4JJavqd82z+k+XDyZvVcI 6LjMKpsDkHfbQsmCQ02C3c1KbXPAKB3oS/nnks0ioD3a+CP+EraItQ6ZPpSwXJ0aybBG JGiTuxmYjzYutnIerIhIV7ef/OtBMl1MMwOB64SQrxkoWr1DVxFOAOLDpLmDKkyqRebB ICdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RmK6mqbq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id q15-20020a170902a3cf00b001c3fa95ca18si7286737plb.333.2023.09.18.03.24.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 03:25:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RmK6mqbq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 4AE64801CEE6; Sun, 17 Sep 2023 20:50:26 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237014AbjIRDtx (ORCPT + 99 others); Sun, 17 Sep 2023 23:49:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239512AbjIRDtn (ORCPT ); Sun, 17 Sep 2023 23:49:43 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C49A3E6 for ; Sun, 17 Sep 2023 20:48:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695008937; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tf1afM7/bTwRaF6MhWk6NmsY4pxpFUisMFOko6iFoOg=; b=RmK6mqbqchmt5lYaE+aVLfYL3xLWUS5jHqRp7sAXOyajK4bn8yEjvdkSQRbq200WYSv/KO bBIFn/skeIo9ifvzbcFkn/E8WL6FZ/lZcgq+OJPKoXI3dZJorf2HNqQu8Eb/n2SOYe5v6a GPu+fXxhXzeYkPBXQ/qKMm5CWax3iPk= Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-85-SGTjx9Y1Pvm88MrZxnYzSg-1; Sun, 17 Sep 2023 23:48:55 -0400 X-MC-Unique: SGTjx9Y1Pvm88MrZxnYzSg-1 Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-1c450fd8e01so9117085ad.3 for ; Sun, 17 Sep 2023 20:48:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695008934; x=1695613734; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=tf1afM7/bTwRaF6MhWk6NmsY4pxpFUisMFOko6iFoOg=; b=mOeh5SmYauS4kdoHDBQ5oPJuvFkQxi4biNYNzo55FuoC+IHNAMELpIZPadlIWE3n8b MtecO597s9rWOcGhH8clLpIfRgPOEbdHbkFd26Thi4BO+59kDEYq34ofzLSDMA3/GU6J pbj3obVlq+nxA4NNi+yaEyH+bJbyKWXLtFfw4RhBWLnXFD9IZ0rxsZRfAhAWaGaq60rH rL5mBE3navzLdo02A23dOIvcf1q2mYdyUr7tN+zDQc7MAnWjD3uEhgM5CEXO1XYsudLE iBhABiKnwwprv3yQ1arqbJTGTa6ZCmRtJQhHpGHq1nfjktbg4wqapPIAh3V6y548Bu4G oWuA== X-Gm-Message-State: AOJu0YzT6bRsbBvwAiqM2KGY/ZyG1yl4XV63rF7uC7C+mcoZL5S0BBwM KmTdyCusc+2xok/f1j+Gs5BWv5yqTX9M1jmRqpwaZX2OU60qdQpDYaS0uW/Kf4MzrCBmDnEVdnZ 9wWDi0oxSkW1p6J13aHx8FHh8 X-Received: by 2002:a17:902:e551:b0:1c4:16f7:d95b with SMTP id n17-20020a170902e55100b001c416f7d95bmr8120385plf.63.1695008934602; Sun, 17 Sep 2023 20:48:54 -0700 (PDT) X-Received: by 2002:a17:902:e551:b0:1c4:16f7:d95b with SMTP id n17-20020a170902e55100b001c416f7d95bmr8120381plf.63.1695008934370; Sun, 17 Sep 2023 20:48:54 -0700 (PDT) Received: from ?IPV6:2001:8003:e5b0:9f00:dbbc:1945:6e65:ec5? ([2001:8003:e5b0:9f00:dbbc:1945:6e65:ec5]) by smtp.gmail.com with ESMTPSA id n10-20020a170902d2ca00b001bbf7fd354csm7284723plc.213.2023.09.17.20.48.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 17 Sep 2023 20:48:53 -0700 (PDT) Message-ID: <4f368470-83c1-4140-9d0f-e64db3402865@redhat.com> Date: Mon, 18 Sep 2023 13:48:47 +1000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [RFC PATCH v2 07/35] x86: intel_epb: Don't rely on link order Content-Language: en-US To: James Morse , 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 References: <20230913163823.7880-1-james.morse@arm.com> <20230913163823.7880-8-james.morse@arm.com> From: Gavin Shan In-Reply-To: <20230913163823.7880-8-james.morse@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.3 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,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 morse.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 (morse.vger.email [0.0.0.0]); Sun, 17 Sep 2023 20:50:26 -0700 (PDT) On 9/14/23 02:37, James Morse wrote: > 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. ^^^^^^^^^^ s/derefernce/dereference Reported by ./scripts/checkpatch.pl --codespell > > 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); Thanks, Gavin