From patchwork Tue Mar 21 14:19:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 665946 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 A44FAC74A5B for ; Tue, 21 Mar 2023 14:19:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231178AbjCUOTT (ORCPT ); Tue, 21 Mar 2023 10:19:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230232AbjCUOTS (ORCPT ); Tue, 21 Mar 2023 10:19:18 -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 A184212BE7; Tue, 21 Mar 2023 07:19:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1679408356; h=from:to:cc:subject:date:message-id: content-transfer-encoding:mime-version; bh=5LmAvDBTWRDOqdDmpDUoEIMQDZqxfw78ew8VuXI53No=; b=esZOIiP3dZFh5HmxJqqUvD7udDkqVfXWvygP/Ve4RB6vTv6VE9bEFsY6 lEah4zbc4y9lzJtog08JswmRGRHUt5wZnxk0HTpDQVM+CqwLez+8u5vKo YjJ0bkC+M6mpAd+eM79w3B50b7ZNK0rus8GL4ZGnGIV1ZHXZz9Xc7lD57 4=; X-IronPort-RemoteIP: 104.47.55.177 X-IronPort-MID: 101716948 X-IronPort-Reputation: None X-IronPort-Listener: OutboundMail X-IronPort-SenderGroup: RELAY_O365 X-IronPort-MailFlowPolicy: $R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wE0U9Nmy2Nm /43CidA40w3vDHWCsUPzbMuEA== IronPort-HdrOrdr: A9a23:LCc9BaO4IiRHNcBcThajsMiBIKoaSvp037Dk7TEXdfUnSL38qy nIpoVg6faUskdrZJhOo7G90cW7MArhHNtOkPEs1PSZLXfbUQiTTL2Kj7GN/9S6IVyAygc178 4JGMISZLLN5BpB/KDHCWKDYrQdKbe8gcSVbKvlvhRQZDAvT6lh6gd/BEK/EldqLTM2dKbRDK DsmvavuQDQBEgqUg== X-IronPort-AV: E=Sophos;i="5.98,279,1673931600"; d="scan'208";a="101716948" Received: from mail-bn8nam12lp2177.outbound.protection.outlook.com (HELO NAM12-BN8-obe.outbound.protection.outlook.com) ([104.47.55.177]) by ob1.hc3370-68.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 21 Mar 2023 10:19:14 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MSU8oulaMZ1ptrCSz+h5oWjKWq5IJiyTZtONuEAF1JXv/+RTJhfPEtUNwBucfEvyhYeCc7632bLZ+2hbPtcmxAmv+B4b2crbAFti9sZpqgK50DfmyfdqnSNICyLTlNoJYbncJK567N24/doYgbdGOAosOqwLtknFbfhlen1aqZyjUbgPVO6qdUpE74evq6JQDKpAh7pESJK8dTzr+zN9AlbwlAcjlqry2sttigDIPHJAYsI24iSFWyeuQsYOQoVf+FQG+qQEhrh2Zsy98x++WnqWRrrdHfrd/VwxWEAjqsA0+gzLmLkMcTOHKQk1JDM789sprH7QUzT7iGgWWydW+Q== 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=pVwGHov7/G5EPBSgvaEw0y/gpmVnGy2Bpc97qeTApaI=; b=MZ4kNbf85dPdDLwGp6Qqdc6Ij4i/Jk6gd6DRQIif3ar+fY+QyaNNv6QPPE74hQkF/cGTAg2v85oTwd0vJbtrqcvDADnBVycsYrq8okdTfBRi/GoPf6EMqdsmGjGMeV0PJL+7Ma4RoQpXPQddoWWSE8I1tV4vA03ZXDbT9FW+ZyqNI5zU+Zpd6kAkIT1zMDQgQ394mMDbiCZex4NBvdsuuF6JeHbt63roRmCG9goHUXA4SWAwwKYtNQV0ApW3RhAu5dU2xsM7AA+6P9Cr3SM5jQAwrJgkk6I8xkDN2YuJhDl0TM24qsa12OrEjCEp9qw5gVj6nFkfhiHk/oz2m6gxnw== 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=pVwGHov7/G5EPBSgvaEw0y/gpmVnGy2Bpc97qeTApaI=; b=v44X4u7yCOujmg0wLYoSb9FQjIRQEwnNTZOscJhagPDGHrcqK0zH/+Og8TVulAAih63v3qTAjg+e/nYsxc9EpJZe9dHFUsyP7mgoaGrPlS6f5CKwpEwneJdOLlPNK2fzK/e5NSt12WvBE5sOliQjnqdjixjWEvh9KrIuayoj17c= 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 CO3PR03MB6775.namprd03.prod.outlook.com (2603:10b6:303:175::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Tue, 21 Mar 2023 14:19:11 +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.037; Tue, 21 Mar 2023 14:19:11 +0000 From: Roger Pau Monne To: linux-kernel@vger.kernel.org Cc: xen-devel@lists.xenproject.org, Roger Pau Monne , "Rafael J. Wysocki" , Len Brown , Juergen Gross , Stefano Stabellini , Oleksandr Tyshchenko , Venkatesh Pallipadi , Alex Chiang , linux-acpi@vger.kernel.org Subject: [PATCH v5] ACPI: processor: Fix evaluating _PDC method when running as Xen dom0 Date: Tue, 21 Mar 2023 15:19:03 +0100 Message-Id: <20230321141904.49177-1-roger.pau@citrix.com> X-Mailer: git-send-email 2.40.0 X-ClientProxiedBy: LO4P123CA0390.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18f::17) To SJ0PR03MB6360.namprd03.prod.outlook.com (2603:10b6:a03:395::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR03MB6360:EE_|CO3PR03MB6775:EE_ X-MS-Office365-Filtering-Correlation-Id: 184262f4-7a47-4563-eac8-08db2a173d7d 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: TL+zIuY5jbXGA0beUnf0t7RbBnEvVmwi8hLHGWey3Coepek6SvNQFYkV9u7H7VOGW0ddsdOrN/r6d/g1oloR5MV0dulYIAAKiOhXrkyw1KnlRR5iKP6MvIopUxZik+ccKn3vaa6eputjGxVEpx/qEaUS3P4E45yWrcpH4cKKqCfEENKiJ/LVDhwFDunUuDzF3JkdKloqWw9lTRlWZ4T/lz9TrIYdXlZw1ExUc3TspQuBqxzdAHgfNv5hNW3wOoJXuTDGJH7kXFgE2aKq6MHvUOkhYxqwSwXOc5El5iO3rH43sXjpTbHln7LtDXcF1jRUkcM/UIYVRn8Wod2UgS/WYP2wpuOzn/vp6mPj5qA+mlNoVg+W8pd+J1gV4NsCds7EbrmbfJ8mJ9ocXN1nMZ6bt9RLtENgBFguDCgwI3lqE7HaG2u62uLxJAZsXNtazmT/lBt6U/FsIquLxDvALCGtwMyvX4FNW3KYAjupor07hbEwfciQ1q3r7A8IuYgyOqe1MDtgAjRJpNpWiRrnpd9dwegu1aDSJoXclOdVH7lHpZF406dkq5ixWaVXzVaLT5tJSfl7C/uNVj2mZRH6F0aU/SuLmzTSb1E5jNyM+bGFF4zqK4jD5WcBZ3xh/EZEZrsN+P17Wh9v66nWqUWjxZin3A== 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)(39860400002)(376002)(136003)(366004)(346002)(396003)(451199018)(5660300002)(7416002)(6666004)(66476007)(6486002)(41300700001)(66556008)(6916009)(83380400001)(478600001)(316002)(4326008)(54906003)(8936002)(36756003)(86362001)(8676002)(66946007)(2906002)(2616005)(82960400001)(186003)(38100700002)(26005)(1076003)(6512007)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?k0nMztsv7TbvsLf4dG2Or7FEy7hr?= =?utf-8?q?pQwBnTHW0T5mcYa/s5PbfDNSeHijkxL3BSwWgP/mYzsiCh7b/ETRmIepmcM+Vi6lI?= =?utf-8?q?8EDVYuPzwx77N5rNLT4DWyjEcJzfUWmuYIcnYcPBoZTZGC65audvFEE1fyMwkL885?= =?utf-8?q?MGjgYkqBfQ0UtvgZyuNBc6bkEohfcgVowa2H2Gw/sc9tx2HGYgMSR8a8rUG/rtrtA?= =?utf-8?q?Oskhh/yB0xF2bS/F8buP8tKQzsxPUbBmzfh/h1ODmFBGpaxQrvgmgECCL1QYSH352?= =?utf-8?q?Woa0CQRQqt60HsvlqpyX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taQ3GjQ5s4pyBZmjIj5CshOIzgEoD+DEZirW18a6rYp6NKK4B?= =?utf-8?q?psO+c3VUqzrilxOwJYz0fixtHdUwgyj2Ots2/L9+wnZiNDzkpuPGtsYTWICGaMpDb?= =?utf-8?q?NloJSHENWSuI8Epz8fn9woA48jqDlveMZ5qmqJZHwn2H4auFTm6OPYOm+87RhsfGh?= =?utf-8?q?mdH+e3URMkCB7KoR3rTA5b4lSWvNTeRW23EixY902E2M1PsYS0OuUcKzzoSIjIQ16?= =?utf-8?q?a5wNBUL2QLXM2WxJ2CzwxzC466pbzahyNvMkS6xIhoPiNsTGjI4GwsPNY0aBvvNi9?= =?utf-8?q?R1PI9oxjxDTUCinwvSPb+MQyiF5ioKS9ewOoTM+OX2bV7KB+XXUMrTSvmQjDrrvDp?= =?utf-8?q?caXNHuMA24sqRK7PJStGixo5ZIPrp2jVug=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: =?utf-8?q?7g6EdyYmaRTLMIz3?= =?utf-8?q?R1ml+qmFn+bQWn3TvnIDwtlXCwNjxNPFgHX637bT8TUphlJNEseyyxV65tH2l06cJ?= =?utf-8?q?0gLc2JnNSerIy3sA4obQbWdp3JoSXuojNy6PJl9ZlBe7sWMrEaSpx9y3T5khZVdfX?= =?utf-8?q?ojmpi+mc1J7RFjjF8aTtFu5rzq5X1CRUQiiVrOy9tEtcZXonLhgcvlEQi6noJbR8R?= =?utf-8?q?e7snnCSicKcw6Rg408gZtLKuFQB61l7umLvdTf60RPNpmXBApzEukunIOUTwO77BS?= =?utf-8?q?Z1C70SfVSXdyxHhUaBSFYjhz9049VO8+bXKNJMaMqXv17TI8RQNMYYcJZYKNMoCqx?= =?utf-8?q?xgq9lxIWzD2nAFaZ35quZRPvYCw2idHKCVyV/Jyyu+CvA7XeitrMhMtvoAqVXvDwl?= =?utf-8?q?SQR4mdVeuAW+FMdg8FOMCxR6h+GpthuzY3eUwuX74I4zrppnE1TAbjfytwI21yDX4?= =?utf-8?q?buWC1TYFyf3fToz9TyPmAK9OO9A50oJOIdu9BPXG/GLzA+GBlUaX61NTtcZZsxV1V?= =?utf-8?q?bWD7rRMDRS0sOXOqgN6uZPe7lGXvvAO4IKlF5tuJhAg4cSEmRuv5Vo7TsP2pX/bQM?= =?utf-8?q?DR1BQOWqGYsDpaPlf4nI5nR3RNwbP5HH7Adxl1ytjZA74zDdBjXgccvtmfvZu5lTv?= =?utf-8?q?6gsBNQ0bgn3+exSZj4Xg5PDlcmPp4aH9KDa+uQ3HebCf+5Xy75ZjNRRLGn1yrF9+H?= =?utf-8?q?Yedmsq6U19SAhFzrpm6UBzrkaNycvcuCC+st8/c9Kic4U37ud3KhgtdCHnDznKuaZ?= =?utf-8?q?LzergMS1bKyioNdfo7+P8uTWu3+mKFPCTt8BvYjeYYzYZZ9QPA2KBNoRyY3vnFNtt?= =?utf-8?q?daVd7Ls/O51F7waR74QWlOK9ksziffHi8onYLKguFwXhLqGJJQmV0Y8smkihClBfj?= =?utf-8?q?Gn0Oss/jYwEwisqWMKrrCa/6NZPrq1z138?= X-OriginatorOrg: citrix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 184262f4-7a47-4563-eac8-08db2a173d7d X-MS-Exchange-CrossTenant-AuthSource: SJ0PR03MB6360.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2023 14:19:11.0458 (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: 7CwDR/J2dQlklzPJ+v9pjy7wLS5SjY/uQI4vunzOOp4JIcAxKAM+KbxK/OOQUyUM2Xy+Jy3HGQskRRlYSL/rAQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO3PR03MB6775 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é --- Changes since v4: - Move definition/declaration of xen_processor_present() to different header. - Fold subject edit. 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. --- drivers/acpi/processor_pdc.c | 11 +++++++++++ drivers/xen/pcpu.c | 20 ++++++++++++++++++++ include/xen/xen.h | 10 ++++++++++ 3 files changed, 41 insertions(+) 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..1814f8762f54 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,21 @@ 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 diff --git a/include/xen/xen.h b/include/xen/xen.h index 7adf59837c25..4410e74f3eb5 100644 --- a/include/xen/xen.h +++ b/include/xen/xen.h @@ -71,4 +71,14 @@ static inline void xen_free_unpopulated_pages(unsigned int nr_pages, } #endif +#if defined(CONFIG_XEN_DOM0) && defined(CONFIG_ACPI) && defined(CONFIG_X86) +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 /* _XEN_XEN_H */