All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Jan Beulich" <JBeulich@suse.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>, "Wei Liu" <wl@xen.org>
Subject: [PATCH RFC 0/9] x86: Merge cpuid and msr policy
Date: Wed, 29 Mar 2023 21:51:28 +0100	[thread overview]
Message-ID: <20230329205137.323253-1-andrew.cooper3@citrix.com> (raw)

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.

But this does mean that we now have

  cpu_policy->basic.$X
  cpu_policy->feat.$Y
  cpu_policy->arch_caps.$Z

and plenty of code now reads

  d->arch.cpu_policy->feat.$Y

instead of

  d->arch.cpuid->feat.$Y

The latter can be half-fixed with some union magic (see patch 9 commit
message).  The former can be fixed by putting cpuid/msr infixes in cpu_policy,
which is doable but very invasive, and would make plenty of code read

  d->arch.cpu_policy->cpuid.feat.$Y

and the two obviously shouldn't be done together.

So, RFC.  Does this code layout look ok?  If we want to make changes with
naming, now is very much the right time to get them sorted.

Patches 1-8 are pretty ready to go.  Patch 9 is the remainder to take out the
temporary hacks, and I'm still in the process of merging the system policy
derivation.

Andrew Cooper (9):
  x86: Rename struct cpu_policy to struct old_cpuid_policy
  x86: Rename {domctl,sysctl}.cpu_policy.{cpuid,msr_policy} fields
  x86: Rename struct cpuid_policy to struct cpu_policy
  x86: Merge struct msr_policy into struct cpu_policy
  x86: Merge the system {cpuid,msr} policy objects
  x86: Merge a domain's {cpuid,msr} policy objects
  x86: Merge xc_cpu_policy's cpuid and msr objects
  x86: Drop struct old_cpu_policy
  RFC: Everything else

 tools/fuzz/cpu-policy/afl-policy-fuzzer.c     |  15 +-
 .../fuzz/x86_instruction_emulator/fuzz-emul.c |   2 +-
 tools/libs/guest/xg_cpuid_x86.c               |  48 +-
 tools/libs/guest/xg_private.h                 |   5 +-
 tools/tests/cpu-policy/test-cpu-policy.c      |  50 +-
 tools/tests/tsx/test-tsx.c                    |  58 +-
 tools/tests/x86_emulator/Makefile             |   2 +-
 tools/tests/x86_emulator/test_x86_emulator.c  |   2 +-
 tools/tests/x86_emulator/x86-emulate.c        |   2 +-
 tools/tests/x86_emulator/x86-emulate.h        |   2 +-
 xen/arch/x86/Makefile                         |   1 +
 xen/arch/x86/cpu-policy.c                     |  67 +++
 xen/arch/x86/cpu/common.c                     |   4 +-
 xen/arch/x86/cpu/mcheck/mce_intel.c           |   2 +-
 xen/arch/x86/cpu/vpmu_intel.c                 |   4 +-
 xen/arch/x86/cpuid.c                          | 101 ++--
 xen/arch/x86/domain.c                         |  18 +-
 xen/arch/x86/domctl.c                         |  51 +-
 xen/arch/x86/hvm/emulate.c                    |   2 +-
 xen/arch/x86/hvm/hvm.c                        |  38 +-
 xen/arch/x86/hvm/ioreq.c                      |   4 +-
 xen/arch/x86/hvm/mtrr.c                       |   2 +-
 xen/arch/x86/hvm/svm/svm.c                    |  18 +-
 xen/arch/x86/hvm/svm/svmdebug.c               |   2 +-
 xen/arch/x86/hvm/vlapic.c                     |   2 +-
 xen/arch/x86/hvm/vmx/vmx.c                    |  12 +-
 xen/arch/x86/hvm/vmx/vvmx.c                   |   2 +-
 xen/arch/x86/include/asm/cpu-policy.h         |  18 +
 xen/arch/x86/include/asm/cpuid.h              |  10 -
 xen/arch/x86/include/asm/domain.h             |   4 +-
 xen/arch/x86/include/asm/guest_pt.h           |   4 +-
 xen/arch/x86/include/asm/msr.h                |  13 +-
 xen/arch/x86/include/asm/paging.h             |   2 +-
 xen/arch/x86/mm/mem_sharing.c                 |   3 +-
 xen/arch/x86/mm/shadow/hvm.c                  |   2 +-
 xen/arch/x86/msr.c                            |  98 +---
 xen/arch/x86/pv/domain.c                      |   2 +-
 xen/arch/x86/pv/emul-priv-op.c                |   6 +-
 xen/arch/x86/pv/ro-page-fault.c               |   2 +-
 xen/arch/x86/sysctl.c                         |  77 +--
 xen/arch/x86/traps.c                          |   2 +-
 xen/arch/x86/x86_emulate.c                    |   2 +-
 xen/arch/x86/x86_emulate/x86_emulate.c        | 166 +++---
 xen/arch/x86/x86_emulate/x86_emulate.h        |   6 +-
 xen/arch/x86/xstate.c                         |   4 +-
 xen/include/public/domctl.h                   |   4 +-
 xen/include/public/sysctl.h                   |   4 +-
 xen/include/xen/lib/x86/cpu-policy.h          | 540 +++++++++++++++++-
 xen/include/xen/lib/x86/cpuid.h               | 475 ---------------
 xen/include/xen/lib/x86/msr.h                 | 104 ----
 xen/lib/x86/cpuid.c                           |  12 +-
 xen/lib/x86/msr.c                             |   6 +-
 xen/lib/x86/policy.c                          |   8 +-
 53 files changed, 986 insertions(+), 1104 deletions(-)
 create mode 100644 xen/arch/x86/cpu-policy.c
 create mode 100644 xen/arch/x86/include/asm/cpu-policy.h
 delete mode 100644 xen/include/xen/lib/x86/cpuid.h
 delete mode 100644 xen/include/xen/lib/x86/msr.h

