linked list within a kernel probe
chris at chrishell.de
Thu Jan 12 10:05:36 EST 2023
Hi Tom, thank you for your support.
in my example, I used a spin_lock(&sl) for blocking traversing the list,
despite this function does nothing but reading or traversing the linked
list. No adding or removing is done within the kprobe function.
The other function called _kprobe_setup_cache_elements, which creates
the linked list, is called from the _init function, only once.
So I think there is no concurrency in this situation?
> Inside the kernel always address the issue of concurrency.
> Adding and removing from lists commonly needs a protective mutual
> exclusive lock.
> Look for like data structures and use the macro/standard tools to get
> it ALL correct including cache coherency.
> There are two strategies -- a data lock or a code monitor.
More information about the Kernelnewbies