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=-10.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, 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 5C5F3C433ED for ; Thu, 20 May 2021 08:27:24 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8F71860FEE for ; Thu, 20 May 2021 08:27:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8F71860FEE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 211376B006C; Thu, 20 May 2021 04:27:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1C1D96B006E; Thu, 20 May 2021 04:27:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F2EE16B0072; Thu, 20 May 2021 04:27:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0053.hostedemail.com [216.40.44.53]) by kanga.kvack.org (Postfix) with ESMTP id BDC226B006C for ; Thu, 20 May 2021 04:27:22 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 51D3318001190 for ; Thu, 20 May 2021 08:27:22 +0000 (UTC) X-FDA: 78160929924.03.3F177CB Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf17.hostedemail.com (Postfix) with ESMTP id 1ADF340B8CED for ; Thu, 20 May 2021 08:27:20 +0000 (UTC) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 14K84J4E004573; Thu, 20 May 2021 04:27:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=subject : to : cc : references : from : message-id : date : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pp1; bh=YX41XFWu+zMPNKf6mrGnpPlK/sRCym1SIXpEM84+Hsk=; b=sLwql3XpLLfoiFxH9g6Mn6xOGcQ01FnLw5+SB+wIG7uZr0/L2m4Ygcz3vLdvq38hzyYi IDjmvJCAc2xPgyQPeqrmz04AaDoe38MlAYymobIVvQqjnnBV0NTWqula9oLwKNs8rdQi KQrByn18H2CkA2VnKd8rtsRdk9/9i3mm3XrK67/ZLvvbi1MgGC2ETOQiSxYnRSddLwZE IZtu2kM4vDczWgRfzoop4iw9c9vzE/Iie2BwlxT0JmYZPk+wnYmisF/tNcrOyGPcwWBV 68a7qjOewCXNX4ZSwBd6TWHZiKYiFwjy1VNWVgD0GcT+s7jbuHcGGJy94qSs6Z7daxMr Fg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 38nksgrwhk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 May 2021 04:27:02 -0400 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 14K84OiI005266; Thu, 20 May 2021 04:27:02 -0400 Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0a-001b2d01.pphosted.com with ESMTP id 38nksgrwgt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 May 2021 04:27:02 -0400 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 14K8NEtN013466; Thu, 20 May 2021 08:26:59 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma06fra.de.ibm.com with ESMTP id 38j5jh1d0e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 May 2021 08:26:59 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 14K8Qvom28311864 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 May 2021 08:26:57 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 40B51A4040; Thu, 20 May 2021 08:26:57 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 41B94A4057; Thu, 20 May 2021 08:26:55 +0000 (GMT) Received: from [9.85.101.109] (unknown [9.85.101.109]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 20 May 2021 08:26:55 +0000 (GMT) Subject: Re: [PATCH v5 3/9] mm/mremap: Use pmd/pud_poplulate to update page table entries To: Peter Xu Cc: Nathan Chancellor , 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: "Aneesh Kumar K.V" Message-ID: <6e0dbb76-2b33-53f1-246e-30cec2b871e2@linux.ibm.com> Date: Thu, 20 May 2021 13:56:54 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-TM-AS-GCONF: 00 X-Proofpoint-GUID: ppsnSJx0qftr1M4U6zU4uGqR3s2-kcSm X-Proofpoint-ORIG-GUID: s1cYGwc5XAE62YHudVR4gHmSPkDQaQ0C Content-Transfer-Encoding: 7bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.761 definitions=2021-05-20_01:2021-05-20,2021-05-19 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 impostorscore=0 clxscore=1015 bulkscore=0 priorityscore=1501 mlxscore=0 adultscore=0 suspectscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105200060 Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=sLwql3Xp; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf17.hostedemail.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com X-Stat-Signature: jqznxfh1notm7riiixchsfwtje5wh5ye X-Rspamd-Queue-Id: 1ADF340B8CED X-Rspamd-Server: rspam02 X-HE-Tag: 1621499240-6899 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/20/21 7:48 AM, Peter Xu wrote: > On Wed, May 19, 2021 at 10:16:07AM +0530, Aneesh Kumar K.V wrote: >>> 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. > > [1] > >> Can you try this change? >> >> 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); > > I reported this issue today somewhere else: > > https://lore.kernel.org/linux-mm/YKVemB5DuSqLFmmz@t490s/ > > And came to this same line after the bisection. > > This seems to work at least for my userfaultfd test on shmem, however I don't > fully understand the commit message [1] on: How do we guarantee we're not > moving a thp pte? > move_page_tables() checks for pmd_trans_huge() and ends up calling move_huge_pmd if it is a THP entry. -aneesh 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=-10.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, 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 D44ABC433B4 for ; Thu, 20 May 2021 08:27:54 +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 4B82C610A2 for ; Thu, 20 May 2021 08:27:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4B82C610A2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com 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 4Fm2tJ6sH7z306d for ; Thu, 20 May 2021 18:27:52 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=sLwql3Xp; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=aneesh.kumar@linux.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=sLwql3Xp; dkim-atps=neutral Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (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 4Fm2sn3ftmz2xvK for ; Thu, 20 May 2021 18:27:24 +1000 (AEST) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 14K84J4E004573; Thu, 20 May 2021 04:27:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=subject : to : cc : references : from : message-id : date : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pp1; bh=YX41XFWu+zMPNKf6mrGnpPlK/sRCym1SIXpEM84+Hsk=; b=sLwql3XpLLfoiFxH9g6Mn6xOGcQ01FnLw5+SB+wIG7uZr0/L2m4Ygcz3vLdvq38hzyYi IDjmvJCAc2xPgyQPeqrmz04AaDoe38MlAYymobIVvQqjnnBV0NTWqula9oLwKNs8rdQi KQrByn18H2CkA2VnKd8rtsRdk9/9i3mm3XrK67/ZLvvbi1MgGC2ETOQiSxYnRSddLwZE IZtu2kM4vDczWgRfzoop4iw9c9vzE/Iie2BwlxT0JmYZPk+wnYmisF/tNcrOyGPcwWBV 68a7qjOewCXNX4ZSwBd6TWHZiKYiFwjy1VNWVgD0GcT+s7jbuHcGGJy94qSs6Z7daxMr Fg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 38nksgrwhk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 May 2021 04:27:02 -0400 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 14K84OiI005266; Thu, 20 May 2021 04:27:02 -0400 Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0a-001b2d01.pphosted.com with ESMTP id 38nksgrwgt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 May 2021 04:27:02 -0400 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 14K8NEtN013466; Thu, 20 May 2021 08:26:59 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma06fra.de.ibm.com with ESMTP id 38j5jh1d0e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 May 2021 08:26:59 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 14K8Qvom28311864 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 May 2021 08:26:57 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 40B51A4040; Thu, 20 May 2021 08:26:57 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 41B94A4057; Thu, 20 May 2021 08:26:55 +0000 (GMT) Received: from [9.85.101.109] (unknown [9.85.101.109]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 20 May 2021 08:26:55 +0000 (GMT) Subject: Re: [PATCH v5 3/9] mm/mremap: Use pmd/pud_poplulate to update page table entries To: Peter Xu References: <20210422054323.150993-1-aneesh.kumar@linux.ibm.com> <20210422054323.150993-4-aneesh.kumar@linux.ibm.com> <87mtsrqqk0.fsf@linux.ibm.com> From: "Aneesh Kumar K.V" Message-ID: <6e0dbb76-2b33-53f1-246e-30cec2b871e2@linux.ibm.com> Date: Thu, 20 May 2021 13:56:54 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-TM-AS-GCONF: 00 X-Proofpoint-GUID: ppsnSJx0qftr1M4U6zU4uGqR3s2-kcSm X-Proofpoint-ORIG-GUID: s1cYGwc5XAE62YHudVR4gHmSPkDQaQ0C Content-Transfer-Encoding: 7bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.761 definitions=2021-05-20_01:2021-05-20, 2021-05-19 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 impostorscore=0 clxscore=1015 bulkscore=0 priorityscore=1501 mlxscore=0 adultscore=0 suspectscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105200060 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, Nathan Chancellor , 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/20/21 7:48 AM, Peter Xu wrote: > On Wed, May 19, 2021 at 10:16:07AM +0530, Aneesh Kumar K.V wrote: >>> 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. > > [1] > >> Can you try this change? >> >> 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); > > I reported this issue today somewhere else: > > https://lore.kernel.org/linux-mm/YKVemB5DuSqLFmmz@t490s/ > > And came to this same line after the bisection. > > This seems to work at least for my userfaultfd test on shmem, however I don't > fully understand the commit message [1] on: How do we guarantee we're not > moving a thp pte? > move_page_tables() checks for pmd_trans_huge() and ends up calling move_huge_pmd if it is a THP entry. -aneesh