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

Re: [PATCH v2 1/4] public: Add page related definitions for accessing guests memory


  • To: Costin Lupu <costin.lupu@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 24 Aug 2021 15:19:55 +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=sRLToQW/y+xHhGTlC9LfAh1+0Gu4EgU8PNO/vHKLXqs=; b=HxvBDxeAB5CeVdx7P/z2FPKlhPY02CjUwwwjaIDcbb1o/vzNGxaOPQhNkx4enb3MzetcA9LS8on4TmWG2rfaLUIw7CsXySyae/8D4mbjtvjg/2YEPZpqHmSlbun+kqMYhycl7w1sQzqLVSMS1q8mcflZVRtARZ4uDBhYkCxfKjBRSQ2w7Oik0aO8sooU07OYprYpvH/AcRXSOv70NLS2AzJ2O+rZdxF550J2Hd28YfQL9Oe/VssbZ7Jnqn1e8uwMKcEDU06B1Tj/YFJe5daaDMACCbMcGTDW/raZwnXc2HHiCTxzQ9jUiAVkbC/+idqjdlYikNnDHYlhZr47XT4JCg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dwSvbqMby9bM0/abIgpPrQh4bpjgF8aM7YUWrc50XZucPK1vKVCUF3DsvdTQ1f6HedwGqGULK85UM1fZi/oqvoQEq6vHMNDRXaZseEwSm+rHz6XHZmhaNMGBtq1nJL9zzdcdTnhNVfEFDHnqek++Dofouk59Vv4ZYiX2CVocZyIkwMp0jUWqjELfm8RD9XB6uVz8k7JMXCkfuKBSJyGMugoLUjSbzyajm3ul4tmCx2K58snCPwnj+oZBd1qm+OwSYOuZgi48BAvHLDdQwtk70/QaglANzoVyptZhNBxy08+AB1anoa3jg9lq2fnC8uKlKbgIZChmRvz5W2/QlmuPkw==
  • Authentication-results: xen.org; dkim=none (message not signed) header.d=none;xen.org; dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, Julien Grall <julien@xxxxxxx>
  • Delivery-date: Tue, 24 Aug 2021 13:20:06 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 24.08.2021 15:03, Costin Lupu wrote:
> On 8/23/21 8:16 PM, Julien Grall wrote:
>> On 20/08/2021 10:26, Jan Beulich wrote:
>>> On 20.08.2021 11:08, Julien Grall wrote:
>>>> On 20/08/2021 08:44, Costin Lupu wrote:
>>>>> On 8/20/21 9:52 AM, Jan Beulich wrote:
>>>>>>> --- /dev/null
>>>>>>> +++ b/xen/include/public/page.h
>>>>>>> @@ -0,0 +1,36 @@
>>>>>>> +/******************************************************************************
>>>>>>>
>>>>>>> + * page.h
>>>>>>> + *
>>>>>>> + * Page definitions for accessing guests memory
>>>>>>> + *
>>>>>>> + * Permission is hereby granted, free of charge, to any person
>>>>>>> obtaining a copy
>>>>>>> + * of this software and associated documentation files (the
>>>>>>> "Software"), to
>>>>>>> + * deal in the Software without restriction, including without
>>>>>>> limitation the
>>>>>>> + * rights to use, copy, modify, merge, publish, distribute,
>>>>>>> sublicense, and/or
>>>>>>> + * sell copies of the Software, and to permit persons to whom the
>>>>>>> Software is
>>>>>>> + * furnished to do so, subject to the following conditions:
>>>>>>> + *
>>>>>>> + * The above copyright notice and this permission notice shall be
>>>>>>> included in
>>>>>>> + * all copies or substantial portions of the Software.
>>>>>>> + *
>>>>>>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
>>>>>>> KIND, EXPRESS OR
>>>>>>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
>>>>>>> MERCHANTABILITY,
>>>>>>> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
>>>>>>> EVENT SHALL THE
>>>>>>> + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
>>>>>>> OR OTHER
>>>>>>> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
>>>>>>> OTHERWISE, ARISING
>>>>>>> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
>>>>>>> OTHER
>>>>>>> + * DEALINGS IN THE SOFTWARE.
>>>>>>> + *
>>>>>>> + * Copyright (c) 2021, Costin Lupu
>>>>>>> + */
>>>>>>> +
>>>>>>> +#ifndef __XEN_PUBLIC_PAGE_H__
>>>>>>> +#define __XEN_PUBLIC_PAGE_H__
>>>>>>> +
>>>>>>> +#include "xen.h"
>>>>>>> +
>>>>>>> +#define XEN_PAGE_SHIFT           12
>>>>>>> +#define XEN_PAGE_SIZE            (xen_mk_long(1) << XEN_PAGE_SHIFT)
>>>>
>>>> This will use UL whereas on Arm a page frame should always be 64-bit
>>>> regardless the bitness. Shouldn't this be converted to use xen_ulong_t
>>>> instead?
>>>
>>> As pointed out on v1, XEN_PAGE_SIZE would better not end up as a
>>> value of signed type, for ...
>>
>> Did you mean "not end up as a value of **unsigned** type"...
>>
>>>
>>>>>>> +#define XEN_PAGE_MASK            (~(XEN_PAGE_SIZE - 1))
>>>
>>> ... this to suitably sign-extend to wider types is necessary.
>>
>> ... because, if I am not mistaken, the sign-extension wouldn't happen
>> with unsigned type. But then on v1 you wrote:
>>
>> "Imo the smallest type this should evaluate to is xen_ulong_t"
>>
>> Which I interpreted as this value should be 64-bit on Arm32. If this not
>> what you meant then I am lost.
>>
>>>
>>> Also unless you expect someone to use typeof(XEN_PAGE_SIZE) I'm
>>> afraid I don't see where the constant being long vs xen_long_t
>>> (if such existed) might matter.
>>> Otoh perhaps xen_mk_ulong() would
>>> better have produced a xen_ulong_t typed values in the first
>>> place, but I'm afraid we can't alter the existing macro.
>>
>> We can create a new one.
>>
>>>> Our stable ABI has not been designed with multiple page granularity in
>>>> mind. We could introduce a hypercall to query the page size used by the
>>>> ABI. But then, I don't think we have the full picture of how this is
>>>> going to pan out (I haven't try to use another page size on Xen yet).
>>>>
>>>> I think we have three choices here:
>>>>     1) Stick with the existing definition in the tools
>>>>     2) Move the definition in the public headers and only expose them to
>>>> the tools.
>>>>     3) Query the page size via a new hypervisor
>>>>
>>>> As I wrote above, 3) is going to take some time to get it right. So the
>>>> question here is whether 2) is temporarily better than 1).
>>>
>>> Because I understand 3) is some way out, and because I think 2) is
>>> better than 1), I wrote "might be an option" for what you call 2).
>>> But I could see people (Andrew for example) to take a different
>>> position and object to such a temporary measure.
>>
>> I think we need to make a decision so Costin doesn't keep sending
>> version on something that can't be merged. What does the others thinks?
> 
> From what I understood, in his last reply to 'stubdom: foreignmemory:
> Fix build after 0dbb4be739c5' thread, Andrew was OK with solution 2).

I agree it can be read this way. 

Jan




 


Rackspace

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