qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Bernhard Beschow" <shentey@gmail.com>,
	"Hervé Poussineau" <hpoussin@reactos.org>,
	"Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>,
	"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
	qemu-ppc@nongnu.org, "Titus Rwantare" <titusr@google.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Yanan Wang" <wangyanan55@huawei.com>,
	"Paul Durrant" <paul@xen.org>,
	"Anthony Perard" <anthony.perard@citrix.com>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"Jagannathan Raman" <jag.raman@oracle.com>,
	"John G Johnson" <john.g.johnson@oracle.com>,
	"Elena Ufimtseva" <elena.ufimtseva@oracle.com>,
	"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [PATCH 0/3] hw: Fix abuse of QOM class internals modified by their instances
Date: Tue, 23 May 2023 09:10:06 +0200	[thread overview]
Message-ID: <bfe359ae-96c9-5eb4-a4a3-56ad7927734e@linaro.org> (raw)
In-Reply-To: <20230523064408.57941-1-philmd@linaro.org>

(posted too quickly)

On 23/5/23 08:44, Philippe Mathieu-Daudé wrote:
> Bernhard warned for QOM class abuse here [*]:
> 
>> A realize method is supposed to modify a single instance only
>> while we're modifying the behavior of whole classes here, i.e.
>> will affect every instance of these classes. This goes against
>> QOM design principles and will therefore be confusing for people
>> who are familiar with QOM in particular and OOP in general.
> 
> This series fixes the cases I found while auditing.

Audited but not yet fixed:

- accel/xen
   xen_init() sets 'default_ram_id'
   -> need to figure migration compatibility (because using shared
      pc_machine_class_init and DEFINE_PC_MACHINE), will be posted
      separately.

- hw/core/bus
   qbus_init_internal() increments 'automatic_ids'
   -> need more thought.

- hw/core/
   machine_parse_smp_config() sets 'smp_props.has_clusters'
   -> dubious

- hw/remote/
   remote_object_init() and probe_pci_info() set 'vendor_id', 'nr_devs'
   -> need more thought.

- qom/object/
   object_dynamic_cast_assert() populates object_cast_cache[]
   -> QOM internal, likely OK.

- softmmu/vl
   configure_blockdev() overwrites 'machine_class->block_default_type'
   -> dubious

- gdbstub
   ppc_gdb_gen_spr_xml() sets 'gdb_num_sprs' and 'gdb_spr_xml'
   -> dubious, likely fixable (maybe like patch #3 of this series)

- tests/unit/
   smp_parse_test() set 'smp_props.prefer_sockets'
   -> dubious, probably tolerable.

> [*] https://lore.kernel.org/qemu-devel/0DAAC63B-0C0F-44C4-B7EB-ACD6C9A36BF1@gmail.com/


      parent reply	other threads:[~2023-05-23  7:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-23  6:44 [PATCH 0/3] hw: Fix abuse of QOM class internals modified by their instances Philippe Mathieu-Daudé
2023-05-23  6:44 ` [PATCH 1/3] hw/mips/jazz: Fix modifying QOM class internal state from instance Philippe Mathieu-Daudé
2023-05-23 18:26   ` Richard Henderson
2023-05-23  6:44 ` [PATCH 2/3] hw/ppc/e500plat: " Philippe Mathieu-Daudé
2023-05-23  9:03   ` Alexander Graf
2023-05-23 18:29   ` Richard Henderson
2023-05-23  6:44 ` [PATCH 3/3] hw/i2c/pmbus_device: Fix modifying QOM class internals " Philippe Mathieu-Daudé
2023-05-23 18:30   ` Richard Henderson
2023-05-23  7:10 ` Philippe Mathieu-Daudé [this message]

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=bfe359ae-96c9-5eb4-a4a3-56ad7927734e@linaro.org \
    --to=philmd@linaro.org \
    --cc=aleksandar.rikalo@syrmia.com \
    --cc=alex.bennee@linaro.org \
    --cc=anthony.perard@citrix.com \
    --cc=elena.ufimtseva@oracle.com \
    --cc=hpoussin@reactos.org \
    --cc=jag.raman@oracle.com \
    --cc=jiaxun.yang@flygoat.com \
    --cc=john.g.johnson@oracle.com \
    --cc=mst@redhat.com \
    --cc=paul@xen.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=shentey@gmail.com \
    --cc=sstabellini@kernel.org \
    --cc=titusr@google.com \
    --cc=wangyanan55@huawei.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).