From patchwork Wed Nov 23 09:08:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 24810 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2677096wrr; Wed, 23 Nov 2022 01:10:23 -0800 (PST) X-Google-Smtp-Source: AA0mqf5t+DtNJAp2uJCgOpRWI/YT6jnYhKbEuAwtLw1mDeX7KU8O5oUiCIhJSzdsBj+WQgAua6uC X-Received: by 2002:a17:90a:df0e:b0:20b:22fb:2ef with SMTP id gp14-20020a17090adf0e00b0020b22fb02efmr36205532pjb.158.1669194622792; Wed, 23 Nov 2022 01:10:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669194622; cv=none; d=google.com; s=arc-20160816; b=JYjqLPLyOQajMTWuEdKYTiX4SOr2d8oYflys1mTPVrUX+KVH6MV4nuE7UTWnstxcni jHxUfLBLYxd5sYtVEhHmO7mHBWdXtXD8qtnhp+KznvkYMsemFTC0Hrd+E9t3I++1BprO lGKFSZY/I5BrVi17h6XRyVYv2EDQocYgiy1GyYUD7rlQAnsWLeiUlCXh7EG4V0x/wRox Szs/oClJB+olsv909D8OwXKP9L+ofIlV70mUf7J9iil0WJbitTd5FNbVKSHi/CIgCAzq NjgTD8hvTsjFEsgktmYlv/dVPgOcDP0ofH+E85jnV/4Gp9Wxz2Zyb4HQwP4OsMOCAybW +lFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=WQbEhgs5qxc94Qred5pff5swxDYduz0Vj7Oft/jd7ac=; b=WRbg1hybf8OUW7kaOxFxFBfnmbTxbefiqJtlRlNnNT7jyBt1r8epjIRwnWMyaUsst7 JDA7Jhusmz0edpr8e06036Aa8JiGjtEY/eUIb7lqNqXBWJSfXXN7vSSTl8wFRkhL5vu/ X8S08/no2PCK/EU9TtNhbTc76ef0u7kNs3qsu/P6pLPaamXA+ovc6n+9hP1pooYHXqOK oipICBdiOjaq4puQo7eVGZD4eptwzDJY5l3xnqP9cJDT+5qujx6Gn/3QBjXHjj0kl306 QWNZzm/T7yXPamhSVrm2C+MwbuADusygUZsmiz02btH3vrHpnN9Dbx04IWWth2Yni0xU SZ6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Xx9SD4+s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h18-20020a656392000000b00476ce2ae030si15905712pgv.153.2022.11.23.01.10.09; Wed, 23 Nov 2022 01:10:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Xx9SD4+s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237144AbiKWJJu (ORCPT + 99 others); Wed, 23 Nov 2022 04:09:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237151AbiKWJJo (ORCPT ); Wed, 23 Nov 2022 04:09:44 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26686193C2 for ; Wed, 23 Nov 2022 01:08:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669194525; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=WQbEhgs5qxc94Qred5pff5swxDYduz0Vj7Oft/jd7ac=; b=Xx9SD4+sZwah5ImmkxMjgS9wiCSP9aq54aRKzRqSjG2zLD4vy1UevPCRINu/IB7l3VyUMC jA80q4IzNJMoABpcjWTFSVJQMjyM9v/ylXZqVdoFL4oj0Cj1AFUFALNnHCi6VNWfN3PpKB FdgM5NYRb4PSozVyw/4BRyiPtA9b2/8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-512-poHxTbQwPziHRPlq95zWVw-1; Wed, 23 Nov 2022 04:08:40 -0500 X-MC-Unique: poHxTbQwPziHRPlq95zWVw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 62D52811E7A; Wed, 23 Nov 2022 09:08:40 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1487A1415114; Wed, 23 Nov 2022 09:08:37 +0000 (UTC) From: Thomas Huth To: kvm@vger.kernel.org, Janosch Frank , Claudio Imbrenda Cc: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, Christian Borntraeger , David Hildenbrand , "Collin L. Walling" , Jason J Herne Subject: [PATCH] KVM: s390: vsie: Fix the initialization of the epoch extension (epdx) field Date: Wed, 23 Nov 2022 10:08:33 +0100 Message-Id: <20221123090833.292938-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750277420746175869?= X-GMAIL-MSGID: =?utf-8?q?1750277420746175869?= We recently experienced some weird huge time jumps in nested guests when rebooting them in certain cases. After adding some debug code to the epoch handling in vsie.c (thanks to David Hildenbrand for the idea!), it was obvious that the "epdx" field (the multi-epoch extension) did not get set to 0xff in case the "epoch" field was negative. Seems like the code misses to copy the value from the epdx field from the guest to the shadow control block. By doing so, the weird time jumps are gone in our scenarios. Link: https://bugzilla.redhat.com/show_bug.cgi?id=2140899 Fixes: 8fa1696ea781 ("KVM: s390: Multiple Epoch Facility support") Signed-off-by: Thomas Huth Acked-by: David Hildenbrand Reviewed-by: Claudio Imbrenda Reviewed-by: Christian Borntraeger Reviewed-by: Janosch Frank --- arch/s390/kvm/vsie.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c index 94138f8f0c1c..ace2541ababd 100644 --- a/arch/s390/kvm/vsie.c +++ b/arch/s390/kvm/vsie.c @@ -546,8 +546,10 @@ static int shadow_scb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page) if (test_kvm_cpu_feat(vcpu->kvm, KVM_S390_VM_CPU_FEAT_CEI)) scb_s->eca |= scb_o->eca & ECA_CEI; /* Epoch Extension */ - if (test_kvm_facility(vcpu->kvm, 139)) + if (test_kvm_facility(vcpu->kvm, 139)) { scb_s->ecd |= scb_o->ecd & ECD_MEF; + scb_s->epdx = scb_o->epdx; + } /* etoken */ if (test_kvm_facility(vcpu->kvm, 156))