From: Ankit Agrawal <ankita@nvidia.com>
To: Jason Gunthorpe <jgg@nvidia.com>, Shuai Xue <xueshuai@linux.alibaba.com>
Cc: Aniket Agashe <aniketa@nvidia.com>,
Vikram Sethi <vsethi@nvidia.com>, Matt Ochs <mochs@nvidia.com>,
Shameer Kolothum <skolothumtho@nvidia.com>,
"linmiaohe@huawei.com" <linmiaohe@huawei.com>,
"nao.horiguchi@gmail.com" <nao.horiguchi@gmail.com>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"david@redhat.com" <david@redhat.com>,
"lorenzo.stoakes@oracle.com" <lorenzo.stoakes@oracle.com>,
"Liam.Howlett@oracle.com" <Liam.Howlett@oracle.com>,
"vbabka@suse.cz" <vbabka@suse.cz>,
"rppt@kernel.org" <rppt@kernel.org>,
"surenb@google.com" <surenb@google.com>,
"mhocko@suse.com" <mhocko@suse.com>,
"tony.luck@intel.com" <tony.luck@intel.com>,
"bp@alien8.de" <bp@alien8.de>,
"rafael@kernel.org" <rafael@kernel.org>,
"guohanjun@huawei.com" <guohanjun@huawei.com>,
"mchehab@kernel.org" <mchehab@kernel.org>,
"lenb@kernel.org" <lenb@kernel.org>,
"kevin.tian@intel.com" <kevin.tian@intel.com>,
"alex@shazbot.org" <alex@shazbot.org>, Neo Jia <cjia@nvidia.com>,
Kirti Wankhede <kwankhede@nvidia.com>,
"Tarun Gupta (SW-GPU)" <targupta@nvidia.com>,
Zhi Wang <zhiw@nvidia.com>, Dheeraj Nigam <dnigam@nvidia.com>,
Krishnakant Jaju <kjaju@nvidia.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-edac@vger.kernel.org" <linux-edac@vger.kernel.org>,
"Jonathan.Cameron@huawei.com" <Jonathan.Cameron@huawei.com>,
"ira.weiny@intel.com" <ira.weiny@intel.com>,
"Smita.KoralahalliChannabasappa@amd.com"
<Smita.KoralahalliChannabasappa@amd.com>,
"u.kleine-koenig@baylibre.com" <u.kleine-koenig@baylibre.com>,
"peterz@infradead.org" <peterz@infradead.org>,
"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: [PATCH v3 1/3] mm: handle poisoning of pfn without struct pages
Date: Fri, 24 Oct 2025 11:59:09 +0000 [thread overview]
Message-ID: <SA1PR12MB71992D35824674EB3A0C7D4AB0F1A@SA1PR12MB7199.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20251024115201.GD847003@nvidia.com>
Thank you so much for the feedbacks! Comments inline.
>> +int register_pfn_address_space(struct pfn_address_space *pfn_space)
>> +{
>> + if (!pfn_space)
>> + return -EINVAL;
>
> Is there a reason callers may be passing NULL?
No, that would be an invalid use case for such.
> Register and unregister are good places to use guard().
Thanks for the suggestion Ira. Will update it.
>If the pfn is not in the process why is it added to the kill list?
I kept it as it is still a process with VMA mapped to the problematic
PFN. This would ultimately result in SIGKILL to be sent to the process.
in kill_procs(). This is very similar to the __add_to_kill() implementation.
>> +static int memory_failure_pfn(unsigned long pfn, int flags)
>> +{
>> + struct interval_tree_node *node;
>> + LIST_HEAD(tokill);
>> +
>> + mutex_lock(&pfn_space_lock);
>
> scoped_guard() Or probably wrap this part in a guarded function.
Ack, thanks.
>> +void unregister_pfn_address_space(struct pfn_address_space *pfn_space)
>> +{
>> + if (!pfn_space)
>> + return;
>> +
>> + mutex_lock(&pfn_space_lock);
>> + interval_tree_remove(&pfn_space->node, &pfn_space_itree);
>
> IIRC removing something not in interval tree will panic kernel. If I
> am not mistaken, should here do something like
> interval_tree_iter_first before interval_tree_remove, to avoid
> driver's ill behavior crash the system?
Thanks Jiaqi for the suggestion. Yeah, I think we should add it.
I'll fix that in the next version.
> If pfn doesn't belong to any address space mapping, it's still
> counted as MF_RECOVERED?
Hi Miaohe, I wasn't sure how should we tag this. It seems you
are suggesting MF_FAILED is more appropriate. I'll address that.
>> p = pfn_to_online_page(pfn);
>> if (!p) {
>> res = arch_memory_failure(pfn, flags);
>
> Can we move above memory_failure_pfn block here? I'm worried
> that too many scenario branches might lead to confusion.
Sure if there isn't any objection, I'll update it.
>> On Fri, Oct 24, 2025 at 05:45:45PM +0800, Shuai Xue wrote:
>> Rather than having MM maintain metadata about these PFNs, have you
>> considered adding an operation callback similar to
>> dev_pagemap_ops->memory_failure?
>
> I think someone could come with such a proposal on top of this, it
> would not be hard to add some ops to pfn_address_space and have the
> code call them instead of using the address_space.
> This version just needs to link into the existing VMA machinery (ie
> collect_procs_pfn), it doesn't make alot of sense to push that work
> into drivers.
Thanks Shuai for the suggestion. However, I agree on this with Jason.
It is preferable to keep that as separate.
next prev parent reply other threads:[~2025-10-24 11:59 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-21 10:23 [PATCH v3 0/3] mm: Implement ECC handling for pfn with no struct page ankita
2025-10-21 10:23 ` [PATCH v3 1/3] mm: handle poisoning of pfn without struct pages ankita
2025-10-21 17:05 ` Ira Weiny
2025-10-22 16:00 ` Jiaqi Yan
2025-10-24 6:34 ` Miaohe Lin
2025-10-24 9:45 ` Shuai Xue
2025-10-24 11:52 ` Jason Gunthorpe
2025-10-24 11:59 ` Ankit Agrawal [this message]
2025-10-21 10:23 ` [PATCH v3 2/3] mm: Change ghes code to allow poison of non-struct pfn ankita
2025-10-21 17:13 ` Ira Weiny
2025-10-21 17:19 ` Luck, Tony
2025-10-22 6:53 ` Shuai Xue
2025-10-22 15:03 ` Ira Weiny
2025-10-24 10:03 ` Shuai Xue
2025-10-24 11:26 ` Ankit Agrawal
2025-10-21 10:23 ` [PATCH v3 3/3] vfio/nvgrace-gpu: register device memory for poison handling ankita
2025-10-21 16:30 ` [PATCH v3 0/3] mm: Implement ECC handling for pfn with no struct page Liam R. Howlett
2025-10-21 16:44 ` Jason Gunthorpe
2025-10-21 18:54 ` Liam R. Howlett
2025-10-21 22:38 ` Jason Gunthorpe
2025-10-24 11:16 ` Ankit Agrawal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=SA1PR12MB71992D35824674EB3A0C7D4AB0F1A@SA1PR12MB7199.namprd12.prod.outlook.com \
--to=ankita@nvidia.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=Liam.Howlett@oracle.com \
--cc=Smita.KoralahalliChannabasappa@amd.com \
--cc=akpm@linux-foundation.org \
--cc=alex@shazbot.org \
--cc=aniketa@nvidia.com \
--cc=bp@alien8.de \
--cc=cjia@nvidia.com \
--cc=david@redhat.com \
--cc=dnigam@nvidia.com \
--cc=guohanjun@huawei.com \
--cc=ira.weiny@intel.com \
--cc=jgg@nvidia.com \
--cc=kevin.tian@intel.com \
--cc=kjaju@nvidia.com \
--cc=kvm@vger.kernel.org \
--cc=kwankhede@nvidia.com \
--cc=lenb@kernel.org \
--cc=linmiaohe@huawei.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-edac@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=mchehab@kernel.org \
--cc=mhocko@suse.com \
--cc=mochs@nvidia.com \
--cc=nao.horiguchi@gmail.com \
--cc=peterz@infradead.org \
--cc=rafael@kernel.org \
--cc=rppt@kernel.org \
--cc=skolothumtho@nvidia.com \
--cc=surenb@google.com \
--cc=targupta@nvidia.com \
--cc=tony.luck@intel.com \
--cc=u.kleine-koenig@baylibre.com \
--cc=vbabka@suse.cz \
--cc=vsethi@nvidia.com \
--cc=xueshuai@linux.alibaba.com \
--cc=zhiw@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox