Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp3201115rdb; Thu, 16 Nov 2023 03:13:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IEfKzlZYHa8hiMJFXZYRq6m78nvP2lRFWLI+kVXi08VlyGo4EdCQl7kyRcR7TdxzlAlPVR4 X-Received: by 2002:a62:b403:0:b0:6bc:b13c:35d5 with SMTP id h3-20020a62b403000000b006bcb13c35d5mr13007504pfn.13.1700133223102; Thu, 16 Nov 2023 03:13:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700133223; cv=none; d=google.com; s=arc-20160816; b=Z7UwPrI5rEa5r0oqAotnzoiRBdEZeu46p7Anp+NiD/soNtf7WgYZHl0uQW+oqkoM6+ B1c69MuiWVM8i1sQiLbtqi3jDiQibEJp3noMR/F9IT3gnsPfZRjD2Uk2hcfAJSnrjRXy Hvd1Om+Kuv9iOHBhRvY0D0cnwvdYgVbn9SBSIy6UMWdF9SIOjeeJ25aWQVR9KXtFMq31 w1MJoO0+Q7G4Xc76ITjE0PG0v6oP8MbhBdVskUA205wwHeCOOZPkb4RrSHJiDs3Oi7GD bcPQ99WjTeUsEyrSLMmPzzSjULdIYNiWB3c5D+Bb9lHgK4AhR98WPfgUy4V/0inpyaFW oW3A== 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; bh=H4HCwr2j6uA9i+DdbiYHyH5Xn4RN8tL3PiSkMY5Icf4=; fh=jhpOHYOWhTq4QfKsrnlTKyNkOVJ3+M0y31U3HsaOZYA=; b=K2rdkJGystXvOq1x28JkwZ2cFNH6u46DDgWym2S+gPFSAI13nR7y17hxXr9PkiNF7G HnNo1Bm2CWFypXwqQbd2jtKSW7aw0XZR7U2/iwYkrz6KIM/Gwt9W5fr0jhwJW+yjQyyk S5pvb2wqtBCSNfqSF5c+iqR5D7nC1lJPGoUEsnjo5YkdwxHF/qJUlW04VwMxxSvEKWM6 +bHzHNurY30TlcZO0uqCCBbSUoMOH2UDOKfh1EUtYUqG6YJ2DKlIJvqqFDgr5rj5Snh5 wvN7FblRhPnzLe61dzHPz1Nx0ecZVltKB/KhWYZUuJ63EnABgJLT8NYjL+47FOVDJy6s jBdw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id b1-20020a056a000a8100b0068fa8499af1si12501862pfl.11.2023.11.16.03.13.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 03:13:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id A7D1581C0CA1; Thu, 16 Nov 2023 03:13:35 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345061AbjKPLNY (ORCPT + 99 others); Thu, 16 Nov 2023 06:13:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344966AbjKPLNX (ORCPT ); Thu, 16 Nov 2023 06:13:23 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 52E99A8 for ; Thu, 16 Nov 2023 03:13:19 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0AD061595; Thu, 16 Nov 2023 03:14:05 -0800 (PST) Received: from [10.1.35.163] (XHFQ2J9959.cambridge.arm.com [10.1.35.163]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D20143F6C4; Thu, 16 Nov 2023 03:13:15 -0800 (PST) Message-ID: <75e721cb-18c2-4717-bdbe-af346b1deafa@arm.com> Date: Thu, 16 Nov 2023 11:13:14 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 01/14] mm: Batch-copy PTE ranges during fork() Content-Language: en-GB To: David Hildenbrand , 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> <930b5f6a-27d9-43da-bf9f-1478c8de1af8@redhat.com> From: Ryan Roberts In-Reply-To: <930b5f6a-27d9-43da-bf9f-1478c8de1af8@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.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 (fry.vger.email [0.0.0.0]); Thu, 16 Nov 2023 03:13:36 -0800 (PST) On 16/11/2023 11:01, David Hildenbrand wrote: > 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. > OK thanks. I'll rework for this approach in v3.