From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8004035965 for ; Fri, 19 Dec 2025 08:02:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.187 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766131326; cv=none; b=OFLUXchhDHUdH8GJT7j0zhVvfm2vG9c8zqYyHQ1q3tb5io/7sKmrtm0GlRigXGQVB4JBRSRy8GuCF75yv63ygTauHzzoZLchr/Wjkua96/hKIP03d04adoxEQh151y42GP76DoBLAj9PH4Y35zXhcTWiNaL3FA1upNdqSPP1LDE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766131326; c=relaxed/simple; bh=VhEQIj4HDBhlEO0FBNfmKBrVQf6A9ChXO2SfP/0m/78=; h=Subject:To:References:CC:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=H5axrQw5e1LjJrxm7XKMoC/qEU+mo6K/85cpgdkOg3TAn9BNdi5rOUlbLUNzbWu1v0f3pEhFXGo79yZFsUNyI6lo3/Yuku+lX4EMnlj49iWbeLhjY4n/STK4cKN9vsx5Gw1T04MRqZIsFuTV9xj3sMciC8gV3iO63CLDtBL+PtM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=3S+R/sqA; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=3S+R/sqA; arc=none smtp.client-ip=45.249.212.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="3S+R/sqA"; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="3S+R/sqA" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=CyvRNKwAgv7NTqrHCG/H7p70m3qHP05/OWELAse7QdU=; b=3S+R/sqAvn9H7VXktWNZsGGoPe0q5cmRGQ/ZHnWU1uRXzFoMP7cc0FLwy5nVG/+NhJJvG2avr NWjrDffQpPDX9Ji3/o6G/diisRkrICJQcCepFySzWq+i0iMuCAhKIZKMYz/Od1pUY3OQjtGvpVh Oa2+WAyDUlgJOsNb3GtgATw= Received: from canpmsgout03.his.huawei.com (unknown [172.19.92.159]) by szxga01-in.huawei.com (SkyGuard) with ESMTPS id 4dXg3M3C4Cz1BGJ9 for ; Fri, 19 Dec 2025 16:01:35 +0800 (CST) dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=CyvRNKwAgv7NTqrHCG/H7p70m3qHP05/OWELAse7QdU=; b=3S+R/sqAvn9H7VXktWNZsGGoPe0q5cmRGQ/ZHnWU1uRXzFoMP7cc0FLwy5nVG/+NhJJvG2avr NWjrDffQpPDX9Ji3/o6G/diisRkrICJQcCepFySzWq+i0iMuCAhKIZKMYz/Od1pUY3OQjtGvpVh Oa2+WAyDUlgJOsNb3GtgATw= Received: from mail.maildlp.com (unknown [172.19.162.254]) by canpmsgout03.his.huawei.com (SkyGuard) with ESMTPS id 4dXg0T2b7lzpStQ; Fri, 19 Dec 2025 15:59:05 +0800 (CST) Received: from dggemv706-chm.china.huawei.com (unknown [10.3.19.33]) by mail.maildlp.com (Postfix) with ESMTPS id E4C2818047B; Fri, 19 Dec 2025 16:01:52 +0800 (CST) Received: from kwepemq500010.china.huawei.com (7.202.194.235) by dggemv706-chm.china.huawei.com (10.3.19.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 19 Dec 2025 16:01:52 +0800 Received: from [10.173.125.37] (10.173.125.37) by kwepemq500010.china.huawei.com (7.202.194.235) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 19 Dec 2025 16:01:51 +0800 Subject: Re: [PATCH] mm/memory-failure: teach kill_accessing_process to accept hugetlb tail page pfn To: Jane Chu References: <20251219062819.2499399-1-jane.chu@oracle.com> CC: , , , , , , , , , , , , , From: Miaohe Lin Message-ID: Date: Fri, 19 Dec 2025 16:01:46 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <20251219062819.2499399-1-jane.chu@oracle.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-ClientProxiedBy: kwepems100001.china.huawei.com (7.221.188.238) To kwepemq500010.china.huawei.com (7.202.194.235) On 2025/12/19 14:28, Jane Chu wrote: > When a hugetlb folio is being poisoned again, try_memory_failure_hugetlb() > passed head pfn to kill_accessing_process(), that is not right. > The precise pfn of the poisoned page should be used in order to > determine the precise vaddr as the SIGBUS payload. > > This issue has already been taken care of in the normal path, that is, > hwpoison_user_mappings(), see [1][2]. Further more, for [3] to work > correctly in the hugetlb repoisoning case, it's essential to inform > VM the precise poisoned page, not the head page. > > [1] https://lkml.kernel.org/r/20231218135837.3310403-1-willy@infradead.org > [2] https://lkml.kernel.org/r/20250224211445.2663312-1-jane.chu@oracle.com > [3] https://lore.kernel.org/lkml/20251116013223.1557158-1-jiaqiyan@google.com/ > Thanks for your patch. > Cc: > Signed-off-by: Jane Chu > --- > mm/memory-failure.c | 22 ++++++++++++---------- > 1 file changed, 12 insertions(+), 10 deletions(-) > > diff --git a/mm/memory-failure.c b/mm/memory-failure.c > index 3edebb0cda30..c9d87811b1ea 100644 > --- a/mm/memory-failure.c > +++ b/mm/memory-failure.c > @@ -681,9 +681,11 @@ static void set_to_kill(struct to_kill *tk, unsigned long addr, short shift) > } > > static int check_hwpoisoned_entry(pte_t pte, unsigned long addr, short shift, > - unsigned long poisoned_pfn, struct to_kill *tk) > + unsigned long poisoned_pfn, struct to_kill *tk, > + int pte_nr) > { > unsigned long pfn = 0; > + unsigned long hwpoison_vaddr; > > if (pte_present(pte)) { > pfn = pte_pfn(pte); > @@ -694,10 +696,11 @@ static int check_hwpoisoned_entry(pte_t pte, unsigned long addr, short shift, > pfn = swp_offset_pfn(swp); > } > > - if (!pfn || pfn != poisoned_pfn) > + if (!pfn || (pfn > poisoned_pfn || (pfn + pte_nr - 1) < poisoned_pfn)) > return 0; Can we get pte_nr from @shift? I.e. something like "pte_nr = 1UL << (shift - PAGE_SHIFT);"? Thanks. .