Message ID | 20221013211234.1318131-15-seanjc@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp484878wrs; Thu, 13 Oct 2022 14:17:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5JL5UHptj9+Q497bx9D0UT04Em8uFyPiH3IvbqfHliv257k3+O+j/peuB9ShgGafqczyeF X-Received: by 2002:a17:902:d70e:b0:178:2d9d:ba7b with SMTP id w14-20020a170902d70e00b001782d9dba7bmr1958753ply.90.1665695831030; Thu, 13 Oct 2022 14:17:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665695831; cv=none; d=google.com; s=arc-20160816; b=no5yETly1z0KVYW7eS9klZ2msO7P7s+FYo0vKJkRU/z81Xj4E+S1sgVwdzdD0Z3vGM 1PnRizHZMznDH6StMAKOE/oDBrzIGjhy+mL8O5TsAyK+E6vf8vcd7nzLIG1ppTvKGUU4 DkLDYQdSRQjYslRqrUDT1/VQn0yX6Xd1jKMzD5UU37bGSZ/mouS1g0CRZlNgdOfyb5gz qxQ8YnJMJFTeVieEwp6PA7bACppxGfmPX6U8tHBH0n8gnVfoJUVJN9SEA19ra3I7DvVo GiCACpGnAWy9XxuJUZtGifq+mWREGaNrbfHpvTZaSgR0is4chsw5uUFmbDYjwHS6cyIX g/FA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:from:subject :message-id:references:mime-version:in-reply-to:date:reply-to :dkim-signature; bh=enHjfiPcp49jZxPsRc8NHubzz9PIYIRo2WUSut8GWYc=; b=U9iz8iU6mzduGmEyy2TSvajtJBYz0zYJjGJkSa8okx4uu9NE803hmoBb+GKQLAYdHn nFKBmVWaDMM6hk4+aC812XTuuac99V+csq/m9WDWQk0PUmXxxiNA3gVGgMASTw/tItQJ umWv24b6oqpHhFpK4MDLYKt+OczhpqI+zINIkYweTHFBX4WJ25InmmjoVfkBsNQeU7l4 G+w1Y0ZpH9Yb7Hy6FIRI4dDdIuy6TT32GFKUAGZHnks7vWCGsRnaqI/HJ/MFo7I5Otwy QoVYwXwD+uAmXAFzjDODx0hPxJsMarI3IoMb4q6MK9UnEjytydvn76dDNvD9XZHHiuCh gcHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=m9qYNDRh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ji10-20020a170903324a00b0016dbc1b5b31si828887plb.61.2022.10.13.14.16.54; Thu, 13 Oct 2022 14:17:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=m9qYNDRh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230225AbiJMVOw (ORCPT <rfc822;ouuuleilei@gmail.com> + 99 others); Thu, 13 Oct 2022 17:14:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230226AbiJMVOA (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 13 Oct 2022 17:14:00 -0400 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7ABB190E5D for <linux-kernel@vger.kernel.org>; Thu, 13 Oct 2022 14:13:47 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-358c893992cso27839067b3.9 for <linux-kernel@vger.kernel.org>; Thu, 13 Oct 2022 14:13:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:reply-to:from:to:cc:subject:date :message-id:reply-to; bh=enHjfiPcp49jZxPsRc8NHubzz9PIYIRo2WUSut8GWYc=; b=m9qYNDRh5/bP062uaLuPUk974Odr39TMFHkfG791CgVfCCQFLpAymJhNra7RzSQbGe vVn/LZa5NpT4Lcsst7qHoK3YygOBe9X/SQ0YYufk1Oj88O7a6YE2Jn4t93mxf9+En6Hn Ooymzgxj3dr/q52Ui9GlfLJX01shMRE+sXSkaYIOl6KgZKtkkfwq1cr7KUoA+mCmmSOk a54h5+MYyfgkgGaKtfZJTEoqT2P/vF9DjqoNH5UgzwQxXIXNYqJgIbLeVrl7gancOnup RubJ/bZM3wPSwZYryJxWEcd3+c19/I4aO5Rae4FCZQpgXCNGXe/N22UwiezQKjSVNkT0 ZmJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:reply-to:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=enHjfiPcp49jZxPsRc8NHubzz9PIYIRo2WUSut8GWYc=; b=lcpYrPJdIOQWYDNWrN81DH9PMj5fAjABQHx2wg50vasZ+lbQAV9/QvJrP5GuoVQNTa 0oIsRyAAAPvnTV1Qf+NEDwFBlBoPS5Gly6aGmHnyaZYBA4PAIYCujk4ZnShg5vRy/Z9j dmCRnr0EF2xf31hKUNClEsRHOCl7dUn6qClkKt0POJRTMSW1dfY/7joZJMTxEma35HeO gC8RbHV/KDXwqpvWnIBhn1vqNKZTmhTNPqVVXIBGATQ681TFaJ7sKHnANjrgmm5WDrpc dimMDzKNaiIARK1NmpM/3gPh8s+mc/nfpQ82/GD2BX4HBx48xAfo5zg1I9jszQMBzTU8 MycQ== X-Gm-Message-State: ACrzQf3zFnRZ3iqfl7KxD1IuZeo1cTD4O64RZFopKwFwVhd31uG/nATf DP9cDnbMaQPG4YSr6+bvR1GIqiz+Gjo= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a25:be14:0:b0:6be:885f:20bb with SMTP id h20-20020a25be14000000b006be885f20bbmr1768093ybk.480.1665695582404; Thu, 13 Oct 2022 14:13:02 -0700 (PDT) Reply-To: Sean Christopherson <seanjc@google.com> Date: Thu, 13 Oct 2022 21:12:32 +0000 In-Reply-To: <20221013211234.1318131-1-seanjc@google.com> Mime-Version: 1.0 References: <20221013211234.1318131-1-seanjc@google.com> X-Mailer: git-send-email 2.38.0.413.g74048e4d9e-goog Message-ID: <20221013211234.1318131-15-seanjc@google.com> Subject: [PATCH v2 14/16] KVM: Skip unnecessary "unmap" if gpc is already valid during refresh From: Sean Christopherson <seanjc@google.com> To: Sean Christopherson <seanjc@google.com>, Paolo Bonzini <pbonzini@redhat.com> Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Michal Luczaj <mhal@rbox.co>, David Woodhouse <dwmw2@infradead.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746608671197987092?= X-GMAIL-MSGID: =?utf-8?q?1746608671197987092?= |
Series |
KVM: x86: gfn_to_pfn_cache fixes and cleanups
|
|
Commit Message
Sean Christopherson
Oct. 13, 2022, 9:12 p.m. UTC
When refreshing a gfn=>pfn cache, skip straight to unlocking if the cache
already valid instead of stuffing the "old" variables to turn the
unmapping outro into a nop.
Signed-off-by: Sean Christopherson <seanjc@google.com>
---
virt/kvm/pfncache.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/virt/kvm/pfncache.c b/virt/kvm/pfncache.c index f211c878788b..57d47f06637d 100644 --- a/virt/kvm/pfncache.c +++ b/virt/kvm/pfncache.c @@ -293,9 +293,8 @@ static int __kvm_gpc_refresh(struct gfn_to_pfn_cache *gpc, gpa_t gpa) ret = hva_to_pfn_retry(gpc); } else { /* If the HVA→PFN mapping was already valid, don't unmap it. */ - old_pfn = KVM_PFN_ERR_FAULT; - old_khva = NULL; ret = 0; + goto out_unlock; } out: