[{"id":1774721,"web_url":"http://patchwork.ozlabs.org/comment/1774721/","msgid":"<20170925150805.3143397d.cohuck@redhat.com>","list_archive_url":null,"date":"2017-09-25T13:08:05","subject":"Re: [Qemu-devel] [PATCH 2/2] s390/kvm: Support for get/set of\n\textended TOD-Clock for guest","submitter":{"id":71914,"url":"http://patchwork.ozlabs.org/api/people/71914/","name":"Cornelia Huck","email":"cohuck@redhat.com"},"content":"On Mon, 25 Sep 2017 12:23:02 +0200\nChristian Borntraeger <borntraeger@de.ibm.com> wrote:\n\n> From: \"Collin L. Walling\" <walling@linux.vnet.ibm.com>\n> \n> Provides an interface for getting and setting the guest's extended\n> TOD-Clock via a single ioctl to kvm. If the ioctl fails because it\n> is not support by kvm, then we fall back to the old style of\n> retrieving the clock via two ioctls.\n> \n> If kvm fails to set a nonzero epoch index, then we ultimately fail\n> the migration altogether and the guest will resume normally on the\n> original host machine.\n\nI'd prefer to have that part split off, as it is a change in behaviour\nand I don't think we should mix it with adding support for an improved\ninterface.\n\n> \n> Signed-off-by: Collin L. Walling <walling@linux.vnet.ibm.com>\n> Reviewed-by: Eric Farman <farman@linux.vnet.ibm.com>\n> Reviewed-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>\n> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>\n> ---\n>  hw/s390x/s390-virtio-ccw.c |  8 +++-----\n>  target/s390x/cpu.c         | 26 +++++++++++++++++++-------\n>  target/s390x/kvm-stub.c    | 10 ++++++++++\n>  target/s390x/kvm.c         | 35 +++++++++++++++++++++++++++++++++++\n>  target/s390x/kvm_s390x.h   |  2 ++\n>  5 files changed, 69 insertions(+), 12 deletions(-)\n> \n> diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c\n> index fafbc6d..bad09f5 100644\n> --- a/hw/s390x/s390-virtio-ccw.c\n> +++ b/hw/s390x/s390-virtio-ccw.c\n> @@ -213,13 +213,11 @@ static int gtod_load(QEMUFile *f, void *opaque, int version_id)\n>  \n>      r = s390_set_clock(&tod_high, &tod_low);\n>      if (r) {\n> -        warn_report(\"Unable to set guest clock for migration: %s\",\n> -                    strerror(-r));\n> -        error_printf(\"Guest clock will not be restored \"\n> -                     \"which could cause the guest to hang.\");\n> +        error_report(\"Unable to set guest clock value. \"\n> +                     \"s390_get_clock returned error %d.\\n\", r);\n\nPlease keep to a single phrase in error_report(). Also, I find\nstrerror() often more useful.\n\n>      }\n>  \n> -    return 0;\n> +    return r;\n>  }\n>  \n>  static SaveVMHandlers savevm_gtod = {\n\nOtherwise looks good.","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx07.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx07.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=cohuck@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3y14Cl5mXHz9tXD\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 25 Sep 2017 23:08:50 +1000 (AEST)","from localhost ([::1]:42389 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dwT7r-0002cz-Pj\n\tfor incoming@patchwork.ozlabs.org; Mon, 25 Sep 2017 09:08:43 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:56028)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <cohuck@redhat.com>) id 1dwT7R-0002cu-02\n\tfor qemu-devel@nongnu.org; Mon, 25 Sep 2017 09:08:18 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <cohuck@redhat.com>) id 1dwT7N-0006sB-OR\n\tfor qemu-devel@nongnu.org; Mon, 25 Sep 2017 09:08:16 -0400","from mx1.redhat.com ([209.132.183.28]:6012)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <cohuck@redhat.com>) id 1dwT7N-0006rz-Hw\n\tfor qemu-devel@nongnu.org; Mon, 25 Sep 2017 09:08:13 -0400","from smtp.corp.redhat.com\n\t(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 8AEF6C047B70;\n\tMon, 25 Sep 2017 13:08:12 +0000 (UTC)","from gondolin (dhcp-192-215.str.redhat.com [10.33.192.215])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 689156C415;\n\tMon, 25 Sep 2017 13:08:07 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 8AEF6C047B70","Date":"Mon, 25 Sep 2017 15:08:05 +0200","From":"Cornelia Huck <cohuck@redhat.com>","To":"Christian Borntraeger <borntraeger@de.ibm.com>","Message-ID":"<20170925150805.3143397d.cohuck@redhat.com>","In-Reply-To":"<20170925102302.60587-3-borntraeger@de.ibm.com>","References":"<20170925102302.60587-1-borntraeger@de.ibm.com>\n\t<20170925102302.60587-3-borntraeger@de.ibm.com>","Organization":"Red Hat GmbH","MIME-Version":"1.0","Content-Type":"text/plain; charset=US-ASCII","Content-Transfer-Encoding":"7bit","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.11","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.31]);\n\tMon, 25 Sep 2017 13:08:12 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"Re: [Qemu-devel] [PATCH 2/2] s390/kvm: Support for get/set of\n\textended TOD-Clock for guest","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Thomas Huth <thuth@redhat.com>, David Hildenbrand <david@redhat.com>,\n\tqemu-devel <qemu-devel@nongnu.org>, Alexander Graf <agraf@suse.de>,\n\t\"Collin L. Walling\" <walling@linux.vnet.ibm.com>,\n\tRichard Henderson <rth@twiddle.net>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1775538,"web_url":"http://patchwork.ozlabs.org/comment/1775538/","msgid":"<3a77203f-2f9e-b867-3be3-86243ccd72f1@redhat.com>","list_archive_url":null,"date":"2017-09-26T13:52:19","subject":"Re: [Qemu-devel] [PATCH 2/2] s390/kvm: Support for get/set of\n\textended TOD-Clock for guest","submitter":{"id":70402,"url":"http://patchwork.ozlabs.org/api/people/70402/","name":"David Hildenbrand","email":"david@redhat.com"},"content":"On 25.09.2017 12:23, Christian Borntraeger wrote:\n> From: \"Collin L. Walling\" <walling@linux.vnet.ibm.com>\n> \n> Provides an interface for getting and setting the guest's extended\n> TOD-Clock via a single ioctl to kvm. If the ioctl fails because it\n> is not support by kvm, then we fall back to the old style of\n> retrieving the clock via two ioctls.\n> \n> If kvm fails to set a nonzero epoch index, then we ultimately fail\n> the migration altogether and the guest will resume normally on the\n> original host machine.\n> \n> Signed-off-by: Collin L. Walling <walling@linux.vnet.ibm.com>\n> Reviewed-by: Eric Farman <farman@linux.vnet.ibm.com>\n> Reviewed-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>\n> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>\n> ---\n>  hw/s390x/s390-virtio-ccw.c |  8 +++-----\n>  target/s390x/cpu.c         | 26 +++++++++++++++++++-------\n>  target/s390x/kvm-stub.c    | 10 ++++++++++\n>  target/s390x/kvm.c         | 35 +++++++++++++++++++++++++++++++++++\n>  target/s390x/kvm_s390x.h   |  2 ++\n>  5 files changed, 69 insertions(+), 12 deletions(-)\n> \n> diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c\n> index fafbc6d..bad09f5 100644\n> --- a/hw/s390x/s390-virtio-ccw.c\n> +++ b/hw/s390x/s390-virtio-ccw.c\n> @@ -213,13 +213,11 @@ static int gtod_load(QEMUFile *f, void *opaque, int version_id)\n>  \n>      r = s390_set_clock(&tod_high, &tod_low);\n>      if (r) {\n> -        warn_report(\"Unable to set guest clock for migration: %s\",\n> -                    strerror(-r));\n> -        error_printf(\"Guest clock will not be restored \"\n> -                     \"which could cause the guest to hang.\");\n> +        error_report(\"Unable to set guest clock value. \"\n> +                     \"s390_get_clock returned error %d.\\n\", r);\n>      }\n\nThis should go into a separate patch (I think also Conny referred to\nthat in her comment).\n\n>  \n> -    return 0;\n> +    return r;\n>  }\n>  \n[..]\n.c\n> index ebb75ca..ef7374c 100644\n> --- a/target/s390x/kvm.c\n> +++ b/target/s390x/kvm.c\n> @@ -643,6 +643,25 @@ int kvm_s390_get_clock(uint8_t *tod_high, uint64_t *tod_low)\n>      return kvm_vm_ioctl(kvm_state, KVM_GET_DEVICE_ATTR, &attr);\n>  }\n>  \n> +int kvm_s390_get_clock_ext(uint8_t *tod_high, uint64_t *tod_low)\n> +{\n> +    int r;\n> +\n> +    struct kvm_s390_vm_tod_clock gtod;\n> +\n\nPlease drop spaces between initializers.\n\n> +    struct kvm_device_attr attr = {\n> +        .group = KVM_S390_VM_TOD,\n> +        .attr = KVM_S390_VM_TOD_EXT,\n> +        .addr = (uint64_t)(&gtod),\n> +    };\n> +\n> +    r = kvm_vm_ioctl(kvm_state, KVM_GET_DEVICE_ATTR, &attr);\n> +    *tod_high = gtod.epoch_idx;\n> +    *tod_low  = gtod.tod;\n> +\n> +    return r;\n> +}\n> +\n>  int kvm_s390_set_clock(uint8_t *tod_high, uint64_t *tod_low)\n>  {\n>      int r;\n> @@ -663,6 +682,22 @@ int kvm_s390_set_clock(uint8_t *tod_high, uint64_t *tod_low)\n>      return kvm_vm_ioctl(kvm_state, KVM_SET_DEVICE_ATTR, &attr);\n>  }\n>  \n> +int kvm_s390_set_clock_ext(uint8_t *tod_high, uint64_t *tod_low)\n> +{\n> +    struct kvm_s390_vm_tod_clock gtod = {\n> +        .epoch_idx = *tod_high,\n> +        .tod  = *tod_low,\n> +    };\n> +\n\ndito\n\n> +    struct kvm_device_attr attr = {\n> +        .group = KVM_S390_VM_TOD,\n> +        .attr = KVM_S390_VM_TOD_EXT,\n> +        .addr = (uint64_t)(&gtod),\n> +    };\n> +\n> +    return kvm_vm_ioctl(kvm_state, KVM_SET_DEVICE_ATTR, &attr);\n> +}\n> +\n>  /**\n>   * kvm_s390_mem_op:\n>   * @addr:      the logical start address in guest memory\n> diff --git a/target/s390x/kvm_s390x.h b/target/s390x/kvm_s390x.h\n> index 2d594bd..501fc5a 100644\n> --- a/target/s390x/kvm_s390x.h\n> +++ b/target/s390x/kvm_s390x.h\n> @@ -29,7 +29,9 @@ int kvm_s390_vcpu_interrupt_post_load(S390CPU *cpu);\n>  int kvm_s390_get_ri(void);\n>  int kvm_s390_get_gs(void);\n>  int kvm_s390_get_clock(uint8_t *tod_high, uint64_t *tod_clock);\n> +int kvm_s390_get_clock_ext(uint8_t *tod_high, uint64_t *tod_clock);\n>  int kvm_s390_set_clock(uint8_t *tod_high, uint64_t *tod_clock);\n> +int kvm_s390_set_clock_ext(uint8_t *tod_high, uint64_t *tod_clock);\n>  void kvm_s390_enable_css_support(S390CPU *cpu);\n>  int kvm_s390_assign_subch_ioeventfd(EventNotifier *notifier, uint32_t sch,\n>                                      int vq, bool assign);\n> \n\nApart from that looks good to me (although I am still 99.9% sure that\nthe kernel part is not fully correct, but have no time to look into it)","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx04.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx04.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=david@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3y1j8r5khcz9sPr\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 26 Sep 2017 23:53:32 +1000 (AEST)","from localhost ([::1]:47661 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dwqIk-0008Vf-U8\n\tfor incoming@patchwork.ozlabs.org; Tue, 26 Sep 2017 09:53:30 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:53656)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <david@redhat.com>) id 1dwqHk-0008BT-Gn\n\tfor qemu-devel@nongnu.org; Tue, 26 Sep 2017 09:52:34 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <david@redhat.com>) id 1dwqHf-0007WJ-HU\n\tfor qemu-devel@nongnu.org; Tue, 26 Sep 2017 09:52:28 -0400","from mx1.redhat.com ([209.132.183.28]:63957)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <david@redhat.com>) id 1dwqHf-0007Vn-7s\n\tfor qemu-devel@nongnu.org; Tue, 26 Sep 2017 09:52:23 -0400","from smtp.corp.redhat.com\n\t(int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 2E8CB7EA87;\n\tTue, 26 Sep 2017 13:52:22 +0000 (UTC)","from [10.36.117.152] (ovpn-117-152.ams2.redhat.com [10.36.117.152])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 7CB4E5D9C9;\n\tTue, 26 Sep 2017 13:52:20 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 2E8CB7EA87","To":"Christian Borntraeger <borntraeger@de.ibm.com>,\n\tCornelia Huck <cohuck@redhat.com>","References":"<20170925102302.60587-1-borntraeger@de.ibm.com>\n\t<20170925102302.60587-3-borntraeger@de.ibm.com>","From":"David Hildenbrand <david@redhat.com>","Organization":"Red Hat GmbH","Message-ID":"<3a77203f-2f9e-b867-3be3-86243ccd72f1@redhat.com>","Date":"Tue, 26 Sep 2017 15:52:19 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<20170925102302.60587-3-borntraeger@de.ibm.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-US","Content-Transfer-Encoding":"7bit","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.14","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.28]);\n\tTue, 26 Sep 2017 13:52:22 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"Re: [Qemu-devel] [PATCH 2/2] s390/kvm: Support for get/set of\n\textended TOD-Clock for guest","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Thomas Huth <thuth@redhat.com>, Richard Henderson <rth@twiddle.net>,\n\t\"Collin L. Walling\" <walling@linux.vnet.ibm.com>,\n\tqemu-devel <qemu-devel@nongnu.org>, Alexander Graf <agraf@suse.de>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}}]