Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp5983796rdb; Sun, 17 Sep 2023 23:26:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFocPiP6qd8kpMe5jls00SmQ30q/LGPAXe2vhetVlyZ8vGnSsKV6VYhdf94sAjLOhPuDQsV X-Received: by 2002:a9d:6657:0:b0:6b9:e35e:8dd with SMTP id q23-20020a9d6657000000b006b9e35e08ddmr9020320otm.2.1695018386786; Sun, 17 Sep 2023 23:26:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695018386; cv=none; d=google.com; s=arc-20160816; b=CVqB5/ojL1/t6wwZHgrRpP49bSPvlrISWChihrLIju3mSr+DcI0o6DeIVIA4B0ETjy r861z7mAMgzH+tlmnaEhJuqVsJU38P/+f9aiCGf/P6rLSoQK7ToqVJh/iHxSXS2OT67F 6Z7mFKWROSzY1v1ujIy5u5viHyDildmDB0UG8sd+u5cxu1RVnM9a0uRyUIPObRlpHpFf 23uO+6g9DDeNaUTBL4zUYEaf22Jr8ISNw1WcIMl6ANAK1c+C2yam/QzCxF+KUDMnIUPV NDcjBY7VKAvTPece66QEdftcNtueJ2m9n5MDQygZOumHFyfkgZ9lOf6okSvqwgU0oSpy zulw== 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=RvD4w7PAsOCgYRxHcY6j9ap1d1nMri/tShexuoBxwd4=; fh=PXJ1nrAkwnzNPHtj0xILXFW28d5sEdNuBWEBRL0T4wA=; b=HZ3Go6d9+nYuiu3Q/7cDXmSU9im5B71w5FVXPDCaRi3Srk5RQ2+GryyksmLGvYVHtf xSEzfwiMdksTxN217niBxvlIqSr+tunvHAGUyV5pVdC08wlmTZLWVeTohFAMH0FQ6Lfz Ot1jM31OdxfXBvBchDfZQXCmgPIwZ5fSp1LA8YHSQohUP/PiYDX52c9+QVjFDJUb+43U 14+j7yukBmTanxm1xu89PEsCSPwj7uSkz/nBuaynggsFqujuIIFDlLCL4i6iRBdbZUti 1yTjEviaYkCJh2IKsykzuNGumG347gN8QZ8vmJueFLI5oAgUk3IEbG+Y4xrJ5vUVt89w YE6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XiXQe0Tq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id b26-20020a6567da000000b00577f59c8a12si7485829pgs.847.2023.09.17.23.26.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Sep 2023 23:26:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XiXQe0Tq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id 7F39D80CCD36; Sun, 17 Sep 2023 22:13:44 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239591AbjIRFNL (ORCPT + 99 others); Mon, 18 Sep 2023 01:13:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239838AbjIRFNI (ORCPT ); Mon, 18 Sep 2023 01:13:08 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 378A811C for ; Sun, 17 Sep 2023 22:12:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695013937; 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=RvD4w7PAsOCgYRxHcY6j9ap1d1nMri/tShexuoBxwd4=; b=XiXQe0Tq2Q7TzAKV8sGV5Gt4DLnRaGOD+pew9f8/0l/9wA2cJbOERJQY9++spBTaq6/zso cCSSTWbyJ8+YdSeYSQoU9exUcTgI8vra3HkLT9wfZAwSxPGWhJ7tXgvdoHN3P+t4liydbc 9W9+6k790ArsLwBBdE1RQTfOYD9XC6Q= 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-640-jWyI4_i5PDiM4BfVFF9vCA-1; Mon, 18 Sep 2023 01:12:15 -0400 X-MC-Unique: jWyI4_i5PDiM4BfVFF9vCA-1 Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-1c43cd8b6cbso17367215ad.0 for ; Sun, 17 Sep 2023 22:12:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695013935; x=1695618735; 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=RvD4w7PAsOCgYRxHcY6j9ap1d1nMri/tShexuoBxwd4=; b=Pefqj1kWcNA1xs3WvPnx+t1vYrW29crjTxtx5RKh60zVD2buUbhHWlqHoDrBTYb2Vk l95yUMTLLUhNqUyYvBkSI4qrrA/BxFpIwPEau9GsRs/mltzXyodx0xMDl7ugtgFOUqhk Giajifaw6ZB2L/gKCU0UMTgeVQ+KKw3+pGJwdvotL0ae7TyvQkZ5/Pw3UdufnVrx3L3I JLKZBUOl4Fj2yCRPS0nr9L0wkycnb0oGF/wXrfANy78A9XaZXgs3g4fUXw11XsTUOZM5 RkNlFMFxqDtq+637HA+hSaBMsbbxZya+BgDzBeH5F5M6SHTZg6BHxOkgTTYYsYkA0Rar h8Fg== X-Gm-Message-State: AOJu0YwBq9kj+YdCB+hh2DZemmqJfLKcLcs46/UiLQ8x5A9ypRh6KJzL ojt/UZIUP/Lz7KLF+0aB73zrUwbs2LTs1JIp9uTLxYHU+a0PeMJ3GLxwPfBI7FT+mHdmA5WGIUq pIxaf+L94FC84spX+7JN2vcPi X-Received: by 2002:a17:902:eaca:b0:1c4:7c4:b2e9 with SMTP id p10-20020a170902eaca00b001c407c4b2e9mr6684100pld.43.1695013934902; Sun, 17 Sep 2023 22:12:14 -0700 (PDT) X-Received: by 2002:a17:902:eaca:b0:1c4:7c4:b2e9 with SMTP id p10-20020a170902eaca00b001c407c4b2e9mr6684091pld.43.1695013934621; Sun, 17 Sep 2023 22:12:14 -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 l3-20020a170903244300b001b80d399730sm3243326pls.242.2023.09.17.22.12.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 17 Sep 2023 22:12:14 -0700 (PDT) Message-ID: <82ce8528-49ae-3937-4020-0666fe416c0a@redhat.com> Date: Mon, 18 Sep 2023 15:12:06 +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 16/35] ACPI: processor: Register CPUs that are online, but not described in the DSDT 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-17-james.morse@arm.com> From: Gavin Shan In-Reply-To: <20230913163823.7880-17-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 agentk.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 (agentk.vger.email [0.0.0.0]); Sun, 17 Sep 2023 22:13:44 -0700 (PDT) On 9/14/23 02:38, James Morse wrote: > ACPI has two descriptions of CPUs, one in the MADT/APIC table, the other > in the DSDT. Both are required. (ACPI 6.5's 8.4 "Declaring Processors" > says "Each processor in the system must be declared in the ACPI > namespace"). Having two descriptions allows firmware authors to get > this wrong. > > If CPUs are described in the MADT/APIC, they will be brought online > early during boot. Once the register_cpu() calls are moved to ACPI, > they will be based on the DSDT description of the CPUs. When CPUs are > missing from the DSDT description, they will end up online, but not > registered. > > Add a helper that runs after acpi_init() has completed to register > CPUs that are online, but weren't found in the DSDT. Any CPU that > is registered by this code triggers a firmware-bug warning and kernel > taint. > > Qemu TCG only describes the first CPU in the DSDT, unless cpu-hotplug > is configured. > > Signed-off-by: James Morse > --- > drivers/acpi/acpi_processor.c | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) > Reviewed-by: Gavin Shan > diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c > index b4bde78121bb..a01e315aa16a 100644 > --- a/drivers/acpi/acpi_processor.c > +++ b/drivers/acpi/acpi_processor.c > @@ -790,6 +790,25 @@ void __init acpi_processor_init(void) > acpi_pcc_cpufreq_init(); > } > > +static int __init acpi_processor_register_missing_cpus(void) > +{ > + int cpu; > + > + if (acpi_disabled) > + return 0; > + > + for_each_online_cpu(cpu) { > + if (!get_cpu_device(cpu)) { > + pr_err_once(FW_BUG "CPU %u has no ACPI namespace description!\n", cpu); > + add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK); > + arch_register_cpu(cpu); > + } > + } > + > + return 0; > +} > +subsys_initcall_sync(acpi_processor_register_missing_cpus); > + > #ifdef CONFIG_ACPI_PROCESSOR_CSTATE > /** > * acpi_processor_claim_cst_control - Request _CST control from the platform.