From: Sean Christopherson <seanjc@google.com>
To: Shaoqin Huang <shahuang@redhat.com>
Cc: kvm@vger.kernel.org, kvmarm@lists.linux.dev,
Paolo Bonzini <pbonzini@redhat.com>,
Shuah Khan <shuah@kernel.org>,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
Peter Xu <peterx@redhat.com>
Subject: Re: [PATCH v2] KVM: selftests: Fix the dirty_log_test semaphore imbalance
Date: Thu, 1 Feb 2024 09:32:41 -0800 [thread overview]
Message-ID: <ZbvVuciX3HENjxQi@google.com> (raw)
In-Reply-To: <510f3534-b076-4d23-b4b8-361c1f872d57@redhat.com>
On Thu, Feb 01, 2024, Shaoqin Huang wrote:
> > > /*
> > > * We reserve page table for 2 times of extra dirty mem which
> > > * will definitely cover the original (1G+) test range. Here
> > > @@ -825,6 +832,13 @@ static void run_test(enum vm_guest_mode mode, void *arg)
> > > sync_global_to_guest(vm, iteration);
> > > }
> > > + /*
> > > + *
> > > + * Before we set the host_quit, let the vcpu has time to run, to make
> > > + * sure we consume the sem_vcpu_stop and the vcpu consume the
> > > + * sem_vcpu_cont, to keep the semaphore balance.
> > > + */
> > > + usleep(p->interval * 1000);
> >
> > Please no. "Wait for a while" is never a complete solution for fixing races.
> > In rare cases, adding a delay might be the only sane workaround, but I doubt that's
> > the case here.
>
> If that's the case. I guess I should keep the current solution. Except you
> have any better solution, please let me know.
Unfortunately I don't have a better solution, and I don't have cycles to stare
at this deeply to figure out what how to make the synchronization rock solid.
Sorry :-/
next prev parent reply other threads:[~2024-02-01 17:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-17 5:22 [PATCH v2] KVM: selftests: Fix the dirty_log_test semaphore imbalance Shaoqin Huang
2023-11-29 6:50 ` Shaoqin Huang
2024-01-26 20:25 ` Sean Christopherson
2024-02-01 8:57 ` Shaoqin Huang
2024-02-01 17:32 ` Sean Christopherson [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-01-12 5:53 Shaoqin Huang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZbvVuciX3HENjxQi@google.com \
--to=seanjc@google.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=shahuang@redhat.com \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox