From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55432) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZvmgD-0004As-Iz for qemu-devel@nongnu.org; Mon, 09 Nov 2015 08:40:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zvmg8-0005ya-Jg for qemu-devel@nongnu.org; Mon, 09 Nov 2015 08:40:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59392) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zvmg8-0005yQ-EL for qemu-devel@nongnu.org; Mon, 09 Nov 2015 08:40:12 -0500 References: <56406315.6050402@redhat.com> <564073AE.6010602@redhat.com> From: Paolo Bonzini Message-ID: <5640A236.4010501@redhat.com> Date: Mon, 9 Nov 2015 14:40:06 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] Qemu: Guest Linux hangs on Mac OS X 10.11 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Aaron Elkins , "qemu-devel@nongnu.org Developers" , "Michael S. Tsirkin" On 09/11/2015 14:30, Peter Maydell wrote: > After a bunch of "try building specific object files with optimization > off to see where the problem goes away" tests, I've narrowed the > problem down further: if you tell clang to disable optimization by > adding __attribute__ ((optnone)) to the two functions > hpet_time_after() and hpet_time_after64() in hw/timer/hpet.c then > the problem goes away. > > My current theory is that we're doing something here that's not > valid C and the compiler ends up optimizing it into something > that results in the timer setting the next-timeout to a very > short interval and that's what's hogging the main-loop time. > I'll look in more detail after lunch. The obvious way to write those functions would be static uint32_t hpet_time_after(uint64_t a, uint64_t b) { return ((int32_t)(b - a)) < 0; } static uint32_t hpet_time_after64(uint64_t a, uint64_t b) { return ((int64_t)(b - a)) < 0; } Paolo