From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0D1F9CD37B0 for ; Mon, 18 Sep 2023 03:49:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Jv4Zv7k6+fAnNv4b9/SjHzSo9dKsy2oqVw05LeROlW4=; b=r+DZCMEGeHqqbX svStKh0Ck8NmqG8ZNgAbomZqZ+Ay/Urq1tSYf2DbYVjRN6KiY+USFXEzHlox9hW3wvhDtV6BNYZRJ Q+4Ow0EZIsMzY1X9kRMc2gOkhvU5LhzQoMxsW3gnFsKDVvsRn/AHOLER/5VfxtQWq4jD9yfKTWcWs 6gC+iCUjEmti1sE8X7M5o52M+UgFc8M1JlMdIPdSPNSOWFMQI8vHd4XS7B040wWi6FYSr36Em8aU+ FYyI2f5GCiPCDSvJmgPDH+XvXrmnyBnb273J7IPSE2MZzWVO9Tmm0iNcHOou7hXKmFlpTMJQsmkQk 3dkcfBk3CUyzjHl0R68w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qi5Fs-00EJfV-2R; Mon, 18 Sep 2023 03:49:00 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qi5Fp-00EJej-2o for linux-arm-kernel@lists.infradead.org; Mon, 18 Sep 2023 03:48:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695008936; 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=FLZUGeW9Mbxhb+kIOs743Mp42E7hnmSAGBEp9F95zONVpTdCNw0VaX8reHPWonnAUvr9PI H9oUxF42485wfRmEspAXUtgVDoq3+2su6WQdxv6SyQaTV0VzNTBuzfNkN0L4E6TcDa8Sos CHuFe6JRtChFCjmTWeQR3Td3m1wd/FA= Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-99-vzfybYEOOuCDBta4gKN72w-1; Sun, 17 Sep 2023 23:48:55 -0400 X-MC-Unique: vzfybYEOOuCDBta4gKN72w-1 Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-1c443fdfedbso14898015ad.2 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=EXSwY9iaHDeaozwPbl2UHsDZbRgOfFOY3aXX2KitY3o1smhcpImQcDmbzdQeuQUi/H aRJCnANI0ZrubICM/tR9dENcGQLEqiAWQJC6V7WYa0vFByXIIBF+AnLZIwTHUxOeCSNs rxJQBuyC88I/MZA8NhQ7VFZnvEWP1FUwq6CsSq8mLojsRcnV2L7C2eLCln6qF2yDy7Xf 4aPPdF+LKhnwjpBVgDjeqLhPpmGWvd33KcDZqOq9Pb4q9DBlyEYoRTopcUIGBwXwIvu5 HeWuBGh52rXWeNvl2zkZciPWzeMRp7TUHYxWPjA3Lnr3wAUi+QzzdUmsb5C2IqlE+zNM 0Oaw== X-Gm-Message-State: AOJu0YydYjrvyCxLBK/NscI4VFj+FMeR/7qCQDC18t6QVb/YDrr5sScP szDLREHFPlKLlsY2kTfH+1b5fusl2UJdhT05HA2DpLxq0gbPLy9HS0yTWwerJWAQCuejrmwkgBj D9k39vUGF559WYHgh47TH0eE1XLgT2yvN/hI= X-Received: by 2002:a17:902:e551:b0:1c4:16f7:d95b with SMTP id n17-20020a170902e55100b001c416f7d95bmr8120389plf.63.1695008934603; Sun, 17 Sep 2023 20:48:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHU+J6/1r/Ic+5ZZYMQ4fGS+99Vl+z2dkdnv17BDJt0rP24HSwlnxKPxSwy3c72dz81jLm2Bg== 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 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> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230917_204857_999157_18D2137F X-CRM114-Status: GOOD ( 19.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel