From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757404AbcCURnE (ORCPT ); Mon, 21 Mar 2016 13:43:04 -0400 Received: from mail-wm0-f49.google.com ([74.125.82.49]:36524 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756863AbcCURnA (ORCPT ); Mon, 21 Mar 2016 13:43:00 -0400 Subject: Re: [PATCH] KVM: fix spin_lock_init order on x86 To: Eric Dumazet References: <1458552292-7405-1-git-send-email-pbonzini@redhat.com> <1458571635.10868.18.camel@edumazet-glaptop3.roam.corp.google.com> <56F010F2.3060306@redhat.com> Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, bp@alien8.de From: Paolo Bonzini Message-ID: <56F032A0.9040906@redhat.com> Date: Mon, 21 Mar 2016 18:42:56 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <56F010F2.3060306@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21/03/2016 16:19, Paolo Bonzini wrote: >>> >> + spin_lock_init(&kvm->mmu_lock); >>> >> + kvm->mm = current->mm; >>> >> + atomic_inc(&kvm->mm->mm_count); >> > >> > current->mm->mm_count is incremented here. >> > >>> >> + kvm_eventfd_init(kvm); >>> >> + mutex_init(&kvm->lock); >>> >> + mutex_init(&kvm->irq_lock); >>> >> + mutex_init(&kvm->slots_lock); >>> >> + atomic_set(&kvm->users_count, 1); >>> >> + INIT_LIST_HEAD(&kvm->devices); >>> >> + >>> >> r = kvm_arch_init_vm(kvm, type); >>> >> if (r) >>> >> goto out_err_no_disable; >> > >> > >> > But out_err_no_disable wont decrement it in case of an error. >> > >> > This is not clear to me where the cleanup is done ? > Indeed, a slightly more complex patch is necessary. Will try again, > this time not doing this as the first thing in the morning. And not even _that_ more complex, just a single mmdrop is necessary. The mmdrop in fact was absent even before the patch, and the patch actually makes it easier to fix the lack of mmdrop. Meaning it now qualifies for stable. Paolo