From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754726AbeDDAsi (ORCPT ); Tue, 3 Apr 2018 20:48:38 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:39773 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753298AbeDDAsh (ORCPT ); Tue, 3 Apr 2018 20:48:37 -0400 X-Google-Smtp-Source: AIpwx4+ZNlk9wS9GyKIL+Y5Ayz6UNZdNy8ddlFY4myPtg94UWPVzKzCRuCDQqhiPt58HIgRwvK/7aQ== Date: Tue, 3 Apr 2018 17:48:34 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com 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> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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)