-- 
2.30.2



             reply	other threads:[~2023-03-29 20:52 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-29 20:51 Andrew Cooper [this message]
2023-03-29 20:51 ` [PATCH 1/9] x86: Rename struct cpu_policy to struct old_cpuid_policy Andrew Cooper
2023-03-29 20:51 ` [PATCH 2/9] x86: Rename {domctl,sysctl}.cpu_policy.{cpuid,msr_policy} fields Andrew Cooper
2023-03-29 20:51 ` [PATCH 3/9] x86: Rename struct cpuid_policy to struct cpu_policy Andrew Cooper
2023-03-29 20:51 ` [PATCH 4/9] x86: Merge struct msr_policy into " Andrew Cooper
2023-03-30  9:30   ` Jan Beulich
2023-03-30 11:11     ` Andrew Cooper
2023-03-30 11:15       ` Jan Beulich
2023-03-29 20:51 ` [PATCH 5/9] x86: Merge the system {cpuid,msr} policy objects Andrew Cooper
2023-03-30  9:40   ` Jan Beulich
2023-03-30 11:19     ` Andrew Cooper
2023-03-29 20:51 ` [PATCH 6/9] x86: Merge a domain's " Andrew Cooper
2023-03-30 10:00   ` Jan Beulich
2023-03-30 11:14     ` Andrew Cooper
2023-03-29 20:51 ` [PATCH 7/9] x86: Merge xc_cpu_policy's cpuid and msr objects Andrew Cooper
2023-03-30 10:04   ` Jan Beulich
2023-03-30 11:56     ` Andrew Cooper
2023-03-29 20:51 ` [PATCH 8/9] x86: Drop struct old_cpu_policy Andrew Cooper
2023-03-30 10:08   ` Jan Beulich
2023-03-30 11:57     ` Andrew Cooper
2023-03-29 20:51 ` [PATCH 9/9] RFC: Everything else Andrew Cooper
2023-03-30 10:16   ` Jan Beulich
2023-03-30 12:01     ` Andrew Cooper
2023-03-30 12:06       ` Jan Beulich
2023-03-30 12:31         ` Andrew Cooper
2023-03-30 12:55           ` Jan Beulich
2023-03-30 10:18 ` [PATCH RFC 0/9] x86: Merge cpuid and msr policy Jan Beulich
2023-03-30 12:08   ` Andrew Cooper
2023-03-30 11:07 ` Roger Pau Monné
2023-03-30 12:59   ` Andrew Cooper
2023-03-30 14:43     ` Roger Pau Monné
2023-04-03 10:55       ` Andrew Cooper
2023-04-03 11:47         ` Roger Pau Monné
2023-04-03 11:48           ` Andrew Cooper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230329205137.323253-1-andrew.cooper3@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=roger.pau@citrix.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.