From patchwork Thu Mar 16 16:42:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Roger Pau Monne X-Patchwork-Id: 13178046 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49346C6FD19 for ; Thu, 16 Mar 2023 16:44:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230375AbjCPQoB (ORCPT ); Thu, 16 Mar 2023 12:44:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230414AbjCPQoA (ORCPT ); Thu, 16 Mar 2023 12:44:00 -0400 Received: from esa3.hc3370-68.iphmx.com (esa3.hc3370-68.iphmx.com [216.71.145.155]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B627AD3D; Thu, 16 Mar 2023 09:43:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1678985022; h=from:to:cc:subject:date:message-id: content-transfer-encoding:mime-version; bh=0h27xBPArc+93u2anT6giWJ02zaElwMA6WGZ/NA2wWc=; b=I6dj/9okR9v2TUeNLDGYkHZkaQISHyTPRKTcfrDB4BSvQiAma5axzkaM Q3eubuMJ0+2u9fQc5Z847/2TW1jRPbMrLVsXt0OSrZVGbVguX5EMLqXWW 6T7DskqUerMx6dCDVEdL7xJmITz0UgAiETjZRuD/pFZNvfrvgIFtTMQWp 0=; X-IronPort-RemoteIP: 104.47.74.49 X-IronPort-MID: 101152086 X-IronPort-Reputation: None X-IronPort-Listener: OutboundMail X-IronPort-SenderGroup: RELAY_O365 X-IronPort-MailFlowPolicy: $RELAYED IronPort-Data: A9a23:gwb1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kZS+CWSjna98sfIE4HKVA/BIvqsIpHe+ibOA1kFWo9TfjLztsJcodlnq1Tmc/I5 je2XUow4F7+g2DXbAyBcnFLdrziR9B8oGg9MChqOkyns0XPeq6q5aYbMpExLb8u8bQ/yeYuF 6VUPcKdHv5IVzLLvSwHaoXwp5BjcxLtgh+SOy2iY340eJsIqxH1x+IItzDHrEEmZhdbf+Nny 1F8/ms3maY+ejk= IronPort-HdrOrdr: A9a23:Nkf1qa7aPy9MB+8goAPXwATXdLJyesId70hD6qkRc20vTiX8ra qTdZsgpH3JYVoqKRQdcKm7SdS9qBDnhOZICOsqTNGftWDd0QPCTL2Ki7GSpwEIcxeeygc379 YYT0ERMqyWMbFMt7eB3OB6KbodKRu8nZxASd2w8548d3AIV0i51XYINu9AKDwJeOCaP+tEKH NB3Ls3m9LOEU5nEfhTz0NqY9T+ X-IronPort-AV: E=Sophos;i="5.98,265,1673931600"; d="scan'208";a="101152086" Received: from mail-bn8nam04lp2049.outbound.protection.outlook.com (HELO NAM04-BN8-obe.outbound.protection.outlook.com) ([104.47.74.49]) by ob1.hc3370-68.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 16 Mar 2023 12:43:10 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YxAM+vcZJVkPHNmAS0LEekjTgYauiQ1Lx42/O2tbOp/POzsuNXkGHGacstzo8L3Nxxeu3qrOlj/A0NeSPuHtWp1fKdMtO/KhWfLj+JA71MHA+RpNgCJ180lC6mr0t775SYR1ef3GXI2edxCO9wszpcc8ATPcs6x6j/KQmoEHecbURVAVaOR/Ft4v7BFQuREE3oEcfKw64pp6rhBgaxTsUNqoPwj5GTjTIzfZIiTmW9uaPkIj6GQpAa6MSdkO1WPImCO3IyPyO5GdunY0LuG6Z4/BMGdZxUoDMwJVw+Bu2RJhU0IhT6Ikyd5n4cpaGZivHAJ6PMVKOPiN/Is3SMLO4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FnsesX4MP7QQGRTtFMaZrcVrqunX9YwGekrbHQ4HpvA=; b=kABW4WmNfemYHHUGON1YauA+uZC0v+PbaNbAqnBJDHVm80WfCGXBs+pzmqV8f2JxXr5l5+N6o3rLlQY69BtyjtzY9aFgVTEFLxNxawpBAJ3hFePTcA7J/6R1ri86EOorCEfHNNDpFJcNLsFx9zTwSJeo71JZS5Af8O0yYaoSMeWLZ45qezHSLZmAq6oAM503Y0qA8Kjsj7Kp7RMQ3/tmcnDnb7bOJ548t2jAYz8XRBfM3s4t5VVkcBSPtJG3z6k/5TVja97IaNCRMTYYfDvHHCKLO5RkzNymqLPKJE1l/6ddg8H6DYn5aJ6IFKiSDz6Y+yxUxAqjIw37bVNH7/q2vA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.onmicrosoft.com; s=selector2-citrix-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FnsesX4MP7QQGRTtFMaZrcVrqunX9YwGekrbHQ4HpvA=; b=LRyn0emPlbEQUb2hVlb3r04StOTo/Mp86u2XCC6Po8xDmSCbVu2Q8qc6dpmkH3+hSXv6mroIV+/UTwCMykBxZcZ03cMbWqo8paa+DeeHMtLMPMqhyWRgl8RwQ/8Mv9Oa+Fx+Y2DtDYA868swKdIm6x8W728lTTKu5CkK+mCueWw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com; Received: from SJ0PR03MB6360.namprd03.prod.outlook.com (2603:10b6:a03:395::11) by BL1PR03MB6070.namprd03.prod.outlook.com (2603:10b6:208:312::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.33; Thu, 16 Mar 2023 16:43:08 +0000 Received: from SJ0PR03MB6360.namprd03.prod.outlook.com ([fe80::48a7:d1ab:897:acda]) by SJ0PR03MB6360.namprd03.prod.outlook.com ([fe80::48a7:d1ab:897:acda%6]) with mapi id 15.20.6178.031; Thu, 16 Mar 2023 16:43:08 +0000 From: Roger Pau Monne To: linux-kernel@vger.kernel.org Cc: xen-devel@lists.xenproject.org, josef@oderland.se, Roger Pau Monne , Juergen Gross , Boris Ostrovsky , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "Rafael J. Wysocki" , Len Brown , Stefano Stabellini , Oleksandr Tyshchenko , Venkatesh Pallipadi , Alex Chiang , linux-acpi@vger.kernel.org Subject: [PATCH v4] acpi/processor: fix evaluating _PDC method when running as Xen dom0 Date: Thu, 16 Mar 2023 17:42:56 +0100 Message-Id: <20230316164257.42590-1-roger.pau@citrix.com> X-Mailer: git-send-email 2.39.0 X-ClientProxiedBy: LO2P265CA0466.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a2::22) To SJ0PR03MB6360.namprd03.prod.outlook.com (2603:10b6:a03:395::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR03MB6360:EE_|BL1PR03MB6070:EE_ X-MS-Office365-Filtering-Correlation-Id: 7fcc2b93-16bb-47f4-581d-08db263d85ae X-LD-Processed: 335836de-42ef-43a2-b145-348c2ee9ca5b,ExtAddr,ExtFwd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LM3agCKjKzDUmTh8UZlrZ+L+/TuuqdEf8uOROi8EqdDRsWYfSKjg8jIMeOZ0LMaQBj0BkX2vjLsaMEr5J1oIuSZxv69XAUxKkNuqpUPC4uvK4Q6eEvUjN2fU5NMTc9HnxsmuQlws52HgMFGBSpu0aAroqflJHLUhqxDNPyubMKMgwl+LolXQld2czGKeC4rlX8VdHs/1+81SdpRPlR31BLytmbc94RtADUOYhawQ5PKbe5zup4KYaX09uJgtBDz7qxToBYaok04k283vH5c+//7mxWNFcJHbmdCkTL9Per6M0vQahNZCnzTbzuD/OLTrutHR8XZye/BHPM3HWffYdOfoamUXGXzMvK10pocsZ/+MwU83bsfeyWIfjuueeJ+u3T3c7XhSuTR/MgeiEOiZf0ZdkrNW26UCNvb0tifq2q5GWZPQRBFHp0TLADy3CjZ6nhoG/1PlCC8Q/QmIEXC8xcv+UFn3gt0zVjheswq8YoUuVeNmcL+JGz9d527O3OwvhFxCYObTDTiLehDHNucTJMT+2PxfP2r/M6/tx2gmu64EoLheCur/SemjT3Z/e6dQIQ7of5ysSUldA/3lphS6vKUcn72eOUkOAKw1jdwSYawXWw0m6NnHWBhQm3LSyzSNSD3t66djxXsdN9MhFlfGgQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ0PR03MB6360.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(346002)(136003)(366004)(39860400002)(376002)(396003)(451199018)(36756003)(66476007)(66946007)(66556008)(8676002)(4326008)(6916009)(38100700002)(82960400001)(83380400001)(2906002)(2616005)(6666004)(41300700001)(6486002)(7416002)(5660300002)(6512007)(8936002)(26005)(6506007)(86362001)(186003)(1076003)(54906003)(316002)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?Eii1A4ofNmPUgvAgVtsSRUNCdvzo?= =?utf-8?q?tIDicGi1XhMx17cAFOC/cv8LBMPY0SSu7fDXRDW2N7H3D76RDG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2nvzAy?= =?utf-8?q?PIeWdQxgO5BaSGsdl0hMCmDwrF04p7Ao6nGOPY/4+mFzAvLWTtdl7IGjaKiYz2d9j?= =?utf-8?q?b8eS+WPsJ0jUk9GpzbGSbO7OLxGY0YsgEzPAr3wh3/ipdvTN50sghy9a0pcgg9lUE?= =?utf-8?q?Su2+/g5id7QFqgsy0+Q+WtEJfaBlh9iY2RkKs3q4AeYcGqHMlf2UFlDNSgtdVMaY8?= =?utf-8?q?VURyEBAsr2o0TQB6rw/4U9t1w45YNYgcMY+4KZ/uNebwmojaC8ZT/vYL8sLcM4HJh?= =?utf-8?q?Z2bXZ8RIs7VTsyKksNO49vRgc3f7hMY+Qg3Zar6/q2DVoS/QLaGNSnITQO4lJAGW9?= =?utf-8?q?4AVbDsR49rGy2SutxTOMv8KJXb7UR8ltQobASActXW69lSbHCosfhvvQohvI51aNB?= =?utf-8?q?6JFnrcuC9O3SdHvd6Drg3rOx3M235xQGMEPT4SbODr/ef6pGex4sgX8ZEAxZHS9In?= =?utf-8?q?iTtUqQqtwBBATHOkPL6rMcUAyLb6jahqaMySESjA4plzZnhWfUmKOwP2/6I8I36ef?= =?utf-8?q?75ZvIlIXV7uC0h7nc5+gBgSos7oRcff/Hiq4+Mz8505nr9u1QAiWUrW+etfgvV8Qs?= =?utf-8?q?IEkwjnGm6MSmofWJdxBUNd2BGzfO8WuKtw=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: =?utf-8?q?AyzSC05f7zCLOJ3e?= =?utf-8?q?ewDepZawmXYKWFcBkGKMZtIx1qZzbE1Eb1lm2mfe9rPVhUDHclSbRHHWXQ/7bV3Qi?= =?utf-8?q?E2q8KAXucToyl/dHyW6hchf2wYJW9C1ZqG7iYCDYD5XS9jYYfl0mfsOlzK26z0RTR?= =?utf-8?q?Si7/QlLMDR661pzwXccZ8j88WUUWWskc2sNm6POUtdgn3GXwVTrcdSVGx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Swwo5?= =?utf-8?q?xQlqBk3HDJp9eYxn3hGLkOXphC5rKhMG3scRrE6KJthIm8xt7MoUKWJKPG2FVYojI?= =?utf-8?q?2ppWj5OK0=3D?= X-OriginatorOrg: citrix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7fcc2b93-16bb-47f4-581d-08db263d85ae X-MS-Exchange-CrossTenant-AuthSource: SJ0PR03MB6360.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Mar 2023 16:43:08.3509 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335836de-42ef-43a2-b145-348c2ee9ca5b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: CPD5ew/vULg0jRHJzybHXZO5K5u/qoWmhzeZSoH3/+2Vmhf9AavM8QfMKc1u1mW4uZzYCh8e07TQs6+CoDtXdQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR03MB6070 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org In ACPI systems, the OS can direct power management, as opposed to the firmware. This OS-directed Power Management is called OSPM. Part of telling the firmware that the OS going to direct power management is making ACPI "_PDC" (Processor Driver Capabilities) calls. These _PDC methods must be evaluated for every processor object. If these _PDC calls are not completed for every processor it can lead to inconsistency and later failures in things like the CPU frequency driver. In a Xen system, the dom0 kernel is responsible for system-wide power management. The dom0 kernel is in charge of OSPM. However, the number of CPUs available to dom0 can be different than the number of CPUs physically present on the system. This leads to a problem: the dom0 kernel needs to evaluate _PDC for all the processors, but it can't always see them. In dom0 kernels, ignore the existing ACPI method for determining if a processor is physically present because it might not be accurate. Instead, ask the hypervisor for this information. Fix this by introducing a custom function to use when running as Xen dom0 in order to check whether a processor object matches a CPU that's online. Such checking is done using the existing information fetched by the Xen pCPU subsystem, extending it to also store the ACPI ID. This ensures that _PDC method gets evaluated for all physically online CPUs, regardless of the number of CPUs made available to dom0. Fixes: 5d554a7bb064 ('ACPI: processor: add internal processor_physically_present()') Signed-off-by: Roger Pau Monné Reviewed-by: Juergen Gross --- Changes since v3: - Protect xen_processor_present() definition with CONFIG_ACPI. Changes since v2: - Extend and use the existing pcpu functionality. Changes since v1: - Reword commit message. --- arch/x86/include/asm/xen/hypervisor.h | 10 ++++++++++ drivers/acpi/processor_pdc.c | 11 +++++++++++ drivers/xen/pcpu.c | 21 +++++++++++++++++++++ 3 files changed, 42 insertions(+) diff --git a/arch/x86/include/asm/xen/hypervisor.h b/arch/x86/include/asm/xen/hypervisor.h index 5fc35f889cd1..990a1609677e 100644 --- a/arch/x86/include/asm/xen/hypervisor.h +++ b/arch/x86/include/asm/xen/hypervisor.h @@ -63,4 +63,14 @@ void __init xen_pvh_init(struct boot_params *boot_params); void __init mem_map_via_hcall(struct boot_params *boot_params_p); #endif +#if defined(CONFIG_XEN_DOM0) && defined(CONFIG_ACPI) +bool __init xen_processor_present(uint32_t acpi_id); +#else +static inline bool xen_processor_present(uint32_t acpi_id) +{ + BUG(); + return false; +} +#endif + #endif /* _ASM_X86_XEN_HYPERVISOR_H */ diff --git a/drivers/acpi/processor_pdc.c b/drivers/acpi/processor_pdc.c index 8c3f82c9fff3..18fb04523f93 100644 --- a/drivers/acpi/processor_pdc.c +++ b/drivers/acpi/processor_pdc.c @@ -14,6 +14,8 @@ #include #include +#include + #include "internal.h" static bool __init processor_physically_present(acpi_handle handle) @@ -47,6 +49,15 @@ static bool __init processor_physically_present(acpi_handle handle) return false; } + if (xen_initial_domain()) + /* + * When running as a Xen dom0 the number of processors Linux + * sees can be different from the real number of processors on + * the system, and we still need to execute _PDC for all of + * them. + */ + return xen_processor_present(acpi_id); + type = (acpi_type == ACPI_TYPE_DEVICE) ? 1 : 0; cpuid = acpi_get_cpuid(handle, type, acpi_id); diff --git a/drivers/xen/pcpu.c b/drivers/xen/pcpu.c index fd3a644b0855..034d05e56507 100644 --- a/drivers/xen/pcpu.c +++ b/drivers/xen/pcpu.c @@ -58,6 +58,7 @@ struct pcpu { struct list_head list; struct device dev; uint32_t cpu_id; + uint32_t acpi_id; uint32_t flags; }; @@ -249,6 +250,7 @@ static struct pcpu *create_and_register_pcpu(struct xenpf_pcpuinfo *info) INIT_LIST_HEAD(&pcpu->list); pcpu->cpu_id = info->xen_cpuid; + pcpu->acpi_id = info->acpi_id; pcpu->flags = info->flags; /* Need hold on xen_pcpu_lock before pcpu list manipulations */ @@ -381,3 +383,22 @@ static int __init xen_pcpu_init(void) return ret; } arch_initcall(xen_pcpu_init); + +#ifdef CONFIG_ACPI +bool __init xen_processor_present(uint32_t acpi_id) +{ + struct pcpu *pcpu; + bool online = false; + + mutex_lock(&xen_pcpu_lock); + list_for_each_entry(pcpu, &xen_pcpus, list) + if (pcpu->acpi_id == acpi_id) { + online = pcpu->flags & XEN_PCPU_FLAGS_ONLINE; + break; + } + + mutex_unlock(&xen_pcpu_lock); + + return online; +} +#endif