Re: [PATCH v2 1/2] gpu: nova-core: add initial driver stub

2025-02-06 Thread Danilo Krummrich
Hi Alexandre, On Thu, Feb 06, 2025 at 11:05:37PM +0900, Alexandre Courbot wrote: > > + > > +/// Enum representation of the GPU chipset. > > +#[derive(fmt::Debug)] > > I suspect you will eventually want to also derive Copy and Clone, as > well as PartialEq and Eq (so the assigned values can be use

Re: [RFC 1/5] mm/hmm: HMM API to enable P2P DMA for device private pages

2025-02-06 Thread Simona Vetter
On Thu, Jan 30, 2025 at 09:23:17AM -0400, Jason Gunthorpe wrote: > On Thu, Jan 30, 2025 at 11:50:27AM +0100, Simona Vetter wrote: > > On Wed, Jan 29, 2025 at 09:47:57AM -0400, Jason Gunthorpe wrote: > > > On Wed, Jan 29, 2025 at 02:38:58PM +0100, Simona Vetter wrote: > > > > > > > > The pgmap->own

Re: [PATCH v2 3/8] rust: drm: add driver abstractions

2025-02-06 Thread Simona Vetter
On Tue, Sep 03, 2024 at 01:11:55PM +0200, Danilo Krummrich wrote: > On Mon, Sep 02, 2024 at 06:29:06PM +0200, Daniel Vetter wrote: > > On Wed, Jun 19, 2024 at 01:31:39AM +0200, Danilo Krummrich wrote: > > > Implement the DRM driver abstractions. > > > > > > The `Driver` trait provides the interfac

Re: [PATCH v1 12/12] mm/rmap: keep mapcount untouched for device-exclusive entries

2025-02-06 Thread Simona Vetter
On Thu, Jan 30, 2025 at 04:43:08PM +0100, David Hildenbrand wrote: > > > Assume you have a THP (or any mTHP today). You can easily trigger the > > > scenario that folio_mapcount() != 0 with active device-exclusive entries, > > > and you start doing rmap walks and stumble over these device-exclusive

Re: [PATCH v1 12/12] mm/rmap: keep mapcount untouched for device-exclusive entries

2025-02-06 Thread Simona Vetter
On Thu, Jan 30, 2025 at 12:42:26PM +0100, David Hildenbrand wrote: > On 30.01.25 11:37, Simona Vetter wrote: > > On Wed, Jan 29, 2025 at 12:54:10PM +0100, David Hildenbrand wrote: > > > Now that conversion to device-exclusive does no longer perform an > > > rmap walk and the main page_vma_mapped_wa

Re: [PATCH v1 12/12] mm/rmap: keep mapcount untouched for device-exclusive entries

2025-02-06 Thread Simona Vetter
On Wed, Jan 29, 2025 at 12:54:10PM +0100, David Hildenbrand wrote: > Now that conversion to device-exclusive does no longer perform an > rmap walk and the main page_vma_mapped_walk() users were taught to > properly handle nonswap entries, let's treat device-exclusive entries just > as if they would

Re: [PATCH v2 0/8] DRM Rust abstractions and Nova

2025-02-06 Thread Simona Vetter
On Mon, Sep 02, 2024 at 06:40:00PM +0200, Daniel Vetter wrote: > On Wed, Jun 19, 2024 at 01:31:36AM +0200, Danilo Krummrich wrote: > > This patch series implements some basic DRM Rust abstractions and a stub > > implementation of the Nova GPU driver. > > > > Nova is intended to be developed upstre

Re: [Question] Are "device exclusive non-swap entries" / "SVM atomics in Nouveau" still getting used in practice?

2025-02-06 Thread Simona Vetter
On Wed, Jan 29, 2025 at 05:13:41PM +0100, David Hildenbrand wrote: > On 29.01.25 15:05, Simona Vetter wrote: > > On Wed, Jan 29, 2025 at 12:31:14PM +0100, David Hildenbrand wrote: > > > On 29.01.25 12:28, Simona Vetter wrote: > > > > On Wed, Jan 29, 2025 at 11:48:03AM +0100, Simona Vetter wrote: >

