Received: by 10.223.164.202 with SMTP id h10csp275017wrb; Thu, 30 Nov 2017 10:06:38 -0800 (PST) X-Google-Smtp-Source: AGs4zMZ+uyR2X0u8aH3kpinaiz3VoZlS10UpmOvh2vrPrhr7cP5buT8JorHyd4bgY1vWGV9djDKt X-Received: by 10.159.254.19 with SMTP id r19mr3355527pls.271.1512065198439; Thu, 30 Nov 2017 10:06:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512065198; cv=none; d=google.com; s=arc-20160816; b=N7d4qD1GFoLREW676V2uAyRf36jTMQB8BZrB/1MJz9bS1gakJvhss+/nwQKdN+q9XD YB5yP4Xly2Y1AmyF+c27Flh2w1p6R0JYnFKkHEhdPuQW72DhA/OxWkbw4WFnyGk0l5NI pyg5ADizOw2LvwIggPKizmfna5BFNMKgwwXUZ/mhAetMUsEk2IYHpUueDnNN7NGt2aRi 20bfthTGbkibSiIvojbYGIIUu0kSuArk0EF1ct3qQ9qfRSthY2rUF4H0Uc8WmmVbSM3G UgSHBHy4tfD6RKWksAeXw8u1QgT0S6NAZ1kDZBkGCRRlyEDkKjGZ3gMuK4VhdK53cC3B aNYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=GTY5FwuQR3sEEOlU0U8B/rpPaI36hBBGfKYAgNdvaUc=; b=pUscZea7fAAbIjnpe5p4Lf3kY+bkonasf1CsG9vETqSgKl0F+46UIoUOeFy8sTElxB L/zVLpaFtB/5mlXPOtrk7OZvq0GtpYI6Fr7iQsKsInWVcwzBOHBO6zR7e0i2Il/2PC/X 5AibApbzMGGN1EKnFCiXlrcftnaQdJfW7wdc9C0hwKHP7MdzwRCycydK3TSCnzcdZ5KZ 6j7gddlkO5mHgswcBX70a0ikh0UBfhDl7dMka8dALqILj4fDKZQ+TF8qnywldfjav7yX 79GX8hNHIL4mfIf9xzPz1e2Tp6v7X7vNDuGC1/8zg/aI8KQjh8dorBoW881rtSuyQMSK jvGw== ARC-Authentication-Results: i=1; mx.google.com; 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=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p4si3351231pgc.477.2017.11.30.10.06.24; Thu, 30 Nov 2017 10:06:38 -0800 (PST) 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; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753884AbdK3SGM (ORCPT + 99 others); Thu, 30 Nov 2017 13:06:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51542 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753824AbdK3SGJ (ORCPT ); Thu, 30 Nov 2017 13:06:09 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7619B6A7E2; Thu, 30 Nov 2017 18:06:09 +0000 (UTC) Received: from flask (ovpn-204-21.brq.redhat.com [10.40.204.21]) by smtp.corp.redhat.com (Postfix) with SMTP id 3678F5D960; Thu, 30 Nov 2017 18:06:06 +0000 (UTC) Received: by flask (sSMTP sendmail emulation); Thu, 30 Nov 2017 19:06:05 +0100 From: =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= To: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, kvm@vger.kernel.org, Paolo Bonzini , Andrea Arcangeli , =?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?= Subject: [PATCH 2/2] TESTING! KVM: x86: add invalidate_range mmu notifier Date: Thu, 30 Nov 2017 19:05:46 +0100 Message-Id: <20171130180546.4331-2-rkrcmar@redhat.com> In-Reply-To: <20171130180546.4331-1-rkrcmar@redhat.com> References: <20171130161933.GB1606@flask> <20171130180546.4331-1-rkrcmar@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 30 Nov 2017 18:06:09 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Does roughly what kvm_mmu_notifier_invalidate_page did before. I am not certain why this would be needed. It might mean that we have another bug with start/end or just that I missed something. Please try just [1/2] first and apply this one only if [1/2] still bugs, thanks! --- virt/kvm/kvm_main.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index b7f4689e373f..0825ea624f16 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -342,6 +342,29 @@ static void kvm_mmu_notifier_change_pte(struct mmu_notifier *mn, srcu_read_unlock(&kvm->srcu, idx); } +static void kvm_mmu_notifier_invalidate_range(struct mmu_notifier *mn, + struct mm_struct *mm, + unsigned long start, + unsigned long end) +{ + struct kvm *kvm = mmu_notifier_to_kvm(mn); + int need_tlb_flush = 0, idx; + + idx = srcu_read_lock(&kvm->srcu); + spin_lock(&kvm->mmu_lock); + kvm->mmu_notifier_seq++; + need_tlb_flush = kvm_unmap_hva_range(kvm, start, end); + need_tlb_flush |= kvm->tlbs_dirty; + if (need_tlb_flush) + kvm_flush_remote_tlbs(kvm); + + spin_unlock(&kvm->mmu_lock); + + kvm_arch_mmu_notifier_invalidate_range(kvm, start, end); + + srcu_read_unlock(&kvm->srcu, idx); +} + static void kvm_mmu_notifier_invalidate_range_start(struct mmu_notifier *mn, struct mm_struct *mm, unsigned long start, @@ -476,6 +499,7 @@ static void kvm_mmu_notifier_release(struct mmu_notifier *mn, } static const struct mmu_notifier_ops kvm_mmu_notifier_ops = { + .invalidate_range = kvm_mmu_notifier_invalidate_range, .invalidate_range_start = kvm_mmu_notifier_invalidate_range_start, .invalidate_range_end = kvm_mmu_notifier_invalidate_range_end, .clear_flush_young = kvm_mmu_notifier_clear_flush_young, -- 2.14.2 From 1585791970753694239@xxx Sun Dec 03 19:24:33 +0000 2017 X-GM-THRID: 1585729051567404073 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread