From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-22.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0BE7C433ED for ; Wed, 19 May 2021 18:02:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7399A61353 for ; Wed, 19 May 2021 18:02:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7399A61353 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id AE4C26B0036; Wed, 19 May 2021 14:02:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A94946B006E; Wed, 19 May 2021 14:02:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9356A6B0070; Wed, 19 May 2021 14:02:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0075.hostedemail.com [216.40.44.75]) by kanga.kvack.org (Postfix) with ESMTP id 6306E6B0036 for ; Wed, 19 May 2021 14:02:41 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id EEFB2180385FC for ; Wed, 19 May 2021 18:02:40 +0000 (UTC) X-FDA: 78158750880.23.D266B41 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf05.hostedemail.com (Postfix) with ESMTP id 52D1AE000136 for ; Wed, 19 May 2021 18:02:39 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id EEC07611BF; Wed, 19 May 2021 18:02:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1621447359; bh=4G51wYYLkZ/TW7ndcHnUvtn1v/wSsDBwD5+CCYdOSno=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=C4pxVUnm+TJxhhV0pi9drq2UEVcZmM7yx1F/m/I8kaOl1RBi8h63PlWEkEznXx/nL loxelmM0TrkNqVi6nTtzxBdfnurtNs+HXtxcHAj9scMAbqL1N/D7rxKmvtzPCrklDO 2aCeQ5q8kBWk7QrBVXdOY7L6BgHFoT/xx/tETaRofFCVXo7ffOOyz9HTJpaqDMplzP qeGJcD7xI06DFM2ZuF+9cSsJVo78kLLoRA4r6W/4EHuNAI3t0nhM6tOahQYZjnVDHH BBl3UVarPvfrK94GQ4ahEHF6t7CxdCV4XwTLAzXakKxyKgn/+Jl6APLTwjFopCigLi d6jV53PoFchZg== Subject: Re: [PATCH v5 3/9] mm/mremap: Use pmd/pud_poplulate to update page table entries To: "Aneesh Kumar K.V" Cc: linux-mm@kvack.org, akpm@linux-foundation.org, mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org, kaleshsingh@google.com, npiggin@gmail.com, joel@joelfernandes.org, Christophe Leroy References: <20210422054323.150993-1-aneesh.kumar@linux.ibm.com> <20210422054323.150993-4-aneesh.kumar@linux.ibm.com> <87mtsrqqk0.fsf@linux.ibm.com> From: Nathan Chancellor Message-ID: <4bc25749-9ae8-6591-f4f6-4ef1c209d3a0@kernel.org> Date: Wed, 19 May 2021 11:02:37 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: <87mtsrqqk0.fsf@linux.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 52D1AE000136 Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=C4pxVUnm; spf=pass (imf05.hostedemail.com: domain of nathan@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=nathan@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-Rspamd-Server: rspam04 X-Stat-Signature: z14bji9tj7kmam1jw9t566zym4b6kffg X-HE-Tag: 1621447359-789915 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 5/18/2021 9:46 PM, Aneesh Kumar K.V wrote: > Nathan Chancellor writes: > >> Hi Aneesh, >> >> On Thu, Apr 22, 2021 at 11:13:17AM +0530, Aneesh Kumar K.V wrote: >>> pmd/pud_populate is the right interface to be used to set the respective >>> page table entries. Some architectures like ppc64 do assume that set_pmd/pud_at >>> can only be used to set a hugepage PTE. Since we are not setting up a hugepage >>> PTE here, use the pmd/pud_populate interface. >>> >>> Signed-off-by: Aneesh Kumar K.V >>> --- >>> mm/mremap.c | 7 +++---- >>> 1 file changed, 3 insertions(+), 4 deletions(-) >>> >>> diff --git a/mm/mremap.c b/mm/mremap.c >>> index ec8f840399ed..574287f9bb39 100644 >>> --- a/mm/mremap.c >>> +++ b/mm/mremap.c >>> @@ -26,6 +26,7 @@ >>> >>> #include >>> #include >>> +#include >>> >>> #include "internal.h" >>> >>> @@ -257,9 +258,8 @@ static bool move_normal_pmd(struct vm_area_struct *vma, unsigned long old_addr, >>> pmd_clear(old_pmd); >>> >>> VM_BUG_ON(!pmd_none(*new_pmd)); >>> + pmd_populate(mm, new_pmd, (pgtable_t)pmd_page_vaddr(pmd)); >>> >>> - /* Set the new pmd */ >>> - set_pmd_at(mm, new_addr, new_pmd, pmd); >>> flush_tlb_range(vma, old_addr, old_addr + PMD_SIZE); >>> if (new_ptl != old_ptl) >>> spin_unlock(new_ptl); >>> @@ -306,8 +306,7 @@ static bool move_normal_pud(struct vm_area_struct *vma, unsigned long old_addr, >>> >>> VM_BUG_ON(!pud_none(*new_pud)); >>> >>> - /* Set the new pud */ >>> - set_pud_at(mm, new_addr, new_pud, pud); >>> + pud_populate(mm, new_pud, (pmd_t *)pud_page_vaddr(pud)); >>> flush_tlb_range(vma, old_addr, old_addr + PUD_SIZE); >>> if (new_ptl != old_ptl) >>> spin_unlock(new_ptl); >>> -- >>> 2.30.2 >>> >>> >> >> This commit causes my WSL2 VM to close when compiling something memory >> intensive, such as an x86_64_defconfig + CONFIG_LTO_CLANG_FULL=y kernel >> or LLVM/Clang. Unfortunately, I do not have much further information to >> provide since I do not see any sort of splat in dmesg right before it >> closes and I have found zero information about getting the previous >> kernel message in WSL2 (custom init so no systemd or anything). >> >> The config file is the stock one from Microsoft: >> >> https://github.com/microsoft/WSL2-Linux-Kernel/blob/a571dc8cedc8e0e56487c0dc93243e0b5db8960a/Microsoft/config-wsl >> >> I have attached my .config anyways, which includes CONFIG_DEBUG_VM, >> which does not appear to show anything out of the ordinary. I have also >> attached a dmesg just in case anything sticks out. I am happy to provide >> any additional information or perform additional debugging steps as >> needed. >> > > Can you try this change? Thank you for the quick diff! This resolves my issue. Tested-by: Nathan Chancellor > modified mm/mremap.c > @@ -279,7 +279,7 @@ static bool move_normal_pmd(struct vm_area_struct *vma, unsigned long old_addr, > pmd_clear(old_pmd); > > VM_BUG_ON(!pmd_none(*new_pmd)); > - pmd_populate(mm, new_pmd, (pgtable_t)pmd_page_vaddr(pmd)); > + pmd_populate(mm, new_pmd, pmd_pgtable(pmd)); > > if (new_ptl != old_ptl) > spin_unlock(new_ptl); > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.3 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 062D2C433B4 for ; Wed, 19 May 2021 18:03:13 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 680C16124C for ; Wed, 19 May 2021 18:03:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 680C16124C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4FlghZ4jQVz2yyM for ; Thu, 20 May 2021 04:03:10 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=C4pxVUnm; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=198.145.29.99; helo=mail.kernel.org; envelope-from=nathan@kernel.org; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=C4pxVUnm; dkim-atps=neutral Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Flgh24y5Rz2xvF for ; Thu, 20 May 2021 04:02:42 +1000 (AEST) Received: by mail.kernel.org (Postfix) with ESMTPSA id EEC07611BF; Wed, 19 May 2021 18:02:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1621447359; bh=4G51wYYLkZ/TW7ndcHnUvtn1v/wSsDBwD5+CCYdOSno=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=C4pxVUnm+TJxhhV0pi9drq2UEVcZmM7yx1F/m/I8kaOl1RBi8h63PlWEkEznXx/nL loxelmM0TrkNqVi6nTtzxBdfnurtNs+HXtxcHAj9scMAbqL1N/D7rxKmvtzPCrklDO 2aCeQ5q8kBWk7QrBVXdOY7L6BgHFoT/xx/tETaRofFCVXo7ffOOyz9HTJpaqDMplzP qeGJcD7xI06DFM2ZuF+9cSsJVo78kLLoRA4r6W/4EHuNAI3t0nhM6tOahQYZjnVDHH BBl3UVarPvfrK94GQ4ahEHF6t7CxdCV4XwTLAzXakKxyKgn/+Jl6APLTwjFopCigLi d6jV53PoFchZg== Subject: Re: [PATCH v5 3/9] mm/mremap: Use pmd/pud_poplulate to update page table entries To: "Aneesh Kumar K.V" References: <20210422054323.150993-1-aneesh.kumar@linux.ibm.com> <20210422054323.150993-4-aneesh.kumar@linux.ibm.com> <87mtsrqqk0.fsf@linux.ibm.com> From: Nathan Chancellor Message-ID: <4bc25749-9ae8-6591-f4f6-4ef1c209d3a0@kernel.org> Date: Wed, 19 May 2021 11:02:37 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: <87mtsrqqk0.fsf@linux.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: npiggin@gmail.com, linux-mm@kvack.org, kaleshsingh@google.com, joel@joelfernandes.org, akpm@linux-foundation.org, linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On 5/18/2021 9:46 PM, Aneesh Kumar K.V wrote: > Nathan Chancellor writes: > >> Hi Aneesh, >> >> On Thu, Apr 22, 2021 at 11:13:17AM +0530, Aneesh Kumar K.V wrote: >>> pmd/pud_populate is the right interface to be used to set the respective >>> page table entries. Some architectures like ppc64 do assume that set_pmd/pud_at >>> can only be used to set a hugepage PTE. Since we are not setting up a hugepage >>> PTE here, use the pmd/pud_populate interface. >>> >>> Signed-off-by: Aneesh Kumar K.V >>> --- >>> mm/mremap.c | 7 +++---- >>> 1 file changed, 3 insertions(+), 4 deletions(-) >>> >>> diff --git a/mm/mremap.c b/mm/mremap.c >>> index ec8f840399ed..574287f9bb39 100644 >>> --- a/mm/mremap.c >>> +++ b/mm/mremap.c >>> @@ -26,6 +26,7 @@ >>> >>> #include >>> #include >>> +#include >>> >>> #include "internal.h" >>> >>> @@ -257,9 +258,8 @@ static bool move_normal_pmd(struct vm_area_struct *vma, unsigned long old_addr, >>> pmd_clear(old_pmd); >>> >>> VM_BUG_ON(!pmd_none(*new_pmd)); >>> + pmd_populate(mm, new_pmd, (pgtable_t)pmd_page_vaddr(pmd)); >>> >>> - /* Set the new pmd */ >>> - set_pmd_at(mm, new_addr, new_pmd, pmd); >>> flush_tlb_range(vma, old_addr, old_addr + PMD_SIZE); >>> if (new_ptl != old_ptl) >>> spin_unlock(new_ptl); >>> @@ -306,8 +306,7 @@ static bool move_normal_pud(struct vm_area_struct *vma, unsigned long old_addr, >>> >>> VM_BUG_ON(!pud_none(*new_pud)); >>> >>> - /* Set the new pud */ >>> - set_pud_at(mm, new_addr, new_pud, pud); >>> + pud_populate(mm, new_pud, (pmd_t *)pud_page_vaddr(pud)); >>> flush_tlb_range(vma, old_addr, old_addr + PUD_SIZE); >>> if (new_ptl != old_ptl) >>> spin_unlock(new_ptl); >>> -- >>> 2.30.2 >>> >>> >> >> This commit causes my WSL2 VM to close when compiling something memory >> intensive, such as an x86_64_defconfig + CONFIG_LTO_CLANG_FULL=y kernel >> or LLVM/Clang. Unfortunately, I do not have much further information to >> provide since I do not see any sort of splat in dmesg right before it >> closes and I have found zero information about getting the previous >> kernel message in WSL2 (custom init so no systemd or anything). >> >> The config file is the stock one from Microsoft: >> >> https://github.com/microsoft/WSL2-Linux-Kernel/blob/a571dc8cedc8e0e56487c0dc93243e0b5db8960a/Microsoft/config-wsl >> >> I have attached my .config anyways, which includes CONFIG_DEBUG_VM, >> which does not appear to show anything out of the ordinary. I have also >> attached a dmesg just in case anything sticks out. I am happy to provide >> any additional information or perform additional debugging steps as >> needed. >> > > Can you try this change? Thank you for the quick diff! This resolves my issue. Tested-by: Nathan Chancellor > modified mm/mremap.c > @@ -279,7 +279,7 @@ static bool move_normal_pmd(struct vm_area_struct *vma, unsigned long old_addr, > pmd_clear(old_pmd); > > VM_BUG_ON(!pmd_none(*new_pmd)); > - pmd_populate(mm, new_pmd, (pgtable_t)pmd_page_vaddr(pmd)); > + pmd_populate(mm, new_pmd, pmd_pgtable(pmd)); > > if (new_ptl != old_ptl) > spin_unlock(new_ptl); >