linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH V2] kvm: arm64: export memory error recovery capability to user space
@ 2019-05-13  6:28 Dongjiu Geng
  2019-05-13  9:44 ` Peter Maydell
  0 siblings, 1 reply; 3+ messages in thread
From: Dongjiu Geng @ 2019-05-13  6:28 UTC (permalink / raw)
  To: christoffer.dall, marc.zyngier, peter.maydell, james.morse,
	rkrcmar, corbet, catalin.marinas, will.deacon, kvm, linux-doc,
	linux-kernel, linux-arm-kernel, kvmarm
  Cc: zhengxiang9, gengdongjiu

When user space do memory recovery, it will check whether KVM and
guest support the error recovery, only when both of them support,
user space will do the error recovery. This patch exports this
capability of KVM to user space.

Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com>
---
v1->v2:
1. check whether host support memory failure instead of RAS capability
   https://patchwork.kernel.org/patch/10730827/

v1:
1. User space needs to check this capability of host is suggested by Peter[1],
this patch as RFC tag because user space patches are still under review,
so this kernel patch is firstly sent out for review.

[1]: https://patchwork.codeaurora.org/patch/652261/
---
 Documentation/virtual/kvm/api.txt | 9 +++++++++
 arch/arm64/kvm/reset.c            | 3 +++
 include/uapi/linux/kvm.h          | 1 +
 3 files changed, 13 insertions(+)

diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt
index cd209f7..822a57b 100644
--- a/Documentation/virtual/kvm/api.txt
+++ b/Documentation/virtual/kvm/api.txt
@@ -4895,3 +4895,12 @@ Architectures: x86
 This capability indicates that KVM supports paravirtualized Hyper-V IPI send
 hypercalls:
 HvCallSendSyntheticClusterIpi, HvCallSendSyntheticClusterIpiEx.
+
+8.21 KVM_CAP_ARM_MEMORY_ERROR_RECOVERY
+
+Architectures: arm, arm64
+
+This capability indicates that guest memory error can be detected by the host which
+supports the error recovery. When user space do recovery, such as QEMU, it will
+check whether host and guest all support memory error recovery, only when both of them
+support, user space will do the error recovery.
diff --git a/arch/arm64/kvm/reset.c b/arch/arm64/kvm/reset.c
index b72a3dd..b6e3986 100644
--- a/arch/arm64/kvm/reset.c
+++ b/arch/arm64/kvm/reset.c
@@ -84,6 +84,9 @@ int kvm_arch_vm_ioctl_check_extension(struct kvm *kvm, long ext)
 	case KVM_CAP_ARM_INJECT_SERROR_ESR:
 		r = cpus_have_const_cap(ARM64_HAS_RAS_EXTN);
 		break;
+	case KVM_CAP_ARM_MEMORY_ERROR_RECOVERY:
+		r= IS_ENABLED(CONFIG_MEMORY_FAILURE);
+		break;
 	case KVM_CAP_SET_GUEST_DEBUG:
 	case KVM_CAP_VCPU_ATTRIBUTES:
 		r = 1;
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index 2b7a652..3b19580 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -975,6 +975,7 @@ struct kvm_ppc_resize_hpt {
 #define KVM_CAP_HYPERV_ENLIGHTENED_VMCS 163
 #define KVM_CAP_EXCEPTION_PAYLOAD 164
 #define KVM_CAP_ARM_VM_IPA_SIZE 165
+#define KVM_CAP_ARM_MEMORY_ERROR_RECOVERY 166
 
 #ifdef KVM_CAP_IRQ_ROUTING
 
-- 
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [RFC PATCH V2] kvm: arm64: export memory error recovery capability to user space
  2019-05-13  6:28 [RFC PATCH V2] kvm: arm64: export memory error recovery capability to user space Dongjiu Geng
@ 2019-05-13  9:44 ` Peter Maydell
  2019-05-13 10:20   ` gengdongjiu
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2019-05-13  9:44 UTC (permalink / raw)
  To: Dongjiu Geng
  Cc: open list:DOCUMENTATION, kvm-devel, Jonathan Corbet,
	Marc Zyngier, Catalin Marinas, Radim Krčmář,
	Will Deacon, Christoffer Dall, lkml - Kernel Mailing List,
	Zheng Xiang, James Morse, kvmarm, arm-mail-list

On Mon, 13 May 2019 at 07:32, Dongjiu Geng <gengdongjiu@huawei.com> wrote:
>
> When user space do memory recovery, it will check whether KVM and
> guest support the error recovery, only when both of them support,
> user space will do the error recovery. This patch exports this
> capability of KVM to user space.
>
> Cc: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com>
> ---
> v1->v2:
> 1. check whether host support memory failure instead of RAS capability
>    https://patchwork.kernel.org/patch/10730827/
>
> v1:
> 1. User space needs to check this capability of host is suggested by Peter[1],
> this patch as RFC tag because user space patches are still under review,
> so this kernel patch is firstly sent out for review.
>
> [1]: https://patchwork.codeaurora.org/patch/652261/
> ---

I thought the conclusion of the thread on the v1 patch was that
userspace doesn't need to specifically ask the host kernel if
it has support for this -- if it does not, then the host kernel
will just never deliver userspace any SIGBUS with MCEERR code,
which is fine. Or am I still confused?

thanks
-- PMM

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [RFC PATCH V2] kvm: arm64: export memory error recovery capability to user space
  2019-05-13  9:44 ` Peter Maydell
@ 2019-05-13 10:20   ` gengdongjiu
  0 siblings, 0 replies; 3+ messages in thread
From: gengdongjiu @ 2019-05-13 10:20 UTC (permalink / raw)
  To: Peter Maydell
  Cc: open list:DOCUMENTATION, kvm-devel, Jonathan Corbet,
	Marc Zyngier, Catalin Marinas, Radim Krčmář,
	Will Deacon, Christoffer Dall, lkml - Kernel Mailing List,
	Zheng Xiang, James Morse, kvmarm, arm-mail-list

On 2019/5/13 17:44, Peter Maydell wrote:
> On Mon, 13 May 2019 at 07:32, Dongjiu Geng <gengdongjiu@huawei.com> wrote:
>>
>> When user space do memory recovery, it will check whether KVM and
>> guest support the error recovery, only when both of them support,
>> user space will do the error recovery. This patch exports this
>> capability of KVM to user space.
>>
>> Cc: Peter Maydell <peter.maydell@linaro.org>
>> Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com>
>> ---
>> v1->v2:
>> 1. check whether host support memory failure instead of RAS capability
>>    https://patchwork.kernel.org/patch/10730827/
>>
>> v1:
>> 1. User space needs to check this capability of host is suggested by Peter[1],
>> this patch as RFC tag because user space patches are still under review,
>> so this kernel patch is firstly sent out for review.
>>
>> [1]: https://patchwork.codeaurora.org/patch/652261/
>> ---
> 
> I thought the conclusion of the thread on the v1 patch was that
> userspace doesn't need to specifically ask the host kernel if
> it has support for this -- if it does not, then the host kernel
> will just never deliver userspace any SIGBUS with MCEERR code,
> which is fine. Or am I still confused?

thanks Peter's quick reply.
yes, I think so, if it does not support,  then the host kernel
will just never deliver userspace any SIGBUS with MCEERR code.

so maybe we do not need this patch.

> 
> thanks
> -- PMM
> .
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2019-05-13 10:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-13  6:28 [RFC PATCH V2] kvm: arm64: export memory error recovery capability to user space Dongjiu Geng
2019-05-13  9:44 ` Peter Maydell
2019-05-13 10:20   ` gengdongjiu

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).