[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 0/3] hw: Fix abuse of QOM class internals modified by their i

From: Philippe Mathieu-Daudé
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
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.11.0

(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

- 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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]