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=-5.3 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 78444C63797 for ; Thu, 22 Jul 2021 06:55:05 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 286EA6100C for ; Thu, 22 Jul 2021 06:55:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 286EA6100C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B84D46B006C; Thu, 22 Jul 2021 02:55:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B33786B0071; Thu, 22 Jul 2021 02:55:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9FB2D6B0072; Thu, 22 Jul 2021 02:55:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0224.hostedemail.com [216.40.44.224]) by kanga.kvack.org (Postfix) with ESMTP id 81D2D6B006C for ; Thu, 22 Jul 2021 02:55:04 -0400 (EDT) Received: from smtpin38.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 366EB82499A8 for ; Thu, 22 Jul 2021 06:55:04 +0000 (UTC) X-FDA: 78389311728.38.DA5BE79 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf13.hostedemail.com (Postfix) with ESMTP id DD1CB103B778 for ; Thu, 22 Jul 2021 06:55:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626936903; 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=EQVCng+li2VqCvgwwVsr3N15LvPWZJi5vTPPAqH9HhU=; b=UzNMD+eF970iClssAWtgLFyIWiiybEXkaOqWR0axBesR+brr9mcUZ68Ud5awFZmiQ44WoE udg6+Q3xJntZEjRnUkpAlaV4dbPTEG+w539qVasmKO5lXLbtF9Xvr2OIw+S1KiVDHbqwRe VhA9w9TBdsLYrpCgbXa//p3rwDTUe2c= 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-365-rthJiOKuO3OmSpSyAJQ-6A-1; Thu, 22 Jul 2021 02:55:01 -0400 X-MC-Unique: rthJiOKuO3OmSpSyAJQ-6A-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E2765100D3A9; Thu, 22 Jul 2021 06:54:14 +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 1E92A19D7C; Thu, 22 Jul 2021 06:54:11 +0000 (UTC) Reply-To: Gavin Shan Subject: Re: [PATCH v3 12/12] mm/debug_vm_pgtable: Fix corrupted page flag 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-13-gshan@redhat.com> <57cb2f04-b3f2-2df4-3d9b-0b430b9c9f3e@arm.com> <8157142c-58e0-44c4-5cdb-76fff4a07210@redhat.com> <5db75fd6-aeb9-c06f-30ab-839c09a0bc68@arm.com> From: Gavin Shan Message-ID: <5d9f2080-7020-d3f0-73cc-ae2af0943303@redhat.com> Date: Thu, 22 Jul 2021 16:54:29 +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: <5db75fd6-aeb9-c06f-30ab-839c09a0bc68@arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: DD1CB103B778 X-Stat-Signature: 3tw4sgb8u9n685c8i8waz3hw7zgrk83p Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=UzNMD+eF; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf13.hostedemail.com: domain of gshan@redhat.com has no SPF policy when checking 216.205.24.124) smtp.mailfrom=gshan@redhat.com X-HE-Tag: 1626936903-133635 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/22/21 1:51 PM, Anshuman Khandual wrote: > Small nit: >=20 > s/Fix corrupted page flag/Fix page flag corruption on arm64/ >=20 Sure, The replacement will be applied in v4, thanks! > On 7/21/21 5:33 PM, Gavin Shan wrote: >> Hi Anshuman, >> >> On 7/21/21 8:18 PM, Anshuman Khandual wrote: >>> On 7/19/21 6:36 PM, Gavin Shan wrote: >>>> In page table entry modifying tests, set_xxx_at() are used to popula= te >>>> the page table entries. On ARM64, PG_arch_1 is set to the target pag= e >>>> flag if execution permission is given. The page flag is kept when th= e >>>> page is free'd to buddy's free area list. However, it will trigger p= age >>>> checking failure when it's pulled from the buddy's free area list, a= s >>>> the following warning messages indicate. >>>> >>>> =C2=A0=C2=A0=C2=A0 BUG: Bad page state in process memhog=C2=A0 pfn:= 08000 >>>> =C2=A0=C2=A0=C2=A0 page:0000000015c0a628 refcount:0 mapcount:0 \ >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 mapping:0000000000= 000000 index:0x1 pfn:0x8000 >>>> =C2=A0=C2=A0=C2=A0 flags: 0x7ffff8000000800(arch_1|node=3D0|zone=3D= 0|lastcpupid=3D0xfffff) >>>> =C2=A0=C2=A0=C2=A0 raw: 07ffff8000000800 dead000000000100 dead00000= 0000122 0000000000000000 >>>> =C2=A0=C2=A0=C2=A0 raw: 0000000000000001 0000000000000000 00000000f= fffffff 0000000000000000 >>>> =C2=A0=C2=A0=C2=A0 page dumped because: PAGE_FLAGS_CHECK_AT_PREP fl= ag(s) set >>>> >>>> This fixes the issue by clearing PG_arch_1 through flush_dcache_page= () >>>> after set_xxx_at() is called. >>> >>> Could you please add comments before each flush_dcache_page() instanc= e >>> explaining why this is needed for arm64 platforms with relevant PG_ar= ch_1 >>> context and how this does not have any adverse effect on other platfo= rms ? >>> It should be easy for some one looking at this code after a while to = figure >>> out from where flush_dcache_page() came from. >>> >> >> Good point. I will improve chage log to include the commit ID in v4 wh= ere the >> page flag (PG_arch_1) is used and explain how. In that case, it's much= clearer >> to understand the reason why we need flush_dcache_page() after set_xxx= _at() on >> ARM64. >=20 > But also some in code comments where flush_dcache_page() is being calle= d. >=20 Yes, I will add some comments where flush_dcache_page() is called in v4. Thanks, Gavin