linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Alistair Popple <apopple@nvidia.com>, Balbir Singh <balbirs@nvidia.com>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org,
	Jason Gunthorpe <jgg@ziepe.ca>,
	Dan Williams <dan.j.williams@intel.com>
Subject: Re: [PATCH] mm/migrate_device: Do not access pgmap for non zone device pages
Date: Fri, 21 Feb 2025 09:13:58 +0100	[thread overview]
Message-ID: <d81fc0e1-053e-47e4-ad94-7c3f8007955f@redhat.com> (raw)
In-Reply-To: <mhubbcqcym3ooq7kn4ub3wcerohdwzq65ap4mrnzdaghjyuhng@7ec6stmrxv6i>

On 20.02.25 23:45, Alistair Popple wrote:
> On Thu, Feb 20, 2025 at 11:38:10PM +1100, Balbir Singh wrote:
>> On 2/20/25 23:05, David Hildenbrand wrote:
>>> On 20.02.25 12:58, Balbir Singh wrote:
>>>> On 2/20/25 22:48, David Hildenbrand wrote:
>>>>> On 20.02.25 00:13, Balbir Singh wrote:
>>>>>> page_pgmap() is referenced before checking if the page is a zone
>>>>>> device page and this triggers the warning in page_pgmap(). Refactor
>>>>>> the code to use the helper function after relevant checks.
>>>>>>
>>>>>> Cc: Alistair Popple <apopple@nvidia.com>
>>>>>> Cc: Jason Gunthorpe <jgg@ziepe.ca>
>>>>>> Cc: David Hildenbrand <david@redhat.com>
>>>>>> Cc: Dan Williams <dan.j.williams@intel.com>
>>>>>>
>>>>>> Signed-off-by: Balbir Singh <balbirs@nvidia.com>
>>>>>> ---
>>>>>>
>>>>>> Fixes: 7f1cfd71153b ("mm: allow compound zone device pages") on
>>>>>> mm-unstable
>>>>>
>>>>> Is there actually something broken? At least for now, reading folio->pgmap should just work, although it might be garbage.
>>>>>
>>>>
>>>> It triggers the VM_WARN_ON_ONCE_PAGE
>>>>
>>>> static inline struct dev_pagemap *page_pgmap(const struct page *page)
>>>> {
>>>>      VM_WARN_ON_ONCE_PAGE(!is_zone_device_page(page), page);
>>>>      return page_folio(page)->pgmap;
>>>> }
>>>>
>>>> Nothing is broken, because the code below has checks for is_device_coherent_page(),
>>>> but in general I think the WARN_ON is correct because it warns us against garbage
>>>> and it's propagation if the correct checks are not in place.
>>>
>>> Ah! Now I read your "triggers the warning in page_pgmap()" in the description.
>>>
>>> It's usually a good idea to just include the splat you observed, if you did, and call it "triggers the VM_WARN_ON_ONCE_PAGE".
>>
>> Sure
>>
>>>
>>> The "Fixes:" should go above the "---" in that case.
>>
>> I was not sure if the commit-ids in mm-unstable are persistent, so I put it
>> below the --- to avoid confusion
> 
> They are not, but I'm unsure what the process is here. I guess either I roll
> this fix into my series and repost or maybe Andrew takes it as is a separate fix
> on top of my series?

Ah, I completely ignored that this is not in mm/mm-stable yet.

Yes, that should best just be squashed into the original commit as long 
as it is not in mm/mm-stable.

-- 
Cheers,

David / dhildenb



      reply	other threads:[~2025-02-21  8:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-19 23:13 Balbir Singh
2025-02-20 11:48 ` David Hildenbrand
2025-02-20 11:58   ` Balbir Singh
2025-02-20 12:05     ` David Hildenbrand
2025-02-20 12:38       ` Balbir Singh
2025-02-20 22:45         ` Alistair Popple
2025-02-21  8:13           ` David Hildenbrand [this message]

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=d81fc0e1-053e-47e4-ad94-7c3f8007955f@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=apopple@nvidia.com \
    --cc=balbirs@nvidia.com \
    --cc=dan.j.williams@intel.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-mm@kvack.org \
    /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