All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <jbeulich@suse.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: Wei Liu <wl@xen.org>, Ian Jackson <iwj@xenproject.org>,
	Juergen Gross <jgross@suse.com>
Subject: Re: [PATCH 5/5] libxc: make xc_domain_maximum_gpfn() endianness-agnostic
Date: Fri, 18 Jun 2021 16:22:30 +0100	[thread overview]
Message-ID: <0258fa6c-3202-b012-90d1-f48a5f3e9d8b@citrix.com> (raw)
In-Reply-To: <bcbf4a71-bf30-5a9e-a399-d4366ee95423@citrix.com>

On 18/06/2021 16:06, Andrew Cooper wrote:
> On 18/06/2021 11:25, Jan Beulich wrote:
>> libxc generally uses uint32_t to represent domain IDs. This is fine as
>> long as addresses of such variables aren't taken, to then pass into
>> hypercalls: To the hypervisor, a domain ID is a 16-bit value. Use an
>> intermediate variable to deal with the issue. (On architectures with
>> arguments passed in registers, such an intermediate variable would have
>> been created by the compiler already anyway, just one of the wrong
>> type.)
>>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>>
>> --- a/tools/libs/ctrl/xc_domain.c
>> +++ b/tools/libs/ctrl/xc_domain.c
>> @@ -856,7 +856,9 @@ int xc_domain_get_tsc_info(xc_interface
>>  
>>  int xc_domain_maximum_gpfn(xc_interface *xch, uint32_t domid, xen_pfn_t *gpfns)
>>  {
>> -    long rc = do_memory_op(xch, XENMEM_maximum_gpfn, &domid, sizeof(domid));
>> +    domid_t xen_domid = domid;
>> +    long rc = do_memory_op(xch, XENMEM_maximum_gpfn, &xen_domid,
>> +                           sizeof(xen_domid));
> Why on earth do we pass the domid in by pointer and not value?

This is horrible.

What we're logically doing is passing a  pointer to struct
xen_memory_$FOO { domid_t domid; }, except its all done by void
pointers, and even the public header files don't provide a suitable
structure.

I think we really do want to retrofit a suitable structure in the public
interface and use that, rather than to continue games like this.

~Andrew


  reply	other threads:[~2021-06-18 15:22 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-18 10:20 [PATCH 0/5] allow xc_domain_maximum_gpfn() to observe full GFN value Jan Beulich
2021-06-18 10:23 ` [PATCH 1/5] x86/HVM: wire up multicalls Jan Beulich
2021-06-18 13:02   ` Andrew Cooper
2021-06-18 13:11     ` Jan Beulich
2021-06-18 10:23 ` [PATCH 2/5] libxencall: osdep_hypercall() should return long Jan Beulich
2021-06-18 13:26   ` Andrew Cooper
2021-06-18 13:42     ` Jan Beulich
2021-06-18 10:24 ` [PATCH 3/5] libxencall: introduce variant of xencall2() returning long Jan Beulich
2021-06-18 13:46   ` Andrew Cooper
2021-06-18 15:03     ` Jan Beulich
2021-06-22 11:38   ` Ian Jackson
2021-06-18 10:24 ` [PATCH 4/5] libxc: use multicall for memory-op on Linux (and Solaris) Jan Beulich
2021-06-18 15:05   ` Andrew Cooper
2021-06-18 15:29     ` Jan Beulich
2021-06-18 10:25 ` [PATCH 5/5] libxc: make xc_domain_maximum_gpfn() endianness-agnostic Jan Beulich
2021-06-18 15:06   ` Andrew Cooper
2021-06-18 15:22     ` Andrew Cooper [this message]
2021-06-18 15:24       ` Andrew Cooper
2021-06-18 15:36         ` Jan Beulich
2021-06-18 13:04 ` [PATCH 0/5] allow xc_domain_maximum_gpfn() to observe full GFN value Jan Beulich

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=0258fa6c-3202-b012-90d1-f48a5f3e9d8b@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=iwj@xenproject.org \
    --cc=jbeulich@suse.com \
    --cc=jgross@suse.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.