Download raw body.
pgo_reference vs KERNEL_LOCK()
> Date: Sat, 2 Nov 2024 21:40:11 +0100
> From: Martin Pieuchot <mpi@grenadille.net>
>
> Since page faults are executed in parallel, all pgo_reference()
> implementations are safe to be executed w/o KERNEL_LOCK().
Sorry, but I can't follow that reasoning.
> ok?
The uao_reference() and udv_reference() implementations are safe, but
I'm not entirely sure about the ones in drm. I think all
pgo_reference() implementations in drm effectively do a kref_get().
Now using kref_get() should be safe to call without holding the kernel
lock. However, the drm code also uses kref_get_unless_zero(). That
relies on RCU, but we cut some corners there and I think that means
that still need the kernel lock for that to work. And that probably
means we need to hold the kernel lock around kref_get() as well.
> Index: uvm/uvm_map.c
> ===================================================================
> RCS file: /cvs/src/sys/uvm/uvm_map.c,v
> diff -u -p -r1.333 uvm_map.c
> --- uvm/uvm_map.c 31 Oct 2024 05:00:00 -0000 1.333
> +++ uvm/uvm_map.c 2 Nov 2024 20:35:23 -0000
> @@ -2593,10 +2593,8 @@ uvm_map_splitentry(struct vm_map *map, s
> } else if (UVM_ET_ISOBJ(orig)) {
> if (next->object.uvm_obj->pgops &&
> next->object.uvm_obj->pgops->pgo_reference) {
> - KERNEL_LOCK();
> next->object.uvm_obj->pgops->pgo_reference(
> next->object.uvm_obj);
> - KERNEL_UNLOCK();
> }
> next->offset += adj;
> }
>
>
pgo_reference vs KERNEL_LOCK()