qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* Re: [Qemu-devel] [PATCH v2 1/2] kvm: sync linux headers
  2018-06-05 20:52 ` [Qemu-devel] [PATCH v2 1/2] kvm: sync linux headers Dongjiu Geng
@ 2018-06-05 13:07   ` Peter Maydell
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Maydell @ 2018-06-05 13:07 UTC (permalink / raw)
  To: Dongjiu Geng; +Cc: James Morse, qemu-arm, QEMU Developers, Linuxarm

On 5 June 2018 at 21:52, Dongjiu Geng <gengdongjiu@huawei.com> wrote:
> Import KVM_CAP_ARM_INJECT_SERROR_ESR and struct kvm_vcpu_events
> for arm64
>
> Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com>

Was this produced with the update-headers script? If so,
the commit message should say so and also which upstream
kernel commit/tag the sync is against. (See QEMU commit
65a6d8dd3f32 for an example.) If not then this series should
be tagged as an RFC, since it shouldn't be applied until
the kernel API changes have gone into the kernel upstream.

thanks
-- PMM

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

* [Qemu-devel] [PATCH v2 1/2] kvm: sync linux headers
  2018-06-05 20:52 [Qemu-devel] [PATCH v2 0/2] add support for VCPU event states Dongjiu Geng
@ 2018-06-05 20:52 ` Dongjiu Geng
  2018-06-05 13:07   ` Peter Maydell
  0 siblings, 1 reply; 7+ messages in thread
From: Dongjiu Geng @ 2018-06-05 20:52 UTC (permalink / raw)
  To: peter.maydell, james.morse, qemu-arm, qemu-devel, gengdongjiu,
	linuxarm

Import KVM_CAP_ARM_INJECT_SERROR_ESR and struct kvm_vcpu_events
for arm64

Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com>
---
 linux-headers/asm-arm64/kvm.h | 13 +++++++++++++
 linux-headers/linux/kvm.h     |  1 +
 2 files changed, 14 insertions(+)

diff --git a/linux-headers/asm-arm64/kvm.h b/linux-headers/asm-arm64/kvm.h
index 17315ab..e240afc 100644
--- a/linux-headers/asm-arm64/kvm.h
+++ b/linux-headers/asm-arm64/kvm.h
@@ -39,6 +39,7 @@
 #define __KVM_HAVE_GUEST_DEBUG
 #define __KVM_HAVE_IRQ_LINE
 #define __KVM_HAVE_READONLY_MEM
+#define __KVM_HAVE_VCPU_EVENTS
 
 #define KVM_COALESCED_MMIO_PAGE_OFFSET 1
 
