On Mon, Jul 06, 2015 at 07:51:40PM +0200, Paolo Bonzini wrote:
>
>
> On 06/07/2015 15:31, Andrew Jones wrote:
> > + if (argc && strcmp(argv[0], "non-atomic") != 0) {
>
> You want == here, don't you?
Ah, now I see that your default was correct before. Sorry that
I didn't looked closely enough to see that you flipped that logic.
>
> 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.
Good call. I'll send a v2 of this patch that puts this in.
Thanks,
drew
>
> Paolo
>
> > lock_ops.lock = none_lock;
> > lock_ops.unlock = none_unlock;
> > + } else {
> > + lock_ops.lock = gcc_builtin_lock;
> > + lock_ops.unlock = gcc_builtin_unlock;
> > }
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html