[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aCd94sBdThAj6jT9@google.com>
Date: Fri, 16 May 2025 19:03:14 +0100
From: Vincent Donnefort <vdonnefort@...gle.com>
To: Marc Zyngier <maz@...nel.org>
Cc: oliver.upton@...ux.dev, joey.gouly@....com, suzuki.poulose@....com,
yuzenghui@...wei.com, catalin.marinas@....com, will@...nel.org,
qperret@...gle.com, linux-arm-kernel@...ts.infradead.org,
kvmarm@...ts.linux.dev, linux-kernel@...r.kernel.org,
kernel-team@...roid.com
Subject: Re: [PATCH v4 10/10] KVM: arm64: np-guest CMOs with PMD_SIZE fixmap
> > +}
> > +
> > 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.
>
> > }
> > }
> >
[...]
Powered by blists - more mailing lists