From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [kvm-unit-tests PATCH 1/2] arm/arm64: spinlock-test fixup Date: Tue, 7 Jul 2015 13:25:25 +0200 Message-ID: <559BB725.8050204@redhat.com> References: <1436189485-21443-1-git-send-email-drjones@redhat.com> <1436189485-21443-2-git-send-email-drjones@redhat.com> <559AC02C.7010707@redhat.com> <20150707112434.GA3381@hawk.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Andrew Jones Return-path: Received: from mx1.redhat.com ([209.132.183.28]:43693 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756882AbbGGLZ2 (ORCPT ); Tue, 7 Jul 2015 07:25:28 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 7AA8A373BCA for ; Tue, 7 Jul 2015 11:25:28 +0000 (UTC) In-Reply-To: <20150707112434.GA3381@hawk.localdomain> Sender: kvm-owner@vger.kernel.org List-ID: On 07/07/2015 13:24, Andrew Jones wrote: >> > 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. No need to, I have already applied this patch, and my fixup on top. Paolo