Re: [PATCH v8 00/17] QEMU cpus.c refactoring part2

2020-09-25 Thread Peter Maydell
On Fri, 25 Sep 2020 at 17:09, Claudio Fontana  wrote:
> Hi, if it is helpful I just rebased on latest master and pushed to
>
> https://github.com/hw-claudio/qemu.git branch: "cpus-refactoring"
>
> The following changes since commit d4277402b5e4645e4c7706a3221f8acd3f1a50f7:
>
>   tests: add missing genh dependency (2020-09-25 14:10:56 +0200)
>
> are available in the Git repository at:
>
>   https://github.com/hw-claudio/qemu.git
>
> for you to fetch changes up to 4822a683c261c249e46d26cd65ff37cc1e1cfb94:

Hi -- any chance you could not include the pull-request cover letter
wording in your emails, please ? It causes my filters to put the
email into my "pull requests to apply" folder...

thanks
-- PMM



Re: [PATCH v8 00/17] QEMU cpus.c refactoring part2

2020-09-25 Thread Claudio Fontana
On 9/25/20 3:09 PM, Paolo Bonzini wrote:
> On 18/09/20 21:00, Richard Henderson wrote:
>> On 9/16/20 7:19 AM, Claudio Fontana wrote:
>>> Motivation and higher level steps:
>>>
>>> https://lists.gnu.org/archive/html/qemu-devel/2020-05/msg04628.html
>>>
>>> Current state is mostly all reviewed, but I include here a few resolutions
>>> of rebasing conflicts and a new patch to use current_machine instead of
>>> qdev_get_machine in softmmu context.
>>>
>>> It's minor, but if additional reviewing is necessary, here is the whole 
>>> series again.
>>>
>>> CI is all green, and also available at 
>>> https://github.com/hw-claudio/qemu.git "cpus-refactoring"
>>>
>>> The following changes since commit 5a77bbb53b087f95dbba7ce30b02ac2d7b147a3a:
>>>
>>>   iotests: Work around failing readlink -f (2020-09-15 18:19:26 +0200)
>>>
>>> are available in the Git repository at:
>>>
>>>   https://github.com/hw-claudio/qemu.git 
>>>
>>> for you to fetch changes up to f9ec667595537400a6bc0aaf094a5ca6bbaacf44:
>>>
>>>   accel/tcg: use current_machine as it is always set for softmmu 
>>> (2020-09-15 18:19:27 +0200)
>>
>> Queuing this to tcg-next, with Phil's suggested change to current_machine in
>> the final patch.
> 
> This doesn't apply anymore, but I've fixed it up because I had it as a
> prerequisite for my next pull request.  If you want, I can shepherd it too.
> 
> Paolo
> 


Hi, if it is helpful I just rebased on latest master and pushed to

https://github.com/hw-claudio/qemu.git branch: "cpus-refactoring"

The following changes since commit d4277402b5e4645e4c7706a3221f8acd3f1a50f7:

  tests: add missing genh dependency (2020-09-25 14:10:56 +0200)

are available in the Git repository at:

  https://github.com/hw-claudio/qemu.git 

for you to fetch changes up to 4822a683c261c249e46d26cd65ff37cc1e1cfb94:

  accel/tcg: use current_machine as it is always set for softmmu (2020-09-25 
17:34:07 +0200)


