Re: [PATCH] KVM: selftests: Wait mprotect_ro_done before write to RO in mmu_stress_test

From: Yan Zhao
Date: Sun Mar 02 2025 - 22:15:39 EST


On Fri, Feb 28, 2025 at 06:00:39AM -0800, Sean Christopherson wrote:
> On Fri, Feb 28, 2025, Yan Zhao wrote:
> > On Thu, Feb 27, 2025 at 02:18:02PM -0800, Sean Christopherson wrote:
> > > On Thu, Feb 27, 2025, Yan Zhao wrote:
> > So, I think the right one is:
> > - } while (!READ_ONCE(mprotect_ro_done));
> > + } while (!READ_ONCE(mprotect_ro_done) || !READ_ONCE(all_vcpus_hit_ro_fault));
>
> /double facepalm
>
> You're 100% correct. I did most of my testing with just the all_vcpus_hit_ro_fault
Haha, however, I failed writing code that makes you 100% happy in one shot :)
Your version is indeed cleaner than mine!

> check, and then botched things when adding back mprotect_ro_done.