Re: [Question] Are "device exclusive non-swap entries" / "SVM atomics in Nouveau" still getting used in practice?

2025-02-06 Thread Simona Vetter
On Tue, Jan 28, 2025 at 09:24:33PM +0100, David Hildenbrand wrote: > On 28.01.25 21:14, Simona Vetter wrote: > > On Tue, Jan 28, 2025 at 11:09:24AM +1100, Alistair Popple wrote: > > > On Fri, Jan 24, 2025 at 06:54:02PM +0100, David Hildenbrand wrote: > > > > > > > On integrated the gpu is tied into

Re: [PATCH v1 4/4] mm/memory: document restore_exclusive_pte()

2025-02-06 Thread Simona Vetter
On Fri, Jan 31, 2025 at 11:14:06AM +1100, Alistair Popple wrote: > On Thu, Jan 30, 2025 at 04:29:33PM +0100, David Hildenbrand wrote: > > On 30.01.25 14:31, Simona Vetter wrote: > > > On Thu, Jan 30, 2025 at 10:37:06AM +0100, David Hildenbrand wrote: > > > > On 30.01.25 01:27, Alistair Popple wrote

Re: [PATCH v1 03/12] mm/rmap: convert make_device_exclusive_range() to make_device_exclusive()

2025-02-06 Thread Simona Vetter
On Wed, Jan 29, 2025 at 12:54:01PM +0100, David Hildenbrand wrote: > The single "real" user in the tree of make_device_exclusive_range() always > requests making only a single address exclusive. The current implementation > is hard to fix for properly supporting anonymous THP / large folios and > f

Re: [RFC 1/5] mm/hmm: HMM API to enable P2P DMA for device private pages

2025-02-06 Thread Simona Vetter
On Thu, Jan 30, 2025 at 01:42:17PM -0400, Jason Gunthorpe wrote: > On Thu, Jan 30, 2025 at 05:09:44PM +0100, Simona Vetter wrote: > > > > An optional callback is a lot less scary to me here (or redoing > > > > hmm_range_fault or whacking the migration helpers a few times) looks a > > > > lot > > >

Re: [PATCH v1 06/12] mm: use single SWP_DEVICE_EXCLUSIVE entry type

2025-02-06 Thread Simona Vetter
On Wed, Jan 29, 2025 at 12:54:04PM +0100, David Hildenbrand wrote: > There is no need for the distinction anymore; let's merge the readable > and writable device-exclusive entries into a single device-exclusive > entry type. > > Signed-off-by: David Hildenbrand Yeah I really don't think there's

Re: [PATCH v1 08/12] mm/rmap: handle device-exclusive entries correctly in try_to_unmap_one()

2025-02-06 Thread Simona Vetter
On Wed, Jan 29, 2025 at 12:54:06PM +0100, David Hildenbrand wrote: > Ever since commit b756a3b5e7ea ("mm: device exclusive memory access") > we can return with a device-exclusive entry from page_vma_mapped_walk(). > > try_to_unmap_one() is not prepared for that, so teach it about these > non-prese

Re: [PATCH v1 05/12] mm/memory: detect writability in restore_exclusive_pte() through can_change_pte_writable()

2025-02-06 Thread Simona Vetter
On Fri, Jan 31, 2025 at 11:55:55AM +0100, David Hildenbrand wrote: > On 31.01.25 00:06, Alistair Popple wrote: > > On Thu, Jan 30, 2025 at 02:03:42PM +0100, Simona Vetter wrote: > > > On Thu, Jan 30, 2025 at 10:58:51AM +0100, David Hildenbrand wrote: > > > > On 30.01.25 10:51, Simona Vetter wrote:

