Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp218287pxv; Wed, 21 Jul 2021 20:54:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPknBlb2Sjguo0HiGgzcbgvSbkc0QzAZTfg2P1YoFltvlVE7UEQKNrfLtoaeZAe2Zkbvjm X-Received: by 2002:a05:6402:1801:: with SMTP id g1mr52162929edy.208.1626926071538; Wed, 21 Jul 2021 20:54:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626926071; cv=none; d=google.com; s=arc-20160816; b=0JClcCJNWU4eV2kmzQAcawoYOXnoO0oyLTBGmtwZVjw096Fh3sWw02Sd/sjm3kfKnc X5kEj4/fgR1Fh6fPPnZbrvi2ODyQMjU/e0miCPTneHZJmkjXMS7oHosj1jlAYGpw6luy eNedhtZSBJs9TFcKSNzfrIRmle045wBtDnsFMlKAmRidK+wAOf3CrU2AdMpxrjCeD1Bx Q2lSDGo01ox24Rjz2R/GVpQoTkxfSkvbWhBGHOcGycbH5hqGDGJowDKQjjTgessqXNRX +L0/Tw+6s6GPOti+w4zAZAFJC0m36WZl4EP2JdcGbWDo6RVPqKMy6Aq0/6HDtaTpiJeV LTSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=VKa+2g9BDZlIVJQa8IetHj7eC3vv4bO3NHbuDVQz4ZM=; b=nMw/uMAegTYu5AVDXmaQgf6h74dCPH+jzrL9H4NQ2NdX+I4m7NfVG3EZ4Gxbl5nIp1 yOjkPiVFhtRudRwywZKnocpL9t0Romlg7+mzVzS9D/+JTqKz3NGCzbOL7TG+CrOMXcxI efKWjIuhQErzH6syAgRf09cjV5gksQwK2g5gKBNOMbNN1uYkpsQAYfZL5oLv8EEl4xmi 33DTQHvUHXMLX9Fgw2Oae1ULuMRRjNTbtVxNEsV6frrp1YHqvjui+LDO7G8fMCaeXYKA rh70YEq7rblqIsPMdzKjBXs/HSzciLti6qKDzXegzei+J8cTLEe8kpPBL4VlWoUXdIuf GNcQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jx17si3913254ejb.15.2021.07.21.20.54.06; Wed, 21 Jul 2021 20:54:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230225AbhGVDJu (ORCPT + 99 others); Wed, 21 Jul 2021 23:09:50 -0400 Received: from foss.arm.com ([217.140.110.172]:42682 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229900AbhGVDJu (ORCPT ); Wed, 21 Jul 2021 23:09:50 -0400 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 D5339D6E; Wed, 21 Jul 2021 20:50:25 -0700 (PDT) Received: from [10.163.65.134] (unknown [10.163.65.134]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1C63A3F66F; Wed, 21 Jul 2021 20:50:22 -0700 (PDT) Subject: Re: [PATCH v3 12/12] mm/debug_vm_pgtable: Fix corrupted page flag To: Gavin Shan , 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> From: Anshuman Khandual Message-ID: <5db75fd6-aeb9-c06f-30ab-839c09a0bc68@arm.com> Date: Thu, 22 Jul 2021 09:21:11 +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: <8157142c-58e0-44c4-5cdb-76fff4a07210@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Small nit: s/Fix corrupted page flag/Fix page flag corruption on arm64/ 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 populate >>> the page table entries. On ARM64, PG_arch_1 is set to the target page >>> flag if execution permission is given. The page flag is kept when the >>> page is free'd to buddy's free area list. However, it will trigger page >>> checking failure when it's pulled from the buddy's free area list, as >>> the following warning messages indicate. >>> >>>     BUG: Bad page state in process memhog  pfn:08000 >>>     page:0000000015c0a628 refcount:0 mapcount:0 \ >>>          mapping:0000000000000000 index:0x1 pfn:0x8000 >>>     flags: 0x7ffff8000000800(arch_1|node=0|zone=0|lastcpupid=0xfffff) >>>     raw: 07ffff8000000800 dead000000000100 dead000000000122 0000000000000000 >>>     raw: 0000000000000001 0000000000000000 00000000ffffffff 0000000000000000 >>>     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. >> >> Could you please add comments before each flush_dcache_page() instance >> explaining why this is needed for arm64 platforms with relevant PG_arch_1 >> context and how this does not have any adverse effect on other platforms ? >> 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 where 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. But also some in code comments where flush_dcache_page() is being called.