qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v2 2/3] KVM: keep track of running ioctls


From: Paolo Bonzini
Subject: Re: [PATCH v2 2/3] KVM: keep track of running ioctls
Date: Fri, 11 Nov 2022 11:49:18 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0

On 11/10/22 17:48, Emanuele Giuseppe Esposito wrote:
diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c
index f9fdd46b9d..8d6a4b1b65 100644
--- a/hw/core/cpu-common.c
+++ b/hw/core/cpu-common.c
@@ -237,6 +237,7 @@ static void cpu_common_initfn(Object *obj)
      cpu->nr_threads = 1;
qemu_mutex_init(&cpu->work_mutex);
+    qemu_lockcnt_init(&cpu->in_ioctl_lock);
      QSIMPLEQ_INIT(&cpu->work_list);
      QTAILQ_INIT(&cpu->breakpoints);
      QTAILQ_INIT(&cpu->watchpoints);
@@ -248,6 +249,7 @@ static void cpu_common_finalize(Object *obj)
  {
      CPUState *cpu = CPU(obj);
+ qemu_lockcnt_destroy(&cpu->in_ioctl_lock);
      qemu_mutex_destroy(&cpu->work_mutex);
  }
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index f9b58773f7..15053663bc 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -397,6 +397,9 @@ struct CPUState {
      uint32_t kvm_fetch_index;
      uint64_t dirty_pages;
+ /* Use by accel-block: CPU is executing an ioctl() */
+    QemuLockCnt in_ioctl_lock;
+
      /* Used for events with 'vcpu' and *without* the 'disabled' properties */
      DECLARE_BITMAP(trace_dstate_delayed, CPU_TRACE_DSTATE_MAX_EVENTS);
      DECLARE_BITMAP(trace_dstate, CPU_TRACE_DSTATE_MAX_EVENTS);

These go in patch 1.

Paolo




reply via email to

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