[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/3] acpi/processor: fix evaluating _PDC method when running as Xen dom0
- To: linux-kernel@xxxxxxxxxxxxxxx
- From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Date: Tue, 29 Nov 2022 17:01:48 +0100
- 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
- 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=fq9Yk9+XavfdcBteaeRI2vnuzqi1nZvTGG84xVpeLXA=; b=UHiKlXVv4fd9PQbkvFkPvdwPUT7wzN0xi5FsJVF1nBy782GjEUsvilikqzEgcvXl+ACVxDmsz5gGlbn6b2tMiG8wy6UolxnE4Xlz9SNeK8vUR6+lnUWX6+x/rqCiODnZJfBKRbZmWIGloxLwCzmnybqPAGd/TjrQzSTDn8h1qZZeiCf1whRpRgjhPQSBhZ6igujcP8ksX94OV3+HJr3U4i6apWg1k7rWBL5N3F72aOwJ1dAYW3+eAu8QUQSn3h03pELVAU1UEyWkvxBjrhgGnygxkAhBnbkYXykvDxQl99J9bSphItgcH8U08Pu8NdJADaUPtk50eAr8spnSBwt+eg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AvrwkeU1KKLrFVtFRShazNzuIgbpps74tarsGUo077rULOhYrgG/BDp8JUTGAAHwi5yonEOFET6w6agBRsV02D+UvlgBwOB7tuFfqQs6JBNokZVez8dOEEMxNaELvsLlfStlj/PMz+LwJcAJwRf+r9Au9afZqKKkf1OSz+1uiGzvaerHpAkxOFnOXQoUGhvewjjOyNbmCgRTCU5ZvI1Ajfe+vmDFcNGAreNo6eP5snzHb+J9ZsvBuVWPvKcRDPVSBqdMipJk9D6xhdR4I6VEbL9hAtCZGZGws0Wmrc+bwyoh8AuNPI05aoyF+rJenpzYB36WM2eNIuXnStxaZ3s2HA==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
- Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, jgross@xxxxxxxx, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Borislav Petkov <bp@xxxxxxxxx>, Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>, x86@xxxxxxxxxx, "H. Peter Anvin" <hpa@xxxxxxxxx>, "Rafael J. Wysocki" <rafael@xxxxxxxxxx>, Len Brown <lenb@xxxxxxxxxx>, Alex Chiang <achiang@xxxxxx>, Venkatesh Pallipadi <venkatesh.pallipadi@xxxxxxxxx>, linux-acpi@xxxxxxxxxxxxxxx
- Delivery-date: Tue, 29 Nov 2022 16:02:21 +0000
- Ironport-data: A9a23:GIHtg6jyEbRef41DEIXJ1eMDX161SRAKZh0ujC45NGQN5FlHY01je htvDDjXO6yINDDyeI93bIWy9RlV6pCHnN83QAZkqC1mRCMb9cadCdqndUqhZCn6wu8v7q5Ex 55HNoSfdpBcolv0/ErF3m3J9CEkvU2wbuOgTrWCYmUpH1QMpB4J0XpLg/Q+jpNjne+3CgaMv cKai8DEMRqu1iUc3lg8sspvkzsy+qWs0N8klgZmP6oS5QWPzyJ94K83fsldEVOpGuG4IcbiL wrz5OnR1n/U+R4rFuSknt7TGqHdauePVeQmoiM+t5mK2nCulARrukoIHKN0hXNsoyeIh7hMJ OBl7vRcf+uL0prkw4zxWzEAe8130DYvFLXveRBTuuTLp6HKnueFL1yDwyjaMKVBktubD12i+ tQBcjRRfyDdoNmq0ZehVsY0i+YYdNbSadZ3VnFIlVk1DN4AaLWbH+Dgw48d2z09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mM TF5z0gI8NwwXXMeXzdm2qn5yDQlBIVr1Pyw16RhnXu5eT/WTIBEsJEwaZUaAHQ5UYMtMx1lP sj5RPQi7NnSTf72Ajt7dnBUB9n0mKyvHoZiOYWy1hSS5EXZrN9pZEWuGlVDJADNiTn751PKp gmMOjsoNJtNX+KZXHQuWdihPSqQ3QIBx+DBnMPv8SEugIm6UxR/g89/ogyj30A/JUyR91v/O LfKJllk7lIU4s/cb99LP1pe7r4NkX9BTb3dE6CK1XuE68Kf1jXrYTs3bkz7Oa2PLQV0ZoJno jbWl8wjx98R6vXM7zP4HR3yGGPfI3kNg6diP22pqIJ9oEUfYCbcBFqEzsV4o6dS/Z2OLyoZx /8AuMTPxbZFxqfJW945XyBZ3BsEwhubCQ0gKdOZ7vcmLO9FqTa8srmTd30GJ3BVR4ZZ0KXOA pxYNG0HrQM0nyW
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
Ping?
So far I've got some feedback from Jan which I've replied to, but I
haven't got any more feedback.
Both patches 1 and 2 are required in order for Xen dom0s to properly
handle ACPI Processor related data to the hypervisor. Patch 3 can be
deal with later.
Thanks, Roger.
On Mon, Nov 21, 2022 at 11:21:10AM +0100, Roger Pau Monne wrote:
> When running as a Xen dom0 the number of CPUs available to Linux can
> be different from the number of CPUs present on the system, but in
> order to properly fetch processor performance related data _PDC must
> be executed on all the physical CPUs online on the system.
>
> The current checks in processor_physically_present() result in some
> processor objects not getting their _PDC methods evaluated when Linux
> is running as Xen dom0. 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.
>
> Fixes: 5d554a7bb064 ('ACPI: processor: add internal
> processor_physically_present()')
> Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> ---
> arch/x86/include/asm/xen/hypervisor.h | 10 ++++++++++
> arch/x86/xen/enlighten.c | 27 +++++++++++++++++++++++++++
> drivers/acpi/processor_pdc.c | 11 +++++++++++
> 3 files changed, 48 insertions(+)
>
> diff --git a/arch/x86/include/asm/xen/hypervisor.h
> b/arch/x86/include/asm/xen/hypervisor.h
> index 16f548a661cf..b9f512138043 100644
> --- a/arch/x86/include/asm/xen/hypervisor.h
> +++ b/arch/x86/include/asm/xen/hypervisor.h
> @@ -61,4 +61,14 @@ void __init xen_pvh_init(struct boot_params *boot_params);
> void __init mem_map_via_hcall(struct boot_params *boot_params_p);
> #endif
>
> +#ifdef CONFIG_XEN_DOM0
> +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/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
> index b8db2148c07d..d4c44361a26c 100644
> --- a/arch/x86/xen/enlighten.c
> +++ b/arch/x86/xen/enlighten.c
> @@ -346,3 +346,30 @@ void xen_arch_unregister_cpu(int num)
> }
> EXPORT_SYMBOL(xen_arch_unregister_cpu);
> #endif
> +
> +#ifdef CONFIG_XEN_DOM0
> +bool __init xen_processor_present(uint32_t acpi_id)
> +{
> + unsigned int i, maxid;
> + struct xen_platform_op op = {
> + .cmd = XENPF_get_cpuinfo,
> + .interface_version = XENPF_INTERFACE_VERSION,
> + };
> + int ret = HYPERVISOR_platform_op(&op);
> +
> + if (ret)
> + return false;
> +
> + maxid = op.u.pcpu_info.max_present;
> + for (i = 0; i <= maxid; i++) {
> + op.u.pcpu_info.xen_cpuid = i;
> + ret = HYPERVISOR_platform_op(&op);
> + if (ret)
> + continue;
> + if (op.u.pcpu_info.acpi_id == acpi_id)
> + return op.u.pcpu_info.flags & XEN_PCPU_FLAGS_ONLINE;
> + }
> +
> + return false;
> +}
> +#endif
> 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 <linux/acpi.h>
> #include <acpi/processor.h>
>
> +#include <xen/xen.h>
> +
> #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);
>
> --
> 2.37.3
>
|