On 12/4/18 8:45 PM, Eduardo Habkost wrote: > On Tue, Dec 04, 2018 at 07:16:39PM +0000, Peter Maydell wrote: >> On Tue, 4 Dec 2018 at 19:05, Eduardo Habkost <ehabk...@redhat.com> wrote: >>> On Tue, Dec 04, 2018 at 06:24:19PM +0000, Peter Maydell wrote: >>>> A cluster is a group of CPUs which are all identical and have >>>> the same view of the rest of the system. >> >>> With that definition in mind, why can't QEMU cluster CPUs >>> automatically by looking at CPU models and address space objects? >> >> That sounds like it is in theory feasible and in practice >> quite tricky. You would have to look not just at the CPU >> model name but also introspect all its properties for >> ones which change features of the CPU and are set differently >> on different CPUs (and I don't think there's any way to >> automatically tell which properties are ones which make >> the CPU different for which-cluster purposes and which aren't). >> And if we automatically checked whether address space objects >> were the same it would rule out implementing devices with >> per-cpu banked memory mapped registers by mapping different >> things into the AS for each CPU (though that's a hypothetical >> at the moment -- I've thought about implementing stuff that >> way but we tend to implement that sort of thing by looking >> at current_cpu->cpu_index at the moment). > > I see. > > Can't we at least do something to make sure the cluster objects > make sense? e.g. by ensuring at least QOM CPU type is the same, > and that cpu->address_space somehow points to > cpu->cluster->address_space? Where such a check should be placed? Cluster realize function is not good since children can still be added after device realization. A good place would be when object_property_add_child() is called, but I'm not aware of a way of hooking into that with the QOM API...
-- Luc > > CCing Paolo, so he can correct me if this doesn't make sense. >