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

RE: [PATCH] tools/libs/ctrl: add and export xc_memory_op


  • To: "Gross, Jurgen" <jgross@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: "Lengyel, Tamas" <tamas.lengyel@xxxxxxxxx>
  • Date: Thu, 19 May 2022 15:03:54 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.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=dy47+LCe1rnw9Uz4ogMSHAsTEseQzSt/iaei8La9KAg=; b=T94ZTM2s2e9iawjsS2B9prLk8ANTkBpRz85mvRPo6q1IIyHYXkqyCsjucNpifLM514xkkh1IaBQZ3HuaVLk6ngEmJ8/WSDEzNJkvA5VyUzz8el8f3QQ18pLldQccec6VFFtI+1dxFrphA3T4Ohwp1mAzF98CqTEtkQmlqgHetS/gsvInsK5fCdBv4F6Ev/zPAnN1haO/FyUeu4t/tx5b5lIIx93Qfni9RypADfkJzG8l01ztqjo9cI7KhtA+vOT5l99nQ+SfaGxX4C2UqaNSqrC5gAiP4d5k8rGfn5HLZpN19/IJikCS5UBznhR9kt2ecoB6jkTGxSxdxzNgCMK5Vg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gxoQ7KNEiNwj/KOcMCqfn29fgsmy8qL3vMZiLTPC2z/2LJ1zU+V682gyQdhqVcRdpDjr/hUarKAien1/u3JIkZPX6ez2qtTj+xVw1V1bLn1pFeVNdquaSFql8C0wCZiCCpYiP9MornTnNm18IK6E4MdAI8btHMYiIxukTPJy5C+EKaA+p6H7yYGYFJcNVhCsPBseSkEk4F6xwUGeVMIPqAqj2CWvC8ibwFbVqjqGePk03+xtHv0Xg+2aISemj5kbXeG0nuHFOnLiyBwrP0afHE0dUXCswDYbaWkTnn9/66yQ6qigcHPQuxIMsYpOPNTdlhi8DpzbBpYvNOq/HOz34A==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com;
  • Cc: Wei Liu <wl@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, "Cooper, Andrew" <andrew.cooper3@xxxxxxxxxx>
  • Delivery-date: Thu, 19 May 2022 15:04:12 +0000
  • Dlp-product: dlpe-windows
  • Dlp-reaction: no-action
  • Dlp-version: 11.6.401.20
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHYa4RIF+g6mxBRRU+cd4s+ndSX+a0mMskAgAAGnRCAAAm+AIAACMUQ
  • Thread-topic: [PATCH] tools/libs/ctrl: add and export xc_memory_op


> -----Original Message-----
> From: Juergen Gross <jgross@xxxxxxxx>
> Sent: Thursday, May 19, 2022 10:31 AM
> To: Lengyel, Tamas <tamas.lengyel@xxxxxxxxx>; xen-
> devel@xxxxxxxxxxxxxxxxxxxx
> Cc: Wei Liu <wl@xxxxxxx>; Anthony PERARD <anthony.perard@xxxxxxxxxx>;
> Cooper, Andrew <andrew.cooper3@xxxxxxxxxx>
> Subject: Re: [PATCH] tools/libs/ctrl: add and export xc_memory_op
> 
> On 19.05.22 15:59, Lengyel, Tamas wrote:
> >
> >
> >> -----Original Message-----
> >> From: Xen-devel <xen-devel-bounces@xxxxxxxxxxxxxxxxxxxx> On Behalf Of
> >> Juergen Gross
> >> Sent: Thursday, May 19, 2022 9:33 AM
> >> To: Lengyel, Tamas <tamas.lengyel@xxxxxxxxx>;
> >> xen-devel@xxxxxxxxxxxxxxxxxxxx
> >> Cc: Wei Liu <wl@xxxxxxx>; Anthony PERARD
> <anthony.perard@xxxxxxxxxx>;
> >> Cooper, Andrew <andrew.cooper3@xxxxxxxxxx>
> >> Subject: Re: [PATCH] tools/libs/ctrl: add and export xc_memory_op
> >>
> >> On 19.05.22 15:27, Tamas K Lengyel wrote:
> >>> Add and export xc_memory_op so that do_memory_op can be used by
> >>> tools linking with libxc. This is effectively in the same spirit as
> >>> the existing xc_domctl and xc_sysctl functions, which are already
> exported.
> >>>
> >>> In this patch we move do_memory_op into xc_private.h as a static
> >>> inline function and convert its 'cmd' input from int to unsigned int
> >>> to accurately reflect what the hypervisor expects. No other changes
> >>> are made
> >> to the function.
> >>>
> >>> Signed-off-by: Tamas K Lengyel <tamas.lengyel@xxxxxxxxx>
> >>> ---
> >>>    tools/include/xenctrl.h      |  1 +
> >>>    tools/libs/ctrl/xc_private.c | 63 +++---------------------------------
> >>>    tools/libs/ctrl/xc_private.h | 58 ++++++++++++++++++++++++++++++++-
> >>>    3 files changed, 63 insertions(+), 59 deletions(-)
> >>>
> >>> diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h index
> >>> 95bd5eca67..484e354412 100644
> >>> --- a/tools/include/xenctrl.h
> >>> +++ b/tools/include/xenctrl.h
> >>> @@ -1597,6 +1597,7 @@ int xc_vmtrace_set_option(xc_interface *xch,
> >>> uint32_t domid,
> >>>
> >>>    int xc_domctl(xc_interface *xch, struct xen_domctl *domctl);
> >>>    int xc_sysctl(xc_interface *xch, struct xen_sysctl *sysctl);
> >>> +long xc_memory_op(xc_interface *xch, unsigned int cmd, void *arg,
> >>> +size_t len);
> >>>
> >>>    int xc_version(xc_interface *xch, int cmd, void *arg);
> >>>
> >>> diff --git a/tools/libs/ctrl/xc_private.c
> >>> b/tools/libs/ctrl/xc_private.c index c0422662f0..6a247d2b1f 100644
> >>> --- a/tools/libs/ctrl/xc_private.c
> >>> +++ b/tools/libs/ctrl/xc_private.c
> >>> @@ -326,64 +326,6 @@ int xc_flush_mmu_updates(xc_interface *xch,
> >>> struct
> >> xc_mmu *mmu)
> >>>        return flush_mmu_updates(xch, mmu);
> >>>    }
> >>>
> >>> -long do_memory_op(xc_interface *xch, int cmd, void *arg, size_t
> >>> len)
> >>
> >> Why don't you just rename this function and modify the users to use
> >> the new name?
> >
> > For two reasons:
> > 1) having the do_memory_op as a static inline is consistent with how
> do_domctl and do_sysctl are implemented, so logically that's what I would
> expect to see for the memory_op hypercall as well.
> 
> It is much more complicated than the do_domctl and do_sysctl inlines.
> 
> Additionally it is being used by libxenguest, so making it an inline would
> expose lots of libxenctrl internals to libxenguest.
> 
> > 2) the patch itself is cleaner because there is no churn in all the files 
> > that
> previously called do_memory_op.
> 
> OTOH all callers are in Xen, so its no deal to change those.

I'm fine with going the pure rename route  if that's what's preferred.

Tamas

 


Rackspace

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