Received: from eggs.gnu.org ([2001:4830:134:3::10]:41263) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WszYP-0003o0-64 for qemu-devel@nongnu.org; Fri, 06 Jun 2014 15:12:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WszYJ-0006AP-1F for qemu-devel@nongnu.org; Fri, 06 Jun 2014 15:11:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:8722) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WszYI-0006AL-PF for qemu-devel@nongnu.org; Fri, 06 Jun 2014 15:11:46 -0400 Date: Fri, 6 Jun 2014 16:11:42 -0300 From: Eduardo Habkost Message-ID: <20140606191142.GC17594@otherpad.lan.raisama.net> References: <1399312987-29499-1-git-send-email-dslutz@verizon.com> <1399312987-29499-2-git-send-email-dslutz@verizon.com> <87wqcuzf8z.fsf_-_@blackfin.pond.sub.org> <5391755E.9070507@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5391755E.9070507@redhat.com> Subject: Re: [Qemu-devel] Should not abort on -global List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: "Michael S. Tsirkin" , Don Slutz , Markus Armbruster , Andreas =?iso-8859-1?Q?F=E4rber?= , qemu-devel@nongnu.org On Fri, Jun 06, 2014 at 10:01:34AM +0200, Paolo Bonzini wrote: > Il 06/06/2014 09:09, Markus Armbruster ha scritto: > >Looks like this regressed in Eduardo's commit 99a0b03 qdev: Set globals > >in instance_post_init function. > > > >Before, we exited cleanly on this error, in device_initfn(): > > > > qdev_prop_set_globals(dev, &err); > > if (err != NULL) { > > qerror_report_err(err); > > error_free(err); > > exit(1); > > } > > Hmm, right. I had noticed this abort in the past, but I wasn't sure > if it was a regression or not. > > However, the above is not hotplug-friendly either. In this sense, I > prefer an assertion that clearly says "gotta fix something here". The assertion can be triggered by user error (a non-existing property or invalid property value). Sounds like a bug to me. I will work on a patch to get back to using exit(), except when it is just a non-existing property. It will still be hotplug-unfriendly, but abort() is not hotplug-friendly either... > > >The commit asserts qdev_prop_set_globals() can't fail, which is wrong. > > > > static void device_post_init(Object *obj) > > { > > DeviceState *dev = DEVICE(obj); > > Error *err = NULL; > > > > qdev_prop_set_globals(dev, &err); > > assert_no_error(err); > > } > > > >Later simplified to: > > > > static void device_post_init(Object *obj) > > { > > qdev_prop_set_globals(DEVICE(obj), &error_abort); > > } > > I think the bug is that the global property should have been filtered > out early. Even if we handle non-existing properties cleanly (without exiting, but just keeping prop->not_used=true), we still need to handle errors returned by property setters in a hotplug-friendly way. > Or alternatively we need something better than > device_post_init to set the globals... no ideas for now. The root problem here seems to be that property setters can report errors, but object_new() can't. Does that mean we need a variation of object_new() which can report errors? -- Eduardo