qemu-devel
[Top][All Lists]
Advanced

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

Re: [RFC PATCH] i386: Add ratelimit for bus locks acquired in guest


From: Xiaoyao Li
Subject: Re: [RFC PATCH] i386: Add ratelimit for bus locks acquired in guest
Date: Fri, 19 Mar 2021 09:23:49 +0800
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1

On 3/17/2021 4:47 PM, Chenyi Qiang wrote:
[...]
  MemTxAttrs kvm_arch_post_run(CPUState *cpu, struct kvm_run *run)
  {
      X86CPU *x86_cpu = X86_CPU(cpu);
@@ -4236,6 +4271,11 @@ MemTxAttrs kvm_arch_post_run(CPUState *cpu, struct 
kvm_run *run)
      } else {
          env->eflags &= ~IF_MASK;
      }
+    if (run->flags & KVM_RUN_X86_BUS_LOCK) {
+        kvm_cpu_synchronize_state(cpu);
+        warn_report("bus lock detected at rip: 0x%lx", env->eip);

Chenyi,

Let's drop the eip here since QEMU has no idea whether it points to the next instruction or the exact instruction acquires bus lock.

+        kvm_rate_limit_on_bus_lock();
+    }
/* We need to protect the apic state against concurrent accesses from
       * different threads in case the userspace irqchip is used. */
@@ -4594,6 +4634,10 @@ int kvm_arch_handle_exit(CPUState *cs, struct kvm_run 
*run)
          ioapic_eoi_broadcast(run->eoi.vector);
          ret = 0;
          break;
+    case KVM_EXIT_X86_BUS_LOCK:
+        /* already handled in kvm_arch_post_run */
+        ret = 0;
+        break;
      default:
          fprintf(stderr, "KVM: unknown exit reason %d\n", run->exit_reason);
          ret = -1;





reply via email to

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