From nobody Wed Nov 27 18:37:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1697730096; cv=none; d=zohomail.com; s=zohoarc; b=lpBZu+PG8tvCss6YKzn2VR/ap1Ix2xCjhjU9klQyHdzqW2xVfqS86bx5DCA8UN24Qm+4K7c7546UGlMuJJTA9uBm79kuDQMwYOLr9FUCMkhPozDVwF/uEcCvUqUJdLlsF9u3fhqjxMx1JhGwiYBrfpqz0VyjOE8DC6UxiTLn/oM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697730096; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=I94165DVF5UqmBmDscBFuMqRd0gjhG/yUz/GC+u3DZo=; b=ChG0EDOuAB9kfLU+J1wCEbJXc6wNlLdAZq1tOX8twndmOKZYHT40uq2UgTf5jZ6nbDWilLRvF9iNh4QcWMEANYgF7dvJ6jqNo535IG/zBDRz4XIf05OFGmRZE8+Tb4wyHWoEp9+krpKJg8CYGJiHUPJQwsDnBTaUYVENoJPGim0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) 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 1697730096098436.88153426684516; Thu, 19 Oct 2023 08:41:36 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.619428.964559 (Exim 4.92) (envelope-from ) id 1qtV90-0001v3-FQ; Thu, 19 Oct 2023 15:41:06 +0000 Received: by outflank-mailman (output) from mailman id 619428.964559; Thu, 19 Oct 2023 15:41:06 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qtV8z-0001nr-LM; Thu, 19 Oct 2023 15:41:05 +0000 Received: by outflank-mailman (input) for mailman id 619428; Thu, 19 Oct 2023 15:41:02 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qtV8w-0006dc-6k for xen-devel@lists.xenproject.org; Thu, 19 Oct 2023 15:41:02 +0000 Received: from desiato.infradead.org (desiato.infradead.org [2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id e6311328-6e95-11ee-9b0e-b553b5be7939; Thu, 19 Oct 2023 17:40:58 +0200 (CEST) Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qtV8M-009yCm-2X; Thu, 19 Oct 2023 15:40:27 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1qtV8M-000Pu2-04; Thu, 19 Oct 2023 16:40:26 +0100 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list X-Inumbo-ID: e6311328-6e95-11ee-9b0e-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description; bh=I94165DVF5UqmBmDscBFuMqRd0gjhG/yUz/GC+u3DZo=; b=b27pRvnBGhO8GBTyfkDGo1zlxb TSesogQRQ2g+1BMqrLQKVS9a1UqGgeO/k1J331Y59qHD6EVut4zvVV0M1qgLrVRf/A+ir9G1MTQIF +0LXsZFDA3t1dM3upyUzwFNy8/FI5lxM+jDPhgc6FHQ22juT+DVHJ5pgPyGW8jgeW4rYxJpx3mDrp tUF1mVG428hFe9nSdcOJQqPLzDalaf0abHj0KqsdEIjy9c4f5HO701r8YI3m544Pe0l7kkTTLJf/o E74nIaxdkPhY7DJpjUTycGAcq0iMv+uHDvW6J9oEfLAz0orGmRTHzAcAbZuMvJ1c2hkl8UCHuriwd 2+mw3Qig==; From: David Woodhouse To: qemu-devel@nongnu.org Cc: Kevin Wolf , Hanna Reitz , Stefano Stabellini , Anthony Perard , Paul Durrant , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Richard Henderson , Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Jason Wang , Marcelo Tosatti , Cleber Rosa , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Wainer dos Santos Moschetta , Beraldo Leal , qemu-block@nongnu.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Bernhard Beschow , Joel Upham Subject: [PATCH v2 06/24] i386/xen: Ignore VCPU_SSHOTTMR_future flag in set_singleshot_timer() Date: Thu, 19 Oct 2023 16:40:02 +0100 Message-Id: <20231019154020.99080-7-dwmw2@infradead.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231019154020.99080-1-dwmw2@infradead.org> References: <20231019154020.99080-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: David Woodhouse X-SRS-Rewrite: SMTP reverse-path rewritten from by desiato.infradead.org. See http://www.infradead.org/rpr.html X-ZohoMail-DKIM: pass (identity @infradead.org) X-ZM-MESSAGEID: 1697730097269100005 From: David Woodhouse Upstream Xen now ignores this flag=C2=B9, since the only guest kernel ever = to use it was buggy. =C2=B9 https://xenbits.xen.org/gitweb/?p=3Dxen.git;a=3Dcommitdiff;h=3D19c6c= bd909 Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant --- target/i386/kvm/xen-emu.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/target/i386/kvm/xen-emu.c b/target/i386/kvm/xen-emu.c index 3ba636b09a..477e93cd92 100644 --- a/target/i386/kvm/xen-emu.c +++ b/target/i386/kvm/xen-emu.c @@ -1076,17 +1076,13 @@ static int vcpuop_stop_periodic_timer(CPUState *tar= get) * Must always be called with xen_timers_lock held. */ static int do_set_singleshot_timer(CPUState *cs, uint64_t timeout_abs, - bool future, bool linux_wa) + bool linux_wa) { CPUX86State *env =3D &X86_CPU(cs)->env; int64_t now =3D kvm_get_current_ns(); int64_t qemu_now =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); int64_t delta =3D timeout_abs - now; =20 - if (future && timeout_abs < now) { - return -ETIME; - } - if (linux_wa && unlikely((int64_t)timeout_abs < 0 || (delta > 0 && (uint32_t)(delta >> 50) !=3D 0)= )) { /* @@ -1128,9 +1124,13 @@ static int vcpuop_set_singleshot_timer(CPUState *cs,= uint64_t arg) } =20 QEMU_LOCK_GUARD(&X86_CPU(cs)->env.xen_timers_lock); - return do_set_singleshot_timer(cs, sst.timeout_abs_ns, - !!(sst.flags & VCPU_SSHOTTMR_future), - false); + + /* + * We ignore the VCPU_SSHOTTMR_future flag, just as Xen now does. + * The only guest that ever used it, got it wrong. + * https://xenbits.xen.org/gitweb/?p=3Dxen.git;a=3Dcommitdiff;h=3D19c6= cbd909 + */ + return do_set_singleshot_timer(cs, sst.timeout_abs_ns, false); } =20 static int vcpuop_stop_singleshot_timer(CPUState *cs) @@ -1155,7 +1155,7 @@ static bool kvm_xen_hcall_set_timer_op(struct kvm_xen= _exit *exit, X86CPU *cpu, err =3D vcpuop_stop_singleshot_timer(CPU(cpu)); } else { QEMU_LOCK_GUARD(&X86_CPU(cpu)->env.xen_timers_lock); - err =3D do_set_singleshot_timer(CPU(cpu), timeout, false, true); + err =3D do_set_singleshot_timer(CPU(cpu), timeout, true); } exit->u.hcall.result =3D err; return true; @@ -1843,7 +1843,7 @@ int kvm_put_xen_state(CPUState *cs) QEMU_LOCK_GUARD(&env->xen_timers_lock); if (env->xen_singleshot_timer_ns) { ret =3D do_set_singleshot_timer(cs, env->xen_singleshot_timer_= ns, - false, false); + false); if (ret < 0) { return ret; } --=20 2.40.1