Watch queue maintainer? WAS:[RFC PATCH RESEND 1/2] watch_queue: Add a DRM_XE_NOTIFY watch type and export init_watch()
From: Thomas Hellström
Date: Wed Mar 18 2026 - 15:57:53 EST
Hi Christian,
I saw you relatively recently commited some patches to the
watch_queue implementation. We're drafting the below change that
probably is going to use it but at this time it's only RFC.
Do you think the below would be acceptable? If so could you help acking
for merge once the series as a whole is ready to go?
Any feedback appreciated,
Thanks,
Thomas
On Tue, 2026-03-10 at 16:57 +0100, Thomas Hellström wrote:
> Add a DRM_XE_NOTIFY watch type for asynchronous error notifications
> from the DRM_XE kernel module.
>
> Also export the init_watch() function for use from kernel drivers.
> Use EXPORT_SYMBOL() to align with other exports from the same file.
>
> Assisted-by: GitHub Copilot:claude-sonnet-4.6
> Signed-off-by: Thomas Hellström <thomas.hellstrom@xxxxxxxxxxxxxxx>
> ---
> include/uapi/linux/watch_queue.h | 3 ++-
> kernel/watch_queue.c | 13 ++++++++++---
> 2 files changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/include/uapi/linux/watch_queue.h
> b/include/uapi/linux/watch_queue.h
> index c3d8320b5d3a..c800c153989d 100644
> --- a/include/uapi/linux/watch_queue.h
> +++ b/include/uapi/linux/watch_queue.h
> @@ -14,7 +14,8 @@
> enum watch_notification_type {
> WATCH_TYPE_META = 0, /* Special record */
> WATCH_TYPE_KEY_NOTIFY = 1, /* Key change event
> notification */
> - WATCH_TYPE__NR = 2
> + WATCH_TYPE_DRM_XE_NOTIFY = 2, /* DRM device event
> notification */
> + WATCH_TYPE__NR = 3
> };
>
> enum watch_meta_notification_subtype {
> diff --git a/kernel/watch_queue.c b/kernel/watch_queue.c
> index 538520861e8b..701b5c388808 100644
> --- a/kernel/watch_queue.c
> +++ b/kernel/watch_queue.c
> @@ -445,11 +445,17 @@ static void put_watch(struct watch *watch)
> }
>
> /**
> - * init_watch - Initialise a watch
> + * init_watch() - Initialise a watch subscription
> * @watch: The watch to initialise.
> - * @wqueue: The queue to assign.
> + * @wqueue: The watch queue (notification pipe) to associate with
> the watch.
> *
> - * Initialise a watch and set the watch queue.
> + * Initialise a newly allocated watch object and associate it with
> @wqueue.
> + * The caller must subsequently set @watch->id and @watch->info_id
> before
> + * calling add_watch_to_object() to subscribe the watch to a
> notification
> + * source.
> + *
> + * The watch queue reference is held internally; call
> put_watch_queue() if
> + * the watch is not successfully passed to add_watch_to_object().
> */
> void init_watch(struct watch *watch, struct watch_queue *wqueue)
> {
> @@ -458,6 +464,7 @@ void init_watch(struct watch *watch, struct
> watch_queue *wqueue)
> INIT_HLIST_NODE(&watch->queue_node);
> rcu_assign_pointer(watch->queue, wqueue);
> }
> +EXPORT_SYMBOL(init_watch);
>
> static int add_one_watch(struct watch *watch, struct watch_list
> *wlist, struct watch_queue *wqueue)
> {