kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: X86: Declare KVM_CAP_SET_GUEST_DEBUG properly
@ 2020-05-05 15:47 Peter Xu
  2020-05-05 17:12 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Xu @ 2020-05-05 15:47 UTC (permalink / raw)
  To: kvm, linux-kernel
  Cc: Paolo Bonzini, peterx, Sean Christopherson, Vitaly Kuznetsov

KVM_CAP_SET_GUEST_DEBUG should be supported for x86 however it's not declared
as supported.  My wild guess is that userspaces like QEMU are using "#ifdef
KVM_CAP_SET_GUEST_DEBUG" to check for the capability instead, but that could be
wrong because the compilation host may not be the runtime host.

The userspace might still want to keep the old "#ifdef" though to not break the
guest debug on old kernels.

Signed-off-by: Peter Xu <peterx@redhat.com>
---

I also think both ppc and s390 may need similar thing, but I didn't touch them
yet because of not confident enough to cover all cases.
---
 arch/x86/kvm/x86.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index c5835f9cb9ad..ac7b0e6f4000 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -3385,6 +3385,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
 	case KVM_CAP_GET_MSR_FEATURES:
 	case KVM_CAP_MSR_PLATFORM_INFO:
 	case KVM_CAP_EXCEPTION_PAYLOAD:
+	case KVM_CAP_SET_GUEST_DEBUG:
 		r = 1;
 		break;
 	case KVM_CAP_SYNC_REGS:
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] KVM: X86: Declare KVM_CAP_SET_GUEST_DEBUG properly
  2020-05-05 15:47 [PATCH] KVM: X86: Declare KVM_CAP_SET_GUEST_DEBUG properly Peter Xu
@ 2020-05-05 17:12 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2020-05-05 17:12 UTC (permalink / raw)
  To: Peter Xu, kvm, linux-kernel; +Cc: Sean Christopherson, Vitaly Kuznetsov

On 05/05/20 17:47, Peter Xu wrote:
> KVM_CAP_SET_GUEST_DEBUG should be supported for x86 however it's not declared
> as supported.  My wild guess is that userspaces like QEMU are using "#ifdef
> KVM_CAP_SET_GUEST_DEBUG" to check for the capability instead, but that could be
> wrong because the compilation host may not be the runtime host.
> 
> The userspace might still want to keep the old "#ifdef" though to not break the
> guest debug on old kernels.
> 
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
> 
> I also think both ppc and s390 may need similar thing, but I didn't touch them
> yet because of not confident enough to cover all cases.

Indeed, I'll squash this:

diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index e15166b0a16d..ad2f172c26a6 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -521,6 +521,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
 	case KVM_CAP_IOEVENTFD:
 	case KVM_CAP_DEVICE_CTRL:
 	case KVM_CAP_IMMEDIATE_EXIT:
+	case KVM_CAP_SET_GUEST_DEBUG:
 		r = 1;
 		break;
 	case KVM_CAP_PPC_GUEST_DEBUG_SSTEP:
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 5dcf9ff12828..d05bb040fd42 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -545,6 +545,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
 	case KVM_CAP_S390_AIS:
 	case KVM_CAP_S390_AIS_MIGRATION:
 	case KVM_CAP_S390_VCPU_RESETS:
+	case KVM_CAP_SET_GUEST_DEBUG:
 		r = 1;
 		break;
 	case KVM_CAP_S390_HPAGE_1M:


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-05 17:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-05 15:47 [PATCH] KVM: X86: Declare KVM_CAP_SET_GUEST_DEBUG properly Peter Xu
2020-05-05 17:12 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).