From: Keir Fraser Subject: Re: [PATCH] binary or instead of logical in timer sync Date: Thu, 3 Aug 2006 13:15:31 +0100 Message-ID: <59affcc6c4073a1a72f5cd3b511fa006@cl.cam.ac.uk> References: <44D16ADB.90005@redhat.com> Mime-Version: 1.0 (Apple Message framework v624) Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <44D16ADB.90005@redhat.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Steven Rostedt Cc: xen-devel , rostedt@goodmis.org List-Id: xen-devel@lists.xenproject.org On 3 Aug 2006, at 04:17, Steven Rostedt wrote: > The reading of a timer is determined if 1. the hypervisor is not > currently updating it (where it sets the LSB of the version) or 2. the > kernel didn't finish reading it before the hypervisor updated it (the > kernel version doesn't match the hypervisor version). > > But the current code doesn't test the above case. Instead, by using a > binary or instead of a logical one, it would only repeat if the > hypervisor was updating __and__ we read the version before it started > updating (or we read it before we started updating, but the hypervisor > finished updating between the first part of the or and the second > check). I don't believe there is a bug here. Are you suggesting that the binary or, used within a logical predicate, behaves as a logical and? That doesn't make sense. The only reason for using binary operators in those predicates is to avoid extra branches in the generated code which would probably be generated to follow the short-circuiting semantics of the logical operators. In fact, I think a smart optimising compiler would generate the *same* object code regardless of whether we use binary/logical or (but I don't believe gcc is that smart yet!). -- Keir