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_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 AA136C4338F for ; Fri, 23 Jul 2021 04:23:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2809960E8E for ; Fri, 23 Jul 2021 04:23:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2809960E8E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 36A436B005D; Fri, 23 Jul 2021 00:23:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 319FC6B006C; Fri, 23 Jul 2021 00:23:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 208496B0070; Fri, 23 Jul 2021 00:23:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0035.hostedemail.com [216.40.44.35]) by kanga.kvack.org (Postfix) with ESMTP id 0320D6B005D for ; Fri, 23 Jul 2021 00:23:17 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 8BDF6181AEF3C for ; Fri, 23 Jul 2021 04:23:17 +0000 (UTC) X-FDA: 78392558034.25.B900D82 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf01.hostedemail.com (Postfix) with ESMTP id 1DEAF5014F59 for ; Fri, 23 Jul 2021 04:23:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1627014196; h=from:from:reply-to: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; bh=RDqHRpETL/O2hE265L4eJPKQHOvkYVQFRK0q5+wQoR8=; b=YCePppPq9NRtcRX9CIvNRslB5z6Oxnz/kadAmXxxfTA3t9eXfMM4uC+03r5+AQDEHxm1hr w0La3LFpOU4zOh8kp1eLwrMLUjjRVbR48zIS1Yf47H64J2zjzkC53OfbrcceISaUsu10v9 0mmJIKO0gdyOIKwVcCYXLzUS/le7i+s= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-185-v8wIC43vPGGswb643-0W9A-1; Fri, 23 Jul 2021 00:23:12 -0400 X-MC-Unique: v8wIC43vPGGswb643-0W9A-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1AC243488C; Fri, 23 Jul 2021 04:23:11 +0000 (UTC) Received: from [10.64.54.195] (vpn2-54-195.bne.redhat.com [10.64.54.195]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 63E485D9C6; Fri, 23 Jul 2021 04:23:08 +0000 (UTC) Reply-To: Gavin Shan Subject: Re: [PATCH v3 07/12] mm/debug_vm_pgtable: Use struct pgtable_debug_args in PTE modifying tests To: Anshuman Khandual , linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, catalin.marinas@arm.com, will@kernel.org, akpm@linux-foundation.org, chuhu@redhat.com, shan.gavin@gmail.com References: <20210719130613.334901-1-gshan@redhat.com> <20210719130613.334901-8-gshan@redhat.com> <99c73652-7294-17ff-0c4f-986b588ab022@redhat.com> <492c96ea-5f60-2720-7da8-1fc18a1f95d3@arm.com> From: Gavin Shan Message-ID: <2666f07b-7a84-89a4-a738-ffb21f76ca8a@redhat.com> Date: Fri, 23 Jul 2021 14:23:24 +1000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 MIME-Version: 1.0 In-Reply-To: <492c96ea-5f60-2720-7da8-1fc18a1f95d3@arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=YCePppPq; spf=none (imf01.hostedemail.com: domain of gshan@redhat.com has no SPF policy when checking 216.205.24.124) smtp.mailfrom=gshan@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam02 X-Stat-Signature: k1ifq7xb64ct4d6yws8bxdjaqmoykxu5 X-Rspamd-Queue-Id: 1DEAF5014F59 X-HE-Tag: 1627014196-174865 Content-Transfer-Encoding: quoted-printable 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: Hi Anshuman, On 7/23/21 12:39 PM, Anshuman Khandual wrote: > On 7/22/21 12:07 PM, Gavin Shan wrote: >> >>>> =C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 pgdp =3D pgd_offset(mm, vaddr= ); >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 p4dp =3D p4d_alloc(mm, pgdp, vaddr); >>>> @@ -1272,11 +1275,11 @@ static int __init debug_vm_pgtable(void) >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 * Page table modifying tests. = They need to hold >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 * proper page table lock. >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 */ >>>> - >>>> -=C2=A0=C2=A0=C2=A0 ptep =3D pte_offset_map_lock(mm, pmdp, vaddr, &p= tl); >>>> -=C2=A0=C2=A0=C2=A0 pte_clear_tests(mm, ptep, pte_aligned, vaddr, pr= ot); >>>> -=C2=A0=C2=A0=C2=A0 pte_advanced_tests(mm, vma, ptep, pte_aligned, v= addr, prot); >>>> -=C2=A0=C2=A0=C2=A0 pte_unmap_unlock(ptep, ptl); >>>> +=C2=A0=C2=A0=C2=A0 ptl =3D pte_lockptr(args.mm, args.pmdp); >>>> +=C2=A0=C2=A0=C2=A0 spin_lock(ptl); >>>> +=C2=A0=C2=A0=C2=A0 pte_clear_tests(&args); >>>> +=C2=A0=C2=A0=C2=A0 pte_advanced_tests(&args); >>>> +=C2=A0=C2=A0=C2=A0 spin_unlock(ptl); >>> >>> Why pte_offset_map_lock()/pte_unmap_unlock() has been dropped and >>> spin_lock()/spin_unlock() sequence has been added ? Please dont >>> change the tests in these patches. >>> >> >> The semantics of pte_offset_map_lock() is to grab and take the lock >> and return the PTE entry, which is mapped if needed. We already had >> the PTE entry tracked by args->ptep in init_args(). So some of the >> operations covered by pte_offset_map_lock() isn't needed any more >=20 > To keep the patch on purpose, please avoid this change here. But if > required, you could send a follow up patch later. >=20 In order to use pte_offset_map_lock() and pte_unmap_unlock(), we need a temporary variable @ptep to store the return value from pte_offset_map_= lock(). The temporary variable @ptep is passed to pte_unmap_unlock(). It means we just need the temporary variable to keep the original implementation in this regard. I will keep pte_offset_map_lock() and pte_unmap_unlock() in v4. If we really want to remove the temporary variable (@ptep), we can do it after this series gets merged. Thanks, Gavin