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

Re: [XENBUS PATCH] Kick the balloon thread in FdoStartDevice



Reviewed-by: Owen Smith <owen.smith@xxxxxxxxx>

On Fri, Jul 25, 2025 at 10:21 AM Owen Smith <owen.smith@xxxxxxxxx> wrote:
There is a race here, as __FdoD3ToD0 registers the watch causing the FdoBalloon thread to wake and race against FdoD3ToD0 setting the device to the D0 power state. Should the balloon thread get to the power state check first, it will bail without inflating the balloon, and since there is no feedback mechanism in the protocol the toolstack does not identify the issue.


Owen

On Tue, Jun 17, 2025 at 8:55 AM Paul Durrant <xadimgnik@xxxxxxxxx> wrote:
On 17/06/2025 08:53, Tu Dinh wrote:
> On 17/06/2025 08:54, Paul Durrant wrote:
>> On 13/06/2025 19:30, Tu Dinh wrote:
>>> Xenbus currently doesn't apply the dynamic memory targets at boot time.
>>>
>>
>> How so?
>>
>> The xenstore watch on memory/target signals the balloon thread's event
>> so the watch registration in __FdoD3ToD0() should always wake the thread
>> (since any watch registration triggers a spurious watch event).
>
> The problem is timing-related: FdoD3ToD0 sets the watch before setting
> power state to D0, but the watch thread goes to sleep if it's not in D0
> power state. Also, my VMs won't apply the memory target at boot without
> this patch.
>

That's new then. This always worked in the XenServer env... for years.

   Paul

>>
>>> Force the balloon thread to update memory targets at boot.
>>>
>>> Signed-off-by: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
>>> ---
>>>    src/xenbus/fdo.c | 3 +++
>>>    1 file changed, 3 insertions(+)
>>>
>>> diff --git a/src/xenbus/fdo.c b/src/xenbus/fdo.c
>>> index 3a4a1a2..c2e69fa 100644
>>> --- a/src/xenbus/fdo.c
>>> +++ b/src/xenbus/fdo.c
>>> @@ -3949,6 +3949,9 @@ not_active:
>>>            ASSERT(__FdoIsActive(Fdo));
>>> +        KeClearEvent(&Fdo->BalloonEvent);
>>> +        ThreadWake(Fdo->BalloonThread);
>>> +
>>>            //
>>>            // Balloon inflation should complete within a reasonable
>>>            // time (otherwise the target is probably unreasonable).
>>
>
> Best regards,
>
>
> Ngoc Tu Dinh | Vates XCP-ng Developer
>
> XCP-ng & Xen Orchestra - Vates solutions
>
> web: https://vates.tech
>
>


 


Rackspace

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