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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABC39C021B2 for ; Tue, 25 Feb 2025 06:50:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 100D06B0082; Tue, 25 Feb 2025 01:50:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0B0D06B0085; Tue, 25 Feb 2025 01:50:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EE13F6B0088; Tue, 25 Feb 2025 01:50:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id D70E56B0082 for ; Tue, 25 Feb 2025 01:50:07 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 43EC3160AD6 for ; Tue, 25 Feb 2025 06:50:07 +0000 (UTC) X-FDA: 83157542454.11.AE4E7E0 Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) by imf16.hostedemail.com (Postfix) with ESMTP id 5890B18000E for ; Tue, 25 Feb 2025 06:50:02 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf16.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.35 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1740466205; h=from:from:sender: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=Nmlu0d3gP3IP3pKdw2nJhD2AYJVpPzxD8hxzPbb2srY=; b=l/cwWc3MdfON/pu5TbRIuXU5539GiIoTGBtak8NnSw2P78Al7m67EvqGXTRigjP+ZYcTXq 1aAxOJ8eoktLy3EVdWHKIsZtWlACYEaORbbCIwXPp+vRlqJPrwgvdJnNA019IGQmk0s/6t yNuk+3dBK3N+I8/vtb1sRhYDLUyXSs0= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf16.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.35 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1740466205; a=rsa-sha256; cv=none; b=wdMu28pVsyuYEQtWibpRA8jsyau3smP07lm5zx4nw2FEsoV2VIbtmOu5VUiyuNgxx91JEf PNe3lTRAlgFW87VnxyNnzJw5j2m3j2qa6a5G79c6c7yz1iTKf14VGWKBpmv+1NZPzzv+pa hZOWcz+rYWmR+5p/F4J0A0jB/Owor1Y= Received: from mail.maildlp.com (unknown [172.19.88.234]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4Z27R665HCzJ1FT; Tue, 25 Feb 2025 14:45:54 +0800 (CST) Received: from kwepemd200019.china.huawei.com (unknown [7.221.188.193]) by mail.maildlp.com (Postfix) with ESMTPS id A31D91401F3; Tue, 25 Feb 2025 14:49:57 +0800 (CST) Received: from [10.173.127.72] (10.173.127.72) by kwepemd200019.china.huawei.com (7.221.188.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 25 Feb 2025 14:49:56 +0800 Subject: Re: [PATCH v2] mm: make page_mapped_in_vma() hugetlb walk aware To: Jane Chu References: <20250224211445.2663312-1-jane.chu@oracle.com> CC: , , , , , , From: Miaohe Lin Message-ID: <3f3acf9f-f71d-77a3-ca61-5cc5c6c7f02b@huawei.com> Date: Tue, 25 Feb 2025 14:49:56 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20250224211445.2663312-1-jane.chu@oracle.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.173.127.72] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemd200019.china.huawei.com (7.221.188.193) X-Rspam-User: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 5890B18000E X-Stat-Signature: m8p36epy9ba6ehech5t773om9z6g6qi5 X-HE-Tag: 1740466202-645277 X-HE-Meta: U2FsdGVkX1/lcJ9/5B+Snkmeh57PXmunOI0WbQsKIgRiu9fx21UlvQM8K/P+KE11JiGDdSu6DXy2rUrebeoAzNgZuJYQwuTDeAEpj0m5myHePMbH4OMNylr54YIon+FTxBxKWlDd9pKS0BPClBKiu+ygtO35m3W3v5kaNQRDP7G4Ql1LZj4xGQXBt8xdhelJxlY7cG+ZoVjtyuUP3JpG260JUJaq8OeMQhRB4i8JBeCOb98qqEvYx1k6XkeaADpVk/C0YxjU1lRenS07mako35rNWByCENlqx5/DQcjULsQ1nJETVPRQt1jtUOHPXYwLOadiq43ExqX5OnABjnefLXpxp7ev+/ASk3u75oMNHW6TBZeHeIY9yN6NSeIpICnkLDXBeUIZTBC5aGIFzsZjnofPP3a/Em5Onfnf5joSFt/Hm/mVkckS5rYotro3K2Xab7uvkl4IK1hQDus6tXuhXCSLxQShhg6QyiEQE7i5k/JsBeBekmb6l2k7UjuZeV87KWfYAu1z0JivZ47SSEgqJpbl7IGPGQ42jjpxLW58oSongQSsQJVg5JGZ7qAU5VlzPLSYZsLsOuqSVcvHehgcGHm1Uzq9Ue9vlg80TFfwNISjLniEB5ahZOKJ1UMFt2PqOWoag27jsbp2XOQjq97MnFGYQU9U+AlG/nL3twSa242VgS1itgGSVUzUB/jMZZsICTjQ6piv2hEMzP/ofLB6ry6FN7p1p5S6EPpueAdW7bOCJWzjZT6R9es0CeB8Xk5FJz6jIK/nGew6WTO8iy4CJiIKCSGA/EJm+fQGudj+DTZAgmYJwMdkkuSq6HbSpkqI+RnRZhNg1qI8WXHy4s0pdg7LXCj7XzrSY1j2om9BZ5W426S76mzqyGa2xiLzMAPIatb/4j8Zu80vOGW+uWRGx6gxwCLpFJl+sMuoL6RPotILqQzeZBlFq2OGcC+RinCP9T4HpLvby6sEieMaCs1 SlR1tYZu Cm1rE12bkzwMOQjylBrhnTVByvITYwRQ7TNmUX2DblAeR89ucCCxTAGvI/yz36Sc6d5emSEmcnQnSGVGkunyPoLpSIbNF7RaD5UtdcJYb/YSFHLBunlX2eNmtQ4tJY8WvDwcudSO6BNtJfs9LSOFKio3f8w8w3TGp7yNjTafwoGuc6KLOgNsGm16dhtxhJ3L4vSk+ 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: List-Subscribe: List-Unsubscribe: On 2025/2/25 5:14, Jane Chu wrote: > When a process consumes a UE in a page, the memory failure handler > attempts to collect information for a potential SIGBUS. > If the page is an anonymous page, page_mapped_in_vma(page, vma) is > invoked in order to > 1. retrieve the vaddr from the process' address space, > 2. verify that the vaddr is indeed mapped to the poisoned page, > where 'page' is the precise small page with UE. > > It's been observed that when injecting poison to a non-head subpage > of an anonymous hugetlb page, no SIGBUS show up; while injecting to > the head page produces a SIGBUS. The casue is that, though hugetlb_walk() > returns a valid pmd entry (on x86), but check_pte() detects mismatch > between the head page per the pmd and the input subpage. Thus the vaddr > is considered not mapped to the subpage and the process is not collected > for SIGBUS purpose. This is the calling stack > collect_procs_anon > page_mapped_in_vma > page_vma_mapped_walk > hugetlb_walk > huge_pte_lock > check_pte > > check_pte() header says that it > "check if [pvmw->pfn, @pvmw->pfn + @pvmw->nr_pages) is mapped at the @pvmw->pte" > but practically works only if pvmw->pfn is the head page pfn at pvmw->pte. > Hindsight acknowledging that some pvmw->pte could point to a hugepage of > some sort such that it makes sense to make check_pte() work for hugepage. Thanks for your patch. This patch looks good to me. > > Signed-off-by: Jane Chu Is a Fixes tag needed? Thanks. .