From mboxrd@z Thu Jan 1 00:00:00 1970 From: Don Slutz Subject: Re: [PATCH v3 2/4] GlobalProperty: Display warning about unused -global Date: Tue, 22 Apr 2014 19:13:03 -0400 Message-ID: <5356F77F.7070504@terremark.com> References: <1395705336-22528-1-git-send-email-dslutz@verizon.com> <1395705336-22528-3-git-send-email-dslutz@verizon.com> <53514312.5060705@suse.de> <5352E293.3090002@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 8bit Return-path: In-Reply-To: <5352E293.3090002@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org Sender: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org To: Paolo Bonzini , =?ISO-8859-15?Q?Andreas_F=E4rb?= =?ISO-8859-15?Q?er?= , Don Slutz Cc: Stefano Stabellini , xen-devel@lists.xensource.com, qemu-devel@nongnu.org, Anthony Liguori , "Michael S. Tsirkin" List-Id: xen-devel@lists.xenproject.org On 04/19/14 16:54, Paolo Bonzini wrote: > Il 18/04/2014 11:21, Andreas Färber ha scritto: >> Improving this is greatly appreciated, thanks. >> >> Now, I can see two ways things can go wrong: a) Mistyping or later >> refactoring devices, or b) user typos or thinkos. >> And four ways to set globals: -global, config file (I hope?), legacy >> command line options (vl.c) and machine .compat_props. >> >> If a property does not exist on the instance of an existing type, >> object_property_parse() will raise an Error and we will abort in >> device_post_init(). >> >> What we are silently missing is if a type is misspelled; for that we can >> probably add an Error **errp to the two qdev_prop_register_global*() >> functions - assuming QOM types are already registered at that point. >> qom-test would help us catch any such mistake by instantiating each machine. > > Even then, I suspect sooner or later machines other than PC and Q35 will be versioned. At that point we'll probably want QEMU-global compat_props that automatically apply to all machines, even if a type is not missing. I think we should already approximate this behavior by allowing machine .compat_props where the type doesn't exist. > If I am reading this correctly, this is asking that .compat_props to not be reported. This currently happens because of not_used being false in all C99 struct initializations. And that Andreas Färber would like me to extend qom-test to check that at least 1 instance of each machine does use each .compat_props so that a typo there gets "checked". -Don Slutz > Paolo > >> I note that your proposed check is not failing, but still, with hot-add >> of e.g. PCI devices we might well get a global property default for a >> type that is not instantiated immediately but possibly used later on. >