@@ -153,6 +154,18 @@ struct kvm_sync_regs {
 struct kvm_arch_memory_slot {
 };
 
+/* for KVM_GET/SET_VCPU_EVENTS */
+struct kvm_vcpu_events {
+	struct {
+		__u8 serror_pending;
+		__u8 serror_has_esr;
+		/* Align it to 8 bytes */
+		__u8 pad[6];
+		__u64 serror_esr;
+	} exception;
+	__u32 reserved[12];
+};
+
 /* If you need to interpret the index values, here is the key: */
 #define KVM_REG_ARM_COPROC_MASK		0x000000000FFF0000
 #define KVM_REG_ARM_COPROC_SHIFT	16
diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h
index cdb148e..cd8be47 100644
--- a/linux-headers/linux/kvm.h
+++ b/linux-headers/linux/kvm.h
@@ -948,6 +948,7 @@ struct kvm_ppc_resize_hpt {
 #define KVM_CAP_S390_BPB 152
 #define KVM_CAP_GET_MSR_FEATURES 153
 #define KVM_CAP_HYPERV_EVENTFD 154
+#define KVM_CAP_ARM_INJECT_SERROR_ESR 155
 
 #ifdef KVM_CAP_IRQ_ROUTING
 
-- 
2.7.4

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

* Re: [Qemu-devel] [PATCH v2 1/2] kvm: sync linux headers
@ 2018-06-06 13:26 gengdongjiu
  0 siblings, 0 replies; 7+ messages in thread
From: gengdongjiu @ 2018-06-06 13:26 UTC (permalink / raw)
  To: Peter Maydell; +Cc: James Morse, qemu-arm, QEMU Developers, Linuxarm

> On 5 June 2018 at 21:52, Dongjiu Geng <gengdongjiu@huawei.com> wrote:
> > Import KVM_CAP_ARM_INJECT_SERROR_ESR and struct kvm_vcpu_events for
> > arm64
> >
> > Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com>
> 
> Was this produced with the update-headers script? If so, the commit message should say so and also which upstream kernel commit/tag
> the sync is against. (See QEMU commit
> 65a6d8dd3f32 for an example.) If not then this series should be tagged as an RFC, since it shouldn't be applied until the kernel API changes
> have gone into the kernel upstream.

Thanks again for the reminder.
Yes, it should be tagged as an RFC, the kernel API changes is still under review.
https://www.spinics.net/lists/kvm/msg169813.html

I used below script and command to sync the kernel changed header.
./scripts/update-linux-headers.sh xxxx

> 
> thanks
> -- PMM

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

* [Qemu-devel] [PATCH v2 0/2] s390x: Enable KVM huge page backing support
@ 2018-07-31  9:08 Janosch Frank
  2018-07-31  9:08 ` [Qemu-devel] [PATCH v2 1/2] kvm: sync linux headers Janosch Frank
  2018-07-31  9:09 ` [Qemu-devel] [PATCH v2 2/2] s390x: Enable KVM huge page backing support Janosch Frank
  0 siblings, 2 replies; 7+ messages in thread
From: Janosch Frank @ 2018-07-31  9:08 UTC (permalink / raw)
  To: qemu-devel; +Cc: borntraeger, david, cohuck

Will be available with kernel 4.19.

Janosch Frank (2):
  kvm: sync linux headers
  s390x: Enable KVM huge page backing support

 linux-headers/linux/kvm.h | 1 +
 target/s390x/kvm.c        | 6 ++++++
 2 files changed, 7 insertions(+)

-- 
2.14.3

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

* [Qemu-devel] [PATCH v2 1/2] kvm: sync linux headers
  2018-07-31  9:08 [Qemu-devel] [PATCH v2 0/2] s390x: Enable KVM huge page backing support Janosch Frank
@ 2018-07-31  9:08 ` Janosch Frank
  2018-07-31  9:09 ` [Qemu-devel] [PATCH v2 2/2] s390x: Enable KVM huge page backing support Janosch Frank
  1 sibling, 0 replies; 7+ messages in thread
From: Janosch Frank @ 2018-07-31  9:08 UTC (permalink / raw)
  To: qemu-devel; +Cc: borntraeger, david, cohuck

Import KVM_CAP_S390_HPAGE.
Placeholder for proper sync.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
---
 linux-headers/linux/kvm.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h
index 98f389a5a3..e3b1e3070c 100644
--- a/linux-headers/linux/kvm.h
+++ b/linux-headers/linux/kvm.h
@@ -949,6 +949,7 @@ struct kvm_ppc_resize_hpt {
 #define KVM_CAP_GET_MSR_FEATURES 153
 #define KVM_CAP_HYPERV_EVENTFD 154
 #define KVM_CAP_HYPERV_TLBFLUSH 155
+#define KVM_CAP_S390_HPAGE 156
 
 #ifdef KVM_CAP_IRQ_ROUTING
 
-- 
2.14.3

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

* [Qemu-devel] [PATCH v2 2/2] s390x: Enable KVM huge page backing support
  2018-07-31  9:08 [Qemu-devel] [PATCH v2 0/2] s390x: Enable KVM huge page backing support Janosch Frank
  2018-07-31  9:08 ` [Qemu-devel] [PATCH v2 1/2] kvm: sync linux headers Janosch Frank
@ 2018-07-31  9:09 ` Janosch Frank
  2018-08-01  9:32   ` Thomas Huth
  1 sibling, 1 reply; 7+ messages in thread
From: Janosch Frank @ 2018-07-31  9:09 UTC (permalink / raw)
  To: qemu-devel; +Cc: borntraeger, david, cohuck

QEMU has had huge page support for a longer time already, but KVM
memory management under s390x needed some changes to work with huge
backings.

Now that we have support, let's enable it if requested and
available. Otherwise we now properly tell the user if there is no
support and back out instead of failing to run the VM later on.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
---
 target/s390x/kvm.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c
index d923cf4240..26e6937498 100644
--- a/target/s390x/kvm.c
+++ b/target/s390x/kvm.c
@@ -285,6 +285,12 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
 {
     MachineClass *mc = MACHINE_GET_CLASS(ms);
 
+    if (mem_path && kvm_vm_enable_cap(s, KVM_CAP_S390_HPAGE, 0)) {
+        error_report("Huge page backing was specified, "
+                     "but this KVM does not support huge pages");
+        return -EINVAL;
+    }
+
     mc->default_cpu_type = S390_CPU_TYPE_NAME("host");
     cap_sync_regs = kvm_check_extension(s, KVM_CAP_SYNC_REGS);
     cap_async_pf = kvm_check_extension(s, KVM_CAP_ASYNC_PF);
-- 
2.14.3

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

* Re: [Qemu-devel] [PATCH v2 2/2] s390x: Enable KVM huge page backing support
  2018-07-31  9:09 ` [Qemu-devel] [PATCH v2 2/2] s390x: Enable KVM huge page backing support Janosch Frank
@ 2018-08-01  9:32   ` Thomas Huth
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Huth @ 2018-08-01  9:32 UTC (permalink / raw)
  To: Janosch Frank, qemu-devel; +Cc: borntraeger, cohuck, david, qemu-s390x

On 07/31/2018 11:09 AM, Janosch Frank wrote:
> QEMU has had huge page support for a longer time already, but KVM
> memory management under s390x needed some changes to work with huge
> backings.
> 
> Now that we have support, let's enable it if requested and
> available. Otherwise we now properly tell the user if there is no
> support and back out instead of failing to run the VM later on.
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> ---
>  target/s390x/kvm.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c
> index d923cf4240..26e6937498 100644
> --- a/target/s390x/kvm.c
> +++ b/target/s390x/kvm.c
> @@ -285,6 +285,12 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
>  {
>      MachineClass *mc = MACHINE_GET_CLASS(ms);
>  
> +    if (mem_path && kvm_vm_enable_cap(s, KVM_CAP_S390_HPAGE, 0)) {
> +        error_report("Huge page backing was specified, "
> +                     "but this KVM does not support huge pages");
> +        return -EINVAL;
> +    }

I think you should also check the page size of the mem_path (e.g. with
qemu_mempath_getpagesize() ?), since a mem_path does not automatically
mean huge pages, does it?

 Thomas


PS: Please CC: qemu-s390x@nongnu.org for s390x patches!

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

end of thread, other threads:[~2018-08-01  9:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-31  9:08 [Qemu-devel] [PATCH v2 0/2] s390x: Enable KVM huge page backing support Janosch Frank
2018-07-31  9:08 ` [Qemu-devel] [PATCH v2 1/2] kvm: sync linux headers Janosch Frank
2018-07-31  9:09 ` [Qemu-devel] [PATCH v2 2/2] s390x: Enable KVM huge page backing support Janosch Frank
2018-08-01  9:32   ` Thomas Huth
  -- strict thread matches above, loose matches on Subject: below --
2018-06-06 13:26 [Qemu-devel] [PATCH v2 1/2] kvm: sync linux headers gengdongjiu
2018-06-05 20:52 [Qemu-devel] [PATCH v2 0/2] add support for VCPU event states Dongjiu Geng
2018-06-05 20:52 ` [Qemu-devel] [PATCH v2 1/2] kvm: sync linux headers Dongjiu Geng
2018-06-05 13:07   ` Peter Maydell

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