Re: [PATCH v1 04/12] mm/rmap: implement make_device_exclusive() using folio_walk instead of rmap walk

2025-02-06 Thread Simona Vetter
On Thu, Jan 30, 2025 at 10:47:29AM +0100, David Hildenbrand wrote: > On 30.01.25 10:40, Simona Vetter wrote: > > On Thu, Jan 30, 2025 at 05:11:49PM +1100, Alistair Popple wrote: > > > On Wed, Jan 29, 2025 at 12:54:02PM +0100, David Hildenbrand wrote: > > > > We require a writable PTE and only suppo

Re: [PATCH v2 1/2] gpu: nova-core: add initial driver stub

2025-02-06 Thread Alexandre Courbot
Hi Danilo, On Thu Feb 6, 2025 at 11:49 PM JST, Danilo Krummrich wrote: >> > +impl Spec { >> > +fn new(bar: &Devres) -> Result { >> > +let bar = bar.try_access().ok_or(ENXIO)?; >> > +let boot0 = regs::Boot0::read(&bar); >> > + >> > +let Some(chipset) = Chipset::from_u32(

[PATCH v2] drm/nouveau: don't attempt to schedule hpd_work on headless cards

2025-02-06 Thread Vasily Khoruzhick
If the card doesn't have display hardware, hpd_work and hpd_lock are left uninitialized which causes BUG when attempting to schedule hpd_work on runtime PM resume. Fix it by adding headless flag to DRM and skip any hpd if it's set. Fixes: ae1aadb1eb8d ("nouveau: don't fail driver load if no displ

Re: [PATCH v1 08/12] mm/rmap: handle device-exclusive entries correctly in try_to_unmap_one()

2025-02-06 Thread Simona Vetter
On Thu, Jan 30, 2025 at 10:08:32AM -0400, Jason Gunthorpe wrote: > On Thu, Jan 30, 2025 at 02:06:12PM +0100, Simona Vetter wrote: > > On Thu, Jan 30, 2025 at 12:08:42PM +0100, David Hildenbrand wrote: > > > On 30.01.25 11:10, Simona Vetter wrote: > > > > On Wed, Jan 29, 2025 at 12:54:06PM +0100, Da

Re: [PATCH v1 05/12] mm/memory: detect writability in restore_exclusive_pte() through can_change_pte_writable()

2025-02-06 Thread Simona Vetter
On Thu, Jan 30, 2025 at 10:58:51AM +0100, David Hildenbrand wrote: > On 30.01.25 10:51, Simona Vetter wrote: > > On Wed, Jan 29, 2025 at 12:54:03PM +0100, David Hildenbrand wrote: > > > Let's do it just like mprotect write-upgrade or during NUMA-hinting > > > faults on PROT_NONE PTEs: detect if the

Re: [Question] Are "device exclusive non-swap entries" / "SVM atomics in Nouveau" still getting used in practice?

2025-02-06 Thread Simona Vetter
On Tue, Jan 28, 2025 at 11:09:24AM +1100, Alistair Popple wrote: > On Fri, Jan 24, 2025 at 06:54:02PM +0100, David Hildenbrand wrote: > > > > > On integrated the gpu is tied into the coherency > > > > > fabric, so there it's not needed. > > > > > > > > > > I think the more fundamental question wit

[PATCH] drm/nouveau: don't attempt to schedule hpd_work on headless cards

2025-02-06 Thread Vasily Khoruzhick
If the card doesn't have display hardware, hpd_work and hpd_lock are left uninitialized which causes BUG when attempting to schedule hpd_work on runtime PM resume. Fix it by adding headless flag to DRM and skip any hpd if it's set. Fixes: ae1aadb1eb8d ("nouveau: don't fail driver load if no displ

Re: [PATCH v1 4/4] mm/memory: document restore_exclusive_pte()

2025-02-06 Thread Simona Vetter
On Thu, Jan 30, 2025 at 11:27:37AM +1100, Alistair Popple wrote: > On Wed, Jan 29, 2025 at 12:58:02PM +0100, David Hildenbrand wrote: > > Let's document how this function is to be used, and why the requirement > > for the folio lock might maybe be dropped in the future. > > Sorry, only just catchi

Re: [PATCH v1 04/12] mm/rmap: implement make_device_exclusive() using folio_walk instead of rmap walk

2025-02-06 Thread Simona Vetter
On Thu, Jan 30, 2025 at 04:59:16PM +0100, David Hildenbrand wrote: > > > > > > Note that the PTE is > > > > > > always writable, and we can always create a > > > > > > writable-device-exclusive > > > > > > entry. > > > > > > > > > > > > With this change, device-exclusive is fully compatible with

Re: [PATCH v1 05/12] mm/memory: detect writability in restore_exclusive_pte() through can_change_pte_writable()

2025-02-06 Thread Simona Vetter
On Wed, Jan 29, 2025 at 12:54:03PM +0100, David Hildenbrand wrote: > Let's do it just like mprotect write-upgrade or during NUMA-hinting > faults on PROT_NONE PTEs: detect if the PTE can be writable by using > can_change_pte_writable(). > > Set the PTE only dirty if the folio is dirty: we might no

Re: [RFC 1/5] mm/hmm: HMM API to enable P2P DMA for device private pages

2025-02-06 Thread Simona Vetter
On Wed, Jan 29, 2025 at 09:47:57AM -0400, Jason Gunthorpe wrote: > On Wed, Jan 29, 2025 at 02:38:58PM +0100, Simona Vetter wrote: > > > > The pgmap->owner doesn't *have* to fixed, certainly during early boot > > > before > > > you hand out any page references it can be changed. I wouldn't be > >

Re: [RFC 1/5] mm/hmm: HMM API to enable P2P DMA for device private pages

2025-02-06 Thread Simona Vetter
On Tue, Jan 28, 2025 at 01:21:23PM -0400, Jason Gunthorpe wrote: > On Tue, Jan 28, 2025 at 05:32:23PM +0100, Thomas Hellström wrote: > > > This series supports three case: > > > > > >  1) pgmap->owner == range->dev_private_owner > > >     This is "driver private fast interconnect" in this case HMM

Re: [PATCH v1 4/4] mm/memory: document restore_exclusive_pte()

2025-02-06 Thread Simona Vetter
On Thu, Jan 30, 2025 at 10:37:06AM +0100, David Hildenbrand wrote: > On 30.01.25 01:27, Alistair Popple wrote: > > On Wed, Jan 29, 2025 at 12:58:02PM +0100, David Hildenbrand wrote: > > > Let's document how this function is to be used, and why the requirement > > > for the folio lock might maybe be

Re: [PATCH v1 08/12] mm/rmap: handle device-exclusive entries correctly in try_to_unmap_one()

2025-02-06 Thread Simona Vetter
On Thu, Jan 30, 2025 at 12:08:42PM +0100, David Hildenbrand wrote: > On 30.01.25 11:10, Simona Vetter wrote: > > On Wed, Jan 29, 2025 at 12:54:06PM +0100, David Hildenbrand wrote: > > > Ever since commit b756a3b5e7ea ("mm: device exclusive memory access") > > > we can return with a device-exclusive

Re: [Question] Are "device exclusive non-swap entries" / "SVM atomics in Nouveau" still getting used in practice?

2025-02-06 Thread Simona Vetter
On Thu, Jan 23, 2025 at 11:20:37AM +0100, David Hildenbrand wrote: > Hi, > > I keep finding issues in our implementation of "device exclusive non-swap > entries", and the way it messes with mapcounts is disgusting. > > As a reminder, what we do here is to replace a PTE pointing to an anonymous >

Re: [Question] Are "device exclusive non-swap entries" / "SVM atomics in Nouveau" still getting used in practice?

2025-02-06 Thread Simona Vetter
On Wed, Jan 29, 2025 at 12:31:14PM +0100, David Hildenbrand wrote: > On 29.01.25 12:28, Simona Vetter wrote: > > On Wed, Jan 29, 2025 at 11:48:03AM +0100, Simona Vetter wrote: > > > On Tue, Jan 28, 2025 at 09:24:33PM +0100, David Hildenbrand wrote: > > > > On 28.01.25 21:14, Simona Vetter wrote: >

Re: [Question] Are "device exclusive non-swap entries" / "SVM atomics in Nouveau" still getting used in practice?

2025-02-06 Thread Simona Vetter
On Fri, Jan 24, 2025 at 11:44:28AM +0100, David Hildenbrand wrote: > On 23.01.25 16:08, Simona Vetter wrote: > > On Thu, Jan 23, 2025 at 11:20:37AM +0100, David Hildenbrand wrote: > > > Hi, > > > > > > I keep finding issues in our implementation of "device exclusive non-swap > > > entries", and th

Re: [PATCH v1 04/12] mm/rmap: implement make_device_exclusive() using folio_walk instead of rmap walk

2025-02-06 Thread Simona Vetter
On Thu, Jan 30, 2025 at 05:11:49PM +1100, Alistair Popple wrote: > On Wed, Jan 29, 2025 at 12:54:02PM +0100, David Hildenbrand wrote: > > We require a writable PTE and only support anonymous folio: we can only > > have exactly one PTE pointing at that page, which we can just lookup > > using a foli

Re: [PATCH v1 2/4] mm/mmu_notifier: drop owner from MMU_NOTIFY_EXCLUSIVE

2025-02-06 Thread Simona Vetter
On Thu, Jan 30, 2025 at 10:28:00AM +0100, David Hildenbrand wrote: > On 30.01.25 06:34, Alistair Popple wrote: > > Looking at hmm_test I see that doesn't use the sequence counter to ensure > > the PTE remains valid whilst it is mapped. I think that is probably wrong, > > so > > apologies if that l

Re: [PATCH] drm/nouveau: don't attempt to schedule hpd_work on headless cards

2025-02-06 Thread Vasily Khoruzhick
On Thu, Jun 6, 2024 at 6:37 PM Dave Airlie wrote: > > readding original poster Thanks, Dave! Ben, please keep me on CC, since I'm not subscribed to either nouveau or dri-devel mailing lists. > On Wed, 29 May 2024 at 09:57, Ben Skeggs wrote: > > > diff --git a/drivers/gpu/drm/nouveau/nouveau_c

[PATCH] drm/nouveau: select FW caching

2025-02-06 Thread Dave Airlie
From: Dave Airlie nouveau tries to load some firmware during suspend that it loaded earlier, but with fw caching disabled it hangs suspend, so just rely on FW cache enabling instead of working around it in the driver. Fixes: 176fdcbddfd2 ("drm/nouveau/gsp/r535: add support for booting GSP-RM")

Re: [PATCH v2 1/2] gpu: nova-core: add initial driver stub

2025-02-06 Thread Alexandre Courbot
Hi Danilo, Here are few comments - or maybe I should say nits, as they are really minor. Note that all my experience in Rust is from user-space, so feel free to ignore anything that does not make sense in the context of the kernel or is too pedantic. On Wed Feb 5, 2025 at 4:03 AM JST, Danilo Krum

Re: [Question] Are "device exclusive non-swap entries" / "SVM atomics in Nouveau" still getting used in practice?

2025-02-06 Thread Simona Vetter
On Wed, Jan 29, 2025 at 11:48:03AM +0100, Simona Vetter wrote: > On Tue, Jan 28, 2025 at 09:24:33PM +0100, David Hildenbrand wrote: > > On 28.01.25 21:14, Simona Vetter wrote: > > > On Tue, Jan 28, 2025 at 11:09:24AM +1100, Alistair Popple wrote: > > > > On Fri, Jan 24, 2025 at 06:54:02PM +0100, Da