From nobody Mon May 6 05:26:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1559138943; cv=none; d=zoho.com; s=zohoarc; b=LVqpfKYez0BvWojL2RIxID8T9/mi/TBjrmLbg7f1iJ/78wi7uKn2E0BqKiQYtbp7fZHTsLNUKmlBOAp+4TSt5vVfHs80RGtbwtBIJ3Hj6hGH0DFE8ZM+PHHuaSzk7K/z2kLKDi8bNoNZgnvaoAwz4lzB5g9gtskX5QGQrDWmDpk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559138943; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=lcEeGPYUHHRsrYCTRzJwcBkAV6hlski3eBSqktXRU0U=; b=Kovz79PKfti6SQtC21GIdiy00Tfa983fAsY53VEXZRHQvMQgz7x0778kqa770Rpqr5sVfQzLt0KqlcIC/x+pat4Ankl8jVbOr6/e7KXlJUKAhLs20AeC1yCLhuH2hpIy/8i58fkSZHRS5j/sw1Q07hWzbZmWJ8eNk+gjTEmqHsc= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1559138943469846.1387627100053; Wed, 29 May 2019 07:09:03 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hVzFA-00074N-Rn; Wed, 29 May 2019 14:07:52 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hVzFA-00074I-8X for xen-devel@lists.xenproject.org; Wed, 29 May 2019 14:07:52 +0000 Received: from esa2.hc3370-68.iphmx.com (unknown [216.71.145.153]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 237fc776-821b-11e9-a768-4b191682de30; Wed, 29 May 2019 14:07:48 +0000 (UTC) X-Inumbo-ID: 237fc776-821b-11e9-a768-4b191682de30 Authentication-Results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=paul.durrant@citrix.com; spf=Pass smtp.mailfrom=Paul.Durrant@citrix.com; spf=None smtp.helo=postmaster@MIAPEX02MSOL02.citrite.net Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa2.hc3370-68.iphmx.com: no sender authenticity information available from domain of paul.durrant@citrix.com) identity=pra; client-ip=23.29.105.83; receiver=esa2.hc3370-68.iphmx.com; envelope-from="Paul.Durrant@citrix.com"; x-sender="paul.durrant@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa2.hc3370-68.iphmx.com: domain of Paul.Durrant@citrix.com designates 23.29.105.83 as permitted sender) identity=mailfrom; client-ip=23.29.105.83; receiver=esa2.hc3370-68.iphmx.com; envelope-from="Paul.Durrant@citrix.com"; x-sender="Paul.Durrant@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:23.29.105.83 ip4:162.221.156.50 ~all" Received-SPF: None (esa2.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@MIAPEX02MSOL02.citrite.net) identity=helo; client-ip=23.29.105.83; receiver=esa2.hc3370-68.iphmx.com; envelope-from="Paul.Durrant@citrix.com"; x-sender="postmaster@MIAPEX02MSOL02.citrite.net"; x-conformance=sidf_compatible IronPort-SDR: oUyc9ri6LKHgqVj/NjSATff6i2wdiOzYID0Lre+Z5/64nAr3ANjCgG01b9Mrg5cSU19zJnV/FI BfFWHhgIkoBMj8Qp3zfHTXdepy/Cb/jE4ZbSbI5+41a2qUC7dC/Yhw+dRymHnEn/xeSViA5kvD sJ7GdPYNkag3L5RidKs3L5Aaav7WrNKQSI+VKo8NPegxKbaSept9Yn/3JIG4UrrbRHcIUHDlC7 5V0nAJmzVaYc2nliO9sIA5fRHMUIQOb/E4sDSdYZv/Zcp+0M2mMO8DLpqm+7EZZgPN+2HhIw6a 4WU= X-SBRS: 2.7 X-MesageID: 1047240 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 23.29.105.83 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.60,527,1549947600"; d="scan'208";a="1047240" From: Paul Durrant To: Date: Wed, 29 May 2019 15:07:44 +0100 Message-ID: <20190529140744.5565-1-paul.durrant@citrix.com> X-Mailer: git-send-email 2.20.1.2.gb21ebb671 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v3] x86/hvm/hpet: avoid 'small' time diff test on resume X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Paul Durrant , Wei Liu , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" It appears that even 64-bit versions of Windows 10, when not using syth- etic timers, will use 32-bit HPET non-periodic timers. There is a test in hpet_set_timer(), specific to 32-bit timers, that tries to disambiguate between a comparator value that is in the past and one that is sufficiently far in the future that it wraps. This is done by assuming that the delta between the main counter and comparator will be 'small' [1], if the comparator value is in the past. Unfortunately, more often than not, this is not the case if the timer is being re-started after a migrate and so the timer is set to fire far in the future (in excess of a minute in several observed cases) rather then set to fire immediately. This has a rather odd symptom where the guest console is alive enough to be able to deal with mouse pointer re-rendering, but any keyboard activity or mouse clicks yield no response. This patch simply adds an extra check of 'creation_finished' into hpet_set_timer() so that the 'small' time test is omitted when the function is called to restart timers after migration, and thus any negative delta causes a timer to fire immediately. [1] The number of ticks that equate to 0.9765625 milliseconds Signed-off-by: Paul Durrant Reviewed-by: Jan Beulich --- Cc: Jan Beulich Cc: Andrew Cooper Cc: Wei Liu Cc: "Roger Pau Monn=C3=A9" I notice that we seemingly don't handle main counter wrap in the HPET code. The spec. says that timers should fire at the point the counter wraps at the timer's width. I think the need for the 'small' time test would go away if this was implemented, but that's for another day. --- xen/arch/x86/hvm/hpet.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/hvm/hpet.c b/xen/arch/x86/hvm/hpet.c index a916758106..12f13f8c3c 100644 --- a/xen/arch/x86/hvm/hpet.c +++ b/xen/arch/x86/hvm/hpet.c @@ -273,10 +273,14 @@ static void hpet_set_timer(HPETState *h, unsigned int= tn, * Detect time values set in the past. This is hard to do for 32-bit * comparators as the timer does not have to be set that far in the fu= ture * for the counter difference to wrap a 32-bit signed integer. We fudge - * by looking for a 'small' time value in the past. + * by looking for a 'small' time value in the past. However, if we + * are restoring after migrate, treat any wrap as past since the value + * is unlikely to be 'small'. */ if ( (int64_t)diff < 0 ) - diff =3D (timer_is_32bit(h, tn) && (-diff > HPET_TINY_TIME_SPAN)) + diff =3D (timer_is_32bit(h, tn) && + vhpet_domain(h)->creation_finished && + (-diff > HPET_TINY_TIME_SPAN)) ? (uint32_t)diff : 0; =20 destroy_periodic_time(&h->pt[tn]); --=20 2.20.1.2.gb21ebb671 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel