[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9WiGqqLyo5VwAmb8qBPZAhUiq_ptdB-lNo5d6A42raXoJU8XPxojB_44bKkR8Tw82SdiiPz1lAKpe7HH9HlDA0fFpgcy6shNjTDxOfsadFE=@emersion.fr>
Date: Wed, 30 Nov 2022 15:34:00 +0000
From: Simon Ser <contact@...rsion.fr>
To: André Almeida <andrealmeid@...lia.com>
Cc: Pekka Paalanen <ppaalanen@...il.com>,
dri-devel@...ts.freedesktop.org, amd-gfx@...ts.freedesktop.org,
linux-kernel@...r.kernel.org, kernel-dev@...lia.com,
alexander.deucher@....com, contactshashanksharma@...il.com,
amaranath.somalapuram@....com, christian.koenig@....com,
pierre-eric.pelloux-prayer@....com,
Rob Clark <robdclark@...il.com>,
Andrey Grodzovsky <andrey.grodzovsky@....com>,
Daniel Vetter <daniel@...ll.ch>,
Daniel Stone <daniel@...ishbar.org>,
'Marek Olšák' <maraeo@...il.com>,
Dave Airlie <airlied@...il.com>,
"Pierre-Loup A . Griffais" <pgriffais@...vesoftware.com>
Subject: Re: [PATCH v3 0/2] drm: Add GPU reset sysfs
On Wednesday, November 30th, 2022 at 16:23, André Almeida <andrealmeid@...lia.com> wrote:
> On 11/28/22 06:30, Simon Ser wrote:
>
> > The PID is racy, the user-space daemon could end up killing an
> > unrelated process… Is there any way we could use a pidfd instead?
>
> Is the PID race condition something that really happens or rather
> something theoretical?
A PID race can happen in practice if many PIDs get spawned. On Linux
PIDs wrap around pretty quickly.
Note, even a sandboxed program inside its own PID namespace can trigger
the wrap-around.
> Anyway, I can't see how pidfd and uevent would work together. Since
> uevent it's kind of a broadcast and pidfd is an anon file, it wouldn't
> be possible to say to userspace which is the fd to be used giving that
> file descriptors are per process resources.
Yeah, I can see how this can be difficult to integrate with uevent.
> On the other hand, this interface could be converted to be an ioctl that
> userspace would block waiting for a reset notification, then the kernel
> could create a pidfd and give to the blocked process the right fd. We
> would probably need a queue to make sure no event is lost.
A blocking IOCTL wouldn't be very nice, you can't integrate that into
an event loop for instance…
Powered by blists - more mailing lists