[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 00/15] hw: expand DEFINE_MACHINE to explicit TypeInfo registration
- To: Daniel P. Berrangé <berrange@xxxxxxxxxx>
- From: Yonggang Luo <luoyonggang@xxxxxxxxx>
- Date: Tue, 3 Nov 2026 17:15:38 +0800
- Arc-authentication-results: i=1; mx.google.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:cc:to:subject:message-id:date:from :reply-to:in-reply-to:references:mime-version:dkim-signature; bh=6HpPn4PoYBNIQe4jwAq6RYNc4y0GSA5S0U2wFZLAcN4=; fh=bPC2PGMQmpuQGGT94eSxX5wfaBnz1TqG72hOn9rgZJI=; b=UGy3+mhPDLOOEKpii0GpD5M591VK6spZNOdu1A6zrNmaxQEbe9r38dCN04vgsX0ULf PUhF89i3oyr0hf4ujcClpW6HKonA4xduLJT6OtM46a720RL2dYI6+HQBOoFrv5Yg5S5l fV6ExYo0t9F1TKR78s6zOYGcZYcMlXoP8Pm4sAlNH6rq4x8D1/RSLf7nPc7G9k4k+yPK Z1ZqKQICXniMIPYB91ciqhhq8gKYd1a3eCdb8PFRmqpNX34aDI5k/DQK8+lTSTBXflTu gB/DKM5PFWp0IwmmiV7E8Ipngzef3CO4J8BVw72L942XOefE4aygQu7eKsmHLUaCPrUs /Svg==; darn=lists.xenproject.org
- Arc-seal: i=1; a=rsa-sha256; t=1793697351; cv=none; d=google.com; s=arc-20260327; b=ezqoDEDR4OVl2/TG8kOfJzFKUrjDo7dZ9gYjsxwITETQnwi28NhF0Sw+QhpTOm7npH EQOGH9PMhoAGa5KWONFBc/KfHDxKivrWkxWQz9yILNVfoiMtbB59XmaF1mGejymUU9uw t5v/Ue/Qq/8k8kQYZp9faIbBJSA4myRo/P4vLLFBsQG1g7j5207AGuFiJXgFBdxM/7Zq WHLQj/nsoIcg9Yg3AR+hE+0W5MT2bORDEhyJg7f9Ijz3WkrjbzKwuV+5SOJR/UCp+NeP JPgmFbxN3AjKZ07JWfZC6YyxzUsKAyeygIb3NFlourBTp7IJrlQFSrjEFwabbRociUoS 89bg==
- Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=20260707 header.d=gmail.com header.i="@gmail.com" header.h="Content-Transfer-Encoding:Content-Type:Cc:To:Subject:Message-ID:Date:From:Reply-To:In-Reply-To:References:MIME-Version"
- Cc: Pierrick Bouvier <pierrick.bouvier@xxxxxxxxxxxxxxxx>, BALATON Zoltan <balaton@xxxxxxxxxx>, qemu-devel@xxxxxxxxxx, Anthony PERARD <anthony@xxxxxxxxxxxxxx>, Felipe Balbi <balbi@xxxxxxxxxx>, Aleksandar Rikalo <arikalo@xxxxxxxxx>, Philippe Mathieu-Daude <philmd@xxxxxxxxx>, Antony Pavlov <antonynpavlov@xxxxxxxxx>, Daniel Henrique Barboza <daniel.barboza@xxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Subbaraya Sundeep <sundeep.lkml@xxxxxxxxx>, Hervé Poussineau <hpoussin@xxxxxxxxxxx>, Max Filippov <jcmvbkbc@xxxxxxxxx>, Niek Linnenbank <nieklinnenbank@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, qemu-riscv@xxxxxxxxxx, Jean-Christophe Dubois <jcd@xxxxxxxxxxxxxxx>, qemu-ppc@xxxxxxxxxx, Alexandre Iooss <erdnaxe@xxxxxxxxx>, Weiwei Li <liwei1518@xxxxxxxxx>, Zhao Liu <zhao1.liu@xxxxxxxxx>, Jiaxun Yang <jiaxun.yang@xxxxxxxxxxx>, Strahinja Jankovic <strahinja.p.jankovic@xxxxxxxxx>, Philippe Mathieu-Daudé <philmd@xxxxxxxxxxxxxxxx>, Thomas Huth <th.huth+qemu@xxxxxxxxx>, Clément Chigot <chigot@xxxxxxxxxxx>, Mark Cave-Ayland <mark.cave-ayland@xxxxxxxxxxxx>, Yoshinori Sato <yoshinori.sato@xxxxxxxxx>, Frederic Konrad <konrad.frederic@xxxxxxxx>, Palmer Dabbelt <palmer@xxxxxxxxxxx>, Peter Maydell <peter.maydell@xxxxxxxxxx>, Chao Liu <chao.liu@xxxxxxxxxxxxxxxxxx>, Sai Pavan Boddu <sai.pavan.boddu@xxxxxxx>, Alistair Francis <alistair@xxxxxxxxxxxxx>, Huacai Chen <chenhuacai@xxxxxxxxxx>, Aurelien Jarno <aurelien@xxxxxxxxxxx>, Gaurav Sharma <gaurav.sharma_7@xxxxxxx>, "Edgar E. Iglesias" <edgar.iglesias@xxxxxxxxx>, Richard Henderson <richard.henderson@xxxxxxxxxx>, Alistair Francis <alistair.francis@xxxxxxx>, Artyom Tarasenko <atar4qemu@xxxxxxxxx>, qemu-arm@xxxxxxxxxx
- Delivery-date: Tue, 03 Nov 2026 09:16:01 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Tue, Nov 3, 2026 at 4:16 PM Daniel P. Berrangé <berrange@xxxxxxxxxx> wrote:
>
> On Fri, Oct 30, 2026 at 05:51:44PM -0800, Pierrick Bouvier wrote:
> > On 10/30/2026 4:09 PM, BALATON Zoltan wrote:
> > > On Fri, 30 Oct 2026, Yonggang Luo wrote:
> > >> DEFINE_MACHINE and DEFINE_MACHINE_EXTENDED hide the TypeInfo and the
> > >> type_init
> > >> function that calls type_register_static(). A later change needs to
> > >> pass a
> > >
> > > That's the point of the macro to hide the boiler plate code.
> > >
> > >> target mask into that registration, and the macros have no parameter
> > >> for it.
> > >
> > > Couldn't you just change the macros to take that parameter instead of
> > > expanding it everywhere?
> > >
> >
> > Problem of macros is that they don't have default parameters, so you
> > need variants for everything:
> >
> > DEFINE_MACHINE
> > DEFINE_MACHINE_EXTENDED
> > DEFINE_MACHINE_WITH_INTERFACES
> > DEFINE_MACHINE_WITH_INTERFACE_ARRAY
> > and now would need a new variant, with variant for other existing ones.
> >
> > In the end, it's just simpler to remove this and add the boilerplate.
> > It's written once and never modified, so using a macro just save typing
> > those lines once.
>
> For each machine, it is only written once, but we add machines
> over time, and every time a new machine is added the code style
> is slightly different. We introduced all the variuos DEFINE_*
> macros for QOM to better ensure consistent style and usage as
> new code is added over time.
I understand that the DEFINE_* macros are bloating because of this.
Indeed currently the only two macros used are "DEFINE_MACHINE" and
"DEFINE_MACHINE_EXTENDED"
; each time people want to add a new attribute, the macros is twiced.
And the usage of DEFINE_MACHINE_EXTENDED is rare and can be replaced
with DEFINE_TYPES or TypeInfo
and be more explicit. When we used as macro parameter, we need think
what's that parameter means, and for
TypeInfo, we can directly know what that member is about(because we
are assigned with the member name).
That's why I suggest keeping a single DEFINE_MACHINE, just like
DEFINE_TYPES; as they are the most
used macros(and simple enough), and won't suffer from changes much.
>
> With regards,
> Daniel
> --
> |: https://berrange.com ~~ https://hachyderm.io/@berrange :|
> |: https://libvirt.org ~~ https://entangle-photo.org :|
> |: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
>
--
此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo
|