xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Alejandro Vallejo <alejandro.vallejo@cloud.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: "Alejandro Vallejo" <alejandro.vallejo@cloud.com>,
	"Wei Liu" <wl@xen.org>,
	"Anthony PERARD" <anthony.perard@citrix.com>,
	"Juergen Gross" <jgross@suse.com>,
	"Jan Beulich" <jbeulich@suse.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>
Subject: [PATCH 0/3] Clean the policy manipulation path in domain creation
Date: Wed,  7 Feb 2024 17:39:54 +0000	[thread overview]
Message-ID: <20240207173957.19811-1-alejandro.vallejo@cloud.com> (raw)

In the context of creating a domain, we currently issue a lot of hypercalls
redundantly while populating its CPU policy; likely a side effect of
organic growth more than anything else.

However, the worst part is not the overhead (this is a glacially cold
path), but the insane amounts of boilerplate that make it really hard to
pick apart what's going on. One major contributor to this situation is the
fact that what's effectively "setup" and "teardown" phases in policy
manipulation are not factored out from the functions that perform said
manipulations, leading to the same getters and setter being invoked many
times, when once each would do.

Another big contributor is the code being unaware of when a policy is
serialised and when it's not.

This patch attempts to alleviate this situation, yielding over 200 LoC
reduction.

Patch 1: Mechanical change. Makes xc_cpu_policy_t public so it's usable
         from clients of libxc/libxg.
Patch 2: Changes the (de)serialization wrappers in xenguest so they always
         serialise to/from the internal buffers of xc_cpu_policy_t. The
         struct is suitably expanded to hold extra information required.
Patch 3: Performs the refactor of the policy manipulation code so that it
         follows a strict: PULL_POLICIES, MUTATE_POLICY (n times), PUSH_POLICY.

Alejandro Vallejo (3):
  tools/xg: Move xc_cpu_policy_t to xenguest.h
  tools/xg: Streamline cpu policy serialise/deserialise calls
  tools/xg: Clean up xend-style overrides for CPU policies

 tools/include/xenguest.h             |  14 +-
 tools/libs/guest/xg_cpuid_x86.c      | 500 +++++++++------------------
 tools/libs/guest/xg_private.h        |  10 -
 tools/libs/guest/xg_sr_common_x86.c  |  54 +--
 tools/misc/xen-cpuid.c               |  40 +--
 xen/include/xen/lib/x86/cpu-policy.h |   6 +-
 6 files changed, 197 insertions(+), 427 deletions(-)

-- 
2.34.1



             reply	other threads:[~2024-02-07 17:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-07 17:39 Alejandro Vallejo [this message]
2024-02-07 17:39 ` [PATCH 1/3] tools/xg: Move xc_cpu_policy_t to xenguest.h Alejandro Vallejo
2024-04-30 14:13   ` Anthony PERARD
2024-02-07 17:39 ` [PATCH 2/3] tools/xg: Streamline cpu policy serialise/deserialise calls Alejandro Vallejo
2024-04-30 14:20   ` Anthony PERARD
2024-02-07 17:39 ` [PATCH 3/3] tools/xg: Clean up xend-style overrides for CPU policies Alejandro Vallejo
2024-04-30 14:42   ` Anthony PERARD

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=20240207173957.19811-1-alejandro.vallejo@cloud.com \
    --to=alejandro.vallejo@cloud.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=anthony.perard@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=jgross@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).