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.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,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 B3AF8C4338F for ; Wed, 28 Jul 2021 10:04:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 602AA60F23 for ; Wed, 28 Jul 2021 10:04:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 602AA60F23 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id C3BC26B0036; Wed, 28 Jul 2021 06:04:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BEB846B005D; Wed, 28 Jul 2021 06:04:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B00E28D0001; Wed, 28 Jul 2021 06:04:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0020.hostedemail.com [216.40.44.20]) by kanga.kvack.org (Postfix) with ESMTP id 999946B0036 for ; Wed, 28 Jul 2021 06:04:54 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 1C6211DAE0 for ; Wed, 28 Jul 2021 10:04:54 +0000 (UTC) X-FDA: 78411562908.07.C66D01B Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf12.hostedemail.com (Postfix) with ESMTP id 9D11F10055A4 for ; Wed, 28 Jul 2021 10:04:53 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AB5FC31B; Wed, 28 Jul 2021 03:04:52 -0700 (PDT) Received: from [10.163.65.183] (unknown [10.163.65.183]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 473503F73D; Wed, 28 Jul 2021 03:04:49 -0700 (PDT) Subject: Re: [PATCH v4 12/12] mm/debug_vm_pgtable: Fix corrupted page flag To: Christophe Leroy , Gavin Shan Cc: shan.gavin@gmail.com, chuhu@redhat.com, akpm@linux-foundation.org, will@kernel.org, catalin.marinas@arm.com, cai@lca.pw, aneesh.kumar@linux.ibm.com, gerald.schaefer@linux.ibm.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <20210727061401.592616-1-gshan@redhat.com> <20210727061401.592616-13-gshan@redhat.com> <20210728095326.Horde.k1npSPaQKh2i7W3XoBsdiQ3@messagerie.c-s.fr> From: Anshuman Khandual Message-ID: <58a1eaa9-ba63-403b-1f4b-c22f23a3a0d3@arm.com> Date: Wed, 28 Jul 2021 15:35:37 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210728095326.Horde.k1npSPaQKh2i7W3XoBsdiQ3@messagerie.c-s.fr> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Authentication-Results: imf12.hostedemail.com; dkim=none; spf=pass (imf12.hostedemail.com: domain of anshuman.khandual@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com; dmarc=pass (policy=none) header.from=arm.com X-Rspamd-Server: rspam02 X-Stat-Signature: 5aag89crrasosk7mxqy41mawbbmjx18f X-Rspamd-Queue-Id: 9D11F10055A4 X-HE-Tag: 1627466693-574729 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: On 7/28/21 1:23 PM, Christophe Leroy wrote: > Gavin Shan a =C3=A9crit=C2=A0: >=20 >> In page table entry modifying tests, set_xxx_at() are used to populate >> the page table entries. On ARM64, PG_arch_1 (PG_dcache_clean) flag is >> set to the target page flag if execution permission is given. The logi= c >> exits since commit 4f04d8f00545 ("arm64: MMU definitions"). The page >> flag is kept when the page is free'd to buddy's free area list. Howeve= r, >> it will trigger page checking failure when it's pulled from the buddy'= s >> free area list, as the following warning messages indicate. >> >> =C2=A0=C2=A0 BUG: Bad page state in process memhog=C2=A0 pfn:08000 >> =C2=A0=C2=A0 page:0000000015c0a628 refcount:0 mapcount:0 \ >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 mapping:0000000000000000 in= dex:0x1 pfn:0x8000 >> =C2=A0=C2=A0 flags: 0x7ffff8000000800(arch_1|node=3D0|zone=3D0|lastcpu= pid=3D0xfffff) >> =C2=A0=C2=A0 raw: 07ffff8000000800 dead000000000100 dead000000000122 0= 000000000000000 >> =C2=A0=C2=A0 raw: 0000000000000001 0000000000000000 00000000ffffffff 0= 000000000000000 >> =C2=A0=C2=A0 page dumped because: PAGE_FLAGS_CHECK_AT_PREP flag(s) set >> >> This fixes the issue by clearing PG_arch_1 through flush_dcache_page() >> after set_xxx_at() is called. For architectures other than ARM64, the >> unexpected overhead of cache flushing is acceptable. >> >> Signed-off-by: Gavin Shan >=20 > Maybe a Fixes: tag would be good to have Agreed. Fixes: a5c3b9ffb0f4 ("mm/debug_vm_pgtable: add tests validating advanced = arch page table helpers") >=20 > And would it be possible to have this fix as first patch of the series = so that it can be applied to stable without applying the whole series ? Changing the allocation scheme does solve another problem (using non-owne= d pages) but is achieved via the entire series applied. But this particular patch = could be moved to the beginning without much problem.