From: Paolo Bonzini <pbonzini@redhat.com>
To: Andrew Jones <drjones@redhat.com>, kvm@vger.kernel.org
Subject: Re: [kvm-unit-tests PATCH 1/2] arm/arm64: spinlock-test fixup
Date: Mon, 6 Jul 2015 19:51:40 +0200 [thread overview]
Message-ID: <559AC02C.7010707@redhat.com> (raw)
In-Reply-To: <1436189485-21443-2-git-send-email-drjones@redhat.com>
On 06/07/2015 15:31, Andrew Jones wrote:
> + if (argc && strcmp(argv[0], "non-atomic") != 0) {
You want == here, don't you?
The reason I switched was that the non-atomic test didn't work for me.
I have now debugged it, and it needs this:
@@ -29,12 +29,12 @@ static void gcc_builtin_unlock(int *lock_var)
}
static void none_lock(int *lock_var)
{
- while (*lock_var != 0);
- *lock_var = 1;
+ while (*(volatile int *)lock_var != 0);
+ *(volatile int *)lock_var = 1;
}
static void none_unlock(int *lock_var)
{
- *lock_var = 0;
+ *(volatile int *)lock_var = 0;
}
static int global_a, global_b;
Otherwise the none_lock function does not reload lock_var.
Paolo
> lock_ops.lock = none_lock;
> lock_ops.unlock = none_unlock;
> + } else {
> + lock_ops.lock = gcc_builtin_lock;
> + lock_ops.unlock = gcc_builtin_unlock;
> }
next prev parent reply other threads:[~2015-07-06 17:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-06 13:31 [kvm-unit-tests PATCH 0/2] one fix, one resend Andrew Jones
2015-07-06 13:31 ` [kvm-unit-tests PATCH 1/2] arm/arm64: spinlock-test fixup Andrew Jones
2015-07-06 17:51 ` Paolo Bonzini [this message]
2015-07-07 11:24 ` Andrew Jones
2015-07-07 11:25 ` Paolo Bonzini
2015-07-06 13:31 ` [kvm-unit-tests PATCH 2/2] arm/arm64: allow building a single test Andrew Jones
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=559AC02C.7010707@redhat.com \
--to=pbonzini@redhat.com \
--cc=drjones@redhat.com \
--cc=kvm@vger.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;
as well as URLs for NNTP newsgroup(s).