[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: Dave Hansen <dave.hansen@xxxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Wed, 30 Nov 2022 16:53:22 +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=ZYrjI+mj72gHPgjYoTrTatGSS29LclN24rgtT/SiE08=; b=fhTJgSTl4/KtHqPjFEXh+a4uldxoN/rRtU9k3M1YB+Y7WOZIYuK1hBA3hmiP5I0g5wnpi4JeMGLBp1k1nLygAzQfH2aKwtxxP+t5fVvEACTgWj7nNJxDgJOqZLx+xM2/WtyLWIGwBVGi3jCxHBTlvdcfl5iBV+EDqDoqPAJ/+y/qYJlY3iPhcVy4nOIu7yIvGEqkASRgBcA/zULYgqu/5JfdzmWyzJZKIlEQOybMq3DmxM7dFqjUAeKxW3Ex0dAVc/8YH/B1kxPK3ywpnXUbItoO/KsTws//Cz9BGDDd3BOrF3BYf0uONSHOo2XcqL44re/gupsuLBu85dcuUx/b2w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BYRErKLL23Yh6x27XuVYhgl3YEym+OZQjffwMqkR+usgtV+v88RxFT6fne8Aq6ZalGdsXBWIt39KwNXfbaaCNuDWa7seteRJ4A0ZqthCtkZFR276dMo3cn07YBM8kOc2KQct3xlcwjdJmVJw9+XBpK+3oh0apO/po8aONuDF05MqCPhCMHhdefrmA7EVeNxKly8LFeLGAtOcL9qbmL7KiZJtMz8YWK8WGxeJgYfNVqBdS+S2VTPntHt2b5WiANQXLM8+YSQYHreeeVbKqguVgfHJRcNOuWSYFuYKrjYpzew7YXUv69Q7tnboOHoS5ZYYANHyypIj9qco2a57W9UcbA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: linux-kernel@xxxxxxxxxxxxxxx, 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: Wed, 30 Nov 2022 15:53:37 +0000
  • Ironport-data: A9a23:B76eHKOSO309ESnvrR1kl8FynXyQoLVcMsEvi/4bfWQNrUoh3mFRx 2QeXWHXPKvcZzahfdB0bIm29EMBusfXzIBlHQto+SlhQUwRpJueD7x1DKtS0wC6dZSfER09v 63yTvGacajYm1eF/k/F3oDJ9CU6jufQA+KmU4YoAwgpLSd8UiAtlBl/rOAwh49skLCRDhiE/ Nj/uKUzAnf8s9JPGj9SuvzrRC9H5qyo4mpB5QRmP5ingXeF/5UrJMNHTU2OByOQrrl8RoaSW +vFxbelyWLVlz9F5gSNy+uTnuUiG9Y+DCDW4pZkc/HKbitq/0Te5p0TJvsEAXq7vh3S9zxHJ HehgrTrIeshFvWkdO3wyHC0GQkmVUFN0OevzXRSLaV/ZqAJGpfh66wGMa04AWEX0vwqAkxfr dw5FBoiVw2pgOOph5iFdOY506zPLOGzVG8ekldJ6GiASN0BGNXESaiM4sJE1jAtgMwIBezZe 8cSdTtoalLHfgFLPVAUTpk5mY9EhFGmK2Ee9A3T+PRxujePpOBy+OGF3N79YNuFSN8Thk+Fj mnH4374ElcRM9n3JT+toi/82bWWxXqTtIQ6D6eZ6P10sU2qlzZPBTYPEmn8k/rghRvrMz5YA wlOksY0loA+/VKmCNn0WQa1plaFuAIRX5xbFOhSwAWMzLfEpgWUHG4JShZfZ9E88sw7Xzon0 hmOhdyBLSxitviZRGyQ8p+QrCiuIm4FIGkafygGQAAZpd75r+kbjB3VSc14OLWoldCzEjb1q xiAqzI/nPMUltIR0Lug/kHvhCilrZzECAUy423/Qm2h/it9ZYi4e5av71nLq/pNRK6cT1+Ou 1AelsSe5fxIBpaI/ASHWM0EGLCk4abDPDC0qVJmAZRn9z2r4HOlVYRR5ixuYkZvLssAPzTuZ Sf7qVMPzJxeJn2naelweY3ZI8QyxIDyBMjiTLbfad8mSoJ4egaK+AltaFSW0mSrl1Ij+Yk7N JGRWcWhF3AXDeJg1jXeb+4W0b4iwC8WxXuVTpf+pzy53LydbWKYUrdDKFKKauEh5a+FiATT7 9tbccCNzn13VOz4fzmS+IULLHgUInUhQ5P7scpacqiEOAUOJY06I/rYwLdkcIs8ma1Qz77M5 ivkBRMez0fjj3raLwnMcmpkdL7kQZd4qzQ8IDAoOlGrnXMkZO5D8ZsiSnf+RpF/nMQL8BK+Z 6BtlxmoahiXdgn6xg==
  • Ironport-hdrordr: A9a23:GYpfFq6pKb8Fuyy+BQPXwMbXdLJyesId70hD6qkRc3Bom6mj/P xG88516faZslgssRMb+exoSZPgfZq0z/cci+Qs1NyZLWrbUQWTXeRfxLqn7zr8GzDvss5xvJ 0QF5SW0eeAb2RHsQ==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Tue, Nov 29, 2022 at 09:43:53AM -0800, Dave Hansen wrote:
> On 11/21/22 02:21, 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.
> 
> How is the number of CPUs available to Linux different?
> 
> Is this a result of the ACPI tables that dom0 sees being "wrong"?

Depends on the mode.  This is all specific to Linux running as a Xen
dom0.

For PV dom0 the ACPI tables that dom0 sees are the native ones,
however available CPUs are not detected based on the MADT, but using
hypercalls, see xen_smp_ops struct and the
x86_init.mpparse.get_smp_config hook used in smp_pv.c
(_get_smp_config()).

For a PVH dom0 Xen provides dom0 with a crafted MADT table that does
only contain the CPUs available to dom0, and hence is likely different
from the native one present on the hardware.

In any case, the dynamic tables dom0 sees where the Processor
objects/devices reside are not modified by Xen in any way, so the ACPI
Processors are always exposed to dom0 as present on the native
tables.

Xen cannot parse the dynamic ACPI tables (neither should it, since
then it would act as OSPM), so it relies on dom0 to provide same data
present on those tables for Xen to properly manage the frequency and
idle states of the CPUs 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.
> 
> What is the end user visible effect of this problem and of the solution?

Without this fix _PDC is only evaluated for the CPUs online from dom0
point of view, which means that if dom0 is limited to 8 CPUs but the
system has 24 CPUs, _PDC will only get evaluated for 8 CPUs, and that
can have the side effect of the data then returned by _PSD method or
other methods being different between CPUs where _PDC was evaluated vs
CPUs where the method wasn't evaluated.  Such mismatches can
ultimately lead to for example the CPU frequency driver in Xen not
initializing properly because the coordination methods between CPUs on
the same domain don't match.

Also not evaluating _PDC prevents the OS (or Xen in this case)
from notifying ACPI of the features it supports.

IOW this fix attempts to make sure all physically online CPUs get _PDC
evaluated, and in order to to that we need to ask the hypervisor if a
Processor ACPI ID matches an online CPU or not, because Linux doesn't
have that information when running as dom0.

Hope the above makes sense and allows to make some progress on the
issue, sometimes it's hard to summarize without getting too
specific,

Thanks, Roger.



 


Rackspace

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