RE: [PATCH v4 5/6] drm/gem-shmem: Track folio accessed/dirty status in mmap

Biju Das
2026-03-13T10:33:19Z

Hi Thomas,

> -----Original Message-----
> From: Thomas Zimmermann <tzimmermann@suse.de>
> Sent: 13 March 2026 10:30
> Subject: Re: [PATCH v4 5/6] drm/gem-shmem: Track folio accessed/dirty status in mmap
>
> Hi
>
> Am 13.03.26 um 11:18 schrieb Boris Brezillon:
> [...]
> >>>>> + if (drm_WARN_ON(obj->dev, !shmem->pages || page_offset >= num_pages))
> >>>>> + return VM_FAULT_SIGBUS;
> >>>>> +
> >>>>> + file_update_time(vma->vm_file);
> >>>>> +
> >>>>> + folio_mark_dirty(page_folio(shmem->pages[page_offset]));
> > Do we need a folio_mark_dirty_lock() here?
>
> There is a helper for that with some documentation. [1]
>
> [1]
> https://elixir.bootlin.com/linux/v6.19.7/source/mm/page-writeback.c#L2826

FYI, I commented all the calls in the patch, it does not solve the issue.

Commenting the callback below fixed the issue.

//.pfn_mkwrite = drm_gem_shmem_pfn_mkwrite,

Cheers,
Biju

> >
> >>>>> +
> >>>>> + return 0;
> >>>>> +}
> >>>>> +
> >>>>> const struct vm_operations_struct drm_gem_shmem_vm_ops = {
> >>>>> .fault = drm_gem_shmem_fault,
> >>>>> .open = drm_gem_shmem_vm_open,
> >>>>> .close = drm_gem_shmem_vm_close,
> >>>>> + .pfn_mkwrite = drm_gem_shmem_pfn_mkwrite,
> >>>>> };
> >>>>> EXPORT_SYMBOL_GPL(drm_gem_shmem_vm_ops);
> >>>>>
> >>>>> --
> >>>>> 2.52.0
> >>>>>
>
> --
> --
> Thomas Zimmermann
> Graphics Driver Developer
> SUSE Software Solutions Germany GmbH
> Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
> GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)
>