[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/3] acpi/processor: fix evaluating _PDC method when running as Xen dom0


  • To: linux-kernel@xxxxxxxxxxxxxxx
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Mon, 21 Nov 2022 11:21:10 +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=V+3B4L6OirXeCSTJWk4PnCTnlFvaE8OXfvZ/IgYSk6A=; b=hyS4BGKh9pbxAsdhDiynwJfs//zih3895saqEs31lA8EjCdrifxFamaePSaUV1TQ+fOseJISzrQXxTA9mDKlYNG+nBEQn7ovwKa6Ov+PXQSFADOKpN6PQLegN8x0OMZ58BVD4uiekB9R3voNssMF+UoFhKZxKaxF0CdPWHuw1+5o+c51NZZNZvM52ts5lxu+nzXe3Mk0JgjLzTJ1kJuu2yfn32H6lW07hzt1OFAGdx8/3Z+954mGlP7sOu/5Rm+8s4ygcnCp1gv/7DUwEOWsXrl+PZCjNFKkwwj+VRE1mpBmogkLszhgwEHomKk15P5ioKFYQeJWJznorpXCXgVTGg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hIpmqLgd1AzlqK8pqGDec0OLCrIb8xv/yosS8KXL/bN28ieay/LlbgbozxatE+yaEpSP/5jEHN9pLhtBVJUMMR6l4aFVRwFzy8RLH2dm6R7X50SDJ1AdymDDVEikFEql5Wz4UvTq12t2jjyiVgGllJFXnyoKmD3FzC/b4J02dRCwosWGXM9lDovQ55YPl3YAtMnOZv1oRA33Y0ZEhk8jSWyAL0rFMTWBFLm07aN77FpROiurpmNQDgahonxNPdRcMr2rOvMZ+29EG0N1DCTwKHOiUWxXmO5c8m7PFBmfO1P1hkChGxUwzEAXzMnNvl9bRik8/oq5ksYSHYHYe8CWsQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, jgross@xxxxxxxx, Roger Pau Monne <roger.pau@xxxxxxxxxx>, 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: Mon, 21 Nov 2022 10:33:35 +0000
  • Ironport-data: A9a23:46A+dq0vDFv1o4vKu/bD5fpxkn2cJEfYwER7XKvMYLTBsI5bp2RUy DEbUG2OOvbYa2H3fNp0bo3l80kOv8eGx9ZiG1dopC1hF35El5HIVI+TRqvS04F+DeWYFR46s J9OAjXkBJppJpMJjk71atANlVEliefTAOK5ULSfUsxIbVcMYD87jh5+kPIOjIdtgNyoayuAo tq3qMDEULOf82cc3lk8tuTS9nuDgNyo4GlC5wVkPKgS1LPjvyJ94Kw3dPnZw0TQGuG4LsbiL 87fwbew+H/u/htFIrtJRZ6iLyXm6paLVeS/oiI+t5qK23CulQRrukoPD9IOaF8/ttm8t4sZJ OOhF3CHYVxB0qXkwIzxWvTDes10FfUuFLTveRBTvSEPpqFvnrSFL/hGVSkL0YMkFulfGU9q8 +5DChExPh2oh9Dx+q6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RtgdPkjvdTGcCWjcARCzP0ziKlfp5oVbGutC085Muv9FEput /RpApIBbU511rhOkWO5Tf90Qjp1zgjr1fk1F+jmHPm5ej0XigzBcZtjZ9QNkKx0TtpgPhMlI Zwm06JvZteCh3N2Az7+tjzThlv0m65u2Arn+I/h2FWFaEedLhSh4oC+149KuZIIAvKrKQcVM V+BsDV4/hbNXuccnDip2FqhOehW3widy32N3Qqi4iw6Xx7jXp5x0wXyIg0hXEb7q8wTJFC+q DtLrlovKsmdL5ZUYtNQMM6BeenAG3ERhzBdEiIJ078Ka0BM3XR77bq/bQO4v2wcpBg9up8pH 34aiIZiYcOQTOsNSXXt6c7sCwlAV/NEQgF8/supqSQ4dbHNf/W2S7qciFdryLvmYRaPiThYY fCBHtnOY6cEYLQI/c54+SHYeg1FZA/arxghj9pYSP4nuv7bqvXi8f8TNH/YJLQLBdMYBKNPp JEZkm/GPl9
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.