From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7259C433E0 for ; Wed, 29 Jul 2020 07:47:40 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 721F320838 for ; Wed, 29 Jul 2020 07:47:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="SR9nDViz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 721F320838 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:53894 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k0goN-0001HV-Lt for qemu-devel@archiver.kernel.org; Wed, 29 Jul 2020 03:47:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44768) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k0gnq-0000rJ-9P for qemu-devel@nongnu.org; Wed, 29 Jul 2020 03:47:06 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:24367) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k0gno-0004M7-Iy for qemu-devel@nongnu.org; Wed, 29 Jul 2020 03:47:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596008823; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=4+H/W2/xOM/ZS87vvyC9SjY9avxywWGNZjLVq60mQj4=; b=SR9nDVizZ5YLa67VNmsXsT2RpoEuyu7ESMdjKDBqLJPDKCXQvYzgEzE/pASDL74e0ai9x7 lyh1GQaCKh0JfcKGgmCK6if9ulmPnKf4loXPzVRNfC+3pS9IcACnbMqv3fWoO1I3YKcmzu 4qM986BLwoWxciFdUkwf9mnRaUNXT9E= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-67-vHggTbbZOaiO44jV-Wm7iQ-1; Wed, 29 Jul 2020 03:47:01 -0400 X-MC-Unique: vHggTbbZOaiO44jV-Wm7iQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 45E3A58; Wed, 29 Jul 2020 07:47:00 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-143.ams2.redhat.com [10.36.112.143]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 12F686932D; Wed, 29 Jul 2020 07:46:59 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 843421132FD2; Wed, 29 Jul 2020 09:46:58 +0200 (CEST) From: Markus Armbruster To: Paolo Bonzini Subject: Re: sysbus_create_simple Vs qdev_create References: <87365t18mp.fsf@dusky.pond.sub.org> <87lfjkvo81.fsf@dusky.pond.sub.org> <20200716222130.GO1274972@habkost.net> <87tuy6k9pa.fsf@dusky.pond.sub.org> <20200717162312.GR1274972@habkost.net> <87r1t6hc0f.fsf@dusky.pond.sub.org> <20200720155955.GV1274972@habkost.net> <87v9ihbe6u.fsf@dusky.pond.sub.org> <50e31ece-215c-a632-e5a2-86ae7ab3abab@redhat.com> <87lfj4f6nz.fsf@dusky.pond.sub.org> <759959d1-f320-734a-ac5e-a60db6b1bc23@redhat.com> Date: Wed, 29 Jul 2020 09:46:58 +0200 In-Reply-To: <759959d1-f320-734a-ac5e-a60db6b1bc23@redhat.com> (Paolo Bonzini's message of "Tue, 28 Jul 2020 19:38:27 +0200") Message-ID: <87mu3iahl9.fsf@dusky.pond.sub.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Received-SPF: pass client-ip=216.205.24.74; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-74.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/29 03:32:20 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , "Daniel P. =?utf-8?Q?Berrang=C3=A9?=" , Eduardo Habkost , Pratik Parvati , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Paolo Bonzini writes: > On 28/07/20 09:19, Markus Armbruster wrote: >>> the composition tree generally mirrors things that are born and die >>> at the same time, and creating children is generally reserved to the >>> object itself. >> >> Yes. Notable exceptions: containers /machine/peripheral, >> /machine/peripheral-anon, /machine/unattached. > > And /objects too. Apart from /machine/unattached, all these dynamic > objects are created by the monitor or the command line. > >>> Children are usually embedded directly in a struct, for >>> example. >> >> We sometimes use object_new() + object_property_add_child() instead. >> Extra indirection. I guess we'd be better off without the extra >> indirection most of the time. Implementation detail. >> >> We sometimes use object_new() without object_property_add_child(), and >> have qdev_realize() put the device in the /machine/unattached orphanage. >> Meh. I guess the orphanage feature exists to make conversion to QOM >> slightly easier. Could we ban its use for new boards at least? > > Banning perhaps is too strong, but yes /machine/unattached is an > anti-pattern. A ban backed by an automated test will be effective. Writing "but don't do that" on the list not so much. The automated test could have a list of exceptions. Adding a new instance of the anti-pattern then isn't impossible (you can update the list of exceptions), but clearly visible to patch submitter and reviewers. [...]