Claudio Fontana (17):
  cpu-timers, icount: new modules
  icount: rename functions to be consistent with the module name
  cpus: prepare new CpusAccel cpu accelerator interface
  cpus: extract out TCG-specific code to accel/tcg
  cpus: extract out qtest-specific code to accel/qtest
  cpus: extract out kvm-specific code to accel/kvm
  cpus: extract out hax-specific code to target/i386/
  cpus: extract out whpx-specific code to target/i386/
  cpus: extract out hvf-specific code to target/i386/hvf/
  cpus: cleanup now unneeded includes
  cpus: remove checks for non-NULL cpus_accel
  cpus: add handle_interrupt to the CpusAccel interface
  hvf: remove hvf specific functions from global includes
  whpx: remove whpx specific functions from global includes
  hax: remove hax specific functions from global includes
  kvm: remove kvm specific functions from global includes
  accel/tcg: use current_machine as it is always set for softmmu

 MAINTAINERS|5 +-
 accel/kvm/kvm-all.c|   14 +-
 accel/kvm/kvm-cpus.c   |   88 +++
 accel/kvm/kvm-cpus.h   |   24 +
 accel/kvm/meson.build  |5 +-
 accel/meson.build  |2 +-
 accel/qtest/meson.build|7 +
 accel/qtest/qtest-cpus.c   |   91 +++
 accel/qtest/qtest-cpus.h   |   17 +
 accel/{ => qtest}/qtest.c  |   13 +-
 accel/stubs/hax-stub.c |   10 -
 accel/stubs/hvf-stub.c |   30 -
 accel/stubs/kvm-stub.c |   23 -
 accel/stubs/meson.build|2 -
 accel/stubs/whpx-stub.c|   47 --
 accel/tcg/cpu-exec.c   |   43 +-
 accel/tcg/meson.build  |2 +-
 accel/tcg/tcg-all.c|   42 +-
 accel/tcg/tcg-cpus.c   |  579 ++
 accel/tcg/tcg-cpus.h   |   17 +
 accel/tcg/translate-all.c  |3 +-
 dma-helpers.c  |4 +-
 docs/replay.txt|6 +-
 exec.c |4 -
 hw/core/cpu.c  |   14 +-
 hw/core/ptimer.c   |8 +-
 hw/i386/x86.c  |3 +-
 include/exec/cpu-all.h |4 +
 include/exec/exec-all.h|4 +-
 include/hw/core/cpu.h  |   14 -
 include/qemu/timer.h   |   24 +-
 include/sysemu/cpu-timers.h|   90 +++
 include/sysemu/cpus.h  |   50 +-
 include/sysemu/hax.h   |   17 -
 include/sysemu/hvf.h   |8 -
 include/sysemu/hw_accel.h  |   69 +-
 include/sysemu/kvm.h   |7 -
 include/sysemu/qtest.h |2 +
 include/sysemu/replay.h|4 +-
 include/sysemu/whpx.h  |   19 -
 replay/replay.c|6 +-
 softmmu/cpu-timers.c   |  279 +++
 softmmu/cpus.c | 1706 +++-
 softmmu/icount.c   |  492 
 softmmu/meson.build|   10 +-
 softmmu/qtest.c|   34 +-
 softmmu/timers-state.h   

Re: [PATCH v8 00/17] QEMU cpus.c refactoring part2

2020-09-25 Thread Paolo Bonzini
On 18/09/20 21:00, Richard Henderson wrote:
> On 9/16/20 7:19 AM, Claudio Fontana wrote:
>> Motivation and higher level steps:
>>
>> https://lists.gnu.org/archive/html/qemu-devel/2020-05/msg04628.html
>>
>> Current state is mostly all reviewed, but I include here a few resolutions
>> of rebasing conflicts and a new patch to use current_machine instead of
>> qdev_get_machine in softmmu context.
>>
>> It's minor, but if additional reviewing is necessary, here is the whole 
>> series again.
>>
>> CI is all green, and also available at 
>> https://github.com/hw-claudio/qemu.git "cpus-refactoring"
>>
>> The following changes since commit 5a77bbb53b087f95dbba7ce30b02ac2d7b147a3a:
>>
>>   iotests: Work around failing readlink -f (2020-09-15 18:19:26 +0200)
>>
>> are available in the Git repository at:
>>
>>   https://github.com/hw-claudio/qemu.git 
>>
>> for you to fetch changes up to f9ec667595537400a6bc0aaf094a5ca6bbaacf44:
>>
>>   accel/tcg: use current_machine as it is always set for softmmu (2020-09-15 
>> 18:19:27 +0200)
> 
> Queuing this to tcg-next, with Phil's suggested change to current_machine in
> the final patch.

This doesn't apply anymore, but I've fixed it up because I had it as a
prerequisite for my next pull request.  If you want, I can shepherd it too.

Paolo




Re: [PATCH v8 00/17] QEMU cpus.c refactoring part2

2020-09-18 Thread Richard Henderson
On 9/16/20 7:19 AM, Claudio Fontana wrote:
> Motivation and higher level steps:
> 
> https://lists.gnu.org/archive/html/qemu-devel/2020-05/msg04628.html
> 
> Current state is mostly all reviewed, but I include here a few resolutions
> of rebasing conflicts and a new patch to use current_machine instead of
> qdev_get_machine in softmmu context.
> 
> It's minor, but if additional reviewing is necessary, here is the whole 
> series again.
> 
> CI is all green, and also available at https://github.com/hw-claudio/qemu.git 
> "cpus-refactoring"
> 
> The following changes since commit 5a77bbb53b087f95dbba7ce30b02ac2d7b147a3a:
> 
>   iotests: Work around failing readlink -f (2020-09-15 18:19:26 +0200)
> 
> are available in the Git repository at:
> 
>   https://github.com/hw-claudio/qemu.git 
> 
> for you to fetch changes up to f9ec667595537400a6bc0aaf094a5ca6bbaacf44:
> 
>   accel/tcg: use current_machine as it is always set for softmmu (2020-09-15 
> 18:19:27 +0200)

Queuing this to tcg-next, with Phil's suggested change to current_machine in
the final patch.


r~



[PATCH v8 00/17] QEMU cpus.c refactoring part2

2020-09-16 Thread Claudio Fontana
Motivation and higher level steps:

https://lists.gnu.org/archive/html/qemu-devel/2020-05/msg04628.html

