All of lore.kernel.org
 help / color / mirror / Atom feed
From: Balbir Singh <balbirs@nvidia.com>
To: Jordan Niethe <jniethe@nvidia.com>,
	Matthew Brost <matthew.brost@intel.com>
Cc: linux-mm@kvack.org, akpm@linux-foundation.org,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	david@redhat.com, ziy@nvidia.com, apopple@nvidia.com,
	lorenzo.stoakes@oracle.com, lyude@redhat.com, dakr@kernel.org,
	airlied@gmail.com, simona@ffwll.ch, rcampbell@nvidia.com,
	mpenttil@redhat.com, jgg@nvidia.com, willy@infradead.org
Subject: Re: [RFC PATCH 1/6] mm/hmm: Add flag to track device private PFNs
Date: Wed, 3 Dec 2025 15:25:02 +1100	[thread overview]
Message-ID: <8d02347d-6ca2-4dfc-ab98-940381fa8b86@nvidia.com> (raw)
In-Reply-To: <75de1c7d-58d2-4a0f-b86c-b3dae65fb52f@nvidia.com>

On 12/2/25 12:20, Jordan Niethe wrote:
> Hi,
> 
> On 29/11/25 05:36, Matthew Brost wrote:
>> On Fri, Nov 28, 2025 at 03:41:41PM +1100, Jordan Niethe wrote:
>>> A future change will remove device private pages from the physical
>>> address space. This will mean that device private pages no longer have
>>> normal PFN and must be handled separately.
>>>
>>> Prepare for this by adding a HMM_PFN_DEVICE_PRIVATE flag to indicate
>>> that a hmm_pfn contains a PFN for a device private page.
>>>
>>> Signed-off-by: Jordan Niethe <jniethe@nvidia.com>
>>> Signed-off-by: Alistair Popple <apopple@nvidia.com>
>>> ---
>>>   include/linux/hmm.h | 2 ++
>>>   mm/hmm.c            | 2 +-
>>>   2 files changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/include/linux/hmm.h b/include/linux/hmm.h
>>> index db75ffc949a7..df571fa75a44 100644
>>> --- a/include/linux/hmm.h
>>> +++ b/include/linux/hmm.h
>>> @@ -23,6 +23,7 @@ struct mmu_interval_notifier;
>>>    * HMM_PFN_WRITE - if the page memory can be written to (requires HMM_PFN_VALID)
>>>    * HMM_PFN_ERROR - accessing the pfn is impossible and the device should
>>>    *                 fail. ie poisoned memory, special pages, no vma, etc
>>> + * HMM_PFN_DEVICE_PRIVATE - the pfn field contains a DEVICE_PRIVATE pfn.
>>>    * HMM_PFN_P2PDMA - P2P page
>>>    * HMM_PFN_P2PDMA_BUS - Bus mapped P2P transfer
>>>    * HMM_PFN_DMA_MAPPED - Flag preserved on input-to-output transformation
>>> @@ -40,6 +41,7 @@ enum hmm_pfn_flags {
>>>       HMM_PFN_VALID = 1UL << (BITS_PER_LONG - 1),
>>>       HMM_PFN_WRITE = 1UL << (BITS_PER_LONG - 2),
>>>       HMM_PFN_ERROR = 1UL << (BITS_PER_LONG - 3),
>>> +    HMM_PFN_DEVICE_PRIVATE = 1UL << (BITS_PER_LONG - 7),

Doesn't this break HMM_PFN_ORDER_SHIFT? The assumption is that we have 5 bits for
order

>>>       /*
>>>        * Sticky flags, carried from input to output,
>>>        * don't forget to update HMM_PFN_INOUT_FLAGS
>>> diff --git a/mm/hmm.c b/mm/hmm.c
>>> index 87562914670a..1cff68ade1d4 100644
>>> --- a/mm/hmm.c
>>> +++ b/mm/hmm.c
>>> @@ -262,7 +262,7 @@ static int hmm_vma_handle_pte(struct mm_walk *walk, unsigned long addr,
>>>           if (is_device_private_entry(entry) &&
>>>               page_pgmap(pfn_swap_entry_to_page(entry))->owner ==
>>>               range->dev_private_owner) {
>>> -            cpu_flags = HMM_PFN_VALID;
>>> +            cpu_flags = HMM_PFN_VALID | HMM_PFN_DEVICE_PRIVATE;
>>
>> I think you’ll need to set this flag in hmm_vma_handle_absent_pmd as
>> well. That function handles 2M device pages. Support for 2M device
>> pages, I believe, will be included in the 6.19 PR, but
>> hmm_vma_handle_absent_pmd is already upstream.
> 
> Thanks Matt, I agree. There will be a few more updates to this
> series for 2MB device pages - I'll send the next revision on top of that
> support.
> 

I think it makes sense to build on top of v6.19 with THP support

Balbir


  reply	other threads:[~2025-12-03  4:25 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-28  4:41 [RFC PATCH 0/6] Remove device private pages from physical address space Jordan Niethe
2025-11-28  4:41 ` [RFC PATCH 1/6] mm/hmm: Add flag to track device private PFNs Jordan Niethe
2025-11-28 18:36   ` Matthew Brost
2025-12-02  1:20     ` Jordan Niethe
2025-12-03  4:25       ` Balbir Singh [this message]
2025-11-28  4:41 ` [RFC PATCH 2/6] mm/migrate_device: Add migrate PFN " Jordan Niethe
2025-11-28  4:41 ` [RFC PATCH 3/6] mm/page_vma_mapped: Add flags to page_vma_mapped_walk::pfn " Jordan Niethe
2025-11-28  4:41 ` [RFC PATCH 4/6] mm: Add a new swap type for migration entries with " Jordan Niethe
2025-12-01  2:43   ` Chih-En Lin
2025-12-02  1:42     ` Jordan Niethe
2025-11-28  4:41 ` [RFC PATCH 5/6] mm/util: Add flag to track device private PFNs in page snapshots Jordan Niethe
2025-11-28  4:41 ` [RFC PATCH 6/6] mm: Remove device private pages from the physical address space Jordan Niethe
2025-11-28  6:52   ` kernel test robot
2025-11-28 17:51   ` Jason Gunthorpe
2025-12-02  2:28     ` Jordan Niethe
2025-12-02  4:10       ` Alistair Popple
2025-11-30  5:45   ` kernel test robot
2025-11-28  7:40 ` [RFC PATCH 0/6] Remove device private pages from " David Hildenbrand (Red Hat)
2025-11-30 23:33   ` Alistair Popple
2025-11-28 15:09 ` Matthew Wilcox
2025-12-02  1:31   ` Jordan Niethe
2025-11-28 16:07 ` Mika Penttilä
2025-12-02  1:32   ` Jordan Niethe
2025-11-28 19:22 ` Matthew Brost
2025-11-30 23:23   ` Alistair Popple
2025-12-01  1:51     ` Matthew Brost
2025-12-02  1:40       ` Jordan Niethe
2025-12-02 22:20 ` Balbir Singh

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=8d02347d-6ca2-4dfc-ab98-940381fa8b86@nvidia.com \
    --to=balbirs@nvidia.com \
    --cc=airlied@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=apopple@nvidia.com \
    --cc=dakr@kernel.org \
    --cc=david@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jgg@nvidia.com \
    --cc=jniethe@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=lyude@redhat.com \
    --cc=matthew.brost@intel.com \
    --cc=mpenttil@redhat.com \
    --cc=rcampbell@nvidia.com \
    --cc=simona@ffwll.ch \
    --cc=willy@infradead.org \
    --cc=ziy@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.