[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH 0/1] static-memory: allow skipping the cache flush
- To: "Grall, Julien" <julien@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- From: Jan Setje-Eilers <Jan.SetjeEilers@xxxxxxxxxx>
- Date: Fri, 18 Sep 2026 14:23:08 -0700
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=0SM+epRE0CJpSQ6kUZJcVL3gxlMNc0Dr5pLnjM53r7c=; b=n5uAzU169Oz2oWdijDnHNuj7TReBk2RoEY6MjU49QrtTGeANInyDaUNuPcL7lkM04vaIhyRfepnq0ijujeljEGb11bJgvVuONzwfinE034BqxQLaRKbHE6Hx86RKTRvp8kO/n0/b2UUdFGk/LldLmPueBH6EdReY5Nb5msri8S0CT8JN6P2ei5VnQH9WOlqOl2fzPyxCHVLvF6ko5cG7q6G42iKLwle7ZQsgxVNFY8U34+DL373vGuRliyffIoCc14lWVmSIxQ9W4oHyUIWnNNuuh2U4HHn8TuXm+jsgSiUejb99bhitFmfMAsJiYC+9Hqj4RYQ8Vr13QwIAlTtoWQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kZd1v+6YjK39LILPJ6yPbER9wmSkJFDo8D4wxwc8GCFTJFbbGKZIIjNrRg6KZPaPEb5JSMRJ2VRr7QXpS+wvA2d+oEarNOK8sAF02cojEUzPYAm3vQzZFAuSejn879WJV/Gvlvf0wrqrvFKFZPqthhBx+GglHmhcQSRcrFZheL+3bLxtnlzZk1eiNkr8MdUGgU1ULiK/Meqrm7iLmr3/SvIaer9RFLFSuPMdOSV2E0Uu5uNFEpE1opb6gwp9gNzf6MERInXvflmTMMIYAeWLliMDGKBJJxwHrxXu1ePytSTDnWtuhvk6K0lsPzkX5LR0CdwHxpvOIwtW0CaY2G28nw==
- Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=corp-2025-04-25 header.d=oracle.com header.i="@oracle.com" header.h="Cc:Content-Transfer-Encoding:Content-Type:Date:From:In-Reply-To:Message-ID:MIME-Version:References:Subject:To"; dkim=pass header.s=selector2-oracle-onmicrosoft-com header.d=oracle.onmicrosoft.com header.i="@oracle.onmicrosoft.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
- Autocrypt: addr=Jan.SetjeEilers@xxxxxxxxxx; keydata= xsDNBGetHhIBDACa4fBRw0+D/y8p0kzZyJ+K5pisnqCKCFVKtAhVYFJjzEoUvVtqKJpjZaWp JtlNQ05u3GZKofFptGJmXJZtttujfE6iWqjFVcm1SUo8kSRSLQ+AxtfAot319Do73k/uhfQM 71+cX5pO6EybCrr962npOEfe6yNbZ3UmszrbmRORw3aI9g/VHmC1SwFj3Gq0KHBQvEB89J6F iDgrHGnQVyQDmCBF6n6mqSJFV/fWK6XeGSj/T/R+8osU0FpXcsZ4OCY9eyJ23zY1M2f2VEV4 B61+UW8orqgXe3mADI0yLP0onViD2UHqV6EDjLWN1ukUkJUoPWzv65LyU1sAw0rKPELvcl4/ rzJPiO8FNMjTp4jibe46Spyh5BKYxN54m8zAF9D9uHA1IX9pJpNRS2uKEnZWHJx1Ew2GZINv 8VDhpPxJP4p4ArZMSzAsNKYSqyuXyQ8Fcn7DCwI8E4tl6tRNacBkf1ByF30oYFYFg1pbMIQm 4z9BY01cBMB59/50dy3QF3MAEQEAAc0tSmFuIFNldGplLUVpbGVycyA8SmFuLlNldGplRWls ZXJzQG9yYWNsZS5jb20+wsENBBMBCAA3FiEEvrH8dy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W322QDnZFpI6FPaLnGgPjMhFuz1qQAPYmRByC4W029 jE+4cS93yyFScwARAQABwsD8BBgBCAAmFiEEvrH8dyNhbaVzmqUqqJoDwbaIAmsFAmetHhIF CQWjmoACGwwACgkQqJoDwbaIAmvmZgv8DAZ8XQnunSonH0N5HMa9qaQafl07cfd8jVk4IFH9 UPIH0463s/0oVJV1hlcqqqk0nZKwobflIrehB/TSSaLnAoy9b2raOKNbj0ppZdoGCm+S3z67 O1c7cx8vQ+nnSe4E+Ko/J/8e4FOYhFUOc4lmIn4ByK+SBKitAkOYI64ugunvGZLj1TV+b1Wf wiWaJUGmzZkjIU2T6J8W1riYn1KW2uNheJQU4/sVtBc6j/hIqccTKBpx0qTszeZnFa28aGkg t2BXv2TqaA7yzbLymTRG4JHRlc9LQ2tHjIjkRBGXpiOG26S7JoeHz+QCqSK2XPp+LP5/XhTk Vvb8FjeyBuJ+Q5RK2vYk6Ws5ua4G1p2AUs0w5SpRxpLUTuTVlntyXQfp7Pa42oX364UOGNrY c+ddxSb+KW13sbIRslW8+LWdvNH/VgPKC3SkblSG5H/e3sfLsA3DAmu886allZ82imnPRlYH /epCCdHbjMyPhatWd4WT2RFakWMvkwGDSJUd50h8
- Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Roger Pau Monné <roger@xxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
- Delivery-date: Fri, 18 Sep 2026 21:23:50 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 9/17/26 04:06, Grall, Julien wrote:
Hi!
> Sorry for the late answer. The topic is a bit tricky.
Thanks for replying regardless. FWIW I tried to get some feedback
internally as well, and it seemed like no one wanted to get involved. :)
> On 29/08/2026 07:06, Jan Setje-Eilers wrote:
>> Hi all,
>>
>> I would like feedback on whether Xen needs to flush every page in a
>> dom0less xen,static-mem bank before assigning it to a guest.
>>
>> Static-memory support is currently enabled only on Arm, where I am using
>> and testing this change. Its implementation and acquisition path are in
>> common code, so this RFC is about the generic static-memory path.
>>
>> The current code cleans and invalidates every page in the bank. This is a
>> safe default, but walking a large bank can add several seconds to boot even
>> though Xen only writes the pages used for the guest kernel, initrd, and
>> device tree.
>>
>> Here, cleaning refers to cache maintenance, not boot scrubbing. With
>> bootscrub=1 or the default bootscrub=idle, Xen assigns dom0less static
>> banks before boot scrubbing starts. The pages are no longer free, so boot
>> scrubbing does not clear them.
>>
>> My starting point is that if a platform permits the untouched pages to be
>> cleared before guest start, the guest cannot depend on their initial
>> contents. This is a platform policy assumption, not something Xen's boot
>> scrubbing establishes. Xen already cleans each page it writes during
>> domain construction.
>>
>> Would it therefore be reasonable to let a platform skip the full-bank
>> flush, provided it can also guarantee that the untouched pages are absent
>> from all caches and that firmware, DMA, EL3 services, and other CPUs do not
>> write them before guest start?
>
> IIUC, the cache flush was mainly added to prevent memory leaking between
> two guests if they are the MMU off (see XSA-364). I think what you wrote
> makes sense, but I would prefer Arm to confirm this is fine. For Xen ...
Yes, I think in a world where guests are coming and going, and smaller,
this flush seems relatively sensible.
>> I am using no-staticmem-cache-flush with bootscrub=0 on a 64-bit Arm
>> system with two dom0less guests. Both guests boot normally. Skipping the
>> flush reduced Xen startup from about five seconds to about one second.
>
> ... I think the slow down you describe could also happen when a dynamic
> VM is created (e.g. via xl).
>
> A few years ago, Arm introduced FEAT_FWB to rework how stage-2 + stage-1
> memory attributes works. Currently in Xen, we are using the "old"
> approach where the used attributes is the strongest of the two. For
> instance, the guest has the MMU off, then the access will bypass the
> cache. With FEAT_FWB, you can force the memory attributes to be
> cacheable even when the MMU is off.
>
> I believe FEAT_FWB should solve the problem you have (assume your HW
> supports it). In term of effort, it is mostly updating the stage-2
> memory attributes and then getting rid of some cache operations (include
> set/way emulation) when the feature is enabled.
I found that as well, but at least some of my hardware is from just
before that shows up.
> BTW, how much memory do you give to the domain? 4 seconds difference
> seems quite a lot.
This is two domains: 15 1/4 G to one and 4 1/4 G to the other.
It really stood out when we did a boot time reduction exercise.
-jan
|