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

Re: [XENBUS PATCH v3 1/2] Use Windows 10 APIs to inflate/deflate balloon



On 13/06/2025 12:36, Paul Durrant wrote:
> On 12/06/2025 12:00, Tu Dinh wrote:
>> Currently the balloon driver allocates pages as normal memory, which
>> causes Windows to report the ballooned memory as kernel-allocated
>> instead of unavailable.
>>
>> Windows 10 provides MM_ALLOCATE_AND_HOT_REMOVE to remove pages from
>> the physical memory pool. The removed pages can be added back with
>> MmAddPhysicalMemory.
>>
>> Using this feature, the real VM memory capacity will be correctly
>> reported in Task Manager.
>>
>> Balloon deflation is implemented using calls to MmAddPhysicalMemory on
>> contiguous PFN ranges.
>>
>> Note that MM_ALLOCATE_AND_HOT_REMOVE actually removes the pages from
>> memory space, so the resulting MDL will have the MDL_IO_SPACE flag;
>> similarly, when probing the freed MDL on deflation, we'll also have to
>> set MDL_IO_SPACE.
>>
>> Signed-off-by: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
>> ---
>> v3: Fix the issue where hot-removed memory will be in I/O space.
>> v2: Updated commit message to say what the patch does. No code change.
>> ---
>>   src/xenbus/balloon.c | 43 ++++++++++++++++++++++++++++++++++++++-----
>>   1 file changed, 38 insertions(+), 5 deletions(-)
>>
>
> How much testing has this had? v3 came out of nowhere.

The v3 fix came from manually testing the ballooning feature with a
debug build under Driver Verifier (standard + a few extra checks). Aside
from that I've done CodeQL and VS code analysis on the driver.

On a side note, the Xen PV drivers use old annotations which are not
checked by VS. Is there interest in upgrading to SAL 2.0? I tried doing
so with xenbus and it caught a couple small issues.

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®.