Message ID | 20231004171102.2073141-1-paul@xen.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:254a:b0:403:3b70:6f57 with SMTP id hf10csp281518vqb; Wed, 4 Oct 2023 10:11:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGXnLt3fP8XmQqCve1iJqNj/092z7LEcvduGHeTq4FT/G8t6+BisXpJEohqYPJdN9yQOWwM X-Received: by 2002:a05:6808:1310:b0:3a9:e8e2:5799 with SMTP id y16-20020a056808131000b003a9e8e25799mr3097562oiv.14.1696439490407; Wed, 04 Oct 2023 10:11:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696439490; cv=none; d=google.com; s=arc-20160816; b=eOnsNl+3egBxwr8EniFkWLvxLJ+pzsdPTkHDdfLpLA/l4CmJOjffcDDxq2BjjJs9Er FoEPb+BwgIIaytr0zD70XW7+ZMIid4EnOXnP31bTCwrtThX0S/UFEP87kcKTIs+oadn7 EjqA5Kxco+KOilp9PnyKNRP2tAxc3hSZOv0hc3UBg1BYa+LvTg/4CAr4Gwlg6kKLtHZB q17cXifdu+0Q3CoxlVXm+DZpVZcXO0besm8AiNw2/IGyjrj1ThIkMUsq96FrZafD3TS/ P6O1gBflgwMCMZgBxqcYQupoqfQQCieTpFaXd6uejkp4uJMHuNKO3wTNWlhbgMPiVtfI V28w== 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=eXr1t5ELu0Zr8qPvmwCEa2lvkD7avFo4m39QC2UwaSM=; fh=F/y/rQAitAoVhyEvV7npxQC+pmk+LQOxsxEGW4WYgok=; b=UCRa096uWL/pv5Lm/bZESnJM2FuGW8PDiuSfrvY+XYpVOih5hRu6gH/G0CIRAo4iC0 cPDaAJ5bKAuhR1mMuDGDoODaLl1bjL+vqSmFS1942IxlZ5yn1sSIl4SiQd3P9k/Qo7b8 8pl1S1fnrPMAhwqfA+b084ldCcg8QD9fEnOmKGuDJJ5DyDfpNp70t6pwtEhrCJY2duLF 1bx7wa2/xsaM5XWIodLKpUFDnAYJ7sYxC4zG6Kqd3Acc9CvbHP2gytsdXVP9b8iaLdVb GnNNH+NpKsBiWGYD/XDQeINEyVVPpk+Mf4rfA/0f/OPfa4ZHunwod/1fIhSadiE8YiqF 6oIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xen.org header.s=20200302mail header.b=qIQJhHsF; 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 m1-20020a656a01000000b005694b757228si4400530pgu.688.2023.10.04.10.11.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 10:11:30 -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=qIQJhHsF; 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 B271380439A0; Wed, 4 Oct 2023 10:11:29 -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 S243635AbjJDRL2 (ORCPT <rfc822;ezelljr.billy@gmail.com> + 19 others); Wed, 4 Oct 2023 13:11:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243641AbjJDRL1 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 4 Oct 2023 13:11:27 -0400 Received: from mail.xenproject.org (mail.xenproject.org [104.130.215.37]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C234695; Wed, 4 Oct 2023 10:11:22 -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=eXr1t5ELu0Zr8qPvmwCEa2lvkD7avFo4m39QC2UwaSM=; b=qIQJhH sF5d4hhCxklAeUCka1A2Hh9Z+BqHTvSPyd/8nQL4b9qF094TbejyNTY8TDMObLjR6knXAJGQ9/FFI 02+WXMQkaf/xDf5zDUF1RWDnRhUJjzL2u8I1YEgxGySX9Ngnz5qA/R26aRmovQsLYRkKZdHguuGwU RH17IWEF3d4=; Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from <paul@xen.org>) id 1qo5P1-000124-U6; Wed, 04 Oct 2023 17:11:15 +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 <paul@xen.org>) id 1qo5P1-0002n6-Kb; Wed, 04 Oct 2023 17:11:15 +0000 From: Paul Durrant <paul@xen.org> To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Paul Durrant <pdurrant@amazon.com>, David Woodhouse <dwmw2@infradead.org>, Sean Christopherson <seanjc@google.com>, Paolo Bonzini <pbonzini@redhat.com>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>, Dave Hansen <dave.hansen@linux.intel.com>, "H. Peter Anvin" <hpa@zytor.com>, x86@kernel.org Subject: [PATCH] KVM: xen: ignore the VCPU_SSHOTTMR_future flag Date: Wed, 4 Oct 2023 17:11:02 +0000 Message-Id: <20231004171102.2073141-1-paul@xen.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, 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: <linux-kernel.vger.kernel.org> 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:11:29 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778845735061618256 X-GMAIL-MSGID: 1778845735061618256 |
Series |
KVM: xen: ignore the VCPU_SSHOTTMR_future flag
|
|
Commit Message
Paul Durrant
Oct. 4, 2023, 5:11 p.m. UTC
From: Paul Durrant <pdurrant@amazon.com> 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 <pdurrant@amazon.com> --- Cc: David Woodhouse <dwmw2@infradead.org> Cc: Sean Christopherson <seanjc@google.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: Borislav Petkov <bp@alien8.de> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: x86@kernel.org --- arch/x86/kvm/xen.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
Comments
On Wed, 2023-10-04 at 17:11 +0000, Paul Durrant wrote: > From: Paul Durrant <pdurrant@amazon.com> > > 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 <pdurrant@amazon.com> nit: I think the commit title should probably be 'KVM: x86:' and then mention Xen somewhere in the rest of the line? Reviewed-by: David Woodhouse <dwmw@amazon.co.uk> > --- > Cc: David Woodhouse <dwmw2@infradead.org> > Cc: Sean Christopherson <seanjc@google.com> > Cc: Paolo Bonzini <pbonzini@redhat.com> > Cc: Thomas Gleixner <tglx@linutronix.de> > Cc: Ingo Molnar <mingo@redhat.com> > Cc: Borislav Petkov <bp@alien8.de> > Cc: Dave Hansen <dave.hansen@linux.intel.com> > Cc: "H. Peter Anvin" <hpa@zytor.com> > Cc: x86@kernel.org > --- > 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;
On Wed, Oct 04, 2023, David Woodhouse wrote: > On Wed, 2023-10-04 at 17:11 +0000, Paul Durrant wrote: > nit: I think the commit title should probably be 'KVM: x86:' and then > mention Xen somewhere in the rest of the line? I would also be ok if we start doing "KVM: x86/xen:", because it seems like y'all are sending enough Xen specific changes that differentiating would be useful.
On 04/10/2023 18:34, Sean Christopherson wrote: > On Wed, Oct 04, 2023, David Woodhouse wrote: >> On Wed, 2023-10-04 at 17:11 +0000, Paul Durrant wrote: >> nit: I think the commit title should probably be 'KVM: x86:' and then >> mention Xen somewhere in the rest of the line? > > I would also be ok if we start doing "KVM: x86/xen:", because it seems like y'all > are sending enough Xen specific changes that differentiating would be useful. Ok, I'll send a v2 with an amended subject line. Paul
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;