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

Re: [PATCH v2] xen/grants: repurpose command line max options


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Wed, 15 Mar 2023 18:40:57 +0000
  • 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tlixwiDJyXjY137k/WVjRo3z4/rUDmXUeHkqUU+U1f8=; b=WO41YRclB+AJQlU6FkeXj4fGjtTqJzsGD7yYrD9cwpFSa/K95+DRS5aQ2/ePM6UK4toWzx/tz2jG5f2NyF7pZozc6lSJBNIHeQ8StuDof+b5V7VrGvnyeUGTYnPoY/3qBjmpLT1iob5Q/emhG2Jvk3t7IZew4G2IgHwtnllu/7RVfAab2J95jBgGAor9VM3oCJQGqJ1EhBUBaLAE7Elis/DdHCvdsnMNa1+JAYZ6ELMSYlizv07lLcHc5fw18rf63+6CPVXWGSWoYot2IKbRIyWxmBFeVBZ84bv3MUfSJ/bhJ1uiGCochC0m7M0seOn42/aRwPNDZ6ra00QcaO6vGw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bgUxwsJQ1+6oK4UTh3gdzbiHr2MhkwclTb/x5Ys2eYvvqvg+lZMX5yjMl+36WYivUMZa5YZcCQnCl2Ii5y0MzF8f/JXC9zzhMjFFYKvEyaIijY4q+S566+hg0UOWyDinvoZZuhawnkbM7I5Jq0Gz00MLviz16WQDF/4EWR0pDBb1q9MwDWC55Jf+TAbrmI9xvhCdsIJShUw2dXDiO57nvG8trM63Wfa5660mz8s7JoIqjg7fXg9ZwH5ONqGUHrqaBM4GyuNWIfbGEGrYP4TgcoILmZHd6lC6zEiQQtzknwGPIgrKQFsgTUamCD/N3tLC5l9eTdUHyj1ioJS4YHnffw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Wed, 15 Mar 2023 18:41:32 +0000
  • Ironport-data: A9a23:cZNPrKsrjZUpzJNmYWvmpPYIsOfnVJxfMUV32f8akzHdYApBsoF/q tZmKTjQbP6MY2b3KdAnad7l/U4HvsXWnIVhTwY9pX83FiND+JbJXdiXEBz9bniYRiHhoOCLz O1FM4Wdc5pkJpP4jk3wWlQ0hSAkjclkfpKlVKiffHg3HVQ+IMsYoUoLs/YjhYJ1isSODQqIu Nfjy+XSI1bg0DNvWo4uw/vrRChH4bKj6Fv0gnRkPaoQ5ASHyiFPZH4iDfrZw0XQE9E88tGSH 44v/JnhlkvF8hEkDM+Sk7qTWiXmlZaLYGBiIlIPM0STqkAqSh4ai87XB9JFAatjsB2bnsgZ9 Tl4ncfYpTHFnEH7sL91vxFwS0mSNEDdkVPNCSDXXce7lyUqf5ZwqhnH4Y5f0YAwo45K7W9yG fMwNRRVMB7cqsKK7ejmUspymPUFM9LyM9ZK0p1g5Wmx4fcOZ7nmG/mPz/kImTA6i4ZJAOrUY NcfZXx3dhPcbhZTO1ARTpUjgOOvgXq5eDpdwL6XjfNvvy6Pk0oujP6xbLI5efTTLSlRtm+eq njL4CLSBRYCOcbE4TGE7mitlqnEmiaTtIc6TeXgraEw2w3ProAVIBMpC3qCm6aasUOzevB0L koJ+RgTqLdnoSRHSfG4BXVUukWsvBQRRt5RGO0S8xyWx+zf5APxLmoZSj9MbvQ2uclwQiYlv neShM/gDzFrtLyTSFqe+62SoDf0PjIaRUcdYQcUQA1D5MPsyKkjgxSKQtt9HaqditzuBSq20 z2MtDI5hbgYkYgMzarTwLzcqzelp5yMRAhl4AzSBj6h9lkhONLjYJG041/G6/oGNJyeUlSKo HkDnY6Z8fwKCpaO0ieKRY3hAY2U2hpMCxWE6XYHInXr327FF6KLFWyI3AxDGQ==
  • Ironport-hdrordr: A9a23:r3qLzal2nvD9e1vKMlLnkyJLhTbpDfIG3DAbv31ZSRFFG/Fw9v re58jzsCWe5Qr5N0tQ4OxoR5PwJk80maQY3WBzB8bbYOCZghrPEGgK1+KLqVPd8kvFl9K1vp 0OT0ERMr3N5RkRt7ef3CCIV/Ep3dmZ/OSFgu3ZwnthJDsaCJ2IGD0JaHf/LnFL
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 14/03/2023 3:42 pm, Roger Pau Monné wrote:
> On Tue, Mar 14, 2023 at 03:59:22PM +0100, Jan Beulich wrote:
>> On 14.03.2023 15:45, Roger Pau Monne wrote:
>>> Slightly change the meaning of the command line
>>> gnttab_max_{maptrack_,}frames: do not use them as upper bounds for the
>>> passed values at domain creation, instead just use them as defaults
>>> in the absence of any provided value.
>>>
>>> It's not very useful for the options to be used both as defaults and
>>> as capping values for domain creation inputs.  The defaults passed on
>>> the command line are used by dom0 which has a very different grant
>>> requirements than a regular domU.  dom0 usually needs a bigger
>>> maptrack array, while domU usually require a bigger number of grant
>>> frames.
>>>
>>> The relaxation in the logic for the maximum size of the grant and
>>> maptrack table sizes doesn't change the fact that domain creation
>>> hypercall can cause resource exhausting, so disaggregated setups
>>> should take it into account.
>>>
>>> Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
>> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
>> albeit perhaps with yet one more wording change (which I'd be happy to
>> make while committing, provided you agree):
>>
>>> --- a/docs/misc/xen-command-line.pandoc
>>> +++ b/docs/misc/xen-command-line.pandoc
>>> @@ -1232,11 +1232,11 @@ The usage of gnttab v2 is not security supported on 
>>> ARM platforms.
>>>  
>>>  > Can be modified at runtime
>>>  
>>> -Specify the maximum number of frames which any domain may use as part
>>> -of its grant table. This value is an upper boundary of the per-domain
>>> -value settable via Xen tools.
>>> +Specify the default upper bound on the number of frames which any domain 
>>> may
>>> +use as part of its grant table unless a different value is specified at 
>>> domain
>>> +creation.
>>>  
>>> -Dom0 is using this value for sizing its grant table.
>>> +Note this value is the effective upper bound for dom0.
>> DomU-s created during Xen boot are equally taking this as their effective
>> value, aiui. So I'd be inclined to amend this: "... for dom0, and for
>> any domU created in the course of Xen booting".
> Not really for domUs, as there's a way to pass a different value for
> both options in the dt, see create_domUs().

Correct.  On the ARM side, this is configurable in the for all dom0less
VMs in the device tree.

I've committed the patch as is, seeing as it's fixing a real bug we
currently have.


But, I'd like to point out that there are still some issues which want
fixing.

The /* Apply defaults if no value was specified */ section is pointless
complication.  All callers pass a real number of frames, except for the
dom0 construction paths which pass in -1.

The logic gets smaller and easier to follow if each of the dom0's
dom_cfg's default to the appropriate opt_* value.  Userspace which
really asks for -1 gets a large domain that actually honours the
uint32_t ABI presented.

With that, the writeable hypfs nodes become useless, and can be dropped,
and the opt_* variables become __initdata.


Next, we need to do something about the fact that the number of maptrack
frames has no relationship to the number of entries.  I don't know what,
but the status quo needs changing.

Next we need to confirm that running guests with no maptrack is safe and
security supportable option.  XSM_SILO + 0 maptrack blocks most of the
grant related XSAs we've had.

And in some copious free time, we still need to get to a point where we
can construct a VM without a grant table at all (but this still looks
like a lot of work).

~Andrew



 


Rackspace

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