Message ID | 20230926122013.867391-5-paul@xen.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1967010vqu; Tue, 26 Sep 2023 07:41:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHfUv5Q8Qe/MMykAudQci3jDMHvp3xXn1aBIWlTJ0E511n74aePpNGJNY7flgdgJ0OL9d/r X-Received: by 2002:a05:6830:20c8:b0:6b9:146a:f1c9 with SMTP id z8-20020a05683020c800b006b9146af1c9mr10861538otq.0.1695739282244; Tue, 26 Sep 2023 07:41:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695739282; cv=none; d=google.com; s=arc-20160816; b=LuvP3SYHZ59vAu7N3Z7pc4+iezvddmTe1temDwMsfQgSoGiixjR0rC78pBfOeVXAaw E99RXyDiNcwD08CYgBxjf4+2yQFeiUWJ9IR4RiZK18EBWlmmfxRWw7DWFA5+2U2ifhpS s7jOCHBOLRq/VZQhHYSFokavn2wRCaEt/DBprRLtjiBpuYg20JziZoAP5nadkdhBN+1I v9V0WSB1IfevlXvYwmOyaRJ7vVpnziP+UdSsB1qy2VMPcLNpwEEGFUVt0/jKDVdZu6Ku upH1t26JiledwNcoh4MuKRX/28HK9XRfgF0Z0hpJViZxjzkW7Nq2ffSEF8Q6XdK218T6 LLeg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=e3Vz0tH7MeijOYhCrJMXMH52NUfYnF7z8/TCVVMfMcA=; fh=eFj9v25W9Wrh6fN+JLpeVaL0rwE8+rsOVorNY/OMc1Y=; b=TvthHGXukZNxH5ylPXRYDDgMgn3jV9S1KUtckBbSGpjiyvA6Pvlg2IrY2BtPGpbKtb oj/U8jpT2rR0eTxRmGtXf4lH7Pzd46Iym5N3Lf+YRRPnyKSkP2IsmhR70Q153JVVLDnh VuE7ESUy/A+kcbTa9zNMbjYqIFTlg+l2jiPsCQElmL1x6VBiT+0NEIFtzH3uz7RgnUdt PoP6fO7XF02a9d8Wn14RDGqm+9r8Qrv2O7rumO0rirwOU3e0tgpB1iMb2lTAjjV7xHZu 60qb35lu1yAlVcXjeT/zI2nQp8oreMNzj4LITW5HSheD/30jp8Jp2q+Iq7A8B4ZtoznC Uwyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xen.org header.s=20200302mail header.b=iE1Bes03; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id h132-20020a636c8a000000b00564bcae8b53si12537320pgc.803.2023.09.26.07.41.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 07:41:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@xen.org header.s=20200302mail header.b=iE1Bes03; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id 478ED8029369; Tue, 26 Sep 2023 05:21:09 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234617AbjIZMUl (ORCPT <rfc822;pwkd43@gmail.com> + 28 others); Tue, 26 Sep 2023 08:20:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234597AbjIZMUh (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 26 Sep 2023 08:20:37 -0400 Received: from mail.xenproject.org (mail.xenproject.org [104.130.215.37]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4D5B10A; Tue, 26 Sep 2023 05:20:30 -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:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=e3Vz0tH7MeijOYhCrJMXMH52NUfYnF7z8/TCVVMfMcA=; b=iE1Bes03B8oIlc8O0lkvpgFiUp Tl/3O4TJ4UmpsRXCuyFiA3ga7Um2zPnMQ8SfsOcvCqqzEufcHDlJerG1MQY6/im1xYAdJfVwQOdIu 01xME7jG+dlVd9fHXpbNQNv/WwwikQJru3IeC/aTXladWm7Sj4ak4RSUOorDbcS/NIyc=; Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from <paul@xen.org>) id 1ql73C-0000Go-4M; Tue, 26 Sep 2023 12:20:26 +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 1ql73B-0001mF-QU; Tue, 26 Sep 2023 12:20:26 +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 <dwmw@amazon.co.uk>, Sean Christopherson <seanjc@google.com>, David Woodhouse <dwmw2@infradead.org>, Paolo Bonzini <pbonzini@redhat.com> Subject: [PATCH v6 04/11] KVM: pfncache: base offset check on khva rather than gpa Date: Tue, 26 Sep 2023 12:20:06 +0000 Message-Id: <20230926122013.867391-5-paul@xen.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230926122013.867391-1-paul@xen.org> References: <20230926122013.867391-1-paul@xen.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email 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 (groat.vger.email [0.0.0.0]); Tue, 26 Sep 2023 05:21:09 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778111513435115208 X-GMAIL-MSGID: 1778111513435115208 |
Series |
KVM: xen: update shared_info and vcpu_info handling
|
|
Commit Message
Paul Durrant
Sept. 26, 2023, 12:20 p.m. UTC
From: Paul Durrant <pdurrant@amazon.com> After a subsequent patch, the gpa may not always be set whereas khva will (as long as the cache valid flag is also set). No functional change intended. Signed-off-by: Paul Durrant <pdurrant@amazon.com> Reviewed-by: David Woodhouse <dwmw@amazon.co.uk> --- Cc: Sean Christopherson <seanjc@google.com> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Paolo Bonzini <pbonzini@redhat.com> --- virt/kvm/pfncache.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/virt/kvm/pfncache.c b/virt/kvm/pfncache.c index 17afbb464a70..37bcb4399780 100644 --- a/virt/kvm/pfncache.c +++ b/virt/kvm/pfncache.c @@ -83,15 +83,18 @@ bool kvm_gpc_check(struct gfn_to_pfn_cache *gpc, unsigned long len) if (!gpc->active) return false; - if ((gpc->gpa & ~PAGE_MASK) + len > PAGE_SIZE) + if (gpc->generation != slots->generation) return false; - if (gpc->generation != slots->generation || kvm_is_error_hva(gpc->uhva)) + if (kvm_is_error_hva(gpc->uhva)) return false; if (!gpc->valid) return false; + if (offset_in_page(gpc->khva) + len > PAGE_SIZE) + return false; + return true; } EXPORT_SYMBOL_GPL(kvm_gpc_check);