linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Ser <contact@emersion.fr>
To: "André Almeida" <andrealmeid@igalia.com>
Cc: "Pekka Paalanen" <ppaalanen@gmail.com>,
	dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, kernel-dev@igalia.com,
	alexander.deucher@amd.com, contactshashanksharma@gmail.com,
	amaranath.somalapuram@amd.com, christian.koenig@amd.com,
	pierre-eric.pelloux-prayer@amd.com,
	"Rob Clark" <robdclark@gmail.com>,
	"Andrey Grodzovsky" <andrey.grodzovsky@amd.com>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"Daniel Stone" <daniel@fooishbar.org>,
	"'Marek Olšák'" <maraeo@gmail.com>,
	"Dave Airlie" <airlied@gmail.com>,
	"Pierre-Loup A . Griffais" <pgriffais@valvesoftware.com>
Subject: Re: [PATCH v3 0/2] drm: Add GPU reset sysfs
Date: Wed, 30 Nov 2022 15:34:00 +0000	[thread overview]
Message-ID: <9WiGqqLyo5VwAmb8qBPZAhUiq_ptdB-lNo5d6A42raXoJU8XPxojB_44bKkR8Tw82SdiiPz1lAKpe7HH9HlDA0fFpgcy6shNjTDxOfsadFE=@emersion.fr> (raw)
In-Reply-To: <2dbf222e-7694-ea5e-c35d-663011c16e84@igalia.com>

On Wednesday, November 30th, 2022 at 16:23, André Almeida <andrealmeid@igalia.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…

  reply	other threads:[~2022-11-30 15:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-25 17:52 [PATCH v3 0/2] drm: Add GPU reset sysfs André Almeida
2022-11-25 17:52 ` [PATCH v3 1/2] drm: Add GPU reset sysfs event André Almeida
2022-11-28  9:27   ` Pekka Paalanen
2022-11-29 14:07   ` Alex Deucher
2022-11-25 17:52 ` [PATCH v3 2/2] drm/amdgpu: Add work function for GPU reset event André Almeida
2022-11-28  9:25 ` [PATCH v3 0/2] drm: Add GPU reset sysfs Pekka Paalanen
2022-11-28  9:30   ` Simon Ser
2022-11-30 15:23     ` André Almeida
2022-11-30 15:34       ` Simon Ser [this message]
2022-11-30 11:11 ` Daniel Vetter
2022-12-08  4:53   ` Alex Deucher
2023-01-05 12:25     ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='9WiGqqLyo5VwAmb8qBPZAhUiq_ptdB-lNo5d6A42raXoJU8XPxojB_44bKkR8Tw82SdiiPz1lAKpe7HH9HlDA0fFpgcy6shNjTDxOfsadFE=@emersion.fr' \
    --to=contact@emersion.fr \
    --cc=airlied@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amaranath.somalapuram@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=andrealmeid@igalia.com \
    --cc=andrey.grodzovsky@amd.com \
    --cc=christian.koenig@amd.com \
    --cc=contactshashanksharma@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=daniel@fooishbar.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel-dev@igalia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maraeo@gmail.com \
    --cc=pgriffais@valvesoftware.com \
    --cc=pierre-eric.pelloux-prayer@amd.com \
    --cc=ppaalanen@gmail.com \
    --cc=robdclark@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).