* [Qemu-devel] [PATCH 0/2] s390/z14: extended TOD-clock support @ 2017-09-25 10:23 Christian Borntraeger 2017-09-25 10:23 ` [Qemu-devel] [PATCH 1/2] linux-headers: Update linux headers for extended TOD-Clock Christian Borntraeger ` (2 more replies) 0 siblings, 3 replies; 6+ messages in thread From: Christian Borntraeger @ 2017-09-25 10:23 UTC (permalink / raw) To: Cornelia Huck Cc: qemu-devel, Alexander Graf, Thomas Huth, David Hildenbrand, Richard Henderson, Christian Borntraeger I still have this patch on my queue as the last remaining z14 item. Since I have already rebase it several time, its time for some additional review. Collin L. Walling (2): linux-headers: Update linux headers for extended TOD-Clock s390/kvm: Support for get/set of extended TOD-Clock for guest hw/s390x/s390-virtio-ccw.c | 8 +++----- linux-headers/asm-s390/kvm.h | 6 ++++++ target/s390x/cpu.c | 26 +++++++++++++++++++------- target/s390x/kvm-stub.c | 10 ++++++++++ target/s390x/kvm.c | 35 +++++++++++++++++++++++++++++++++++ target/s390x/kvm_s390x.h | 2 ++ 6 files changed, 75 insertions(+), 12 deletions(-) -- 2.9.4 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH 1/2] linux-headers: Update linux headers for extended TOD-Clock 2017-09-25 10:23 [Qemu-devel] [PATCH 0/2] s390/z14: extended TOD-clock support Christian Borntraeger @ 2017-09-25 10:23 ` Christian Borntraeger 2017-09-25 10:23 ` [Qemu-devel] [PATCH 2/2] s390/kvm: Support for get/set of extended TOD-Clock for guest Christian Borntraeger 2017-09-25 10:49 ` [Qemu-devel] [PATCH 0/2] s390/z14: extended TOD-clock support no-reply 2 siblings, 0 replies; 6+ messages in thread From: Christian Borntraeger @ 2017-09-25 10:23 UTC (permalink / raw) To: Cornelia Huck Cc: qemu-devel, Alexander Graf, Thomas Huth, David Hildenbrand, Richard Henderson, Collin L. Walling From: "Collin L. Walling" <walling@linux.vnet.ibm.com> Conny: to be replaced with 4.14-rc*. Adds KVM_S390_VM_TOD_EXT attribute for the extended TOD-Clock attribute and kvm_s390_vm_tod_clock struct for TOD-Clock data. Signed-off-by: Collin L. Walling <walling@linux.vnet.ibm.com> --- linux-headers/asm-s390/kvm.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/linux-headers/asm-s390/kvm.h b/linux-headers/asm-s390/kvm.h index 8387d71..7b750ef 100644 --- a/linux-headers/asm-s390/kvm.h +++ b/linux-headers/asm-s390/kvm.h @@ -88,6 +88,12 @@ struct kvm_s390_io_adapter_req { /* kvm attributes for KVM_S390_VM_TOD */ #define KVM_S390_VM_TOD_LOW 0 #define KVM_S390_VM_TOD_HIGH 1 +#define KVM_S390_VM_TOD_EXT 2 + +struct kvm_s390_vm_tod_clock { + __u8 epoch_idx; + __u64 tod; +}; /* kvm attributes for KVM_S390_VM_CPU_MODEL */ /* processor related attributes are r/w */ -- 2.9.4 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH 2/2] s390/kvm: Support for get/set of extended TOD-Clock for guest 2017-09-25 10:23 [Qemu-devel] [PATCH 0/2] s390/z14: extended TOD-clock support Christian Borntraeger 2017-09-25 10:23 ` [Qemu-devel] [PATCH 1/2] linux-headers: Update linux headers for extended TOD-Clock Christian Borntraeger @ 2017-09-25 10:23 ` Christian Borntraeger 2017-09-25 13:08 ` Cornelia Huck 2017-09-26 13:52 ` David Hildenbrand 2017-09-25 10:49 ` [Qemu-devel] [PATCH 0/2] s390/z14: extended TOD-clock support no-reply 2 siblings, 2 replies; 6+ messages in thread From: Christian Borntraeger @ 2017-09-25 10:23 UTC (permalink / raw) To: Cornelia Huck Cc: qemu-devel, Alexander Graf, Thomas Huth, David Hildenbrand, Richard Henderson, Collin L. Walling, Christian Borntraeger From: "Collin L. Walling" <walling@linux.vnet.ibm.com> Provides an interface for getting and setting the guest's extended TOD-Clock via a single ioctl to kvm. If the ioctl fails because it is not support by kvm, then we fall back to the old style of retrieving the clock via two ioctls. If kvm fails to set a nonzero epoch index, then we ultimately fail the migration altogether and the guest will resume normally on the original host machine. Signed-off-by: Collin L. Walling <walling@linux.vnet.ibm.com> Reviewed-by: Eric Farman <farman@linux.vnet.ibm.com> Reviewed-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> --- hw/s390x/s390-virtio-ccw.c | 8 +++----- target/s390x/cpu.c | 26 +++++++++++++++++++------- target/s390x/kvm-stub.c | 10 ++++++++++ target/s390x/kvm.c | 35 +++++++++++++++++++++++++++++++++++ target/s390x/kvm_s390x.h | 2 ++ 5 files changed, 69 insertions(+), 12 deletions(-) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index fafbc6d..bad09f5 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -213,13 +213,11 @@ static int gtod_load(QEMUFile *f, void *opaque, int version_id) r = s390_set_clock(&tod_high, &tod_low); if (r) { - warn_report("Unable to set guest clock for migration: %s", - strerror(-r)); - error_printf("Guest clock will not be restored " - "which could cause the guest to hang."); + error_report("Unable to set guest clock value. " + "s390_get_clock returned error %d.\n", r); } - return 0; + return r; } static SaveVMHandlers savevm_gtod = { diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index 34538c3..c8f1219 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -357,22 +357,34 @@ unsigned int s390_cpu_set_state(uint8_t cpu_state, S390CPU *cpu) int s390_get_clock(uint8_t *tod_high, uint64_t *tod_low) { + int r = 0; + if (kvm_enabled()) { - return kvm_s390_get_clock(tod_high, tod_low); + r = kvm_s390_get_clock_ext(tod_high, tod_low); + if (r == -ENXIO) { + return kvm_s390_get_clock(tod_high, tod_low); + } + } else { + /* Fixme TCG */ + *tod_high = 0; + *tod_low = 0; } - /* Fixme TCG */ - *tod_high = 0; - *tod_low = 0; - return 0; + + return r; } int s390_set_clock(uint8_t *tod_high, uint64_t *tod_low) { + int r = 0; + if (kvm_enabled()) { - return kvm_s390_set_clock(tod_high, tod_low); + r = kvm_s390_set_clock_ext(tod_high, tod_low); + if (r == -ENXIO) { + return kvm_s390_set_clock(tod_high, tod_low); + } } /* Fixme TCG */ - return 0; + return r; } int s390_set_memory_limit(uint64_t new_limit, uint64_t *hw_limit) diff --git a/target/s390x/kvm-stub.c b/target/s390x/kvm-stub.c index 261e1cd..43f02c2 100644 --- a/target/s390x/kvm-stub.c +++ b/target/s390x/kvm-stub.c @@ -68,11 +68,21 @@ int kvm_s390_get_clock(uint8_t *tod_high, uint64_t *tod_low) return -ENOSYS; } +int kvm_s390_get_clock_ext(uint8_t *tod_high, uint64_t *tod_low) +{ + return -ENOSYS; +} + int kvm_s390_set_clock(uint8_t *tod_high, uint64_t *tod_low) { return -ENOSYS; } +int kvm_s390_set_clock_ext(uint8_t *tod_high, uint64_t *tod_low) +{ + return -ENOSYS; +} + void kvm_s390_enable_css_support(S390CPU *cpu) { } diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index ebb75ca..ef7374c 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -643,6 +643,25 @@ int kvm_s390_get_clock(uint8_t *tod_high, uint64_t *tod_low) return kvm_vm_ioctl(kvm_state, KVM_GET_DEVICE_ATTR, &attr); } +int kvm_s390_get_clock_ext(uint8_t *tod_high, uint64_t *tod_low) +{ + int r; + + struct kvm_s390_vm_tod_clock gtod; + + struct kvm_device_attr attr = { + .group = KVM_S390_VM_TOD, + .attr = KVM_S390_VM_TOD_EXT, + .addr = (uint64_t)(>od), + }; + + r = kvm_vm_ioctl(kvm_state, KVM_GET_DEVICE_ATTR, &attr); + *tod_high = gtod.epoch_idx; + *tod_low = gtod.tod; + + return r; +} + int kvm_s390_set_clock(uint8_t *tod_high, uint64_t *tod_low) { int r; @@ -663,6 +682,22 @@ int kvm_s390_set_clock(uint8_t *tod_high, uint64_t *tod_low) return kvm_vm_ioctl(kvm_state, KVM_SET_DEVICE_ATTR, &attr); } +int kvm_s390_set_clock_ext(uint8_t *tod_high, uint64_t *tod_low) +{ + struct kvm_s390_vm_tod_clock gtod = { + .epoch_idx = *tod_high, + .tod = *tod_low, + }; + + struct kvm_device_attr attr = { + .group = KVM_S390_VM_TOD, + .attr = KVM_S390_VM_TOD_EXT, + .addr = (uint64_t)(>od), + }; + + return kvm_vm_ioctl(kvm_state, KVM_SET_DEVICE_ATTR, &attr); +} + /** * kvm_s390_mem_op: * @addr: the logical start address in guest memory diff --git a/target/s390x/kvm_s390x.h b/target/s390x/kvm_s390x.h index 2d594bd..501fc5a 100644 --- a/target/s390x/kvm_s390x.h +++ b/target/s390x/kvm_s390x.h @@ -29,7 +29,9 @@ int kvm_s390_vcpu_interrupt_post_load(S390CPU *cpu); int kvm_s390_get_ri(void); int kvm_s390_get_gs(void); int kvm_s390_get_clock(uint8_t *tod_high, uint64_t *tod_clock); +int kvm_s390_get_clock_ext(uint8_t *tod_high, uint64_t *tod_clock); int kvm_s390_set_clock(uint8_t *tod_high, uint64_t *tod_clock); +int kvm_s390_set_clock_ext(uint8_t *tod_high, uint64_t *tod_clock); void kvm_s390_enable_css_support(S390CPU *cpu); int kvm_s390_assign_subch_ioeventfd(EventNotifier *notifier, uint32_t sch, int vq, bool assign); -- 2.9.4 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH 2/2] s390/kvm: Support for get/set of extended TOD-Clock for guest 2017-09-25 10:23 ` [Qemu-devel] [PATCH 2/2] s390/kvm: Support for get/set of extended TOD-Clock for guest Christian Borntraeger @ 2017-09-25 13:08 ` Cornelia Huck 2017-09-26 13:52 ` David Hildenbrand 1 sibling, 0 replies; 6+ messages in thread From: Cornelia Huck @ 2017-09-25 13:08 UTC (permalink / raw) To: Christian Borntraeger Cc: qemu-devel, Alexander Graf, Thomas Huth, David Hildenbrand, Richard Henderson, Collin L. Walling On Mon, 25 Sep 2017 12:23:02 +0200 Christian Borntraeger <borntraeger@de.ibm.com> wrote: > From: "Collin L. Walling" <walling@linux.vnet.ibm.com> > > Provides an interface for getting and setting the guest's extended > TOD-Clock via a single ioctl to kvm. If the ioctl fails because it > is not support by kvm, then we fall back to the old style of > retrieving the clock via two ioctls. > > If kvm fails to set a nonzero epoch index, then we ultimately fail > the migration altogether and the guest will resume normally on the > original host machine. I'd prefer to have that part split off, as it is a change in behaviour and I don't think we should mix it with adding support for an improved interface. > > Signed-off-by: Collin L. Walling <walling@linux.vnet.ibm.com> > Reviewed-by: Eric Farman <farman@linux.vnet.ibm.com> > Reviewed-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com> > Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> > --- > hw/s390x/s390-virtio-ccw.c | 8 +++----- > target/s390x/cpu.c | 26 +++++++++++++++++++------- > target/s390x/kvm-stub.c | 10 ++++++++++ > target/s390x/kvm.c | 35 +++++++++++++++++++++++++++++++++++ > target/s390x/kvm_s390x.h | 2 ++ > 5 files changed, 69 insertions(+), 12 deletions(-) > > diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c > index fafbc6d..bad09f5 100644 > --- a/hw/s390x/s390-virtio-ccw.c > +++ b/hw/s390x/s390-virtio-ccw.c > @@ -213,13 +213,11 @@ static int gtod_load(QEMUFile *f, void *opaque, int version_id) > > r = s390_set_clock(&tod_high, &tod_low); > if (r) { > - warn_report("Unable to set guest clock for migration: %s", > - strerror(-r)); > - error_printf("Guest clock will not be restored " > - "which could cause the guest to hang."); > + error_report("Unable to set guest clock value. " > + "s390_get_clock returned error %d.\n", r); Please keep to a single phrase in error_report(). Also, I find strerror() often more useful. > } > > - return 0; > + return r; > } > > static SaveVMHandlers savevm_gtod = { Otherwise looks good. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH 2/2] s390/kvm: Support for get/set of extended TOD-Clock for guest 2017-09-25 10:23 ` [Qemu-devel] [PATCH 2/2] s390/kvm: Support for get/set of extended TOD-Clock for guest Christian Borntraeger 2017-09-25 13:08 ` Cornelia Huck @ 2017-09-26 13:52 ` David Hildenbrand 1 sibling, 0 replies; 6+ messages in thread From: David Hildenbrand @ 2017-09-26 13:52 UTC (permalink / raw) To: Christian Borntraeger, Cornelia Huck Cc: qemu-devel, Alexander Graf, Thomas Huth, Richard Henderson, Collin L. Walling On 25.09.2017 12:23, Christian Borntraeger wrote: > From: "Collin L. Walling" <walling@linux.vnet.ibm.com> > > Provides an interface for getting and setting the guest's extended > TOD-Clock via a single ioctl to kvm. If the ioctl fails because it > is not support by kvm, then we fall back to the old style of > retrieving the clock via two ioctls. > > If kvm fails to set a nonzero epoch index, then we ultimately fail > the migration altogether and the guest will resume normally on the > original host machine. > > Signed-off-by: Collin L. Walling <walling@linux.vnet.ibm.com> > Reviewed-by: Eric Farman <farman@linux.vnet.ibm.com> > Reviewed-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com> > Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> > --- > hw/s390x/s390-virtio-ccw.c | 8 +++----- > target/s390x/cpu.c | 26 +++++++++++++++++++------- > target/s390x/kvm-stub.c | 10 ++++++++++ > target/s390x/kvm.c | 35 +++++++++++++++++++++++++++++++++++ > target/s390x/kvm_s390x.h | 2 ++ > 5 files changed, 69 insertions(+), 12 deletions(-) > > diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c > index fafbc6d..bad09f5 100644 > --- a/hw/s390x/s390-virtio-ccw.c > +++ b/hw/s390x/s390-virtio-ccw.c > @@ -213,13 +213,11 @@ static int gtod_load(QEMUFile *f, void *opaque, int version_id) > > r = s390_set_clock(&tod_high, &tod_low); > if (r) { > - warn_report("Unable to set guest clock for migration: %s", > - strerror(-r)); > - error_printf("Guest clock will not be restored " > - "which could cause the guest to hang."); > + error_report("Unable to set guest clock value. " > + "s390_get_clock returned error %d.\n", r); > } This should go into a separate patch (I think also Conny referred to that in her comment). > > - return 0; > + return r; > } > [..] .c > index ebb75ca..ef7374c 100644 > --- a/target/s390x/kvm.c > +++ b/target/s390x/kvm.c > @@ -643,6 +643,25 @@ int kvm_s390_get_clock(uint8_t *tod_high, uint64_t *tod_low) > return kvm_vm_ioctl(kvm_state, KVM_GET_DEVICE_ATTR, &attr); > } > > +int kvm_s390_get_clock_ext(uint8_t *tod_high, uint64_t *tod_low) > +{ > + int r; > + > + struct kvm_s390_vm_tod_clock gtod; > + Please drop spaces between initializers. > + struct kvm_device_attr attr = { > + .group = KVM_S390_VM_TOD, > + .attr = KVM_S390_VM_TOD_EXT, > + .addr = (uint64_t)(>od), > + }; > + > + r = kvm_vm_ioctl(kvm_state, KVM_GET_DEVICE_ATTR, &attr); > + *tod_high = gtod.epoch_idx; > + *tod_low = gtod.tod; > + > + return r; > +} > + > int kvm_s390_set_clock(uint8_t *tod_high, uint64_t *tod_low) > { > int r; > @@ -663,6 +682,22 @@ int kvm_s390_set_clock(uint8_t *tod_high, uint64_t *tod_low) > return kvm_vm_ioctl(kvm_state, KVM_SET_DEVICE_ATTR, &attr); > } > > +int kvm_s390_set_clock_ext(uint8_t *tod_high, uint64_t *tod_low) > +{ > + struct kvm_s390_vm_tod_clock gtod = { > + .epoch_idx = *tod_high, > + .tod = *tod_low, > + }; > + dito > + struct kvm_device_attr attr = { > + .group = KVM_S390_VM_TOD, > + .attr = KVM_S390_VM_TOD_EXT, > + .addr = (uint64_t)(>od), > + }; > + > + return kvm_vm_ioctl(kvm_state, KVM_SET_DEVICE_ATTR, &attr); > +} > + > /** > * kvm_s390_mem_op: > * @addr: the logical start address in guest memory > diff --git a/target/s390x/kvm_s390x.h b/target/s390x/kvm_s390x.h > index 2d594bd..501fc5a 100644 > --- a/target/s390x/kvm_s390x.h > +++ b/target/s390x/kvm_s390x.h > @@ -29,7 +29,9 @@ int kvm_s390_vcpu_interrupt_post_load(S390CPU *cpu); > int kvm_s390_get_ri(void); > int kvm_s390_get_gs(void); > int kvm_s390_get_clock(uint8_t *tod_high, uint64_t *tod_clock); > +int kvm_s390_get_clock_ext(uint8_t *tod_high, uint64_t *tod_clock); > int kvm_s390_set_clock(uint8_t *tod_high, uint64_t *tod_clock); > +int kvm_s390_set_clock_ext(uint8_t *tod_high, uint64_t *tod_clock); > void kvm_s390_enable_css_support(S390CPU *cpu); > int kvm_s390_assign_subch_ioeventfd(EventNotifier *notifier, uint32_t sch, > int vq, bool assign); > Apart from that looks good to me (although I am still 99.9% sure that the kernel part is not fully correct, but have no time to look into it) -- Thanks, David ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH 0/2] s390/z14: extended TOD-clock support 2017-09-25 10:23 [Qemu-devel] [PATCH 0/2] s390/z14: extended TOD-clock support Christian Borntraeger 2017-09-25 10:23 ` [Qemu-devel] [PATCH 1/2] linux-headers: Update linux headers for extended TOD-Clock Christian Borntraeger 2017-09-25 10:23 ` [Qemu-devel] [PATCH 2/2] s390/kvm: Support for get/set of extended TOD-Clock for guest Christian Borntraeger @ 2017-09-25 10:49 ` no-reply 2 siblings, 0 replies; 6+ messages in thread From: no-reply @ 2017-09-25 10:49 UTC (permalink / raw) To: borntraeger; +Cc: famz, cohuck, thuth, david, qemu-devel, agraf, rth Hi, This series seems to have some coding style problems. See output below for more information: Type: series Message-id: 20170925102302.60587-1-borntraeger@de.ibm.com Subject: [Qemu-devel] [PATCH 0/2] s390/z14: extended TOD-clock support === TEST SCRIPT BEGIN === #!/bin/bash BASE=base n=1 total=$(git log --oneline $BASE.. | wc -l) failed=0 git config --local diff.renamelimit 0 git config --local diff.renames True commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..." if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then failed=1 echo fi n=$((n+1)) done exit $failed === TEST SCRIPT END === Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384 Switched to a new branch 'test' 96c6906c93 s390/kvm: Support for get/set of extended TOD-Clock for guest f4ecf143f0 linux-headers: Update linux headers for extended TOD-Clock === OUTPUT BEGIN === Checking PATCH 1/2: linux-headers: Update linux headers for extended TOD-Clock... Checking PATCH 2/2: s390/kvm: Support for get/set of extended TOD-Clock for guest... ERROR: Error messages should not contain newlines #34: FILE: hw/s390x/s390-virtio-ccw.c:217: + "s390_get_clock returned error %d.\n", r); total: 1 errors, 0 warnings, 134 lines checked Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS. === OUTPUT END === Test command exited with code: 1 --- Email generated automatically by Patchew [http://patchew.org/]. Please send your feedback to patchew-devel@freelists.org ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-09-26 13:52 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-09-25 10:23 [Qemu-devel] [PATCH 0/2] s390/z14: extended TOD-clock support Christian Borntraeger 2017-09-25 10:23 ` [Qemu-devel] [PATCH 1/2] linux-headers: Update linux headers for extended TOD-Clock Christian Borntraeger 2017-09-25 10:23 ` [Qemu-devel] [PATCH 2/2] s390/kvm: Support for get/set of extended TOD-Clock for guest Christian Borntraeger 2017-09-25 13:08 ` Cornelia Huck 2017-09-26 13:52 ` David Hildenbrand 2017-09-25 10:49 ` [Qemu-devel] [PATCH 0/2] s390/z14: extended TOD-clock support no-reply
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.