Received: from eggs.gnu.org ([140.186.70.92]:35100) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RZNiX-0002Ry-JU for qemu-devel@nongnu.org; Sat, 10 Dec 2011 09:15:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RZNiW-00009N-G8 for qemu-devel@nongnu.org; Sat, 10 Dec 2011 09:15:57 -0500 Received: from gunk.araneus.fi ([166.84.6.82]:60216) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RZNiW-00009H-9g for qemu-devel@nongnu.org; Sat, 10 Dec 2011 09:15:56 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <20195.27033.682993.370559@guava.gson.org> Date: Sat, 10 Dec 2011 16:15:53 +0200 In-Reply-To: Re: References: <20111210095911.AE7BE75E5D@guava.gson.org> <20195.18399.486776.141719@guava.gson.org> From: Andreas Gustafsson Subject: Re: [Qemu-devel] [PATCH] target-i386: fix cmpxchg instruction emulation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: malc Cc: qemu-devel@nongnu.org, Alexander Graf malc wrote: > > Inefficient in what way? The generated code only grows by a single > > unconditional branch. > > The generated code grows by a memory write Yes, an additional store instruction is generated, but the number of store instructions *executed* does not change. The original code already does a store in both the compare-equal and the compare-unequal case, by branching to the same store instruction; with my patch, a store is still done in both cases, but the store instruction executed is a separate one in each. > (which is not what the hardware does). The hardware does an atomic read-modify-write; qemu emulates this as a separate read and write, and like the hardware, always does the write part whether or not the "modify" part actually modified the data. My patch does *not* change this in any way. > I recall having discussion aboutit with Fabrcie (in private) and i > blieve (and if my memory serves me) we came to the conclusion that > there's a way forward w.r.t. to this issue i just never came around of > implementing it, i can try to dig out the old mails and share the > highlights with you if you are interested. Yes, please. -- Andreas Gustafsson, gson@gson.org