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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FAF1C433F5 for ; Tue, 10 May 2022 16:00:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346709AbiEJQED (ORCPT ); Tue, 10 May 2022 12:04:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347557AbiEJQBs (ORCPT ); Tue, 10 May 2022 12:01:48 -0400 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0641B2A249 for ; Tue, 10 May 2022 08:55:40 -0700 (PDT) Received: by mail-pl1-x636.google.com with SMTP id x18so17120946plg.6 for ; Tue, 10 May 2022 08:55:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=uzcCgVmhU+wESri3om0ZJezhJTbuZg70xEa5Aqfd+Kk=; b=j/4xO85+1iXeH6xPw7ga+S3tLZMTM08tKdS6+/P2WQoPLZQM3bma31auNvCGgMI7Ar XO54JRbZ5BtLRTQg9/0nD+wbZZ/55C/zxqc/YAIJJJTmE7iJm3kNHNbP9yBeloVN8Zry uc/GfhYhqfU6uvbPNHL1W6I3MnTtamWPUcml19joeVb3pcEE9qHUkwkGiymZbtR/EUbw 7zM3U6UcRRiqqxkbrNMb0yPIE4AZfU+p+ZP8jTC6T8+mEeCfPiKx59vtN21407Yfg/el O70YHEfHrJATZ8c9AdE6A5yPOFTwxIhhzAxHsq3X0laMczaHf3YHRcMS0o6j/IYotzTh prfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=uzcCgVmhU+wESri3om0ZJezhJTbuZg70xEa5Aqfd+Kk=; b=rqrRN1kbPdkKnKSSz7pUipGFKOR8Qg7bINsrA+rksQ4IsfSFF+hd49/8fmleY8VFbZ 8VnYk9p7kowJYJrR17O1MoXlZYe0FC6MS2xM2l+8Yv9tWt0m0CGhYm6DA5+BLeL0B8Yo 1i3BRx5I0xbDra8WeH3nTCIDfSnlPj+3lLeo4EA8NP3KF1esXxoiyq59hpgzN9gLfDS5 hQloxSXoilBmeKyfcUMDv67qdX7sBJdGNjHn2zvLdbOnFkJvC+4Idm5+ledlSkUH36qr 9x0hvuBIcbLop5CRMHhb2gm/C8oJ35AHIjT2s4Fc+07aUWmfdJ+q/eDRSXGHt3TqlJA2 KXeA== X-Gm-Message-State: AOAM5321LT6USUPsdO0NkNdkr7tHC5IFnXRKBozst7Lqz0clhXLuzUQO /e+fZa6uwfSRrsM0qrHBFAB5eA== X-Google-Smtp-Source: ABdhPJzDPZtZKtrakyoFjvKdG06+B3/wtrOXa/yfusBAvuf8/HUplk+3U/L9l/GLUCHmXlz3bAN82w== X-Received: by 2002:a17:90b:1e04:b0:1dc:9252:efbc with SMTP id pg4-20020a17090b1e0400b001dc9252efbcmr621215pjb.39.1652198139513; Tue, 10 May 2022 08:55:39 -0700 (PDT) Received: from localhost ([139.177.225.234]) by smtp.gmail.com with ESMTPSA id x62-20020a623141000000b0050dc762819fsm10934700pfx.121.2022.05.10.08.55.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 May 2022 08:55:39 -0700 (PDT) Date: Tue, 10 May 2022 23:55:36 +0800 From: Muchun Song To: Baolin Wang Cc: catalin.marinas@arm.com, will@kernel.org, mike.kravetz@oracle.com, akpm@linux-foundation.org, willy@infradead.org, anshuman.khandual@arm.com, christophe.leroy@csgroup.eu, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 1/2] arm64/hugetlb: Use ptep_get() to get the pte value of a huge page Message-ID: References: <6aabddaf4cae5ae2205c3a7df9b9e15dbd61b641.1652180088.git.baolin.wang@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6aabddaf4cae5ae2205c3a7df9b9e15dbd61b641.1652180088.git.baolin.wang@linux.alibaba.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 10, 2022 at 07:12:52PM +0800, Baolin Wang wrote: > The original huge_ptep_get() on ARM64 is just a wrapper of ptep_get(), > which will not take into account any contig-PTEs dirty and access bits. > Meanwhile we will implement a new ARM64-specific huge_ptep_get() > interface in following patch, which will take into account any contig-PTEs > dirty and access bits and only be allowed to pass the head pte of > a contig-PTE/PMD size page. IIUC, the huge_ptep_get() you have implemented in patch 2 could handle non-head pte. It'll return the original pte without potential AD bit. I admit it is more efficeent to use ptep_get() directly, but the judgement here should be updated. With this update. Reviewed-by: Muchun Song Thanks. > Thus change to use ptep_get() to get the pte value of a huge page as > a preparation. > > Signed-off-by: Baolin Wang > --- > arch/arm64/mm/hugetlbpage.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c > index ca8e65c..be5e2f3 100644 > --- a/arch/arm64/mm/hugetlbpage.c > +++ b/arch/arm64/mm/hugetlbpage.c > @@ -172,7 +172,7 @@ static pte_t get_clear_flush(struct mm_struct *mm, > unsigned long pgsize, > unsigned long ncontig) > { > - pte_t orig_pte = huge_ptep_get(ptep); > + pte_t orig_pte = ptep_get(ptep); > bool valid = pte_valid(orig_pte); > unsigned long i, saddr = addr; > > @@ -385,7 +385,7 @@ pte_t huge_ptep_get_and_clear(struct mm_struct *mm, > { > int ncontig; > size_t pgsize; > - pte_t orig_pte = huge_ptep_get(ptep); > + pte_t orig_pte = ptep_get(ptep); > > if (!pte_cont(orig_pte)) > return ptep_get_and_clear(mm, addr, ptep); > @@ -408,11 +408,11 @@ static int __cont_access_flags_changed(pte_t *ptep, pte_t pte, int ncontig) > { > int i; > > - if (pte_write(pte) != pte_write(huge_ptep_get(ptep))) > + if (pte_write(pte) != pte_write(ptep_get(ptep))) > return 1; > > for (i = 0; i < ncontig; i++) { > - pte_t orig_pte = huge_ptep_get(ptep + i); > + pte_t orig_pte = ptep_get(ptep + i); > > if (pte_dirty(pte) != pte_dirty(orig_pte)) > return 1; > -- > 1.8.3.1 > > 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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9D987C433F5 for ; Tue, 10 May 2022 15:56:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=CtJzqG7DJDg20lzeD1nb+e2v26hHXRjZW6JRZoH4eek=; b=kraHX5F9y3F8L7 pxBDW/dCCDArB/Yg57smGWiT+oBI1I6Bw0lHMNQI7pzjH7J0uSPX+JKQFnKt8bh8IqbecsYPZkWx/ GW+2I6Tmr3ZipCyVfJvT/8yMiskjXL+oXyY7BcfgU/1kfk4ZouQJcsHlx0vsP+LFKYXvLxU/K7KJ3 gFLzqSQ0KtRHkoHatoisLWSy/BBOs+XLBeUZICVMEUV+Zw6pEWW9b/Zitho5UbK37EgBx36NyfGi4 H2OsUEj9uEWgY5V1TCRWehy3rf3G0el9LOCjPnrUGYah4Vy+KTWmlRc52v37tIxsBzwM835+OwqHR 7oX3NdRwKAmsvprqZgkw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1noSDD-002tNQ-02; Tue, 10 May 2022 15:55:47 +0000 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1noSD8-002tKI-MZ for linux-arm-kernel@lists.infradead.org; Tue, 10 May 2022 15:55:44 +0000 Received: by mail-pj1-x1034.google.com with SMTP id cq17-20020a17090af99100b001dc0386cd8fso2508750pjb.5 for ; Tue, 10 May 2022 08:55:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=uzcCgVmhU+wESri3om0ZJezhJTbuZg70xEa5Aqfd+Kk=; b=j/4xO85+1iXeH6xPw7ga+S3tLZMTM08tKdS6+/P2WQoPLZQM3bma31auNvCGgMI7Ar XO54JRbZ5BtLRTQg9/0nD+wbZZ/55C/zxqc/YAIJJJTmE7iJm3kNHNbP9yBeloVN8Zry uc/GfhYhqfU6uvbPNHL1W6I3MnTtamWPUcml19joeVb3pcEE9qHUkwkGiymZbtR/EUbw 7zM3U6UcRRiqqxkbrNMb0yPIE4AZfU+p+ZP8jTC6T8+mEeCfPiKx59vtN21407Yfg/el O70YHEfHrJATZ8c9AdE6A5yPOFTwxIhhzAxHsq3X0laMczaHf3YHRcMS0o6j/IYotzTh prfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=uzcCgVmhU+wESri3om0ZJezhJTbuZg70xEa5Aqfd+Kk=; b=ZHBXzsQDwIudn4bUrtxLCj2VnKQEmx5vo1JMZBPLuC+6nyG1sFXD7o0R/rdkIACw8q AYp8R+pfggkANpkNJXI27JnIye1K+XHZKjjym6UKrs2dEMHos50sndlZTh4qbePhYG40 LU9tgtasS9uArQg6/dt8UfaVax7IBzzeIY/cwQHR57/g9As4ugfZ9z+31XPRo6PAupiO 8Gj0Q/+8hvaWynjQMPo22jQT7pwK2djuSv9oCSLxggMQfVDb+U2tFqqIc/bU2N3DYQIx WwfTp84sJHpUODeK8A1GzwNEbPckGDPfxNJVaj+Ch0eL0WWTSXhdyCRppZTMxm+P6jJT d4mQ== X-Gm-Message-State: AOAM5337NlQUo5klt8GFwPpEE61AB9cE64t2eNLM75SzXappFAYp4DsI 3ue3JoAWYnriEMQo81xFFlcdOg== X-Google-Smtp-Source: ABdhPJzDPZtZKtrakyoFjvKdG06+B3/wtrOXa/yfusBAvuf8/HUplk+3U/L9l/GLUCHmXlz3bAN82w== X-Received: by 2002:a17:90b:1e04:b0:1dc:9252:efbc with SMTP id pg4-20020a17090b1e0400b001dc9252efbcmr621215pjb.39.1652198139513; Tue, 10 May 2022 08:55:39 -0700 (PDT) Received: from localhost ([139.177.225.234]) by smtp.gmail.com with ESMTPSA id x62-20020a623141000000b0050dc762819fsm10934700pfx.121.2022.05.10.08.55.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 May 2022 08:55:39 -0700 (PDT) Date: Tue, 10 May 2022 23:55:36 +0800 From: Muchun Song To: Baolin Wang Cc: catalin.marinas@arm.com, will@kernel.org, mike.kravetz@oracle.com, akpm@linux-foundation.org, willy@infradead.org, anshuman.khandual@arm.com, christophe.leroy@csgroup.eu, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 1/2] arm64/hugetlb: Use ptep_get() to get the pte value of a huge page Message-ID: References: <6aabddaf4cae5ae2205c3a7df9b9e15dbd61b641.1652180088.git.baolin.wang@linux.alibaba.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <6aabddaf4cae5ae2205c3a7df9b9e15dbd61b641.1652180088.git.baolin.wang@linux.alibaba.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220510_085542_965033_C83B92F4 X-CRM114-Status: GOOD ( 22.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, May 10, 2022 at 07:12:52PM +0800, Baolin Wang wrote: > The original huge_ptep_get() on ARM64 is just a wrapper of ptep_get(), > which will not take into account any contig-PTEs dirty and access bits. > Meanwhile we will implement a new ARM64-specific huge_ptep_get() > interface in following patch, which will take into account any contig-PTEs > dirty and access bits and only be allowed to pass the head pte of > a contig-PTE/PMD size page. IIUC, the huge_ptep_get() you have implemented in patch 2 could handle non-head pte. It'll return the original pte without potential AD bit. I admit it is more efficeent to use ptep_get() directly, but the judgement here should be updated. With this update. Reviewed-by: Muchun Song Thanks. > Thus change to use ptep_get() to get the pte value of a huge page as > a preparation. > > Signed-off-by: Baolin Wang > --- > arch/arm64/mm/hugetlbpage.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c > index ca8e65c..be5e2f3 100644 > --- a/arch/arm64/mm/hugetlbpage.c > +++ b/arch/arm64/mm/hugetlbpage.c > @@ -172,7 +172,7 @@ static pte_t get_clear_flush(struct mm_struct *mm, > unsigned long pgsize, > unsigned long ncontig) > { > - pte_t orig_pte = huge_ptep_get(ptep); > + pte_t orig_pte = ptep_get(ptep); > bool valid = pte_valid(orig_pte); > unsigned long i, saddr = addr; > > @@ -385,7 +385,7 @@ pte_t huge_ptep_get_and_clear(struct mm_struct *mm, > { > int ncontig; > size_t pgsize; > - pte_t orig_pte = huge_ptep_get(ptep); > + pte_t orig_pte = ptep_get(ptep); > > if (!pte_cont(orig_pte)) > return ptep_get_and_clear(mm, addr, ptep); > @@ -408,11 +408,11 @@ static int __cont_access_flags_changed(pte_t *ptep, pte_t pte, int ncontig) > { > int i; > > - if (pte_write(pte) != pte_write(huge_ptep_get(ptep))) > + if (pte_write(pte) != pte_write(ptep_get(ptep))) > return 1; > > for (i = 0; i < ncontig; i++) { > - pte_t orig_pte = huge_ptep_get(ptep + i); > + pte_t orig_pte = ptep_get(ptep + i); > > if (pte_dirty(pte) != pte_dirty(orig_pte)) > return 1; > -- > 1.8.3.1 > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel