From patchwork Wed Oct 4 17:46:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 148444 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:254a:b0:403:3b70:6f57 with SMTP id hf10csp301695vqb; Wed, 4 Oct 2023 10:46:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH4hvPtesGG5EDGt6UlYROOknv1Fwj73AuK4goevGXRMUooSWi/HgLfch1bJ5CCMbZSg9K6 X-Received: by 2002:a17:90b:4f8c:b0:26f:f272:144c with SMTP id qe12-20020a17090b4f8c00b0026ff272144cmr2592748pjb.27.1696441610352; Wed, 04 Oct 2023 10:46:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696441610; cv=none; d=google.com; s=arc-20160816; b=QlFCiaHgJrrpK/hyBODwDnNTRtM6/UyyFwfvXm1Aw5icA2LAlQ9my5vkQX+WulDxSM vMTWJ5Zih5yXgAaXfaqRn934BBNbNvF0GGL4CCFSllmaXpbQpPbI2lJK4PhYpbZ1b0nY Cl3kfFYbzTQWek5262Xp1W1dB9uSYMkWHJx2JdxQU/BgS/EU7+GUhDByvuxjxcPQnw+O jOQSOZ2QgyrGRT9lBIkGmZ6TIzG18lV33/3qQUIblyzpmSH1hQYSSrM2uG25eLBFyvg6 n0wwTSCi47vl4NFyOku1GLa/XvsFof9Mw2jYi4w7JLTDQAW7O6k6ltzUZhyIk+fWf84t fWqg== 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=9gqPmyTqMnaI5p/Yo2lWX8v6irfTkiQJyeLI3Y/+zIE=; fh=8AvbwpPKF0Qe5WwS5eyABOVDUChKGxIrkPaOnjrOqKo=; b=S3R+0A7GTn14jZb5EfIzmbmuVA8ooiB3AtlngFNjJcTWvMfdw1MW9n0NZ3nXTLRnI1 MaZXHw0Yvllld+XnJnlZkj6BEvc11izlpLF2/lB7v/l1Gob5pajzM3kU0HEL43nldFlX GiEa+iLlctpG58xAUkuel0mKLBKodvp9FUEInNgSdz5XNEOkKZJQHa3QC8pngd4sjPKw ii01CIo2/vS3eISvX5GtDC9jzEeZihNv32iK4WCYj4/q0+b2lXP9vtXpkNCtD5OP4z/u fCa4JmV0tzqy4ZH62pvVtqfO8/pz+W4okWfWds2EapYpRJKo8od91xY7yMVGbDDS09kH BNPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xen.org header.s=20200302mail header.b=THUEtcun; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id f8-20020a17090a120800b00278f819d43asi1867408pja.109.2023.10.04.10.46.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 10:46:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@xen.org header.s=20200302mail header.b=THUEtcun; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 824E583743A2; Wed, 4 Oct 2023 10:46:49 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243433AbjJDRqp (ORCPT + 19 others); Wed, 4 Oct 2023 13:46:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233497AbjJDRqo (ORCPT ); Wed, 4 Oct 2023 13:46:44 -0400 Received: from mail.xenproject.org (mail.xenproject.org [104.130.215.37]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 889BF9E; Wed, 4 Oct 2023 10:46:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date: Subject:Cc:To:From; bh=9gqPmyTqMnaI5p/Yo2lWX8v6irfTkiQJyeLI3Y/+zIE=; b=THUEtc unQCDvOdaaGMv//tZS+KnFKrjVgqVmY1Oz4phjWFwdFVFTpf8/tgOSvx7ptevmVImLFQv6sMrm5+l gx/dQCoi+DH2YtY2UJQK54HKlLwcwKTOa9ZiDNfX5WiksD2v6bdmeuKtfwrCnGAlUAPqDLNbP+pB2 Gvs2CZjh53Y=; Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qo5xA-0001tA-NQ; Wed, 04 Oct 2023 17:46:32 +0000 Received: from ec2-63-33-11-17.eu-west-1.compute.amazonaws.com ([63.33.11.17] helo=REM-PW02S00X.ant.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qo5xA-0003xm-CC; Wed, 04 Oct 2023 17:46:32 +0000 From: Paul Durrant To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Paul Durrant , David Woodhouse , David Woodhouse , Sean Christopherson , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , x86@kernel.org Subject: [PATCH v2] KVM: x86/xen: ignore the VCPU_SSHOTTMR_future flag Date: Wed, 4 Oct 2023 17:46:28 +0000 Message-Id: <20231004174628.2073263-1-paul@xen.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_PASS, SPF_PASS,URIBL_BLOCKED autolearn=ham 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 04 Oct 2023 10:46:49 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778847958216965057 X-GMAIL-MSGID: 1778847958216965057 From: Paul Durrant Upstream Xen now ignores this flag [1], since the only guest kernel ever to use it was buggy. By ignoring the flag the guest will always get a callback if it sets a negative timeout which upstream Xen has determined not to cause problems for any guest setting the flag. [1] https://xenbits.xen.org/gitweb/?p=xen.git;a=commitdiff;h=19c6cbd909 Signed-off-by: Paul Durrant Reviewed-by: David Woodhouse --- Cc: David Woodhouse Cc: Sean Christopherson Cc: Paolo Bonzini Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: "H. Peter Anvin" Cc: x86@kernel.org v2: - Amend the patch subject line --- arch/x86/kvm/xen.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/arch/x86/kvm/xen.c b/arch/x86/kvm/xen.c index 40edf4d1974c..8f1d46df0f3b 100644 --- a/arch/x86/kvm/xen.c +++ b/arch/x86/kvm/xen.c @@ -1374,12 +1374,8 @@ static bool kvm_xen_hcall_vcpu_op(struct kvm_vcpu *vcpu, bool longmode, int cmd, return true; } + /* A delta <= 0 results in an immediate callback, which is what we want */ delta = oneshot.timeout_abs_ns - get_kvmclock_ns(vcpu->kvm); - if ((oneshot.flags & VCPU_SSHOTTMR_future) && delta < 0) { - *r = -ETIME; - return true; - } - kvm_xen_start_timer(vcpu, oneshot.timeout_abs_ns, delta); *r = 0; return true;