Received: by 10.213.65.68 with SMTP id h4csp556965imn; Wed, 4 Apr 2018 03:21:32 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/mW4yn7aWk0pDMr2WCpBh+vOkckVVgNQ5v1oq43po4IRtg1WPnspDYwcs4sf3MVDxLxu4y X-Received: by 10.98.236.86 with SMTP id k83mr13391317pfh.84.1522837292658; Wed, 04 Apr 2018 03:21:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522837292; cv=none; d=google.com; s=arc-20160816; b=E+/Ch9QC7p+pt3i53/O6JBFbHeH3QMQyYtuKfjTQqsx0goULk9Vl9G4XJQzwQP9G6r ZkUcwgrO7UgNIKLwqHW+GVXuR3Hq87MPk7GtXBHg3ATJ+5+Oz7b41n+z5ANn7H8Cg0bb iLfrzrYdNo7FlNP1/tGwF4cZLiWWLPjyA+9iZiudeTAqyjznE2TchVOGC3zCb1DxXx6D nF5fG2BL4Jo5mqG9lkc2pZ5Vg18iEKVr21nhPNW2agIDnNhGbR0fmg/arEw5+VVpHV8w YWf8LLq4wncsnN8tCxhjbm2TwrMLGPpi8fDTWMEpBEx9VPFdZswS+eV7piCoEbX1HUzB jSsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date:from :references:cc:to:subject:arc-authentication-results; bh=JErVkDuVJ1lCNDlgQAA8QXbhulF1hHZ3Pi+cH3fZ0ns=; b=YGDBL4mVSF8ZpuZm2CE/vaW7qMwl6JDrwHvkXYMFO4UWnKIVA4f+bcihy2aZgT6Tzy S0ntYlTIl6kYNidTPie1GKMlp5F3YpscCGFg68ct2sas6iwN4y4FqQyXwb/CUwY86bkd 0vnpoXXdAs9iO01nSFwgdo/j3sWBUPzUftP+jt2Rstrm0MFaf3E59aowR2p/WD+uudC/ yMrXKjv6yU1dpyq3fPyyhdulRuk3BsEyNt9WynaHPTA5SxFdjgePJTPG6r7U4NnqbBXd HVMdgjy2VeES5kYJ8IpgJ8VAQ7auYFNK72pO1/PeZ6ZrYj7yvI5RYKWPf2KQIUhKd/DL vj2w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a9si3417341pgu.454.2018.04.04.03.21.18; Wed, 04 Apr 2018 03:21:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751443AbeDDKUG (ORCPT + 99 others); Wed, 4 Apr 2018 06:20:06 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:44842 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751155AbeDDKUC (ORCPT ); Wed, 4 Apr 2018 06:20:02 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w34AJbsG099331 for ; Wed, 4 Apr 2018 06:20:01 -0400 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0b-001b2d01.pphosted.com with ESMTP id 2h4vm5rthh-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Wed, 04 Apr 2018 06:20:01 -0400 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 4 Apr 2018 11:19:59 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 4 Apr 2018 11:19:51 +0100 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w34AJo7T45875446; Wed, 4 Apr 2018 10:19:50 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 56EBE42042; Wed, 4 Apr 2018 11:11:41 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 111AB4203F; Wed, 4 Apr 2018 11:11:39 +0100 (BST) Received: from [9.145.59.61] (unknown [9.145.59.61]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 4 Apr 2018 11:11:38 +0100 (BST) Subject: Re: [mm] b1f0502d04: INFO:trying_to_register_non-static_key To: David Rientjes 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 References: <20180317075119.u6yuem2bhxvggbz3@inn> <792c0f75-7e7f-cd81-44ae-4205f6e4affc@linux.vnet.ibm.com> From: Laurent Dufour Date: Wed, 4 Apr 2018 12:19:48 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 18040410-0012-0000-0000-000005C6E67A X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18040410-0013-0000-0000-00001942F818 Message-Id: <147e8be3-2c33-2111-aacc-dc2bb932fa8c@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-04-04_03:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804040110 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/04/2018 02:48, David Rientjes wrote: > 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) No, this not needed because the vma is allocated with kmem_cache_zalloc() so vm_ref_count is 0, and insert_vm_struc() will later call __vma_link_rb() which will call seqcount_init(). Furhtermore, in case of error, the vma structure is freed without calling get_vma() so there is risk of lockdep warning.