Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2887949rwd; Wed, 14 Jun 2023 08:30:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4x9xxjhXtaips+ECr+MsE9BZAGcmT4ZblZdYaCNJA0KtTrsKYOLhm+FVUGH7I0v2T1OsK7 X-Received: by 2002:a05:6a00:2449:b0:657:1fe5:eb63 with SMTP id d9-20020a056a00244900b006571fe5eb63mr2559965pfj.7.1686756652094; Wed, 14 Jun 2023 08:30:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686756652; cv=none; d=google.com; s=arc-20160816; b=jWbpJmFpOPG7YFoFCAv7IXaKcdcLyKgZqMCh0aDDgo+QoAfoUs970W9zl6OvgVXjzG 8+UHBFXYyeehAaQuzWeqL9oqN5QIn8Zw4BPcSvaNAK9Jrvoc5t9bd0ArpZV0/A3BAp6C HwpZyvBbCqpKald/lOky2ZwFSsi1v9Y3xu7MaE3gKAoa8jTY2bDxDMeCdOP/d4Az8b9m BP6S7W5jaJYnvOvPNo2a4+du2j1mdqhUreCZBACKqieflHaFtjNUeUrVdFKos5lz05bJ K09zCM/ocCU5geo2jYHau+E//aZVsmAuDacM97nm5LBX6fCs7Be1b6PexBpVLlu1Cpvd yDig== 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 :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=dJJSEeqK6QXbXzLAxpLoHNxXrX7Cx+/0FsKlU9Zst5Q=; b=zplm2K0bDSA0xdrSaFU8mXAtTOGubAX9E/7UjJl3AJgiD6MXs7bHLTTsvnLYu3Dhjn txrLNm3EeV5beSsbV/+E4YkTq9ZSCawtMxmG/Tu4hiK/JW242QTo+ssQBJ4vKYhd3nNd DyYLh/Z8ypiNYdQL/w8SEeRrMeIGz4MwDiyJ0uQ83IwoF2/ZBJeminm14IHSQk6EvTLp v3CC6F/qyeOa/L5RiGAoGOgQQKu2mted/v0xREEO9jiOJuEd3sXAEH2RBomy52ANoPLW u7whu7I6rLRYoWaCONzgcn0LJfhIx7Kxf4ud1H3WpunPbufieajBNloMJQHfbvrI7ZhT Az4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=K1UBbJzd; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f7-20020aa79687000000b006590bb60328si88835pfk.173.2023.06.14.08.30.39; Wed, 14 Jun 2023 08:30:52 -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=@redhat.com header.s=mimecast20190719 header.b=K1UBbJzd; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343683AbjFNPSS (ORCPT + 99 others); Wed, 14 Jun 2023 11:18:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233280AbjFNPSO (ORCPT ); Wed, 14 Jun 2023 11:18:14 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6907311B for ; Wed, 14 Jun 2023 08:17:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686755838; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dJJSEeqK6QXbXzLAxpLoHNxXrX7Cx+/0FsKlU9Zst5Q=; b=K1UBbJzdwTj0foxQcLKjoLUoFXbCGMb//BHKvXyNBAC22f/UhwUHBFqEbIoUjGA9IFpqHJ 6pmg0zNWmstHtSUdblqO+ez08EEvQyeblDn3k89Qc3IPoSeA/jz+J3vy5P7g32Ocpv8G4y pQCYgAhs9IjlQXEIMs+0eNCvsC8eAOk= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-668-yUhkZ3JJME2neTYv06iuog-1; Wed, 14 Jun 2023 11:17:17 -0400 X-MC-Unique: yUhkZ3JJME2neTYv06iuog-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-3f80e7e15b0so5197785e9.2 for ; Wed, 14 Jun 2023 08:17:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686755835; x=1689347835; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=dJJSEeqK6QXbXzLAxpLoHNxXrX7Cx+/0FsKlU9Zst5Q=; b=FIquESA89woqoKI5Y3RzCwsqGi8QA9MlyQZfsHjnXEtKdxjZIkH5/DVJiBMUmT9E+u k7n+We2TyJ7E0pBQeCNr//IJchJ/1gz46id1NOZ6L/H5wYxUcOr/lNSlnyt1d/uL38eG I8IchXgQwGa9BG4mUf8qoKNYyQ5uqUTIp8pQO09ot0Sn7T/tSHom3JlyDIkD0Ou7mLiF 53KxnGD83cuxuXZorCzEooR8NQepan7E04ZFVNyrPE+X6glboq79GuWlbscxRH971awa qoKmUAUPZu3DcC036yrmbac0+fj9P9SNHpLFu6RhJ+OkDPqenECq1bT2mDNqYx5hR+zw BJ6A== X-Gm-Message-State: AC+VfDwD6daD3EBB5vMveQD1zwCC9hp2jwLc08NStvpDwnSHPHdv/g+t LxOEC9Pi5nVEWAu/NOMj8Dhplwgqyt3R30Vc5UMohZxu1LuOOp11SJ7SgzsnVfWJ7W0lVULarQp XU84/Sqa65fyZT9odO95vU33V X-Received: by 2002:a05:600c:220d:b0:3f7:e443:c5b3 with SMTP id z13-20020a05600c220d00b003f7e443c5b3mr11985659wml.21.1686755835722; Wed, 14 Jun 2023 08:17:15 -0700 (PDT) X-Received: by 2002:a05:600c:220d:b0:3f7:e443:c5b3 with SMTP id z13-20020a05600c220d00b003f7e443c5b3mr11985636wml.21.1686755835391; Wed, 14 Jun 2023 08:17:15 -0700 (PDT) Received: from ?IPV6:2003:cb:c704:b200:7d03:23db:ad5:2d21? (p200300cbc704b2007d0323db0ad52d21.dip0.t-ipconnect.de. [2003:cb:c704:b200:7d03:23db:ad5:2d21]) by smtp.gmail.com with ESMTPSA id e16-20020adffc50000000b0030fbb834074sm10722810wrs.15.2023.06.14.08.17.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 14 Jun 2023 08:17:14 -0700 (PDT) Message-ID: Date: Wed, 14 Jun 2023 17:17:13 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH 4/7] mm/hugetlb: Prepare hugetlb_follow_page_mask() for FOLL_PIN Content-Language: en-US To: Peter Xu Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Matthew Wilcox , Andrea Arcangeli , John Hubbard , Mike Rapoport , Vlastimil Babka , "Kirill A . Shutemov" , Andrew Morton , Mike Kravetz , James Houghton , Hugh Dickins References: <20230613215346.1022773-1-peterx@redhat.com> <20230613215346.1022773-5-peterx@redhat.com> <533c32cf-9a18-1590-4d29-f076d6bd58c1@redhat.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE 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 14.06.23 17:11, Peter Xu wrote: > On Wed, Jun 14, 2023 at 04:57:37PM +0200, David Hildenbrand wrote: >> On 13.06.23 23:53, Peter Xu wrote: >>> It's coming, not yet, but soon. Loose the restriction. >>> >>> Signed-off-by: Peter Xu >>> --- >>> mm/hugetlb.c | 7 ------- >>> 1 file changed, 7 deletions(-) >>> >>> diff --git a/mm/hugetlb.c b/mm/hugetlb.c >>> index f037eaf9d819..31d8f18bc2e4 100644 >>> --- a/mm/hugetlb.c >>> +++ b/mm/hugetlb.c >>> @@ -6467,13 +6467,6 @@ struct page *hugetlb_follow_page_mask(struct vm_area_struct *vma, >>> spinlock_t *ptl; >>> pte_t *pte, entry; >>> - /* >>> - * FOLL_PIN is not supported for follow_page(). Ordinary GUP goes via >>> - * follow_hugetlb_page(). >>> - */ >>> - if (WARN_ON_ONCE(flags & FOLL_PIN)) >>> - return NULL; >>> - >>> hugetlb_vma_lock_read(vma); >>> pte = hugetlb_walk(vma, haddr, huge_page_size(h)); >>> if (!pte) >> Did you fix why the warning was placed there in the first place? (IIRC, at >> least unsharing support needs to be added, maybe more) > > Feel free to have a look at patch 2 - it should be done there, hopefully in > the right way. And IIUC it could be a bug to not do that before (besides > CoR there was also the pgtable permission checks that was missing). More > details in patch 2's commit message. Thanks, Oh, that slipped my eyes (unsharing is not really a permission check) -- and the patch description could have been more explicit about why we can now lift the restrictions. For the records: we don't use CoR terminology upstream. As suggested by John, we use "GUP-triggered unsharing". As unsharing only applies to FOLL_PIN, it doesn't quite fit into patch #2. Either move that to this patch or squash both. -- Cheers, David / dhildenb