Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1863718rwb; Tue, 29 Nov 2022 21:38:34 -0800 (PST) X-Google-Smtp-Source: AA0mqf6jwNshivdJnRL2InwJOAock7bLF6SbXZHoB1OzaFyHbWMPHNmulYfQ+nn5AvrsDH7hNevg X-Received: by 2002:a17:906:b811:b0:7c0:9ff2:c206 with SMTP id dv17-20020a170906b81100b007c09ff2c206mr734503ejb.609.1669786714570; Tue, 29 Nov 2022 21:38:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669786714; cv=none; d=google.com; s=arc-20160816; b=r2dZ9NS9zNmMdQyXmjk7qwonQW0CAOIYktiDiqPwVo+FjTIDcZoAmZGuuglYethYjI WQ6A4mqdU8Z7+ROEH5mbwkE3a6USNGgXSgub4tW3IC9mjE1oB5TGbAP69xmUepgbu+E3 omJEsnPOkGHE4Boo0Cbh84IZFCl/9yBmNSGLU0vpXV4iiidsKPeFtApP5wcIRdqoAu7B H+COpOxSfBDHC4ddzwD1iUnFX8U0xbw8e65cprGOi68t2EjRPI7nZXjwSxWtfUyuJ6wP FFQ6g/b7k375MktLVr19ATjwHn5ivcWLRuD4SCBRdcHfXJA4mitBNDqXKjJ7tU9uwQaD d6dA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=8UahAMjd29iHvYXqRSjUosxmwEcfUhHXKNOXp/KbZ5Q=; b=KE8Y/RxWvxz3ORJe6UnvMeiDLYFWIL3vPHs3lZoHHcajET8L4/EuzHpZWc/yOozASg 9KKYoPN1MxNG3t0JzXrtLTBDFy4g9ogHLhrzuM9nMAZQ+3lMmOiEJnpcnGpuOlKGQejk H+z5eRbVeG11LiNObvUHF9BuIhBigZ+uspeCoSRd7GA+cAIAOx2KQ5tLD3aGKH9EHo5y eCWWDbvlWM384IF0xchNRD/kiYTnFBTyAX8Cu3UKczvUJAuVrNOBvBe78pe1Icjybu3x QInCCY7Y8zsNI5aI0nsYJkw9zBirzG2Keo5ggDacdlV8JfrH5bDLztR41lVx+ugBx6V+ ERXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qf+88buj; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dn9-20020a05640222e900b0046b13a74fa8si529521edb.416.2022.11.29.21.38.14; Tue, 29 Nov 2022 21:38:34 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=qf+88buj; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233423AbiK3FST (ORCPT + 84 others); Wed, 30 Nov 2022 00:18:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232806AbiK3FSQ (ORCPT ); Wed, 30 Nov 2022 00:18:16 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD36E69ABE for ; Tue, 29 Nov 2022 21:18:14 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id D6B52CE17EC for ; Wed, 30 Nov 2022 05:18:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2B40C433D6; Wed, 30 Nov 2022 05:18:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669785491; bh=LthRoD/zLPG9U+Zco97eCEddMkCmFyhLksJ09r5LxBA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=qf+88bujVlsGtbJhGEKuyTN8cI+YiRVYOwBRf5XX7L4QvEQfQk5nzyrlNxn93NpaM DMmkNdtS8RU5BeWhKxovjrCPXAO7uUU+RO/1qQwxohR63Bah0gB4RJ9cWIrjwcc+mZ +HCX7PR0eyAeOPE5IbSoGDgoy2rDOWFtoWJ7PePTgJpzGK8tfELHAMKkX1ktQrZr4z zIIF74BGt0CE49UGDWwAEJUXotUuw53TTmuM6nyZxyZuuhkyJBhEQNFHhB3sTeBNKW 1teCDxRTdLRj61Z6GTWKPDSj5C5FeS/K/A71B2Mibc29dCg66RjBN4t23WbbqqvZym 7+27oIX/FjJdg== Date: Tue, 29 Nov 2022 21:18:08 -0800 From: Eric Biggers To: Peter Xu Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, James Houghton , Jann Horn , Andrew Morton , Andrea Arcangeli , Rik van Riel , Nadav Amit , Miaohe Lin , Muchun Song , Mike Kravetz , David Hildenbrand Subject: Re: [PATCH 10/10] mm/hugetlb: Introduce hugetlb_walk() Message-ID: References: <20221129193526.3588187-1-peterx@redhat.com> <20221129193526.3588187-11-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221129193526.3588187-11-peterx@redhat.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 Tue, Nov 29, 2022 at 02:35:26PM -0500, Peter Xu wrote: > +static inline pte_t * > +hugetlb_walk(struct vm_area_struct *vma, unsigned long addr, unsigned long sz) > +{ > +#if defined(CONFIG_ARCH_WANT_HUGE_PMD_SHARE) && defined(CONFIG_LOCKDEP) > + struct hugetlb_vma_lock *vma_lock = vma->vm_private_data; > + > + /* > + * If pmd sharing possible, locking needed to safely walk the > + * hugetlb pgtables. More information can be found at the comment > + * above huge_pte_offset() in the same file. > + * > + * NOTE: lockdep_is_held() is only defined with CONFIG_LOCKDEP. > + */ > + if (__vma_shareable_flags_pmd(vma)) > + WARN_ON_ONCE(!lockdep_is_held(&vma_lock->rw_sema) && > + !lockdep_is_held( > + &vma->vm_file->f_mapping->i_mmap_rwsem)); > +#endif FYI, in next-20221130 there is a compile error here due to this commit: In file included from security/commoncap.c:19: ./include/linux/hugetlb.h:1262:42: error: incomplete definition of type 'struct hugetlb_vma_lock' WARN_ON_ONCE(!lockdep_is_held(&vma_lock->rw_sema) && ~~~~~~~~^ ./include/linux/lockdep.h:286:47: note: expanded from macro 'lockdep_is_held' #define lockdep_is_held(lock) lock_is_held(&(lock)->dep_map) ^~~~ - Eric