Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp3475013rwi; Fri, 21 Oct 2022 17:22:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4QyXuwhELk+vBNr2r0dZoR3O/G7ZW/b1gzCnLmy0ulR+PNWEO6IhQ6fGxUZjvp5YyKzTJS X-Received: by 2002:a17:902:d48e:b0:186:822e:d02d with SMTP id c14-20020a170902d48e00b00186822ed02dmr4038264plg.121.1666398170203; Fri, 21 Oct 2022 17:22:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666398170; cv=none; d=google.com; s=arc-20160816; b=wgdc2him70S8SfAx9g7LroIGUxpssjAl5hggWmKohen8ufuvMBbREzwa0g2K9xUvF0 KaPY8gPCB5/HggUch6Un2sBl642a2ELgFCllENUCjDBWHy8d6rdFnt6l7/1spyFyC21j 2M5BglseR0irh8fVWI0LuzFAezWLs1Bjv//uuy8/aw3UQYDYfa99XPM0FNluy7CTtiWl wV89vxPECaLryrkA7QZ98LQ7psehv9r8+R78XiHEzgM61PLSyO3p0Hzl1vpdjlYhz5oj eIqINYj1BMDAEeI5KpzpCTWdPGVk6vUxvejp/2PQWbT0OImLM6ONhtOfTixtnrHGug2f dA+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=FsbSvlVxGH7D4k107lqA7eAi/c6cWz3yuiU0rZC9C0c=; b=1AkoBh5IA2e7nGPAZrqWXhCmoULJxDcE8gr1NtoIoJOX16JyPIpRWUiCPupYBMg5SB /NwLAcs+x2n6HwHhevXmCkZTAjTda4q/bBxVNWx60kWCcxgmypAL+1VVXD71cfK2936p uTBzA3gvSbWW9MMdt/jNicCeJbXm8H9q4lBSOcerzmRAMDQew2/JM7ybi+1jbIlAME5r yRjHqzZglQHy6A5kvOBTmrf8scf4XcyspYVkcmlx4mz+ZWcaI67VHuMDX/5LE2gE2A12 rsbTwxgVNmr70P3pozbzWhPWmJczv44ORKe4PB/NgYIf1KjRdnlzCyJ2pX9GBzi7Oybb ZYRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b="P/YCZyVR"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p9-20020a170902ebc900b0017c59fa6b65si585710plg.597.2022.10.21.17.22.36; Fri, 21 Oct 2022 17:22:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b="P/YCZyVR"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230156AbiJVAF6 (ORCPT + 99 others); Fri, 21 Oct 2022 20:05:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230176AbiJVAFi (ORCPT ); Fri, 21 Oct 2022 20:05:38 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D23C27DF5 for ; Fri, 21 Oct 2022 17:04:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Sender:Reply-To:Content-ID:Content-Description; bh=FsbSvlVxGH7D4k107lqA7eAi/c6cWz3yuiU0rZC9C0c=; b=P/YCZyVR5WywsGYepOjMLoI/6m gNoCbFA0S4qyJZ3aG6rm5vWUGAaBy3mHiMSyqlKm8bmFHQcLGam8VXlKN4onx3bnL03TyFZEMSdoI bio51BYZZiTPOxUu/O2dw94MTmJtDzfGLcUNYUWCngxnj2s8YbEGFUlpvxmJ+4x17c1YRKLqTA1lN 0nEr7jUt/qrNCvPKLPg0sGICr+MPqPi6NB+0nzpVhYdBUSyDJ51I9d1XkMRMwizgj1SIOivmSAiKQ nYT0kik2KAuHwBi3BdNA5ErWkjoI2P+0KGWK36OksaKefA+Y8RyL2ToAgI8/W7le89qgBkmKE64+v 8BQPyCTw==; Received: from [2601:1c2:d80:3110::a2e7] by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1om1yc-00ATqf-O9; Sat, 22 Oct 2022 00:02:58 +0000 Message-ID: Date: Fri, 21 Oct 2022 17:02:57 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: [shmem] 7a7256d5f5: WARNING:possible_recursive_locking_detected Content-Language: en-US To: Ira Weiny , Andrew Morton Cc: Matthew Wilcox , kernel test robot , "Fabio M. De Francesco" , lkp@lists.01.org, lkp@intel.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Peter Xu , Andrea Arcangeli References: <202210211215.9dc6efb5-yujie.liu@intel.com> <20221021133041.5811e1fb291eb6aaf122a59c@linux-foundation.org> From: Randy Dunlap In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/21/22 17:00, Ira Weiny wrote: > > I was about to get this patch ready to send when I found this: > > commit b6ebaedb4cb1a18220ae626c3a9e184ee39dd248 > Author: Andrea Arcangeli > Date: Fri Sep 4 15:47:08 2015 -0700 > > userfaultfd: avoid mmap_sem read recursion in mcopy_atomic > > If the rwsem starves writers it wasn't strictly a bug but lockdep > doesn't like it and this avoids depending on lowlevel implementation > details of the lock. > > [akpm@linux-foundation.org: delete weird BUILD_BUG_ON()] > Signed-off-by: Andrea Arcangeli > Acked-by: Pavel Emelyanov > ... > > So I wonder if the true fix is something to lockdep? > > Regardless I'll send the below patch because it will restore things to a > working order. with ; added to each + line. > But I'm CC'ing Andrea for comments. > > Ira > >> >> Ira >> >> diff --git a/mm/shmem.c b/mm/shmem.c >> index 8280a5cb48df..6c8e99bf5983 100644 >> --- a/mm/shmem.c >> +++ b/mm/shmem.c >> @@ -2424,9 +2424,11 @@ int shmem_mfill_atomic_pte(struct mm_struct *dst_mm, >> >> if (!zeropage) { /* COPY */ >> page_kaddr = kmap_local_folio(folio, 0); >> + pagefault_disable() >> ret = copy_from_user(page_kaddr, >> (const void __user *)src_addr, >> PAGE_SIZE); >> + pagefault_enable() >> kunmap_local(page_kaddr); >> >> /* fallback to copy_from_user outside mmap_lock */ >> >> -- ~Randy