From patchwork Tue Sep 5 14:52:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 9939189 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0F005604D3 for ; Tue, 5 Sep 2017 15:06:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 00354289A3 for ; Tue, 5 Sep 2017 15:06:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E8A98289A9; Tue, 5 Sep 2017 15:06:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 78012289A3 for ; Tue, 5 Sep 2017 15:06:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=yEvLEQuzR+xLz9n/9CspNoNwQ3HfGAAj05S8ojOQTX0=; b=ZOl2jjPp1CoiFwNZQFBR7uF4i1 jxSZgx303/PynqAMzoOA3s5rSFhRO9vDcwGJf3qIfY8RJa2UUnTlSUXQSOzgSsCMMcGBluima/I7V dc3I/QVRXOfO8dakM3cjqxYshBrGJZbWihh4hLUe+DEfZM3NElkO2uIIwSqwTxXzV3adUBkkvJt5P cYiZPmBuOV3/UsaknQLi+uNPL3kQ4WhEbeR2F9+lC5WzPvNKm6vUJrcaPxU7ATkYEQaaa11lJ2Q4q TIZLwOe50anR0gP5rTTJkxfXzTcaRIr4/tRQA7uNqMImAJNGPaTN1MifvQ3Z7xMwD9JNklg+Qbh5t PZB6MzbQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dpFQP-0007Xt-46; Tue, 05 Sep 2017 15:06:01 +0000 Received: from mail-wm0-x234.google.com ([2a00:1450:400c:c09::234]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dpFDV-0007ZI-5p for linux-arm-kernel@lists.infradead.org; Tue, 05 Sep 2017 14:52:45 +0000 Received: by mail-wm0-x234.google.com with SMTP id f199so364948wme.0 for ; Tue, 05 Sep 2017 07:52:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=P40sPM+bpPwt4Ofd4X9sttgTW53WOA7sah6mw3xKPZ8=; b=eqPh+6w+vXOLscbws0/1XKfqTgQMgcXoPwM/kCYTdJbN/nl71GP4UPbNNlSSosR0ul 6bCW1ivjhtVxWcZmRDa+YMEGP6P6EWLd38ufBXgiKKMdSwD2sSgl6DbH8cscWhp+09Mz 00Fs3UYT3FQKAgaNOvKRQYn+EdPtAiJxOAl5o= 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=P40sPM+bpPwt4Ofd4X9sttgTW53WOA7sah6mw3xKPZ8=; b=rkuSDCWSf0AGdLy1FRnVALivL3RPLfSCffoUflJhNU9IvGoNALjj5OnmeVIkFiqOhh 7UDn2YHbxMcanuiEl4gLiF8CJFGeZ0vkhwG34akL+5wy0P0Ob9ZkT/0MovgR+bLgCW2H vu8FYVsdErl9c3mZeDn/snX4EoVIuYs0qhvCIB38kpDGsQ3u+v8QULYMu9aUf04KNXRo rERY6kp3DZhtQPxjHRrtGF21rJPposs2f00PQQDV68F5VVoP+7+3KYuHqi0uFzDPTJY6 Dv7jDEP5zpFy3uT4OE/NyO3Ew5a8sywTVzvzRomCJaSLLuaTaOJ6CmTtFsXqmovKFfrm rqvg== X-Gm-Message-State: AHPjjUip1DsGLqRWnztrnnkxsa7bzj3tD5lUQ5KDYXCFYFAqHMIlKO/f ss9prTWvleYgxuC+ X-Google-Smtp-Source: ADKCNb6AE+/mGmSz1M4zpEmAU2iL2KFvQnPaGZsDjMJII/MW++NW/lNe/EEgV+C/a+jWqKXrA8kJPA== X-Received: by 10.80.218.10 with SMTP id z10mr3372658edj.224.1504623139483; Tue, 05 Sep 2017 07:52:19 -0700 (PDT) Received: from localhost.localdomain (xd93ddc2d.cust.hiper.dk. [217.61.220.45]) by smtp.gmail.com with ESMTPSA id a28sm293809edc.14.2017.09.05.07.52.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 05 Sep 2017 07:52:18 -0700 (PDT) From: Christoffer Dall To: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Subject: [PULL 3/8] KVM: arm/arm64: Handle hva aging while destroying the vm Date: Tue, 5 Sep 2017 16:52:02 +0200 Message-Id: <20170905145207.18447-4-cdall@linaro.org> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170905145207.18447-1-cdall@linaro.org> References: <20170905145207.18447-1-cdall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170905_075241_614910_3E36CF13 X-CRM114-Status: GOOD ( 10.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kvm@vger.kernel.org, Suzuki K Poulose , Marc Zyngier , stable@vger.kernel.org, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Suzuki K Poulose The mmu_notifier_release() callback of KVM triggers cleaning up the stage2 page table on kvm-arm. However there could be other notifier callbacks in parallel with the mmu_notifier_release(), which could cause the call backs ending up in an empty stage2 page table. Make sure we check it for all the notifier callbacks. Cc: stable@vger.kernel.org Fixes: commit 293f29363 ("kvm-arm: Unmap shadow pagetables properly") Reported-by: Alex Graf Reviewed-by: Christoffer Dall Signed-off-by: Suzuki K Poulose Signed-off-by: Marc Zyngier --- virt/kvm/arm/mmu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/virt/kvm/arm/mmu.c b/virt/kvm/arm/mmu.c index 0e1fc75..2ea21da 100644 --- a/virt/kvm/arm/mmu.c +++ b/virt/kvm/arm/mmu.c @@ -1718,12 +1718,16 @@ static int kvm_test_age_hva_handler(struct kvm *kvm, gpa_t gpa, u64 size, void * int kvm_age_hva(struct kvm *kvm, unsigned long start, unsigned long end) { + if (!kvm->arch.pgd) + return 0; trace_kvm_age_hva(start, end); return handle_hva_to_gpa(kvm, start, end, kvm_age_hva_handler, NULL); } int kvm_test_age_hva(struct kvm *kvm, unsigned long hva) { + if (!kvm->arch.pgd) + return 0; trace_kvm_test_age_hva(hva); return handle_hva_to_gpa(kvm, hva, hva, kvm_test_age_hva_handler, NULL); }