Message ID | 20230922150009.3319-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 h50csp5650290vqi; Fri, 22 Sep 2023 08:07:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGGEs6VChdf0rrXkYRsZ7lpLzFNGia2cK/1ImtergCjPf0Z4uTgx20DaHP8UazGanq5XfWf X-Received: by 2002:a17:90a:df06:b0:26d:2158:10ac with SMTP id gp6-20020a17090adf0600b0026d215810acmr8279708pjb.14.1695395251363; Fri, 22 Sep 2023 08:07:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695395251; cv=none; d=google.com; s=arc-20160816; b=b33kmtvrNw82I4w6Z9b0Ml25lev92uypEhf8Pl/490C+p2gb/gu2eKJxO3n0o2s9as uD9N/zIibQk/zwSIcUT9GJSWZGa8buutItPbncG2xCPJrjgomWTkO4dxU+mpscN9vSC3 rCe1mxLzAaowMft/VJJA/0GszX+NGvsSYDvoDL+J/Nh/b0bpGh+JF3MbiXHQEyd/KEul WMy+/KACWviKp20wm/r7cCWERgRXJrrCv/YdGACxYVxNlheHfxyQHuwetDMJioH5WxJx F1/cRZgi8qFSAz+qM3/K+znDtPJ3lgarASgRl5B7b5VmBOQijXaZIoEMwIHuVZHokNqs PGeQ== 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=kdbeTUhfSo2HoJRPagSzKyGX1Ocu5Da5YaA5JGkKnX//F2jz5OTQiaPPdEfKSDaSCI 5KqK1LAb2ludT8L8iX65VtwOBCG3PREx3oO5uqcOlPyNxbKncsZQqTAoXoa+T5/QDtjC VpDH0SRNhArWtUy4D0VapGCJMNQcS1pr1e+H9u1jV5XG7sDhMpsGRYl7J+TyrhpzMcKY J2mGByF1wTPsiE0rnKIKDe/0mm915p9q7v/92CXjhdFPuMesplsoMBplKUxdLd7sUc/4 U7wpGVklgb/bNPJBz4nx/+DdKqxQUvBzjKcPDpTtflQSoXOtt6VOQ9m7QxjHlbLNEA1X u0Ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xen.org header.s=20200302mail header.b=jl6XYVcA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id fv9-20020a17090b0e8900b00274880d2b70si6397918pjb.8.2023.09.22.08.07.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 08:07:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@xen.org header.s=20200302mail header.b=jl6XYVcA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (Postfix) with ESMTP id 956AE81EE53E; Fri, 22 Sep 2023 08:00:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232329AbjIVPAk (ORCPT <rfc822;chrisfriedt@gmail.com> + 29 others); Fri, 22 Sep 2023 11:00:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232149AbjIVPAf (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 22 Sep 2023 11:00:35 -0400 Received: from mail.xenproject.org (mail.xenproject.org [104.130.215.37]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2786E199; Fri, 22 Sep 2023 08:00:28 -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=jl6XYVcAHjvLe2yNyG3ez4kYiB 98VppdFRXq+COgYtWd7/o2BvQ5Dfi0XSrKju03QFtxBTAp79vaxLTDU93/Fc3dEYq6onwPy3zz7ch wZU61jxHbRtCS2HiIUaqXWnfQzWTgmkpi4y8rJ6jjQhSDRCZSsE9xk27ZqSTM50VJ+T8=; Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from <paul@xen.org>) id 1qjhdq-00044j-Sn; Fri, 22 Sep 2023 15:00: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 1qjhdq-0005y2-L4; Fri, 22 Sep 2023 15:00: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 v5 04/10] KVM: pfncache: base offset check on khva rather than gpa Date: Fri, 22 Sep 2023 15:00:03 +0000 Message-Id: <20230922150009.3319-5-paul@xen.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230922150009.3319-1-paul@xen.org> References: <20230922150009.3319-1-paul@xen.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.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 (pete.vger.email [0.0.0.0]); Fri, 22 Sep 2023 08:00:51 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777750771335900058 X-GMAIL-MSGID: 1777750771335900058 |
Series |
KVM: xen: update shared_info and vcpu_info handling
|
|
Commit Message
Paul Durrant
Sept. 22, 2023, 3 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);