On 7 December 2017 at 16:48, Igor Mammedov <imamm...@redhat.com> wrote:
> On Thu, 7 Dec 2017 16:05:50 +0000
> Peter Maydell <peter.mayd...@linaro.org> wrote:
>
>> Hi; I'm currently writing '-cpu max' support for ARM. For that I'd
>> like to be able to do the "probe host kernel for its supported feature
>> set" in the CPU object's instance-init function, but I'd like to do
>> it just once and cache the answer. Can I rely on something or other
>> having the BQL or otherwise ensuring that two threads don't run
>> the instance_init method in parallel (eg in a hotplug situation),
>> or do I need to create and use my own mutex to protect the cached
>> answer data?
> considering cached data shouldn't change during qemu lifetime it
> shouldn't be possible for instance_init() to clash at hotplug
> time as object_new(cpu) calls serialized within monitor/qmp loop.

Right, that was my question -- are we guaranteed that anything
that calls object_new(cpu) does it with a lock?

> But why cpu's instance_init, we could cache host's value at
> configure_accelerator() time (could be different depending on accel).

I don't know if I need the information at configure_accelerator()
time (if you say "-cpu cortex-a57" then we don't need to bother
probing). The first time I know if we want to probe is when a
"-cpu host" CPU is created.

thanks
-- PMM

Reply via email to