From patchwork Tue Jul 18 12:03:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 9848181 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 B23B1602C8 for ; Tue, 18 Jul 2017 12:04:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A027426E40 for ; Tue, 18 Jul 2017 12:04:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9387C2847D; Tue, 18 Jul 2017 12:04:12 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3EC6B26E40 for ; Tue, 18 Jul 2017 12:04:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751543AbdGRMEK (ORCPT ); Tue, 18 Jul 2017 08:04:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42482 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751532AbdGRMEH (ORCPT ); Tue, 18 Jul 2017 08:04:07 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A72FF25B90; Tue, 18 Jul 2017 12:04:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A72FF25B90 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=mtosatti@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com A72FF25B90 Received: from amt.cnet (ovpn-116-24.gru2.redhat.com [10.97.116.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id E58DD7FB8E; Tue, 18 Jul 2017 12:04:05 +0000 (UTC) Received: from amt.cnet (localhost [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 1DE78104FFC; Tue, 18 Jul 2017 09:03:50 -0300 (BRT) Received: (from marcelo@localhost) by amt.cnet (8.14.7/8.14.7/Submit) id v6IC3lV6004787; Tue, 18 Jul 2017 09:03:47 -0300 Date: Tue, 18 Jul 2017 09:03:47 -0300 From: Marcelo Tosatti To: linux-rt-users@vger.kernel.org, Peter Zijlstra Cc: kvm@vger.kernel.org Subject: [PATCH -rt] kvm: lockdep annotate mmu_lock wait_lock Message-ID: <20170718120347.GA25342@amt.cnet> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 18 Jul 2017 12:04:06 +0000 (UTC) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP wait_lock for mmu_lock, being allocated in kmalloc memory, can't be tracked by LOCKDEP. Disable LOCKDEP verification for it. Fixes INFO: trying to register non-static key. the code is fine but needs lockdep annotation. turning off the locking correctness validator. CPU: 0 PID: 12386 Comm: qemu-kvm Not tainted 3.10.0-631.rt56.546.el7.x86_64.debug #1 Hardware name: To be filled by O.E.M. To be filled by O.E.M./PMH61ML, BIOS 4.6.4 07/14/2011 0000000000000002 00000000ee340fa8 ffff88008e2d7bc0 ffffffffa57534fc ffff88008e2d7bd0 ffffffffa574ce9f ffff88008e2d7c50 ffffffffa510e565 ffff88008e2d7bf8 00000001a50cf83d 0000000000000000 ffff880000000000 Call Trace: [] dump_stack+0x19/0x1b [] register_lock_class.part.27+0x38/0x3c [] __lock_acquire+0xcc5/0xdc0 [] lock_acquire+0xb2/0x230 [] ? rt_spin_lock_slowlock+0x6d/0x3c0 [] _raw_spin_lock_irqsave+0x70/0xc0 [] ? rt_spin_lock_slowlock+0x6d/0x3c0 [] rt_spin_lock_slowlock+0x6d/0x3c0 [] rt_spin_lock+0x2c/0x60 [] kvm_page_track_register_notifier+0x1f/0x60 [kvm] [] kvm_mmu_init_vm+0x2b/0x30 [kvm] [] kvm_arch_init_vm+0x264/0x290 [kvm] [] kvm_dev_ioctl+0xde/0x740 [kvm] [] do_vfs_ioctl+0x365/0x5b0 [] SyS_ioctl+0xa1/0xc0 [] tracesys+0xdd/0xe2 --------------------------- | preempt count: 00000001 ] | 1-level deep critical section nesting: ---------------------------------------- .. [] .... _raw_spin_lock_irqsave+0x4d/0xc0 .....[] .. ( <= rt_spin_lock_slowlock+0x6d/0x3c0) Signed-off-by: Marcelo Tosatti diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 7e80f62..6375db8 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -613,6 +613,8 @@ static struct kvm *kvm_create_vm(unsigned long type) return ERR_PTR(-ENOMEM); spin_lock_init(&kvm->mmu_lock); + + lockdep_set_novalidate_class(&kvm->mmu_lock.lock.wait_lock); mmgrab(current->mm); kvm->mm = current->mm; kvm_eventfd_init(kvm);