Message ID | 20230918112148.28855-5-paul@xen.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp2593991vqi; Mon, 18 Sep 2023 04:52:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGWGb619DKnwSMoCrU3fcaKJLskGFb3xXY/YRVtNql8JfUJbTGzreBjrHLb9mo2Mefje/VZ X-Received: by 2002:a05:6a00:2396:b0:690:1720:aa83 with SMTP id f22-20020a056a00239600b006901720aa83mr12389486pfc.21.1695037928336; Mon, 18 Sep 2023 04:52:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695037928; cv=none; d=google.com; s=arc-20160816; b=NpllLvylDxXD3GWLhaBMOacLJMQKnxM+CXIkilqZg7BIjUZfZoiZwFXPqdLL5iGVHI MUu+wXrM51MrmFeIxJSnIOCqcJo4lAImDzKeoyPuCYV+Pc+McstDb/EghHiIF6GFCfhW 8r+134X5s00AJNgNB/wmaPXZGR+9UuVWUK/gYo8SqRjpKRQPLhO0e6m1IE4/U2WPLaCW MX6Vy2OzecjgUonPRrzN6/OW0ZRmv5O2wxpOTq/XOJx51okm9DKCkM/mjrY/3pgBfIsM ElqqhhLft+WnOikAWaoqTkE/8V2a+LbeYw7Y6iPeR5NuytJS119nGZsG/VtYI0owXx14 5foA== 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=aoVoeCi9/rtzNMORNn8BQRGqHJo92bkJdeOMKDpUkA4=; fh=huad6iRJsyL9duZ/mEsnypNTRWjlSl25gjzGtGjMd5k=; b=QK0cwMdGhv+d18vDLAsJIPeXy/W5eVC440ZezIs5wHK4yYbShOHQRBkMA55rL2C1R1 MPiv/JvmPLzHXcvBjLpXDRkJRPFXg3MtMmeQllKqi/8yZLg8bTnmUuWANG6MiNyWp6SW Mlc7qu81ImUnAOJRleGrJ4NcWeuAFbE01m8OiuLrojGto/WLG99d5NeMrzBe2WhaC6RX 6aSHE7URaghKj0T22Bqub+jWSbnXQCUtvWtgGyE7kPXHNqLAmwzqSibpse+s/IEJzTYZ RMMOacfnmVx7CjKxzpTJ1d/sRp81NOFW/TzX2Gmn7vx5lueOaCWq0J5PJb8lRyIkpreV dicg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xen.org header.s=20200302mail header.b=HQRKlLQA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id cb8-20020a056a00430800b0068fb5cbcef2si7652475pfb.117.2023.09.18.04.52.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 04:52:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@xen.org header.s=20200302mail header.b=HQRKlLQA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id 9175B806E3F0; Mon, 18 Sep 2023 04:23:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241674AbjIRLXA (ORCPT <rfc822;kernel.ruili@gmail.com> + 27 others); Mon, 18 Sep 2023 07:23:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240278AbjIRLWW (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 18 Sep 2023 07:22:22 -0400 Received: from mail.xenproject.org (mail.xenproject.org [104.130.215.37]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12FCAFD; Mon, 18 Sep 2023 04:22:16 -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=aoVoeCi9/rtzNMORNn8BQRGqHJo92bkJdeOMKDpUkA4=; b=HQRKlLQA9pV4dXmzirFalSxWvo Ptne6KDr0vA4qCsBazcZrftvz3XAjikB3wMXhiLEsvebYP4tJaYZegHDlRwo40bfkV81ywnTOH5eQ LySZJDwKQ2jFXzd4FaiavCA2qn1gSVvlOfHbWco64xJ4cWrIA0LVGQu0NtzkgyoW43SA=; Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from <paul@xen.org>) id 1qiCKR-000722-Fg; Mon, 18 Sep 2023 11:22:11 +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 1qiCKR-0005f3-8O; Mon, 18 Sep 2023 11:22:11 +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>, Paolo Bonzini <pbonzini@redhat.com> Subject: [PATCH v2 04/12] KVM: pfncache: base offset check on khva rather than gpa Date: Mon, 18 Sep 2023 11:21:40 +0000 Message-Id: <20230918112148.28855-5-paul@xen.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230918112148.28855-1-paul@xen.org> References: <20230918112148.28855-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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Mon, 18 Sep 2023 04:23:27 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777376090810557084 X-GMAIL-MSGID: 1777376090810557084 |
Series |
KVM: xen: update shared_info and vcpu_info handling
|
|
Commit Message
Paul Durrant
Sept. 18, 2023, 11:21 a.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 <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);