From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49044) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aobKa-0006Xh-Cy for qemu-devel@nongnu.org; Fri, 08 Apr 2016 14:40:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aobKX-0001hs-6q for qemu-devel@nongnu.org; Fri, 08 Apr 2016 14:40:32 -0400 Received: from mail-qg0-x241.google.com ([2607:f8b0:400d:c04::241]:35305) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aobKX-0001ho-27 for qemu-devel@nongnu.org; Fri, 08 Apr 2016 14:40:29 -0400 Received: by mail-qg0-x241.google.com with SMTP id b32so10789776qgf.2 for ; Fri, 08 Apr 2016 11:40:28 -0700 (PDT) Sender: Richard Henderson References: <1460050358-25025-1-git-send-email-cota@braap.org> <1460050358-25025-9-git-send-email-cota@braap.org> From: Richard Henderson Message-ID: <5707FB19.2020709@twiddle.net> Date: Fri, 8 Apr 2016 11:40:25 -0700 MIME-Version: 1.0 In-Reply-To: <1460050358-25025-9-git-send-email-cota@braap.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 08/13] qemu-thread: optimize spin_lock for uncontended locks List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Emilio G. Cota" , QEMU Developers , MTTCG Devel Cc: =?UTF-8?Q?Alex_Benn=c3=a9e?= , Paolo Bonzini , Peter Crosthwaite , Peter Maydell , Sergey Fedorov On 04/07/2016 10:32 AM, Emilio G. Cota wrote: > static inline void qemu_spin_lock(QemuSpin *spin) > { > - do { > + while (atomic_xchg(&spin->value, true)) { > while (atomic_read(&spin->value)) { > cpu_relax(); > } > - } while (atomic_xchg(&spin->value, true)); > + } > } And merge this one as well, please. It's a good improvement, but there's little point to keeping these separate. r~