Message ID | 20230918144111.641369-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 h50csp3030844vqi; Mon, 18 Sep 2023 17:00:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGgUJipL/SuJfQPJZJTW+xGNkvsT9+Nj0O17r6R1rPGdhhoUH95/GtIV8+0IjUdqK52K1ry X-Received: by 2002:a05:6808:8e:b0:3a8:6b4d:6b78 with SMTP id s14-20020a056808008e00b003a86b4d6b78mr10909281oic.35.1695081632851; Mon, 18 Sep 2023 17:00:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695081632; cv=none; d=google.com; s=arc-20160816; b=yCGAITYK+tf7A5YwGJ1KgdOr96OUDmUx426NF5xKqcMoonG1QDhs2weI82AROY1Wxa yhg8QihaZOKMY0qJ3qOqnZaYlUH/5h6D8te4u0Uq0D+Gygvkmy6f7gwxZnYKRvYpomEe XBloMek68pF/guu0eEddAyqHaceo8wtAWDsnPIY5QceC4t/osa23D6CZF2jOeCy5Fenn 5r5LbwKtm74TMFdwN7aPEEc26tQXMZ2I51fUK0JoGlmtzfQNzpBroCEKC7tKKG/+H3sc fwT5aHp3qqmvD33u0F8SsmZw7Bhy/8qIp+tzkdR2p6Vax3bmX6wiGdOhg5e3rMp4NvqU ujAQ== 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=0eGGXnc5vBmAE8zpS0TzZWx5te66TwGgtV+bYpeTlu4=; fh=YQxcWeFtTLB3mMceSRxC2i/1m4lEYnAvVMXZ98qp9Z4=; b=MNGmFx8O9QB7qMi3+qg8PEd00wKXWKDbo/gML8Uic8aS0ohG6Q+NEsnAJRWVZKrnBK s01SseWhAMh16m0UchdDhWgh3/vzTdn5LYgqKXcg/83OdfT0fyrcrVLvb5uskJXV0odN QxTCkerKVuEa4Sl8pR8wHH5LwXBuA2T8RaUQo6fd0Kh0yC0P3zPdPqzzndatoEUoNzFn hKCki9w/e+2SrjKhStf5g8tm4mmg1AUQOzT5Ep1HTMa7/8kwX1ljlvEdr39B1o4fpbfI Us8A2bsdpdr63KqKNMm9TJmEcsqWyoMjzUSAeMW3mu5XsxxjWaIouzyaT77Al73SbJBs XxNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xen.org header.s=20200302mail header.b=xv4fEw7Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id l37-20020a635725000000b005694492c259si8655216pgb.282.2023.09.18.17.00.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 17:00:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@xen.org header.s=20200302mail header.b=xv4fEw7Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 3C0AE815CDB7; Mon, 18 Sep 2023 09:34: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 S230193AbjIRQeP (ORCPT <rfc822;kernel.ruili@gmail.com> + 25 others); Mon, 18 Sep 2023 12:34:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229864AbjIRQdw (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 18 Sep 2023 12:33:52 -0400 Received: from mail.xenproject.org (mail.xenproject.org [104.130.215.37]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83D047A80; Mon, 18 Sep 2023 09:12:05 -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=0eGGXnc5vBmAE8zpS0TzZWx5te66TwGgtV+bYpeTlu4=; b=xv4fEw7Q9+E5M8WA0ZHC3Cbxe5 Q8KTOSvHlk4j+r5joqIH1D6QOvJqwVA5f+mNyvgkK0QpYl/j1w9xrlqFKuEI/oI6RgL1RkbuCk8+u 3FyMeo0bTeH81uJFuyoj5LoQ+3BcH1KHWB17+cUdTj9eX7aqrv+5xRARiH8GYltvvzyQ=; Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from <paul@xen.org>) id 1qiFRB-0003QI-0l; Mon, 18 Sep 2023 14:41:21 +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 1qiFRA-0006IJ-Pk; Mon, 18 Sep 2023 14:41:20 +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>, David Woodhouse <dwmw2@infradead.org>, Paolo Bonzini <pbonzini@redhat.com> Subject: [PATCH v3 04/13] KVM: pfncache: base offset check on khva rather than gpa Date: Mon, 18 Sep 2023 14:41:02 +0000 Message-Id: <20230918144111.641369-5-paul@xen.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230918144111.641369-1-paul@xen.org> References: <20230918144111.641369-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 09:34:27 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777421918277838198 X-GMAIL-MSGID: 1777421918277838198 |
Series |
KVM: xen: update shared_info and vcpu_info handling
|
|
Commit Message
Paul Durrant
Sept. 18, 2023, 2:41 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: 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);