From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl0-x241.google.com (mail-pl0-x241.google.com [IPv6:2607:f8b0:400e:c01::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40G6lW1K01zF1pY for ; Wed, 4 Apr 2018 10:48:38 +1000 (AEST) Received: by mail-pl0-x241.google.com with SMTP id 59-v6so8861777plc.13 for ; Tue, 03 Apr 2018 17:48:38 -0700 (PDT) Date: Tue, 3 Apr 2018 17:48:34 -0700 (PDT) From: David Rientjes To: Laurent Dufour cc: kernel test robot , paulmck@linux.vnet.ibm.com, peterz@infradead.org, akpm@linux-foundation.org, kirill@shutemov.name, ak@linux.intel.com, mhocko@kernel.org, dave@stgolabs.net, jack@suse.cz, Matthew Wilcox , benh@kernel.crashing.org, mpe@ellerman.id.au, paulus@samba.org, Thomas Gleixner , Ingo Molnar , hpa@zytor.com, Will Deacon , Sergey Senozhatsky , Andrea Arcangeli , Alexei Starovoitov , kemi.wang@intel.com, sergey.senozhatsky.work@gmail.com, Daniel Jordan , linux-kernel@vger.kernel.org, linux-mm@kvack.org, haren@linux.vnet.ibm.com, khandual@linux.vnet.ibm.com, npiggin@gmail.com, bsingharora@gmail.com, Tim Chen , linuxppc-dev@lists.ozlabs.org, x86@kernel.org, lkp@01.org Subject: Re: [mm] b1f0502d04: INFO:trying_to_register_non-static_key In-Reply-To: Message-ID: References: <20180317075119.u6yuem2bhxvggbz3@inn> <792c0f75-7e7f-cd81-44ae-4205f6e4affc@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Wed, 28 Mar 2018, Laurent Dufour wrote: > On 26/03/2018 00:10, David Rientjes wrote: > > On Wed, 21 Mar 2018, Laurent Dufour wrote: > > > >> I found the root cause of this lockdep warning. > >> > >> In mmap_region(), unmap_region() may be called while vma_link() has not been > >> called. This happens during the error path if call_mmap() failed. > >> > >> The only to fix that particular case is to call > >> seqcount_init(&vma->vm_sequence) when initializing the vma in mmap_region(). > >> > > > > Ack, although that would require a fixup to dup_mmap() as well. > > You're right, I'll fix that too. > I also think the following is needed: diff --git a/fs/exec.c b/fs/exec.c --- a/fs/exec.c +++ b/fs/exec.c @@ -312,6 +312,10 @@ static int __bprm_mm_init(struct linux_binprm *bprm) vma->vm_flags = VM_SOFTDIRTY | VM_STACK_FLAGS | VM_STACK_INCOMPLETE_SETUP; vma->vm_page_prot = vm_get_page_prot(vma->vm_flags); INIT_LIST_HEAD(&vma->anon_vma_chain); +#ifdef CONFIG_SPECULATIVE_PAGE_FAULT + seqcount_init(&vma->vm_sequence); + atomic_set(&vma->vm_ref_count, 0); +#endif err = insert_vm_struct(mm, vma); if (err)