Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1990845imm; Sat, 13 Oct 2018 07:56:25 -0700 (PDT) X-Google-Smtp-Source: ACcGV62weuMo6ary56QrjeiQ8/iYI3IcYgPYTERR+/EkqHOFEZ+c6js6UY/FurfMDlNNTDX7dueq X-Received: by 2002:a63:4047:: with SMTP id n68-v6mr9232457pga.224.1539442585212; Sat, 13 Oct 2018 07:56:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539442585; cv=none; d=google.com; s=arc-20160816; b=l0nuxay9CQ7a0gg+M0XYf47numJjBpsbjt8M+UjvChXl/0PSTuV1sYJUWXZMUOT63s K8k8qivr1rIYbAAwv6+XEashm3rQfZcgTLtzmtGMlE18UJy0Q9rArlumCWDvrIE7WG0m HsnZnlfmn4kFi3UuCkvMEFdj181SEogUubkg7lyah7708UHFP8py95dYxJ7ii/9+MFVV C7vPMYVxAYkZqJFwxP11AFg808lxvN55834CsPMCXb+yiZp89/V/2SdAh/uBXneNtzY3 eQJAXc6E019T4OxR8Nc0PLgiJjhOTEYYNmLaW63Kw2EjQb9pyo1G4dE0v9RSOFDw9rZ9 70Vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:in-reply-to:message-id:date :subject:cc:from:dkim-signature; bh=7Q3nhAKtrRoanNPwr2twsR26XJWb59XJ8/rc2Pd+TSM=; b=dLJiMMlwmrHtgiMxUxMUdUQkYqsF3iMxVGQyoIKi2/6dNI8RsrMylXylQbE9AO6Nro AclOdVs9Q5+Tiw6IzBGrh1vAAcJE6jq33uufRrmjdTNpJg+0L+89GBLUB+DhMZnkskNn hiCQ2YDW/zg94O6Wx2FOVaxhbxeDSutuz1fw63NXWCIOt4NZ3EM+x6Vp5kRUNqbcJviD 1keVyo1HFFa2T7XGUNSasu2rS/7U+8wJWvRs7wH+hoegwYEcFDily5KrnutuiFulIg+d yGQhpDNNBXmmuWb/wjKqN+3LqUwVTFcjkF9DQGohJ82Wodd4U4IYWII1ANodRjGuXqtL kxpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=juTHXYgX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ce19-v6si5088859plb.162.2018.10.13.07.56.10; Sat, 13 Oct 2018 07:56:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=juTHXYgX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727039AbeJMWcj (ORCPT + 99 others); Sat, 13 Oct 2018 18:32:39 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:44161 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726281AbeJMWci (ORCPT ); Sat, 13 Oct 2018 18:32:38 -0400 Received: by mail-pl1-f194.google.com with SMTP id p25-v6so7251112pli.11; Sat, 13 Oct 2018 07:55:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7Q3nhAKtrRoanNPwr2twsR26XJWb59XJ8/rc2Pd+TSM=; b=juTHXYgXukWYR3Td4NTZZK6EJLKtcc6JdtqVHyNu+kVR7xNZRl7aB5E1F/+X0kGgap qxYqLJppNLOOpufkoOoq0YAr4eTDOyTlmY1XkFTntdxA1E9W+6nsoUFrymLOxvIkISDs VNWAIoDMPg1407iiY6co46rGu+zg0rOqZi2LzPtdoaKkNQayIsu1RK+wapeaI3hNJk4c i6c6RnmaJcYLt5AkoDGg9h+sCiOcxqWLiqodUdP5rqLHXEftTO2e7Yy58kFmcFgn4DN9 jheeK/0XgrxVB/SypoJqIXIctCGbK/JD3phe3myubOehZ0O7hKTwPm8lSthWuQLyY8vD WWtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7Q3nhAKtrRoanNPwr2twsR26XJWb59XJ8/rc2Pd+TSM=; b=C8ZpgukMOt7ORDWRvmBSKSh81vvmH3/W7HLbMSgWnZNeDE8D0KFriYL8fzsJmQRYVe n5CucQsXXylBbA9XjYr4Yc5+nImDhQP5oFbd1kf0Z+2fwjN4NO8C4fs97q3KwxEtuRDw FXF5C5Bec9/FvemABrmomlw8vEM0nPE1A+4ijsGxOIWcj5aL+PfS7i07Qqib5XfdqXO3 7xBvEigY2OPsOwDlNOaDn5A64WpVrJmaX1FulxweorMf69PZTECWXq1D9MdEa9onF70r 0iQTtqhrcbX9W3+RWOI/jSnwN5mLZJBdAtRpP1Hv0rXHfw4AwTF9U3Zf+DmsLRWg+TbH Vssw== X-Gm-Message-State: ABuFfohPp1NMvd6bIhfd+CAq5u3T9xAyz3tMl82aKcNtazMtJNIyU67u m/vMvX4BAHT+LW5YRJtgAzM= X-Received: by 2002:a17:902:509:: with SMTP id 9-v6mr10216527plf.155.1539442512417; Sat, 13 Oct 2018 07:55:12 -0700 (PDT) Received: from localhost.corp.microsoft.com ([2404:f801:9000:18:d9bf:62c6:740b:9fc4]) by smtp.googlemail.com with ESMTPSA id v81-v6sm8688724pfj.25.2018.10.13.07.55.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 13 Oct 2018 07:55:11 -0700 (PDT) From: lantianyu1986@gmail.com X-Google-Original-From: Tianyu.Lan@microsoft.com Cc: Lan Tianyu , kys@microsoft.com, haiyangz@microsoft.com, sthemmin@microsoft.com, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, pbonzini@redhat.com, rkrcmar@redhat.com, devel@linuxdriverproject.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, michael.h.kelley@microsoft.com, vkuznets@redhat.com Subject: [PATCH V4 8/15] KVM/MMU: Flush tlb directly in kvm_mmu_zap_collapsible_spte() Date: Sat, 13 Oct 2018 22:53:59 +0800 Message-Id: <20181013145406.4911-9-Tianyu.Lan@microsoft.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20181013145406.4911-1-Tianyu.Lan@microsoft.com> References: <20181013145406.4911-1-Tianyu.Lan@microsoft.com> To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lan Tianyu kvm_mmu_zap_collapsible_spte() returns flush request to the slot_handle_leaf() and the latter does flush on demand. When range flush is available, make kvm_mmu_zap_collapsible_spte() to flush tlb with range directly to avoid returning range back to slot_handle_leaf(). Signed-off-by: Lan Tianyu --- arch/x86/kvm/mmu.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index c4f7679f12c3..e984a0067a43 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -5743,7 +5743,13 @@ static bool kvm_mmu_zap_collapsible_spte(struct kvm *kvm, !kvm_is_reserved_pfn(pfn) && PageTransCompoundMap(pfn_to_page(pfn))) { drop_spte(kvm, sptep); - need_tlb_flush = 1; + + if (kvm_available_flush_tlb_with_range()) + kvm_flush_remote_tlbs_with_address(kvm, sp->gfn, + KVM_PAGES_PER_HPAGE(sp->role.level)); + else + need_tlb_flush = 1; + goto restart; } } -- 2.14.4