[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200323214317.GV28711@linux.intel.com>
Date: Mon, 23 Mar 2020 14:43:18 -0700
From: Sean Christopherson <sean.j.christopherson@...el.com>
To: Peter Xu <peterx@...hat.com>
Cc: Christian Borntraeger <borntraeger@...ibm.com>,
Janosch Frank <frankja@...ux.ibm.com>,
Paolo Bonzini <pbonzini@...hat.com>,
David Hildenbrand <david@...hat.com>,
Cornelia Huck <cohuck@...hat.com>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, Qian Cai <cai@....pw>
Subject: Re: [PATCH 7/7] KVM: selftests: Add "delete" testcase to
set_memory_region_test
On Mon, Mar 23, 2020 at 03:06:36PM -0400, Peter Xu wrote:
> On Fri, Mar 20, 2020 at 01:55:46PM -0700, Sean Christopherson wrote:
> > + /*
> > + * Spin until the memory region is moved to a misaligned address. This
> > + * may or may not trigger MMIO, as the window where the memslot is
> > + * invalid is quite small.
> > + */
> > + val = guest_spin_on_val(0);
> > + GUEST_ASSERT(val == 1 || val == MMIO_VAL);
> > +
> > + /* Spin until the memory region is realigned. */
> > + GUEST_ASSERT(guest_spin_on_val(MMIO_VAL) == 1);
>
> IIUC ideally we should do GUEST_SYNC() after each GUEST_ASSERT() to
> make sure the two threads are in sync. Otherwise e.g. there's no
> guarantee that the main thread won't run too fast to quickly remove
> the memslot and re-add it back before the guest_spin_on_val() starts
> above, then the assert could trigger when it reads the value as zero.
Hrm, I was thinking ucall wasn't available across pthreads, but it's just
dumped into a global variable. I'll rework this to replace the udelay()
hacks with proper synchronization.
Powered by blists - more mailing lists