qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 1/2] accel: move qtest CpusAccel functions to a common locati


From: Claudio Fontana
Subject: Re: [PATCH 1/2] accel: move qtest CpusAccel functions to a common location
Date: Mon, 12 Oct 2020 22:23:34 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0

On 10/12/20 10:07 PM, Jason Andryuk wrote:
> Move and rename accel/qtest/qtest-cpu.* files to accel/dummy/ so they
> can be re-used by Xen.
> 
> Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
> ---
>  .../qtest-cpus.c => dummy/dummy-cpus.c}       | 22 +++++--------------
>  .../qtest-cpus.h => dummy/dummy-cpus.h}       | 10 ++++-----
>  accel/dummy/meson.build                       |  6 +++++
>  accel/meson.build                             |  1 +
>  accel/qtest/meson.build                       |  1 -
>  accel/qtest/qtest.c                           |  7 +++++-
>  6 files changed, 23 insertions(+), 24 deletions(-)
>  rename accel/{qtest/qtest-cpus.c => dummy/dummy-cpus.c} (76%)
>  rename accel/{qtest/qtest-cpus.h => dummy/dummy-cpus.h} (59%)
>  create mode 100644 accel/dummy/meson.build
> 
> diff --git a/accel/qtest/qtest-cpus.c b/accel/dummy/dummy-cpus.c
> similarity index 76%
> rename from accel/qtest/qtest-cpus.c
> rename to accel/dummy/dummy-cpus.c
> index 7c5399ed9d..efade99f03 100644
> --- a/accel/qtest/qtest-cpus.c
> +++ b/accel/dummy/dummy-cpus.c
> @@ -1,5 +1,5 @@
>  /*
> - * QTest accelerator code
> + * Dummy cpu thread code
>   *
>   * Copyright IBM, Corp. 2011
>   *
> @@ -13,21 +13,14 @@
>  
>  #include "qemu/osdep.h"
>  #include "qemu/rcu.h"
> -#include "qapi/error.h"
> -#include "qemu/module.h"
> -#include "qemu/option.h"
> -#include "qemu/config-file.h"
> -#include "sysemu/accel.h"
> -#include "sysemu/qtest.h"
>  #include "sysemu/cpus.h"
> -#include "sysemu/cpu-timers.h"
>  #include "qemu/guest-random.h"
>  #include "qemu/main-loop.h"
>  #include "hw/core/cpu.h"
>  
> -#include "qtest-cpus.h"
> +#include "dummy-cpus.h"
>  
> -static void *qtest_cpu_thread_fn(void *arg)
> +static void *dummy_cpu_thread_fn(void *arg)
>  {
>  #ifdef _WIN32
>      error_report("qtest is not supported under Windows");

I wonder if this should be changed to "dummy cpu thread is not supported under 
Windows".

Does not matter probably.

> @@ -72,7 +65,7 @@ static void *qtest_cpu_thread_fn(void *arg)
>  #endif
>  }
>  
> -static void qtest_start_vcpu_thread(CPUState *cpu)
> +void dummy_start_vcpu_thread(CPUState *cpu)
>  {
>      char thread_name[VCPU_THREAD_NAME_SIZE];
>  
> @@ -81,11 +74,6 @@ static void qtest_start_vcpu_thread(CPUState *cpu)
>      qemu_cond_init(cpu->halt_cond);
>      snprintf(thread_name, VCPU_THREAD_NAME_SIZE, "CPU %d/DUMMY",
>               cpu->cpu_index);
> -    qemu_thread_create(cpu->thread, thread_name, qtest_cpu_thread_fn, cpu,
> +    qemu_thread_create(cpu->thread, thread_name, dummy_cpu_thread_fn, cpu,
>                         QEMU_THREAD_JOINABLE);
>  }
> -
> -const CpusAccel qtest_cpus = {
> -    .create_vcpu_thread = qtest_start_vcpu_thread,
> -    .get_virtual_clock = qtest_get_virtual_clock,
> -};
> diff --git a/accel/qtest/qtest-cpus.h b/accel/dummy/dummy-cpus.h
> similarity index 59%
> rename from accel/qtest/qtest-cpus.h
> rename to accel/dummy/dummy-cpus.h
> index 739519a472..a7a0469b17 100644
> --- a/accel/qtest/qtest-cpus.h
> +++ b/accel/dummy/dummy-cpus.h
> @@ -7,11 +7,11 @@
>   * See the COPYING file in the top-level directory.
>   */
>  
> -#ifndef QTEST_CPUS_H
> -#define QTEST_CPUS_H
> +#ifndef DUMMY_CPUS_H
> +#define DUMMY_CPUS_H
>  
> -#include "sysemu/cpus.h"
> +#include "qemu/typedefs.h"
>  
> -extern const CpusAccel qtest_cpus;
> +void dummy_start_vcpu_thread(CPUState *);
>  
> -#endif /* QTEST_CPUS_H */
> +#endif /* DUMMY_CPUS_H */
> diff --git a/accel/dummy/meson.build b/accel/dummy/meson.build
> new file mode 100644
> index 0000000000..5fbe27de90
> --- /dev/null
> +++ b/accel/dummy/meson.build
> @@ -0,0 +1,6 @@
> +dummy_ss = ss.source_set()
> +dummy_ss.add(files(
> +  'dummy-cpus.c',
> +))
> +
> +specific_ss.add_all(when: ['CONFIG_SOFTMMU', 'CONFIG_POSIX'], if_true: 
> dummy_ss)
> diff --git a/accel/meson.build b/accel/meson.build
> index bb00d0fd13..d45a33fb8e 100644
> --- a/accel/meson.build
> +++ b/accel/meson.build
> @@ -1,5 +1,6 @@
>  softmmu_ss.add(files('accel.c'))
>  
> +subdir('dummy')
>  subdir('qtest')
>  subdir('kvm')
>  subdir('tcg')
> diff --git a/accel/qtest/meson.build b/accel/qtest/meson.build
> index e477cb2ae2..a2f3276459 100644
> --- a/accel/qtest/meson.build
> +++ b/accel/qtest/meson.build
> @@ -1,7 +1,6 @@
>  qtest_ss = ss.source_set()
>  qtest_ss.add(files(
>    'qtest.c',
> -  'qtest-cpus.c',
>  ))
>  
>  specific_ss.add_all(when: ['CONFIG_SOFTMMU', 'CONFIG_POSIX'], if_true: 
> qtest_ss)
> diff --git a/accel/qtest/qtest.c b/accel/qtest/qtest.c
> index 537e8b449c..ac54bc8f52 100644
> --- a/accel/qtest/qtest.c
> +++ b/accel/qtest/qtest.c
> @@ -25,7 +25,12 @@
>  #include "qemu/main-loop.h"
>  #include "hw/core/cpu.h"
>  
> -#include "qtest-cpus.h"
> +#include "accel/dummy/dummy-cpus.h"

this is a bit strange from my perspective, does not look right.

Maybe this dummy cpu prototype should be somewhere in include/ ,
like include/sysemu/cpus.h or even better include/sysemu/accel.h

> +
> +const CpusAccel qtest_cpus = {
> +    .create_vcpu_thread = dummy_start_vcpu_thread,
> +    .get_virtual_clock = qtest_get_virtual_clock,
> +};
>  
>  static int qtest_init_accel(MachineState *ms)
>  {
> 




reply via email to

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