[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: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 18 Jun 2021 17:36:29 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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=Xz1pzk1+R8C8+7jLgvopLD8NK0XD6rH7eFt/+eifFuc=; b=E3ZTiIzNlEHHOeP7cx1KdzeUUu2zF2I21xISz2A4YqblvvZIXlPvIIcAZsyF/dTr5HAaa6lET7W1KwDCPgt9SVwO6BclddtvdU3SkN7nLPjCre7JTnFbg0NsMa+cvcVXuJsOMtwrJZ6DqSfXtnqj2tpaV1cGCHPzv3XLJE21i4aNd0FsomVZySsGLLUSV+01cNdM/y4emFzuIC1uxp76AE/SDe7NxfJ02Litzw7nK+n4W8K8aRjpn97ThtffyJ/PyhC8JLAYeEEtevr/Ufn4HaJaJBGSJzodDUpdHFU8jnqFv59YBGlh3G4iNXqVzTpG3wc3O5U4L4NjR2lueRg6oQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OkCaKxTegjPJnHTMYtLHhP+UJvPjFjzExNrseK+EiCRdGi+GxgXgvryD1YG4nE7tE1ckwgTQ6/7//Mzdpc2PyI33b1HF38z5CNEHEZ31dg2jA8PZqchqMc4Vpaudg7gJmXyRFdKs497mAoQcIdxG6c1JNfD/kZbmdtPCUa36N4LLfrqq7RnE91sBbmgKFEqfA2XgLHEr5SIIU3k73Q+GtSlBEm5xeABR1VQFxbHng6z8QRhhoAwoNtqetoh+Gi5FIz+WMJz4+zUDcbOMws8PFiCiNzgBmQmeN1AMU67dVRYvBR8PU69abL2C7GZu91IkjxOpXYKeW8UdFkxENi/CgA==
  • Authentication-results: lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=none action=none header.from=suse.com;
  • Cc: Wei Liu <wl@xxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Fri, 18 Jun 2021 15:36:41 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 18.06.2021 17:24, Andrew Cooper wrote:
> 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.

Not really, no - this is something a domain can inquire on itself.

Jan




 


Rackspace

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