Received: by 2002:a05:7412:e79e:b0:f3:1519:9f41 with SMTP id o30csp165575rdd; Wed, 22 Nov 2023 12:12:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IHu6/Qw3KwAlKO7aenKlFwMIlfuLxSaSQuxmrZvT0ydJqoCb7WITr2HYWD72/WkZ7Nu5ue0 X-Received: by 2002:a17:90b:38ca:b0:27d:f711:112e with SMTP id nn10-20020a17090b38ca00b0027df711112emr3947161pjb.45.1700683951228; Wed, 22 Nov 2023 12:12:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700683951; cv=none; d=google.com; s=arc-20160816; b=NV/bgxidJKaB4wJIehZx/q9bOD8gReXffUtoi1gNZ/4BGl/OLzr6FluqIEkm1pyoqR yv9ZX9/TCTUCv4YnTRCNIVwdQ3ecEQilOGBDFVynhcuqUZ8TPQ406S9Xlc1P+AwDgaDT EKR+EPUi7/QV4AqZ+Qdv+/6YQruI3BgsPpfz234vTfxEY1EAvuAj6oDFWWQBlOIGdyov IqZbaxLWN6cAhucJHB/mWMsxYiYcoYazGxOYeKq80rY1jk5d3HmGtgqxSM+qQb5UWUvw o+M+r9wWBdkLnwH6MHQ4wBnrMxEwmARzUTMxDerbs7f8wWZLhYq4IzRl5fr/goriJoCM BqFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=EUc1kNzgvBLGYRu/rkonm6DDPZkTeQzFiTMrjnDyrY8=; fh=e5a54vEr1x3zSxaSTpSeL0hLutjLhfIQavU7m0RgMEg=; b=n+i5Ezxh53wbbWgatWuF5XmB4GuFuJfSGZvAdxFyhqzKuHM4PN1r4Tlivhb6Pv0YCK o4rJqSM9hv1zYoi0idN7x3axxV7rYqONHnIYPe7ctDstdpC1ENcstZ7NiSk6U3alFjZQ PVDP/HjhWLYsKbHosagHnQi83S/ejsRkor+2NnhbaG5B78K3oN8WPxxgJ0Fp+qi1CLET jsU/s3ju5VZRYEZWnnpFYF9y/zib9GYPq6q/cqerJaYU2uSoOGpXp3OCYwwb8VOer93+ NazVv23hagQ55SIBHXpSxKzbl/S3qsXdK89ysjdjshhdmDm2afNq+KSpbwpTpdgHTp0U 4wpg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id y6-20020a17090a474600b0028516fe2bffsi313818pjg.186.2023.11.22.12.12.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 12:12:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 9BE4082664A2; Wed, 22 Nov 2023 12:12:28 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231767AbjKVUMV convert rfc822-to-8bit (ORCPT + 99 others); Wed, 22 Nov 2023 15:12:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230377AbjKVUMU (ORCPT ); Wed, 22 Nov 2023 15:12:20 -0500 Received: from mail-oa1-f52.google.com (mail-oa1-f52.google.com [209.85.160.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14F23A4; Wed, 22 Nov 2023 12:12:16 -0800 (PST) Received: by mail-oa1-f52.google.com with SMTP id 586e51a60fabf-1d542f05b9aso30635fac.1; Wed, 22 Nov 2023 12:12:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700683935; x=1701288735; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hRAUhzzHnP+XZxzQEXs8TfAKCs5HsmLQBIFGrTTFm+M=; b=J932pq15PT2CkREZCSSNK0BlpQ0nqyfU+osRNkVIv3m87wFFPEovtx968w3ftk0mrR L4BJjIXOmkY3RasRwH2E4xZO9jCM1zIdVITtVND9wfwmf9KTZo6AbAaJg2ahocJbgEJP m9Ogi/7pgWxW7e5JL7XLI6aAdofpE0Lgu0HN+YIgvEtJhAjukunww7j7Fce3cNFvRRKH Vm/E11BfpPS1ZTW6/sWS+Wi7sgtlW17oYIMqq/48VwGC3Z+/1+qLoZgadILNEyFcgOFU m1q7StboXi64wXeLFB+302Rbsvrnkbji6zf483imMzQvQKawJbcP2kAReb/qGNLljMoM Mvvw== X-Gm-Message-State: AOJu0YyPK8bkC9ADQ/dhTSY789AKLC2Pe78CyyhPxQ2Vt5CM789NFZ4g KRX6YSzf7Lwud5nlfKxe2pWSPlwaMCUtiKsdwRU= X-Received: by 2002:a05:6871:a58b:b0:1ea:1510:d8df with SMTP id wd11-20020a056871a58b00b001ea1510d8dfmr3742289oab.4.1700683935194; Wed, 22 Nov 2023 12:12:15 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: "Rafael J. Wysocki" Date: Wed, 22 Nov 2023 21:12:04 +0100 Message-ID: Subject: Re: [PATCH 02/21] x86: intel_epb: Don't rely on link order To: Russell King Cc: 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, 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" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.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 (groat.vger.email [0.0.0.0]); Wed, 22 Nov 2023 12:12:28 -0800 (PST) On Tue, Nov 21, 2023 at 2:44 PM Russell King wrote: > > 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 > Reviewed-by: Gavin Shan > Signed-off-by: Russell King (Oracle) Acked-by: Rafael J. Wysocki and I'd suggest sending this separately to the x86 list. > --- > 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 > >