From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:33626) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uaonh-0006tv-BB for qemu-devel@nongnu.org; Fri, 10 May 2013 11:00:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uaong-0007SC-Bx for qemu-devel@nongnu.org; Fri, 10 May 2013 11:00:01 -0400 Received: from mail-gg0-x22e.google.com ([2607:f8b0:4002:c02::22e]:35296) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uaong-0007S8-7G for qemu-devel@nongnu.org; Fri, 10 May 2013 11:00:00 -0400 Received: by mail-gg0-f174.google.com with SMTP id i2so917745ggn.33 for ; Fri, 10 May 2013 07:59:59 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <518D0B68.505@redhat.com> Date: Fri, 10 May 2013 16:59:52 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1368188203-3407-1-git-send-email-pbonzini@redhat.com> <874nebdm4r.fsf@codemonkey.ws> <518CF130.2030402@redhat.com> <518CF4C4.6020901@suse.de> <518CF669.30803@redhat.com> <871u9ezypj.fsf@codemonkey.ws> In-Reply-To: <871u9ezypj.fsf@codemonkey.ws> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH for-1.5 0/9] Disable expensive QOM cast debugging for official releases List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: mst@redhat.com, =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= , Aurelien Jarno , qemu-devel@nongnu.org Il 10/05/2013 16:39, Anthony Liguori ha scritto: > I just oppose the notion of disabling casts and *especially* only > disabling casts for official builds. This actually happens all the time. Exactly this kind of type-safe cast is disabled in releases of GCC, but enabled when building from svn trunk. I have hardly seen any of these failures _during development_, much less on a release. I appreciate the advantage of type-safe casts, but in QEMU they are a solution in search of a problem. They are cheap to implement (though not that cheap to execute ;)) so it's perfectly fine to have them, but they are not _needed_; disabling them is anyway a good build-time option to have. Type-safe casts make sense in GTK+/GObject where: 1) type-safe casts return NULL and log a "critical" error, they do not abort; 2) all functions fail with another "critical" error if they are passed NULL. We do neither, so we're just trading a crash now for a crash very soon after (our call stacks tend to be relatively shallow, with some exceptions such as the block layer). Also, in GTK+/GObject the code paths are unpredictable because they depend on user interaction, and a crash can lead to data loss. By contrast, in QEMU most of the code is hardly ever run, and the possible paths are very few because driver writers tend to use always the same path. The day someone is bringing up a new guest OS and encounters such a crash, we'll tell them to either build from git, or to use --enable-qom-cast-debug. I'm sure it will be a long time before that happens... Paolo > Regards, > > Anthony Liguori > >>> Either way, it would be nice to see the call sites of those >>> most-impacting dynamic casts! So far I held back my APIC RFC since I'm >>> not sure how to reproducibly profile things. >> >> It's interrupts (both sending and returning from them). >> >> Paolo > > >