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: 111689 Delivered-To: patch@linaro.org Received: by 10.37.128.210 with SMTP id c18csp5584853ybm; Tue, 5 Sep 2017 07:52:26 -0700 (PDT) X-Received: by 10.99.126.84 with SMTP id o20mr4379394pgn.239.1504623146854; Tue, 05 Sep 2017 07:52:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504623146; cv=none; d=google.com; s=arc-20160816; b=H9UUhfV7mrt/ruG6SdmcckI9qcNfBkjSPfAVcoJjjm1beJDkiVk5pf58HAyn5aHeX+ 5sqDzEzgRF3p08ndfqEJrru98Y2d5uS0iMCABZ3Pj0uruxTyISyPvAFo3LAc1Q5RaTgo IIJjrI79AVyOY205izx8yxZIb7OJSti5Q0Kpd1YaO+hbaDoSns4m+4+4sRi083ne4dS/ ZDjqLk8zYVuWM1FPDs0ztsD4b6/OqwoD0yzZ5YK9HncbiJ3HgoTonNBpH576Qoake2ds UsR1p7khA7IufrF4on0Ai5D0eHKx4KBdqL9IKw2uahFEKEeME/A0YcsdB8D1EyC3Fy/t 3Pjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=P40sPM+bpPwt4Ofd4X9sttgTW53WOA7sah6mw3xKPZ8=; b=IwMfkaooMZzBBisqKj7ZHq/ibYI42hrNpB8YYocLc9b2HhgevJpKqddZH8oq8yqqZe htL7tiXIWxwm5VaLYiMRc4N4naSfhjloBUEW4yHQuiJ5wn1QzFJfwnxLVcw3Byu4iWAf kp7YN9NeC2f+YOfE4CXp0wXj3jOeeJKIy8w7sNQt/j8Ke0RLmNShLLAyJ4oF7hPa9xJ3 QYnYE4V9u1ZpnEVC5mwA9H5sowtgJL9zo+VLOsyJs6rmBWto91sxt5FLD97okn9YGYCF 2AJhMfkPFl/Axr3IxAJ2WHFhf5pEuZfeMRNyZDWUeN9RBWkDKH6ktKpvirm6bvdyoxXS zV9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eqPh+6w+; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r2si365197pgd.499.2017.09.05.07.52.26; Tue, 05 Sep 2017 07:52:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eqPh+6w+; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751974AbdIEOwZ (ORCPT + 6 others); Tue, 5 Sep 2017 10:52:25 -0400 Received: from mail-wm0-f46.google.com ([74.125.82.46]:36592 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751863AbdIEOwV (ORCPT ); Tue, 5 Sep 2017 10:52:21 -0400 Received: by mail-wm0-f46.google.com with SMTP id i145so20452214wmf.1 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=M5UgGaim0aXtSclxa6M6BwP/6qBkko6fhBBgIulL1I07iPVuN1OdSMXWO3LYQ2uoKL XDUsw0JC/LN6MXVvICvm7QlWlcVHZrCXZ2aA6afP/3w8WYxcqHbZmPmtJ+kTVRjbvLk5 OtDLum/dzoX+FnllRMDUsxVptaOiz8Y4oDD0NMjr6LTHwbCyXFOfmVtjdfqIeCFERS4Z 8tQkTjlxwSWcux/wERqvMmJB08gtI/eCSfiX85kLCmRysRiAtf11Snt+IO/YHWb7Vun9 urkQbovsBL67Qo8hniwP69HmMOLfYxo65niqA3Sp3y7JUZuNeroojjjAEo5EogJqWuoJ zaeg== X-Gm-Message-State: AHPjjUirJJZSXBBJ1T2m/e05cLfkRUSGqD0NZcCvzjkLr6Qjdd8lJTkB fsYdctxjtzUr+K+9aDAFIw== 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?b?UmFkaW0gS3LEjW3DocWZ?= Cc: Marc Zyngier , kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Suzuki K Poulose , stable@vger.kernel.org, Suzuki K Poulose 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> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 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(+) -- 2.9.0 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); }