Current state is mostly all reviewed, but I include here a few resolutions
of rebasing conflicts and a new patch to use current_machine instead of
qdev_get_machine in softmmu context.

It's minor, but if additional reviewing is necessary, here is the whole series 
again.

CI is all green, and also available at https://github.com/hw-claudio/qemu.git 
"cpus-refactoring"

The following changes since commit 5a77bbb53b087f95dbba7ce30b02ac2d7b147a3a:

  iotests: Work around failing readlink -f (2020-09-15 18:19:26 +0200)

are available in the Git repository at:

  https://github.com/hw-claudio/qemu.git 

for you to fetch changes up to f9ec667595537400a6bc0aaf094a5ca6bbaacf44:

  accel/tcg: use current_machine as it is always set for softmmu (2020-09-15 
18:19:27 +0200)


Claudio Fontana (17):
  cpu-timers, icount: new modules
  icount: rename functions to be consistent with the module name
  cpus: prepare new CpusAccel cpu accelerator interface
  cpus: extract out TCG-specific code to accel/tcg
  cpus: extract out qtest-specific code to accel/qtest
  cpus: extract out kvm-specific code to accel/kvm
  cpus: extract out hax-specific code to target/i386/
  cpus: extract out whpx-specific code to target/i386/
  cpus: extract out hvf-specific code to target/i386/hvf/
  cpus: cleanup now unneeded includes
  cpus: remove checks for non-NULL cpus_accel
  cpus: add handle_interrupt to the CpusAccel interface
  hvf: remove hvf specific functions from global includes
  whpx: remove whpx specific functions from global includes
  hax: remove hax specific functions from global includes
  kvm: remove kvm specific functions from global includes
  accel/tcg: use current_machine as it is always set for softmmu



Further work for future patches include:

* additional improvements to naming consistency in QEMU files.
  (Claudio, Alex, Roman)

* tcg vcpu start refactoring, providing then multiple structs for
  mttg, icount, normal. (Claudio, Alex)

* possible removal of NULL check for virtual clock if the qcow2
  early call is solved. (Claudio, Paolo, Berto)

PATCH v7 -> PATCH v8:

* rebased on latest master, including "softmmu/cpus: Only set parallel_cpus for 
SMP"

* added a patch to use current_machine instead of qdev_get_machine in softmmu 
context.

PATCH v6 -> PATCH v7:

* in patch "cpu-timers, icount: new modules":
  - remove redundant double initialization of spice
  - remove lingering calls to icount_get

PATCH v5 -> PATCH v6:

* moved to mason build system

* patch (new): cpus: remove checks for non-NULL cpus_accel (Richard)

  This has however a big caveat: in some cases the virtual clock is
  queried before an accelerator is set or ticks are enabled; this is
  currently special cased (keeping the NULL check in cpus_get_virtual_clock),
  but maybe this should not happen at all? (Paolo, Berto)

* in patch "cpu-timers, icount: new modules"
  do not change (yet) icount_enabled() to a function.
  Mimic instead what is done with tcg_enabled(). (Richard)

* split the changes into two separate patches, with name-only changes
  extracted out into a separate patch (Richard).
  Removed existing Reviewed-by because of these changes (Alex)-
  Alex are you ok with them?

* in patch "cpus: prepare new CpusAccel cpu accelerator interface"
  remove some unneeded stubs from stubs/cpu-synchronize-state.c
  Use const for the CpusAccel interface. (Richard)

* in patch "cpus: extract out TCG-specific code to accel/tcg"
  use const for the CpusAccel interface. (Richard)

* in patch "cpus: extract out qtest-specific code to accel/qtest"
  use const for the CpusAccel interface;
  use g_assert_not_reached (Richard)

* in patch "cpus: extract out kvm-specific code to accel/kvm"
  use const for the CpusAccel interface. (Richard)

* in patch "cpus: extract out hax-specific code to target/i386/"
  use const for the CpusAccel interface. (Richard)

* in patch "cpus: extract out whpx-specific code to target/i386/"
  use const for the CpusAccel interface. (Richard)

* in patch "cpus: extract out hvf-specific code to target/i386/hvf/"
  use const for the CpusAccel interface. (Richard)


RFC v4 -> PATCH v5:

* in patch 2, move comment about cpus_get_elapsed_ticks from patch 3
  (Philippe)

* in patch 11-14, do not create separate xxx-int.h files,
  instead use the xxx-cpus.h files (Philippe)

RFC v3 -> v4:

* added patch 9: cleanup unneeded includes

* added patch 10: add handle_interrupt to the interface (Roman)

* added patch 11-14: remove accelerator specific internal functions
  from global includes (Roman)

* in patch 2, removed leftover "if hvf_enabled" hunk

* in patch 2, convert if (!tcg_enabled) with more punctual if (hax_enabled)
  when eating dummy