Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1532894rwb; Wed, 14 Dec 2022 11:21:48 -0800 (PST) X-Google-Smtp-Source: AA0mqf7VwItDRaOk8qdtMUowOZSuoWCu41Et5jGymUfEJUXOxK+Ybrma2f+Eh11vmDBD1lyI9+Qf X-Received: by 2002:a17:90a:9742:b0:219:c2f2:f818 with SMTP id i2-20020a17090a974200b00219c2f2f818mr26699823pjw.42.1671045707818; Wed, 14 Dec 2022 11:21:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671045707; cv=none; d=google.com; s=arc-20160816; b=Du6EyvbIsD87Fvu27uPrzKzTCIse1mBEQTD9Hy/wsl5H1aqrWgZqN1PlOqJkopMXjS N4GYbzkkNpYWcAcUwMRZUzvzvdpOLRESUlHWUtFNYKGRxcNI7SMHa+0GVfRUA+YpqHvI SINa0TjuppvyMPv5Eu/3bCmLlWQBwoOu0vH0nP1YdM54op5Hf6qeMOCtSnIM2mezreSX cix1ognDoUZMjSz65eM564IIjWfnhy6p2inJfgkmkdp+rX/WRzx1ZFzBOAVGH2dzFCKA BYKqwouY/skln8c/YsNDyqC5O6jLhTxeVNOR4P//jy12VWJSRS41GQiSDrvuy/nOrz8c ucCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=k9cGqAjg4onQOK2CDcNCWzuxJXzOE93Rua+7XFpp9qQ=; b=datEpCPUEH72NJ2WAbyGFsuTbqoG2w1EmeAoZck1ItHdCc0zzd/J+H0mRMtWnKjnrN mVtRf1eNNo/Ezn2ZEHt/iVj7ObaoS0YGyxR9TnrAtifpNonlv6i+MdiiQzVnqCtrvuFl RHqL7q9G61d3keAcPkQrCA+DI0UccAwl93dV9DVq+HUw9FjnKY2sgvQBZg1XloNJtIIZ 1RHPRRcZqZafFwzoKUsp2Q9BpgJytlBTtGCFNgrzRZojLeD26C05/SFDxiVwFhJHBjW1 o1Jae9jJNRjfH1gMH668lLZQeaKArB0eCZY+RwW+vTz+IoYCj9jfE0FtUknHkp3JPjmX rIFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=rNSjP365; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pc12-20020a17090b3b8c00b0021929c5bd92si2945970pjb.127.2022.12.14.11.21.38; Wed, 14 Dec 2022 11:21:47 -0800 (PST) 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=rNSjP365; 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 S239029AbiLNTLh (ORCPT + 70 others); Wed, 14 Dec 2022 14:11:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238879AbiLNTLd (ORCPT ); Wed, 14 Dec 2022 14:11:33 -0500 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AEACDECF for ; Wed, 14 Dec 2022 11:11:32 -0800 (PST) Received: by mail-pj1-x102b.google.com with SMTP id q17-20020a17090aa01100b002194cba32e9so219548pjp.1 for ; Wed, 14 Dec 2022 11:11:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=k9cGqAjg4onQOK2CDcNCWzuxJXzOE93Rua+7XFpp9qQ=; b=rNSjP36539bQaZ50jWk1UKjWFkvEwm2WoMxQBCIFBR6GjWJ0DzUyyCfRsOFGuQtoFG 194yYYY4LwjCTVwPAEsXO2dLrAzxROlPVtz/BqhF/7b8eOloavcHNc6/ddF10ACn5GPX ae3m2kQ6OoooDmZuoTIklSktWJMasHeYtivba72UWQ4cmcu9tb8NlbQzldqr7hv0Fbsg WNkplU9RJT2DQUMdFT9a8znpGwfkoPq4X0z63l9fkEoI1GBGHzABK/ehtK4TGtk1/4tV 1ybhvM+iU/yGA5HuyiWcjZmEJ6XQxI9UctxGnPX9Tr5BwDtSAfN/zob3oqsgqTP1OTVC mQnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=k9cGqAjg4onQOK2CDcNCWzuxJXzOE93Rua+7XFpp9qQ=; b=n09TnAJtiHmU32HOuW7FS5wG2Z0rqUlX7x8E7FXwxmGCaV5I2/9DpImhm9CohW6a3T h8TicgWRSGtwDn1DDvNvein5AW0Dr98dXTMW+Rdx7+8N2nrWKnzFPvYQB1+kA0NiDdrP nsTI8qnfeIeuyPa8HfVt54WCaqfqhegWeYuc4NH4RYQc7yrCv9LgX1H+qY1lcCDuhPVm /BN8vgf/uzwGc4kc3CQTIWKbaSXaaoo/IbvPRPkqTUKyUjXyLTpEGt0FYGlNGKsoBN2M YoUC7WSz1SO4fQDwZmyc4EW/wsBO7CRccBpmqb0tvuG1EvHqiUm+4pnWBVcbE9yEylxN yG0w== X-Gm-Message-State: AFqh2kpXFp5WVufxzzv5XdddXsv7EV86BvHjmRA0hnp82gs0gJ7M/dN2 ofDGFHFOnebL/SZaWlJ+Bc7R5Q== X-Received: by 2002:a17:902:b187:b0:189:58a8:282 with SMTP id s7-20020a170902b18700b0018958a80282mr543017plr.3.1671045091469; Wed, 14 Dec 2022 11:11:31 -0800 (PST) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id t14-20020a1709027fce00b00188fce6e8absm2175827plb.280.2022.12.14.11.11.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Dec 2022 11:11:30 -0800 (PST) Date: Wed, 14 Dec 2022 19:11:27 +0000 From: Sean Christopherson To: Lai Jiangshan Cc: Hou Wenlong , kvm@vger.kernel.org, David Matlack , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Lan Tianyu , linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 2/6] KVM: x86/mmu: Fix wrong gfn range of tlb flushing in kvm_set_pte_rmapp() Message-ID: References: <0ce24d7078fa5f1f8d64b0c59826c50f32f8065e.1665214747.git.houwenlong.hwl@antgroup.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_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: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 14, 2022, Lai Jiangshan wrote: > On Thu, Oct 13, 2022 at 1:00 AM Sean Christopherson wrote: > > > +/* Flush the given page (huge or not) of guest memory. */ > > > +static inline void kvm_flush_remote_tlbs_gfn(struct kvm *kvm, gfn_t gfn, int level) > > > +{ > > > + u64 pages = KVM_PAGES_PER_HPAGE(level); > > > + > > > > Rather than require the caller to align gfn, what about doing gfn_round_for_level() > > in this helper? It's a little odd that the caller needs to align gfn but doesn't > > have to compute the size. > > > > I'm 99% certain kvm_set_pte_rmap() is the only path that doesn't already align the > > gfn, but it's nice to not have to worry about getting this right, e.g. alternatively > > this helper could WARN if the gfn is misaligned, but that's _more work. > > > > kvm_flush_remote_tlbs_with_address(kvm, gfn_round_for_level(gfn, level), > > KVM_PAGES_PER_HPAGE(level); > > > > If no one objects, this can be done when the series is applied, i.e. no need to > > send v5 just for this. > > > > Hello Paolo, Sean, Hou, > > It seems the patchset has not been queued. I believe it does > fix bugs. It's on my list of things to get merged for 6.3. I haven't been more agressive in getting it queued because I assume there are very few KVM-on-HyperV users that are likely to be affected.