All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alistair Popple <apopple@nvidia.com>
To: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
Cc: Jason Gunthorpe <jgg@nvidia.com>,
	intel-xe@lists.freedesktop.org,
	Matthew Brost <matthew.brost@intel.com>,
	Simona Vetter <simona.vetter@ffwll.ch>,
	DRI-devel <dri-devel@lists.freedesktop.org>,
	Linux Memory Management List <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH] mm/hmm, mm/migrate_device: Allow p2p access and p2p migration
Date: Wed, 16 Oct 2024 15:46:28 +1100	[thread overview]
Message-ID: <87jze88xch.fsf@nvdebian.thelocal> (raw)
In-Reply-To: <67d855c26e95d89997f0ae5a0e1a5fdc636f6b95.camel@linux.intel.com>


Thomas Hellström <thomas.hellstrom@linux.intel.com> writes:

> On Tue, 2024-10-15 at 10:02 -0300, Jason Gunthorpe wrote:
>> On Tue, Oct 15, 2024 at 02:41:24PM +0200, Thomas Hellström wrote:
>> > > It has nothing to do with kernel P2P, you are just allowing more
>> > > selective filtering of dev_private_owner. You should focus on
>> > > that in
>> > > the naming, not p2p. ie allow_dev_private()
>> > > 
>> > > P2P is stuff that is dealing with MEMORY_DEVICE_PCI_P2PDMA.
>> > 
>> > Yes, although the intention was to incorporate also other fast
>> > interconnects in "P2P", not just "PCIe P2P", but I'll definitely
>> > take a
>> > look at the naming.
>> 
>> It has nothing to do with that, you are just filtering the device
>> private pages differently than default.
>> 
>> Your end use might be P2P, but at this API level it certainly is not.
>
> Sure. Will find something more suitable.
>
>> 
>> > > This is just allowing more instances of the same driver to co-
>> > > ordinate
>> > > their device private memory handle, for whatever purpose.
>> > 
>> > Exactly, or theoretically even cross-driver.
>> 
>> I don't want to see things like drivers changing their pgmap handles
>> privately somehow. If we are going to make it cross driver then it
>> needs to be generalized alot more.
>
> Cross-driver is initially not a thing, so let's worry about that later.
> My impression though is that this is the only change required for
> hmm_range_fault() and that infrastructure for opt-in and dma-mapping
> would need to be provided elsewhere?

Cross-driver is tricky because the device-private pages have no meaning
outside of the driver which owns/allocates them. One option is to have a
callback which returns P2PDMA pages which can then be dma-mapped. See
https://lore.kernel.org/linux-mm/20241015152348.3055360-1-ymaman@nvidia.com/
for an example of that.

>> 
>> > > 
>> > > Otherwise I don't see a particular problem, though we have talked
>> > > about widening the matching for device_private more broadly using
>> > > some
>> > > kind of grouping tag or something like that instead of a
>> > > callback.
>> > > You
>> > > may consider that as an alternative
>> > 
>> > Yes. Looked at that, but (if I understand you correctly) that would
>> > be
>> > the case mentioned in the commit message where the group would be
>> > set
>> > up statically at dev_pagemap creation time?
>> 
>> Not necessarily statically, but the membership would be stored in the
>> pagemap and by updated during hotplug/etc
>> 
>> If this is for P2P then the dynamic behavior is pretty limited, some
>> kind of NxN bitmap.
>> 
>> > > hmm_range struct inside a caller private data struct and use that
>> > > instead if inventing a whole new struct and pointer.
>> > 
>> > Our first attempt was based on that but then that wouldn't be
>> > reusable
>> > in the migrate_device.c code. Hence the extra indirection.
>> 
>> It is performance path, you should prefer duplication rather than
>> slowing it down..
>
> OK. Will look at duplicating.
>
> Thanks,
> Thomas
>
>
>> 
>> Jason


  reply	other threads:[~2024-10-16  4:51 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-15 11:13 [RFC PATCH] mm/hmm, mm/migrate_device: Allow p2p access and p2p migration Thomas Hellström
2024-10-15 11:21 ` Thomas Hellström
2024-10-15 12:17 ` Jason Gunthorpe
2024-10-15 12:41   ` Thomas Hellström
2024-10-15 13:02     ` Jason Gunthorpe
2024-10-15 13:17       ` Thomas Hellström
2024-10-16  4:46         ` Alistair Popple [this message]
2024-10-15 13:34 ` ✓ CI.Patch_applied: success for " Patchwork
2024-10-15 13:35 ` ✓ CI.checkpatch: " Patchwork
2024-10-15 13:36 ` ✓ CI.KUnit: " Patchwork
2024-10-15 13:47 ` ✓ CI.Build: " Patchwork
2024-10-15 13:50 ` ✓ CI.Hooks: " Patchwork
2024-10-15 13:51 ` ✓ CI.checksparse: " Patchwork
2024-10-15 22:06 ` ✗ CI.FULL: failure " Patchwork
2024-10-16  6:20 ` ✓ CI.Patch_applied: success for mm/hmm, mm/migrate_device: Allow p2p access and p2p migration (rev2) Patchwork
2024-10-16  6:20 ` ✓ CI.checkpatch: " Patchwork
2024-10-16  6:21 ` ✓ CI.KUnit: " Patchwork
2024-10-16  6:33 ` ✓ CI.Build: " Patchwork
2024-10-16  6:35 ` ✓ CI.Hooks: " Patchwork
2024-10-16  6:37 ` ✓ CI.checksparse: " Patchwork
2024-10-16  7:00 ` ✓ CI.BAT: " Patchwork
2024-10-16 14:48 ` ✗ CI.FULL: failure " Patchwork

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=87jze88xch.fsf@nvdebian.thelocal \
    --to=apopple@nvidia.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jgg@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=matthew.brost@intel.com \
    --cc=simona.vetter@ffwll.ch \
    --cc=thomas.hellstrom@linux.intel.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.