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

Re: Introduction of stable interface between Xenstore and hypervisor


  • To: Juergen Gross <jgross@xxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 13 Sep 2021 09:39:47 +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; bh=hX/RP9X88cA+nkyIzwgkGoiOgzdc/4idb4/dybz09Wk=; b=JVP0CfIm51EQ8uscUZ5F2Loyy6ruubpNTw7KoDPp2FsxlxgY975dOBYEkNJ5s1Z0FwUdb/Bd71ZMasRRSlOI4d6faF07M/gVd21tQ7bsOzBe56TWQizI7sonu9ytolkOiJSmylI9ND2ykLAMA16MYtm5R2QkM80qnuMEh9xG9nOb+CFyG39PeaYSnDMnAzRnG6erMtxUAn+cFmOIgAwfmrKNqfR1476KvmpjXRGwXSMATMuAI4Z+N6YnPakhVTEqMoCSU+0r/NnxOiANoFFDekU16+Oh9A5hNpsR/IsjPiVWzi1mGQlpL7qnn19V7JsXFaQi9MyrKn+bcJc7DpTFyw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NEVnXl4dangeuCCTWbhI5/sAdrpXi+bo4ei0g4k7Zyy6BZuxliLRGZd3S0oR3kzX2xfEmmGDYykb/+8FxrlWZnqoU02X905R4df7rKN/zrj5rhTMm0noAk5+8BkCoP2VcBOytaGKF+VHDfD2ZcpYraroXrXv2IsfOlRMA0L1R8Y7VKeWkYYvoDz4IMmkI8loJ0OXGxV4RrFYxpUoFfx4pUFHY6D6GxKNAJAe82wxE4fbIRK+zf2toyRl+eqqSGVFFOAMuS4WVdDLnfpoYSvJuMwJ/hGfyVJLFkuhcxvHRe24EZFeX40Eu0ou/QT6zB2w+W7IZ4Dicc4aFL9Kc39LhQ==
  • 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: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Wei Liu <wl@xxxxxxx>, George Dunlap <George.Dunlap@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 13 Sep 2021 07:40:00 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 10.09.2021 15:46, Juergen Gross wrote:
> On 10.09.21 15:22, Jan Beulich wrote:
>> On 09.09.2021 08:27, Juergen Gross wrote:
>>> Today Xenstore is using one unstable interface to retrieve the state
>>> of a domain (existing, dying).
>>>
>>> In order to decouple Xenstore further from the hypervisor, a stable
>>> interface should be established. This new interface should cover the
>>> following functionality:
>>>
>>> - get the needed state of a domain (existing, dying)
>>> - get a unique identifier per domain telling Xenstore that a domid
>>>     has been reused (today Xenstore could in theory miss this)
>>> - provide a way to avoid having to get the state of all domains when
>>>     a state change of a domain has been signaled (there is only an event
>>>     "some domain has changed state" today: VIRQ_DOM_EXC)
>>>
>>> I'm suggesting the following hypervisor modifications:
>>>
>>> - Addition of a global 64 bit domain sequence counter. This counter
>>>     will be incremented each time a new domain is created.
>>> - Addition of a sequence count to struct domain. It will be set to
>>>     the value of the new global domain sequence counter when the domain
>>>     is being created.
>>
>> This looks like an "extended domain ID", which I think we want to
>> avoid unless exposure is extremely limited. Since we can't easily
>> predict what future usage this may have, I would suggest to seed the
>> global with a 15-bit (or wider) random value. I'd like to further
>> suggest considering to not have this be maintained by simply
>> incrementing, to make very clear to consumers that the actual value
>> has no other meaning. This could be done by multiplying by a random
>> odd number larger than 1 (determined at build or boot time). All we
>> want to guarantee is that numbers don't repeat (earlier than a 64-bit
>> value would wrap when linearly incremented).
> 
> Fine with me.
> 
>>
>>> - Addition of a global bitmap with one bit for each possible domid
>>>     (resulting in a 4 kB page). Each time the state of a domain is changed
>>>     (domain creation, shutdown, deletion) the related bit is set.
>>>     When the VIRQ_DOM_EXC event is being registered the bitmap is reset to
>>>     have the bits set for all existing domains.
>>
>> This page, as I understand from the subsequent item, is not intended
>> to be exposed to the domain running xenstored (or any other one)?
> 
> Correct.
> 
>>
>>> - Addition of a new stable hypercall ("get domain state") returning the
>>>     following information:
>>>     + domid of a domain having the bit set in above bitmap
>>>     + state of that domain (existing, dying)
>>>     + sequence count of that domain
>>>     The related bit is reset in the bitmap as a side effect of the call.
>>
>> What I'd like us to consider up front is whether xenstored is going
>> to remain only entity interested in this kind of information. The
>> entire design looks to leverage that there's only a single consumer
>> in the system.
> 
> Right. I'm just writing some RFC patches, and I have coded this
> interface to be usable only for the domain having VIRQ_DOM_EXC
> registered.
> 
> The alternative (IMO) would have been to expose the domain-state
> bitmap to Xenstore (and/or other interested parties).

Right, but then a simple bitmap wouldn't suffice, would it? What
would be the criteria to clear a bit there? All interested parties
would have to signal that they've observed the respective state
change.

Further, while - like you - I'd prefer to avoid sharing the bitmap,
the question remains whether such further interested parties are
conceivable.

>> I understand the caller would iterate over this hypercall. Is there
>> concern about this iteration never finishing, if e.g. a guest gets
>> rebooted quickly enough?
> 
> No. As a reboot will always include Xenstore activity, there is no
> chance for that to happen.

Is this really the case? I thought that was an implementation
aspect of the tool stack(s). Take an XTF test: For it to be run
(no drivers, no qemu) is it really necessary to fiddle with
Xenstore? If from an abstract pov it isn't, then the hypervisor
should not become dependent upon such. IMO, that is.

Apart from this - how would Xenstore activity prevent this loop
from becoming unbounded? Is this because you expect other
operations to be serialized with running this loop? If so, how
do you prevent starvation from this loop taking long?

Jan




 


Rackspace

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