[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 5/5] libxc: make xc_domain_maximum_gpfn() endianness-agnostic
- To: Jan Beulich <jbeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
- Date: Fri, 18 Jun 2021 16:24:22 +0100
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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-SenderADCheck; bh=KpDty8QdHfR4l02BoZDsxp/26qG5NlYkfs/5fGe7/c4=; b=dOEmoPmfl7OaaCluUq+Qca4PtuxogCCdLAhuptrGjJooe9GFMQZ3meJ+WEfuEoldhHPr4h2OFnulNbYML9O67CxK7j79/SFN/nB4HgSNvtNBkptjGJ8RWARdmjgYPxHDoo0fLvQYCPjTj3/HD+5XR4IKW80y/lfkflu+Z3zTsVau2IXOd0lSHURSQQhIa7r+U1uQasSi2uMH30Lp4h29MMHHgQenIGUPMTbW6D7r+MzAV/hwChvFsctQnqKSxaMVNjZc0w+jUCC+RiXClH/T2tv9VtI+Eu7yVQsJ5qWVpNM5zhMZSfzHmP5+9lTxOadGsL0fS/UeJkxufahRZrplaw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZaCW1ZmbPCCAr8QSBe5goB8XgNtivCoprBq1dxMy3+wSX6YGw/aXmXVsu3VOMWn3PlAqLNcC5V5FGGcEH5EHmp9CPvK+KQ+8iyJlliHINtAblWNU01/tvvPY5g5VGrjCMHEjd0EsiONGrCph/odPyxsuxpxLKTjzeijVFmAwsnzru8G/5fGJ0+U112x1zu96aMSEQP17QfwnlLO80EUxTcw6j8fKwiIrAryDv/Ew1DINCYMoBSnnJ4e3JcCo3v79oyNV3x5mTTNbGagJXRKXb7S2Ap8xLEQouIpFqnol+uHLWwp7mAqthia415MmhwKO8jKe4WiPABWfHiP6CsjJ1g==
- Authentication-results: esa6.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
- Cc: Wei Liu <wl@xxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>
- Delivery-date: Fri, 18 Jun 2021 15:24:37 +0000
- Ironport-hdrordr: A9a23:fsKWBq/zy+TXMiTGDgNuk+AuI+orL9Y04lQ7vn2ZKSY5TiVXra CTdZUgpHnJYVMqMk3I9uruBEDtex3hHNtOkOss1NSZLW7bUQmTXeJfBOLZqlWNJ8S9zJ856U 4JScND4bbLfDxHZKjBgTVRE7wbsaa6GKLDv5ah85+6JzsaGp2J7G1Ce3am+lUdfng+OXKgfq Dsm/auoVCbCAwqR/X+PFYpdc7ZqebGkZr3CCR2eyLOuGG1/EiVAKeRKWnj4isj
- Ironport-sdr: jILxIwSiqFHrcQ+/eFF+oZHNznDER+poq/zqRso8ON93ri/lgzKkLxPwBOAk5vLn2klE5ch3g5 su4k2ZR9sn1IGELKxb6+q8pF6VbaSgT0BRSIMcRCUrs5ZaSlh/UWx+tnMkomXQAga8Q+n46vfB 9ai/GkG5QrfZYqaiYHkHb+gjp2QQfULjyS3NDqtKTG8A8jPH5KvPoZQwrb1hD3dEaXgsECYI44 7ibRcQIeyEeYC4oYuGXrZliw40FjpxoLxMsUjGt4vKTjrED/NgBpawDiTbThl+uAGRqB+a3ieh 0VA=
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 18/06/2021 16:22, Andrew Cooper wrote:
> 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@xxxxxxxx>
>>>
>>> --- 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.
Alternatively, declare this interface broken and reimplement it as a
domctl, which is where the functionality ought logically to live.
~Andrew
|