Received: from eggs.gnu.org ([209.51.188.92]:48440) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hGctj-00054f-AX for qemu-devel@nongnu.org; Wed, 17 Apr 2019 01:14:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hGcti-0007U8-C5 for qemu-devel@nongnu.org; Wed, 17 Apr 2019 01:14:15 -0400 From: Markus Armbruster References: <1555315185-16414-1-git-send-email-like.xu@linux.intel.com> <1555315185-16414-3-git-send-email-like.xu@linux.intel.com> <20190416212003.GB2272@habkost.net> Date: Wed, 17 Apr 2019 07:14:10 +0200 In-Reply-To: <20190416212003.GB2272@habkost.net> (Eduardo Habkost's message of "Tue, 16 Apr 2019 18:20:03 -0300") Message-ID: <87ftqh1ae5.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v3 2/2] core/qdev: refactor qdev_get_machine() with type assertion List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost Cc: Like Xu , Peter Maydell , Thomas Huth , qemu-trivial@nongnu.org, qemu-devel@nongnu.org, like.xu@intel.com, Igor Mammedov Eduardo Habkost writes: > On Mon, Apr 15, 2019 at 03:59:45PM +0800, Like Xu wrote: >> To avoid the misuse of qdev_get_machine() if machine hasn't been created yet, >> this patch uses qdev_get_machine_uncheck() for obj-common (share with user-only >> mode) and adds type assertion to qdev_get_machine() in system-emulation mode. >> >> Suggested-by: Igor Mammedov >> Signed-off-by: Like Xu > > Reviewed-by: Eduardo Habkost > > I'm queueing the series on machine-next, thanks! Hold your horses, please. I dislike the name qdev_get_machine_uncheck(). I could live with qdev_get_machine_unchecked(). However, I doubt this is the right approach. The issue at hand is undisciplined creation of QOM object /machine. This patch adds an asseertion "undisciplined creation of /machine didn't create crap", but only in some places. I think we should never create /machine as (surprising!) side effect of qdev_get_machine(). Create it explicitly instead, and have qdev_get_machine() use object_resolve_path("/machine", NULL) to get it. Look ma, no side effects.