[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a4e07fb1-1f36-1078-0695-ff4b72016d48@linux.alibaba.com>
Date: Fri, 9 Jul 2021 18:05:25 +0800
From: Lai Jiangshan <laijs@...ux.alibaba.com>
To: Paolo Bonzini <pbonzini@...hat.com>,
Lai Jiangshan <jiangshanlai@...il.com>,
linux-kernel@...r.kernel.org
Cc: Sean Christopherson <seanjc@...gle.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>,
kvm@...r.kernel.org
Subject: Re: [PATCH] KVM: X86: Also reload the debug registers before
kvm_x86->run() when the host is using them
On 2021/7/9 17:49, Paolo Bonzini wrote:
> On 09/07/21 05:09, Lai Jiangshan wrote:
>> I just noticed that emulation.c fails to emulate with DBn.
>> Is there any problem around it?
>
> Just what you said, it's not easy and the needs are limited. I implemented kvm_vcpu_check_breakpoint because I was
> interested in using hardware breakpoints from gdb, even with unrestricted_guest=0 and invalid guest state, but that's it.
>
Hello Paolo
I just remembered I once came across the patch, but I forgot it when
I wrote the mail.
It seems kvm_vcpu_check_breakpoint() handles only for code breakpoint
and doesn't handle for data breakpoints.
And no code handles DR7_GD bit when the emulation is not resulted from
vm-exit. (for example, the non-first instruction when kvm emulates
instructions back to back and the instruction accesses to DBn).
Thanks
Lai
> Paolo
>
>> For code breakpoint, if the instruction didn't cause vm-exit,
>> (for example, the 2nd instruction when kvm emulates instructions
>> back to back) emulation.c fails to emulate with DBn.
>>
>> For code breakpoint, if the instruction just caused vm-exit.
>> It is difficult to analyze this case due to the complex priorities
>> between vectored events and fault-like vm-exit.
>> Anyway, if it is an instruction that vm-exit has priority over #DB,
>> emulation.c fails to emulate with DBn.
>>
>> For data breakpoint, a #DB must be delivered to guest or to VMM (when
>> guest-debug) after the instruction. But emulation.c doesn't do so.
>>
>> And the existence of both of effective DBn (guest debug) and guest DBn
>> complicates the problem when we try to emulate them.
Powered by blists - more mailing lists