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

Re: [XEN PATCH] x86/msr: Allow hardware domain to read package C-state residency counters


  • To: Simon Gaiser <simon@xxxxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 19 Jul 2023 08:20:46 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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=YUSCWpDXcVPScQSMRPKosNRXK8r1O3dIvtD0aGktKWI=; b=NifN0BL6CmX2SWrurHxu8raX6tfa9MoqzC2zHtoRjf49UlReKxIajPrhkwp3jHlsqU8HUN0/gPhI6zKIt5BHnKKu3193T6geNpQjRy4KF3yNJc1LAKuPEERLsuVWIyHK17Ego9LgRzRKina/c0fs4K1a7RgEBHXl5+6Ew5h7gnZTRX5yG0wZMVn40St8U4jF/K5D9N64FRz+CcFDZeEMYLzGPXb+rD7xhzE/B77J5v4tdob89jGCqd0TInRhAfk69IxW/y8NElhb54RvagybUzOvUXpKSn8mDBvLkl1vsIotssdAEVYPJ1f2l0ykeeioLrDU70czHKZqM+y9TtI5cg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LODy5CiWCDQFvStmfkiED9t7ohMKgyzafUqTF5oMaON2w4536gUTE2OB9Jr9zbZXwYNSg9++7HUWg+0MHKL4URV68lbIQ1TsPjOZeJxQ6UzRHY6LOahAcDosWG5kSFhlgRPAyoHdAgZqzvYaER8qxKoWELwy8UG3iT3EZEtahFGtk6OmPUACazEKXso6OTFIw/cp4Ue+e2erXvtZhwGr9oKyDmDoVGBUN5bZpncixRqZPcVXCCwFU6k4YlHYPdvmraqAKjT6wLRHJ9KV8HfWQgFRf0fPZRCV6T1jxwVfkocASPP3cAcalAHHXsaFhXWLuBZQvdXpe+qfQ0/ydmeEug==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Delivery-date: Wed, 19 Jul 2023 06:21:06 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 19.07.2023 01:27, Simon Gaiser wrote:
> Andrew Cooper:
>> On 18/07/2023 2:17 pm, Simon Gaiser wrote:
>>> Since it's limited to the hardware domain it should be safe and it's
>>> very useful to have access to this directly in dom0 when debugging power
>>> related things for example S0ix.
>>
>> You need a SoB.
> 
> Yeah, sorry.
> 
>> But, this is an area there things are subtly broken.  For package-scope
>> MSRs on single socket systems (which does include client systems), then
>> this happens to function.
>>
>> It does not function for core-scoped MSRs, or at all in a multi-socket
>> system.  In such scenarios, dom0 can be rescheduled to a CPU in a
>> different scope while it thinks it is sampling a single scope.
>>
>> This is one of the areas where dom0 and Xen end up fighting over the system.
>>
>> I agree that we want some way for dom0 to get this information, but I'm
>> afraid it's not as simple as just permitting access to the MSRs like this.
> 
> I see. So a generic solution is not so easy. Also even if there would be
> an interface for dom0, my main motivation was to be able to just use
> existing code like /sys/kernel/debug/pmc_core/package_cstate_show and
> turbostat. You can already read those PC-states via Xen's debug
> interface, but that's less convenient.
> 
> For those package-scoped MSRs, how about limiting them to single-socket
> systems?

No, that's all hackery that in the extreme case may be okay to have in
debug builds, but never in release ones. Even having such in debug
builds is problematic, because then we won't routinely test code paths
as used by release builds. When virtualized and trying to access real
MSRs (rather than properly virtualized ones), you need some sort of PV
solution. If you want stuff like that to show up in "standard
interfaces", you'll have to teach the code providing those to use
whatever the (perhaps to be added) PV interface is.

Jan



 


Rackspace

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