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

Alejandro Vallejo posted 7 patches 5 months, 4 weeks ago
Failed in applying to current master (apply log)
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(-)
[PATCH 0/7] Cleanup and code duplication removal in xenguest
Posted by Alejandro Vallejo 5 months, 4 weeks ago
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(-)

-- 
2.34.1