[PATCH v4 10/10] KVM: arm64: np-guest CMOs with PMD_SIZE fixmap
Vincent Donnefort
vdonnefort at google.com
Fri May 16 11:03:14 PDT 2025
> > +}
> > +
> > static void clean_dcache_guest_page(void *va, size_t size)
> > {
> > WARN_ON(!PAGE_ALIGNED(size));
> >
> > while (size) {
> > - __clean_dcache_guest_page(hyp_fixmap_map(__hyp_pa(va)),
> > - PAGE_SIZE);
> > - hyp_fixmap_unmap();
> > - va += PAGE_SIZE;
> > - size -= PAGE_SIZE;
> > + size_t fixmap_size = size == PMD_SIZE ? size : PAGE_SIZE;
> > + void *addr = __fixmap_guest_page(va, &fixmap_size);
> > +
> > + __clean_dcache_guest_page(addr, fixmap_size);
> > + __fixunmap_guest_page(fixmap_size);
> > +
> > + size -= fixmap_size;
> > + va += fixmap_size;
>
> Can this ever be called with a *multiple* of PMD_SIZE? In this case
> you'd still end-up doing PAGE_SIZEd-bite CMOs until there is only
> PMD_SIZE left, ruining the optimisation.
>
> I think this needs fixing.
So this can be only called with size either equal to PAGE_SIZE or PMD_SIZE. I
wasn't sure if it was worth to make it more generic than it needs.
But like for the first patch, I can make it more future-proof by handling size >
PMD_SIZE.
>
> > }
> > }
> >
[...]
More information about the linux-arm-kernel
mailing list