Received: from eggs.gnu.org ([2001:4830:134:3::10]:37746) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wt2WB-00049V-Cw for qemu-devel@nongnu.org; Fri, 06 Jun 2014 18:21:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wt2W5-0002nk-2T for qemu-devel@nongnu.org; Fri, 06 Jun 2014 18:21:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56280) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wt2W4-0002nA-Qs for qemu-devel@nongnu.org; Fri, 06 Jun 2014 18:21:41 -0400 Date: Fri, 6 Jun 2014 19:21:36 -0300 From: Eduardo Habkost Message-ID: <20140606222136.GD17594@otherpad.lan.raisama.net> References: <20140606201429.GK15000@otherpad.lan.raisama.net> <20140606233858.1f126642@thinkpad> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140606233858.1f126642@thinkpad> Subject: Re: [Qemu-devel] [PATCH] qdev: Skip non-existing properties when setting globals List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: "Michael S. Tsirkin" , qemu-devel@nongnu.org, Don Slutz , Markus Armbruster , Paolo Bonzini , Andreas =?iso-8859-1?Q?F=E4rber?= On Fri, Jun 06, 2014 at 11:38:58PM +0200, Igor Mammedov wrote: > On Fri, 6 Jun 2014 17:14:29 -0300 > Eduardo Habkost wrote: > > > This avoids QEMU from aborting on cases like this: > > > > $ ./install/bin/qemu-system-x86_64 -global cpu.foobar=5 > > qemu-system-x86_64: Property '.foobar' not found > > Aborted (core dumped) > That is expected behavior. Why? QEMU should never dump core due to user error. QEMU should not abort when handling a device_add command due to user error. > > > > > The code sets dev->not_used if the property is not found as an effort to > > to allow errors to be reported even if the device is hotpluggable, but > > it won't catch all errors. We can't know the property is not going to be > > available for hotpluggable devices, unless we actually try to create the > > device. > Instead of ignoring users errors, DeviceState should have async_error > field which could be set by device_post_init() instead of aborting and > later device_add could gracefully fail hotadd operation if error is set. > > PS: > initfn-s could also reuse this, instead of ignoring errors as they do now. Your proposal sounds good, and would allow reporting error without creating an object_new() variation that accepts Error**. But I believe we need to choose what to do in the meantime, while we don't have that mechanism implemented. Dumping core is not acceptable. Exiting QEMU while handling device_add doesn't seem acceptable to me, either. -- Eduardo