Skip to content

Cleanup and code duplication removal in xenguest

Alejandro Vallejo xen-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest7 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7tools/xenguest: Dynamically allocate xc_cpu_policy_t contentstools/include/xenguest.h tools/libs/guest/xg_cpuid_x86.c tools/libs/guest/xg_private.h +4 more+119 -531 reply
2/7tools/xg: Simplify write_x86_cpu_policy_records()tools/libs/guest/xg_sr_common_x86.c+17 -380 replies
3/7tools/xg: Add self-(de)serialisation functions for cpu_policytools/libs/guest/xg_cpuid_x86.c+49 -410 replies
4/7tools/xg: Split xc_cpu_policy_set_domain()tools/include/xenguest.h tools/libs/guest/xg_cpuid_x86.c tools/tests/tsx/test-tsx.c+21 -130 replies
5/7tools/xg: Streamline xc_cpuid_apply_policy()tools/include/xenguest.h tools/libs/guest/xg_cpuid_x86.c+93 -920 replies
6/7tools/xg: Simplify xc_cpuid_xend_policy() and xc_msr_policy()tools/libs/guest/xg_cpuid_x86.c+38 -2231 reply
7/7tools/xg: Simplify hypercall stubstools/libs/guest/xg_cpuid_x86.c+22 -370 replies

Reviews trailers per patch

1 of 7 patches has a Reviewed-by or Acked-by.

PatchAnthony PERARD
1/7R-b
2/7
3/7
4/7
5/7
6/7
7/7

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/7] Cleanup and code duplication removal in xenguest

NOTE: This series is still under test

This series tries to bind the current xc_cpu_policy_t and its serialization buffers. Having them separate makes it hard to extend of modify the serialized policy structure and needlessly leaks details in places that don't need them, causing a lot of boilerplate and code duplication. The resulting code is >100LoC leaner.

The series is not as aggressive as it could be, but it's enough to unlock future work regarding cpu policy extensions and ought to make toolstack interactions a lot faster.

Patch 1: Remove the fixed buffers in xc_cpu_policy_t and create pointers
populated during xc_cpu_policy_init() instead.
Patch 2: Removes boilerplate by making use of the newly created buffers Patch 3: Adds a couple of helpers to keep the 2 forms inside the
xc_cpu_policy_t object consistently in sync.
Patch 4: Splits the common set_cpu_policy wrapper in 2. One to send the
deserialized form of the policy object (after serializing it internally first) and another to send the serialized form directly.
Patch 5: Uses the previous patches to avoid a lot of boilerplate in the
main policy manipulation routine.
Patch 6: Remove code duplication in the xend-style override setters Patch 7: Final cleanup so the get_cpu_policy wrappers can operate on policy
objects directly

Alejandro Vallejo (7):
tools/xenguest: Dynamically allocate xc_cpu_policy_t contents tools/xg: Simplify write_x86_cpu_policy_records() tools/xg: Add self-(de)serialisation functions for cpu_policy tools/xg: Split xc_cpu_policy_set_domain() tools/xg: Streamline xc_cpuid_apply_policy() tools/xg: Simplify xc_cpuid_xend_policy() and xc_msr_policy() tools/xg: Simplify hypercall stubs

 tools/include/xenguest.h             |  11 +-
 tools/libs/guest/xg_cpuid_x86.c      | 626 +++++++++++----------------
 tools/libs/guest/xg_private.h        |  17 +-
 tools/libs/guest/xg_sr_common_x86.c  |  55 +--
 tools/misc/xen-cpuid.c               |   2 +-
 tools/tests/tsx/test-tsx.c           |  61 +--
 xen/include/xen/lib/x86/cpu-policy.h |   2 +-
 7 files changed, 318 insertions(+), 456 deletions(-)
Signature · 1 line
2.34.1