[PATCH 0/5] cpus: a few tweaks to CPU realization

Alex Bennée posted 5 patches 6 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20240530194250.1801701-1-alex.bennee@linaro.org
Maintainers: Cameron Esfahani <dirty@apple.com>, Roman Bolshakov <rbolshakov@ddn.com>, Paolo Bonzini <pbonzini@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, Eduardo Habkost <eduardo@habkost.net>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Yanan Wang <wangyanan55@huawei.com>, "Alex Bennée" <alex.bennee@linaro.org>, Alexandre Iooss <erdnaxe@crans.org>, Mahmoud Mandour <ma.mandourr@gmail.com>, Pierrick Bouvier <pierrick.bouvier@linaro.org>, Reinoud Zandijk <reinoud@netbsd.org>, Sunil Muthuswamy <sunilmut@microsoft.com>
include/hw/core/cpu.h             | 18 ++++++++++++++----
accel/dummy-cpus.c                |  3 ---
accel/hvf/hvf-accel-ops.c         |  4 ----
accel/kvm/kvm-accel-ops.c         |  3 ---
accel/tcg/tcg-accel-ops-mttcg.c   |  4 ----
accel/tcg/tcg-accel-ops-rr.c      | 14 +++++++-------
cpu-target.c                      |  1 -
hw/core/cpu-common.c              | 25 +++++++++++++++++--------
plugins/core.c                    |  6 +-----
target/i386/nvmm/nvmm-accel-ops.c |  3 ---
target/i386/whpx/whpx-accel-ops.c |  3 ---
11 files changed, 39 insertions(+), 45 deletions(-)
[PATCH 0/5] cpus: a few tweaks to CPU realization
Posted by Alex Bennée 6 months ago
The recent IPS plugin exposed a race condition between vcpu_init
callbacks and the other vcpu state callbacks. I originally thought
there was some wider re-factoring to be done to clean this up but it
turns out things are broadly where they should be. However some of the
stuff allocated in the vCPU threads can clearly be done earlier so
I've moved enough from cpu_common_realizefn to cpu_common_initfn to
allow plugins to queue work before the threads start solving the race.

Please review.

Alex Bennée (5):
  hw/core: expand on the alignment of CPUState
  cpu: move Qemu[Thread|Cond] setup into common code
  cpu-target: don't set cpu->thread_id to bogus value
  plugins: remove special casing for cpu->realized
  core/cpu-common: initialise plugin state before thread creation

 include/hw/core/cpu.h             | 18 ++++++++++++++----
 accel/dummy-cpus.c                |  3 ---
 accel/hvf/hvf-accel-ops.c         |  4 ----
 accel/kvm/kvm-accel-ops.c         |  3 ---
 accel/tcg/tcg-accel-ops-mttcg.c   |  4 ----
 accel/tcg/tcg-accel-ops-rr.c      | 14 +++++++-------
 cpu-target.c                      |  1 -
 hw/core/cpu-common.c              | 25 +++++++++++++++++--------
 plugins/core.c                    |  6 +-----
 target/i386/nvmm/nvmm-accel-ops.c |  3 ---
 target/i386/whpx/whpx-accel-ops.c |  3 ---
 11 files changed, 39 insertions(+), 45 deletions(-)

-- 
2.39.2


Re: [PATCH 0/5] cpus: a few tweaks to CPU realization
Posted by Philippe Mathieu-Daudé 5 months, 4 weeks ago
On 30/5/24 21:42, Alex Bennée wrote:
> The recent IPS plugin exposed a race condition between vcpu_init
> callbacks and the other vcpu state callbacks. I originally thought
> there was some wider re-factoring to be done to clean this up but it
> turns out things are broadly where they should be. However some of the
> stuff allocated in the vCPU threads can clearly be done earlier so
> I've moved enough from cpu_common_realizefn to cpu_common_initfn to
> allow plugins to queue work before the threads start solving the race.
> 
> Please review.
> 
> Alex Bennée (5):
>    hw/core: expand on the alignment of CPUState
>    cpu: move Qemu[Thread|Cond] setup into common code
>    cpu-target: don't set cpu->thread_id to bogus value
>    plugins: remove special casing for cpu->realized

Thanks, patches 1-4 queued so far.

Re: [PATCH 0/5] cpus: a few tweaks to CPU realization
Posted by Philippe Mathieu-Daudé 5 months, 4 weeks ago
On 3/6/24 14:47, Philippe Mathieu-Daudé wrote:
> On 30/5/24 21:42, Alex Bennée wrote:
>> The recent IPS plugin exposed a race condition between vcpu_init
>> callbacks and the other vcpu state callbacks. I originally thought
>> there was some wider re-factoring to be done to clean this up but it
>> turns out things are broadly where they should be. However some of the
>> stuff allocated in the vCPU threads can clearly be done earlier so
>> I've moved enough from cpu_common_realizefn to cpu_common_initfn to
>> allow plugins to queue work before the threads start solving the race.
>>
>> Please review.
>>
>> Alex Bennée (5):
>>    hw/core: expand on the alignment of CPUState
>>    cpu: move Qemu[Thread|Cond] setup into common code
>>    cpu-target: don't set cpu->thread_id to bogus value
>>    plugins: remove special casing for cpu->realized
> 
> Thanks, patches 1-4 queued so far.

Now patch 5 also queued ;)