Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp3194917rdb; Thu, 16 Nov 2023 03:02:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IG/hOV8ydmuturG8TyTcFsBL3zgRGlTI4r5oxNBTfGtc52erXy++8IVopK3TW8aai3uOZRC X-Received: by 2002:a05:6a20:2588:b0:185:b481:302b with SMTP id k8-20020a056a20258800b00185b481302bmr1935182pzd.9.1700132545532; Thu, 16 Nov 2023 03:02:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700132545; cv=none; d=google.com; s=arc-20160816; b=YU0CViQG/CWytdJO6c/EfKHEmdJFiD5kB+bojkKih6Rp++UI3UP1D9mNw6u5+P1/Bu o7zrbjGHJIOwMjo7fHQlfmYC3iUmvFTsF5OPEQzg0Fl+Fzo29fHOCTliUIfyio9q3eBH 1vXN7/yJL891wEIpk+Tkiqf+dl2TbQcRQB11vqtJUWvDjcUUS6HrrPnN1OHksq2u3tNT MG6E8xY4ykrbutJFk36h6O7tLLYJ8gchkFhsZQa8qXnC5GpYGQpZZZUL6i6MVxrT5T5b 6P3NA4aDjja+vVjItpjjw0a4Hm4jku03yRBJVEGmcDvYWKRPwdyvJtZ9FEE1qONxGZdJ MYWA== 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:autocrypt:from:references:cc:to:content-language :subject:user-agent:mime-version:date:message-id:dkim-signature; bh=tG/qxV/5LF6QLG8P+GElyJmBVfmO6gfwlWGi3iluUvc=; fh=JarPnzcPZhcYNUsKtt+xMT+vuop5Ra4PqwQhPmLhlJE=; b=c9BpER9Bjbawoni5xjs/8Sjb/AaF9cGF5vqKv+hENjU1sOCwmJmH/8uQZhoHdOjBHA RMJ0K0INvAG5rKI/hDTzMuinNwSExAojOq6fN3HiT8HprsVKkI3vM54UoZMAcn3Yjrjr t5k/3/WBIO8uTJWDRKRnlc9mi81x1di+Go4rZHyCQPoAUunGKVJAtEz4jLQoLqVguywY w7LEltFDMOFnqIOVtcSsSjZJ0iBF3emTmuukm8RMw5Tl9xAdEy+0MAUfzFJ1Q++GFRd1 wuRhDT2fnkMHuo17i7NyjnE7I/gwyV4r6WwrXBKXIkOzpJmqb/wYVMpjyVFX6Z6kw5O9 oJyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="elo/AgAq"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id cm19-20020a056a020a1300b005b92a7d88e6si12503196pgb.823.2023.11.16.03.02.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 03:02:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="elo/AgAq"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id B8959816EBF4; Thu, 16 Nov 2023 03:02:17 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230326AbjKPLCA (ORCPT + 99 others); Thu, 16 Nov 2023 06:02:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230193AbjKPLB6 (ORCPT ); Thu, 16 Nov 2023 06:01:58 -0500 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 BD7B784 for ; Thu, 16 Nov 2023 03:01:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700132513; 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:autocrypt:autocrypt; bh=tG/qxV/5LF6QLG8P+GElyJmBVfmO6gfwlWGi3iluUvc=; b=elo/AgAqrJYFiaMuy7hvlBfKxy80zEuLNoMvUx2DpqnBdZSFjjJwZpl12qvox4cWjTGGHN C0KYdjBX5zxvJAzgQ7lvbqZjHueYu8wDrm3tS0mgMyTI5dR5n7P0eGNP3i2JaIfZWWsJbN iMx6cn4nuAXtcl9gFfXqjgvAebfCsi4= Received: from mail-lj1-f199.google.com (mail-lj1-f199.google.com [209.85.208.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-142-NxFaLoWcNOe_tZhxYa3q-g-1; Thu, 16 Nov 2023 06:01:52 -0500 X-MC-Unique: NxFaLoWcNOe_tZhxYa3q-g-1 Received: by mail-lj1-f199.google.com with SMTP id 38308e7fff4ca-2c50bebd8dfso5756871fa.3 for ; Thu, 16 Nov 2023 03:01:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700132511; x=1700737311; h=content-transfer-encoding:in-reply-to:organization:autocrypt: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=tG/qxV/5LF6QLG8P+GElyJmBVfmO6gfwlWGi3iluUvc=; b=uynMxjQZQX1L1uca42VazeAbJHeydTpJybvo1/iVWnL7OKafDNd2x+pHOJ0n55+5ck TUIRIufREWxtkQ94gWEIAMcMI49W3DEWqD8CbQLkyfSpXak83GnP1SrJKnwR/6mPGLBj OejMOc5tkmqgiKCMSApuUye3exJODaNrzQTmUWurR5X7JHsJ6CemP04fDDfVNIsvnBfW TA2y2w/aA0OE4e1Jm23rVnG7KIGXETj5sM4k707A7YHTB5h1O/24bA1m2eP10cqIN/vu 7SxUNaAG0gBpzLzKhfmplLB3zvZTzDbfWlc7xLB6En61NZVQ+QOiHYvg+zh7Xi560EDv 9McQ== X-Gm-Message-State: AOJu0YwYkYYenaTo+xH1gcuOfSTDj4nT87lZzo2LIpyzUHlN6U23H3hn xzIMbxgl0AYi08hzJvGPrj/7uPE7b40OtcQ5avdbIEX51NsDejUPjibLMpkO23a1CI82lQmvnHh gK87AaKRAr6LXmIlxC8eboGiF X-Received: by 2002:a2e:b614:0:b0:2c5:19ab:7270 with SMTP id r20-20020a2eb614000000b002c519ab7270mr5817548ljn.35.1700132510921; Thu, 16 Nov 2023 03:01:50 -0800 (PST) X-Received: by 2002:a2e:b614:0:b0:2c5:19ab:7270 with SMTP id r20-20020a2eb614000000b002c519ab7270mr5817507ljn.35.1700132510434; Thu, 16 Nov 2023 03:01:50 -0800 (PST) Received: from ?IPV6:2a09:80c0:192:0:5dac:bf3d:c41:c3e7? ([2a09:80c0:192:0:5dac:bf3d:c41:c3e7]) by smtp.gmail.com with ESMTPSA id bg3-20020a05600c3c8300b004077219aed5sm3232262wmb.6.2023.11.16.03.01.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 16 Nov 2023 03:01:49 -0800 (PST) Message-ID: <930b5f6a-27d9-43da-bf9f-1478c8de1af8@redhat.com> Date: Thu, 16 Nov 2023 12:01:48 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 01/14] mm: Batch-copy PTE ranges during fork() Content-Language: en-US To: Ryan Roberts , kernel test robot , Catalin Marinas , Will Deacon , Ard Biesheuvel , Marc Zyngier , Oliver Upton , James Morse , Suzuki K Poulose , Zenghui Yu , Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , Andrew Morton , Anshuman Khandual , Matthew Wilcox , Yu Zhao , Mark Rutland , Kefeng Wang , John Hubbard , Zi Yan Cc: oe-kbuild-all@lists.linux.dev, Linux Memory Management List , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20231115163018.1303287-2-ryan.roberts@arm.com> <202311160516.kHhfmjvl-lkp@intel.com> <4e8d329c-eda6-4ff8-bb56-8924bb4583b2@redhat.com> From: David Hildenbrand Autocrypt: addr=david@redhat.com; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HGcXFT0V9 PXFNNgV5jXMQRwU0O/ztJIQqsE5LsUomE//bLwzj9IVsaQpKDqW6TAPjcdBDPLHvriq7kGjt WhVhdl0qEYB8lkBEU7V2Yb+SYhmhpDrti9Fq1EsmhiHSkxJcGREoMK/63r9WLZYI3+4W2rAc UucZa4OT27U5ZISjNg3Ev0rxU5UH2/pT4wJCfxwocmqaRr6UYmrtZmND89X0KigoFD/XSeVv jwBRNjPAubK9/k5NoRrYqztM9W6sJqrH8+UWZ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oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8 kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt WNyWQQ== Organization: Red Hat In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 16 Nov 2023 03:02:17 -0800 (PST) On 16.11.23 11:36, Ryan Roberts wrote: > On 16/11/2023 10:12, David Hildenbrand wrote: >> On 16.11.23 11:07, Ryan Roberts wrote: >>> Hi All, >>> >>> Hoping for some guidance below! >>> >>> >>> On 15/11/2023 21:26, kernel test robot wrote: >>>> Hi Ryan, >>>> >>>> kernel test robot noticed the following build errors: >>>> >>>> [auto build test ERROR on akpm-mm/mm-everything] >>>> [also build test ERROR on linus/master v6.7-rc1 next-20231115] >>>> [cannot apply to arm64/for-next/core efi/next] >>>> [If your patch is applied to the wrong git tree, kindly drop us a note. >>>> And when submitting patch, we suggest to use '--base' as documented in >>>> https://git-scm.com/docs/git-format-patch#_base_tree_information] >>>> >>>> url: >>>> https://github.com/intel-lab-lkp/linux/commits/Ryan-Roberts/mm-Batch-copy-PTE-ranges-during-fork/20231116-010123 >>>> base:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git >>>> mm-everything >>>> patch link: >>>> https://lore.kernel.org/r/20231115163018.1303287-2-ryan.roberts%40arm.com >>>> patch subject: [PATCH v2 01/14] mm: Batch-copy PTE ranges during fork() >>>> config: arm-randconfig-002-20231116 >>>> (https://download.01.org/0day-ci/archive/20231116/202311160516.kHhfmjvl-lkp@intel.com/config) >>>> compiler: arm-linux-gnueabi-gcc (GCC) 13.2.0 >>>> reproduce (this is a W=1 build): >>>> (https://download.01.org/0day-ci/archive/20231116/202311160516.kHhfmjvl-lkp@intel.com/reproduce) >>>> >>>> If you fix the issue in a separate patch/commit (i.e. not just a new version of >>>> the same patch/commit), kindly add following tags >>>> | Reported-by: kernel test robot >>>> | Closes: >>>> https://lore.kernel.org/oe-kbuild-all/202311160516.kHhfmjvl-lkp@intel.com/ >>>> >>>> All errors (new ones prefixed by >>): >>>> >>>>     mm/memory.c: In function 'folio_nr_pages_cont_mapped': >>>>>> mm/memory.c:969:16: error: implicit declaration of function 'pte_pgprot'; >>>>>> did you mean 'ptep_get'? [-Werror=implicit-function-declaration] >>>>       969 |         prot = pte_pgprot(pte_mkold(pte_mkclean(ptent))); >>>>           |                ^~~~~~~~~~ >>>>           |                ptep_get >>>>     cc1: some warnings being treated as errors >>> >>> It turns out that pte_pgprot() is not universal; its only implemented by >>> architectures that select CONFIG_HAVE_IOREMAP_PROT (currently arc, arm64, >>> loongarch, mips, powerpc, s390, sh, x86). >>> >>> I'm using it in core-mm to help calculate the number of "contiguously mapped" >>> pages within a folio (note that's not the same as arm64's notion of >>> contpte-mapped. I just want to know that there are N physically contiguous pages >>> mapped virtually contiguously with the same permissions). And I'm using >>> pte_pgprot() to extract the permissions for each pte to compare. It's important >>> that we compare the permissions because just because the pages belongs to the >>> same folio doesn't imply they are mapped with the same permissions; think >>> mprotect()ing a sub-range. >>> >>> I don't have a great idea for how to fix this - does anyone have any thoughts? >> >> KIS :) fork() operates on individual VMAs if I am not daydreaming. >> >> Just check for the obvious pte_write()/dirty/ and you'll be fine. > > Yes, that seems much simpler! I think we might have to be careful about the uffd > wp bit too? I think that's it - are there any other exotic bits that might need > to be considered? Good question. Mimicing what the current code already does should be sufficient. uffd-wp should have the PTE R/O. You can set the contpte bit independent of any SW bit (uffd-wp, softdirty, ...) I guess, no need to worry about that. -- Cheers, David / dhildenb