All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Cc: qemu-devel@nongnu.org,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Anton Johansson" <anjo@rev.ng>,
	marcandre.lureau@redhat.com,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Max Filippov" <jcmvbkbc@gmail.com>
Subject: Re: [PATCH v2 3/7] qom/object: register OBJECT and INTERFACE QOM types before main
Date: Thu, 30 Apr 2026 08:12:49 +0100	[thread overview]
Message-ID: <afMA8SCcF9XJ8VUe@redhat.com> (raw)
In-Reply-To: <20260430035626.3511676-4-pierrick.bouvier@oss.qualcomm.com>

On Wed, Apr 29, 2026 at 08:56:22PM -0700, Pierrick Bouvier wrote:
> Those types are special, as they are the base of all other QOM types. In
> next commit, we'll introduce an extra step in module initialization for
> target-info-* types.
> 
> However, those types depend on TYPE_OBJECT, which is only registered
> at MODULE_INIT_QOM step.
> 
> To avoid having to introduce another step, and modify all code calling
> module_call_init(MODULE_INIT_QOM), we simply register those base types
> directly in the static constructor, before anything else.
> 
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
> ---
>  qom/object.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/qom/object.c b/qom/object.c
> index f981e270440..a5d268d0722 100644
> --- a/qom/object.c
> +++ b/qom/object.c
> @@ -2839,7 +2839,7 @@ static void object_class_init(ObjectClass *klass, const void *data)
>                                    NULL);
>  }
>  
> -static void register_types(void)
> +static void __attribute__((constructor)) register_types(void)
>  {
>      static const TypeInfo interface_info = {
>          .name = TYPE_INTERFACE,
> @@ -2857,5 +2857,3 @@ static void register_types(void)
>      type_interface = type_register_internal(&interface_info);
>      type_register_internal(&object_info);
>  }
> -
> -type_init(register_types)

IMHO this should have been done using the MODULE_INIT_QOM_EARLY
approach that I suggested on v1, rather than special casing both
the base classes and MODULE_INIT_TARGET_INFO

With regards,
Daniel



  reply	other threads:[~2026-04-30  7:13 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-30  3:56 [PATCH v2 0/7] single-binary: deduplicate target_info() Pierrick Bouvier
2026-04-30  3:56 ` [PATCH v2 1/7] target-info: extract target_info() definition in target-info-init.h Pierrick Bouvier
2026-04-30  8:03   ` Marc-André Lureau
2026-04-30 16:23     ` Pierrick Bouvier
2026-04-30  3:56 ` [PATCH v2 2/7] target-info: introduce TargetInfo in QOM Pierrick Bouvier
2026-04-30  3:56 ` [PATCH v2 3/7] qom/object: register OBJECT and INTERFACE QOM types before main Pierrick Bouvier
2026-04-30  7:12   ` Daniel P. Berrangé [this message]
2026-04-30 16:03     ` Pierrick Bouvier
2026-04-30 17:07       ` Daniel P. Berrangé
2026-04-30 17:28         ` Pierrick Bouvier
2026-04-30 17:37           ` Pierrick Bouvier
2026-04-30  3:56 ` [PATCH v2 4/7] target/xtensa/core: register types using type_init Pierrick Bouvier
2026-04-30  4:48   ` Philippe Mathieu-Daudé
2026-04-30  3:56 ` [PATCH v2 5/7] system/vl: register target info types first in qom Pierrick Bouvier
2026-04-30  7:47   ` Daniel P. Berrangé
2026-04-30 18:57     ` Pierrick Bouvier
2026-04-30  3:56 ` [PATCH v2 6/7] target-info-qom: detect target from QOM Pierrick Bouvier
2026-04-30  3:56 ` [PATCH v2 7/7] target-info: replace target_info() in system-mode Pierrick Bouvier
2026-04-30 20:40 ` [PATCH v2 0/7] single-binary: deduplicate target_info() Pierrick Bouvier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=afMA8SCcF9XJ8VUe@redhat.com \
    --to=berrange@redhat.com \
    --cc=anjo@rev.ng \
    --cc=armbru@redhat.com \
    --cc=jcmvbkbc@gmail.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=pierrick.bouvier@oss.qualcomm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.