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

Re: [PATCH RFC 0/9] x86: Merge cpuid and msr policy


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Thu, 30 Mar 2023 13:59:37 +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=ydxzYJvNQNKpTgpx0Ez9ufD32XjxhTUy40rwB1NomAw=; b=WI11VbMWcahzq4Ix4YwIL1kdL6+P0rKfIJ4bO49rvZ0Ba75D0FMELxrko7QGubN7lGRZLXf1ol+JTybQWyMHqC72w6q1jLY36bHY4+xAxivF6FV+2HTVTgNBND07koILaz+van+Ardkwnrmb6NUrL8mtxpM58GYeit5hzm52IYqQJ9QkuDRZ8Lg+h95KnjqFrbhVCVsT1G1frL9PtY77PnxfFNtnkEkn8KeYh6l7edU6+V9QLI7p8JFjpYvGZT8roV2iM4tggoupsQu0WJyVJsKK6wbXHB4Xrib7MKgXsaYncPqJb1jeS27pXVjucdy1dKiUb0GmP5KuoWiehHUEPg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Wda8d0rHsYfkzVSucAcDtOEA/1XWvOsRu1Q+v96skEMWXR3ZV4fVmu2yEhUmYaAjm+uCh/IfiA0VgozGiH2RC3a5b0WPPbPnoQ6tzTwSv8AEqTmhUvbKA87UMP62PsQ+6JF0OqQXrwiGEXdoclzGl0TNd8PrV3McWOiP657ZuJDOH1Dszfgs3BFVjbYEqP2ctY5KysKT9xgpxQWTeOnyYBvGxodcVSIRLLhvgIUeu1s9OubyUANGAYU233rIWw5xkQGmCDpGGtSSvGI1afFX/QaRw/J7dy/pJX3Odo1rShopI41J/PQyG3pz1QehOlyaM5Mc/JbZQeILGZYg5zTzZw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Jan Beulich <JBeulich@xxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Thu, 30 Mar 2023 13:00:01 +0000
  • Ironport-data: A9a23:tN80iK68GHqFM+s9FBB1gAxRtBXGchMFZxGqfqrLsTDasY5as4F+v jFOWW2FP/7eamPyeYgnaoy19khVupKDydVqTAA4pSlhHi5G8cbLO4+Ufxz6V8+wwm8vb2o8t plDNYOQRCwQZiWBzvt4GuG59RGQ7YnRGvynTraCYnsrLeNdYH9JoQp5nOIkiZJfj9G8Agec0 fv/uMSaM1K+s9JOGjt8B5mr9VU+7JwehBtC5gZlPasQ5AeE/5UoJMl3yZ+ZfiOQrrZ8RoZWd 86bpJml82XQ+QsaC9/Nut4XpWVTH9Y+lSDX4pZnc/DKbipq/0Te4Y5iXBYoUm9Fii3hojxE4 I4lWapc6+seFvakdOw1C3G0GszlVEFM0OevzXOX6aR/w6BaGpdFLjoH4EweZOUlFuhL7W5m1 MAxORkUQ0m6pOu7mb74Tes2xZoDBZy+VG8fkikIITDxK98DGMqGaYOaoNhS0XE3m9xEGuvYa 4wBcz1zYR/cYhpJfFAKFJY5m+TujX76G9FagAvN+exrvC6OkUooj+GF3Nn9I7RmQe18mEqCq 32A1GP+GhwAb/SUyCaf82LqjejK9c/+cNtKT+XkrqY23zV/wEQtFyI8D0Cbi8KFixO6ff99c kcf5Gkh+P1aGEuDC4OVsweDiG6JuFsQVsRdF8U+6RqR0ezE7gCBHG8GQzVdLts8u6ceZxYny 1uIlNPBHiF0vfueTnf13qiQhSO/P24SN2BqWMMfZQ4M4t2mqodjiBvKF4xnCPTs0YSzHizsy TeXqiR4n68UkcMAy6S8+xbAni6ooZ/KCAUy4207Q16Y0++wX6b9D6TA1LQRxa8owFqxJrVZg EU5pg==
  • Ironport-hdrordr: A9a23:aMgfxa8jQHPFllexZRpuk+AiI+orL9Y04lQ7vn2ZKSY5TiVXra CTdZUgpHvJYVMqMk3I9uruBEDtex3hHP1OkOws1NWZLWrbUQKTRekP0WKL+Vbd8kbFh4xgPM lbEpSXCLfLfCVHZcSR2njFLz73quP3j5xBho3lvglQpRkBUdAG0+/gYDzraXGfQmN9dPwEPa vZ3OVrjRy6d08aa8yqb0N1JdQq97Xw5evbiQdtPW9e1DWz
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 30/03/2023 12:07 pm, Roger Pau Monné wrote:
> On Wed, Mar 29, 2023 at 09:51:28PM +0100, Andrew Cooper wrote:
>> tl;dr to add MSR_ARCH_CAPS features sensibly, cpu_{featureset<->policy}() 
>> need
>> to not operate on objects of differing lifetimes, so structs
>> {cpuid,msr}_policy need merging and cpu_policy is the obvious name.
> So the problem is that there's a chance we might get a cpu_policy
> object that contains a valid (allocated) cpuid object, but not an msr
> one?

No - not cpu_policy.  It is that we can get a cpuid_policy and an
msr_policy that aren't at the same point in their lifecycle.

... which is exactly what happens right now for the raw/host msr right
now if you featureset_to_policy() to include MSR data.

Merging the two together into cpu_policy causes there to be a single
object lifecycle.


It's probably worth repeating the advise from the footnote in
https://lwn.net/Articles/193245/ again.  Get your datastructures right,
and the code takes care of itself.  Don't get them right, and the code
tends to be unmaintainable.


>> But this does mean that we now have
>>
>>   cpu_policy->basic.$X
>>   cpu_policy->feat.$Y
>>   cpu_policy->arch_caps.$Z
> I'm not sure I like the fact that we now can't differentiate between
> policy fields related to MSRs or CPUID leafs.
>
> Isn't there a chance we might in the future get some name space
> collision by us having decided to unify both?

The names are chosen by me so far, and the compiler will tell us if
things actually collide.

And renaming the existing field is a perfectly acceptable way of
resolving a conflict which arises in the future.

But yes - this was the whole point of asking the question.

~Andrew



 


Rackspace

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