All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Ser <contact@emersion.fr>
To: Emil Velikov <emil.l.velikov@gmail.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>,
	Will Drewry <wad@chromium.org>, Kees Cook <keescook@chromium.org>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	"Linux-Kernel@Vger. Kernel. Org" <linux-kernel@vger.kernel.org>,
	ML dri-devel <dri-devel@lists.freedesktop.org>,
	Andy Lutomirski <luto@amacapital.net>,
	Cyrill Gorcunov <gorcunov@gmail.com>,
	"# 3.13+" <stable@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH v3] kcmp: Support selection of SYS_kcmp without CHECKPOINT_RESTORE
Date: Fri, 12 Feb 2021 13:14:19 +0000	[thread overview]
Message-ID: <pIyZ-Jj7O2MYk1vKeyghnFmiFWk_5ZWm-Ze1gUqdDaXzImOVjVdjPh2uyHa-sxOPovRk1ApSKk_5zKBvOrzoSwXeXUu0LbZ75Q1D3gIK2Kk=@emersion.fr> (raw)
In-Reply-To: <CACvgo52u1ASWXOuWuDwoXvbZhoq+RHn_GTxD5y9k+kO_dzmT7w@mail.gmail.com>

On Friday, February 12th, 2021 at 1:57 PM, Emil Velikov <emil.l.velikov@gmail.com> wrote:

> On Fri, 5 Feb 2021 at 22:01, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> >
> > Userspace has discovered the functionality offered by SYS_kcmp and has
> > started to depend upon it. In particular, Mesa uses SYS_kcmp for
> > os_same_file_description() in order to identify when two fd (e.g. device
> > or dmabuf)
>
> As you rightfully point out, SYS_kcmp is a bit of a two edged sword.
> While you mention the CONFIG issue, there is also a portability aspect
> (mesa runs on more than just linux) and as well as sandbox filtering
> of the extra syscall.
>
> Last time I looked, the latter was still an issue and mesa was using
> SYS_kcmp to compare device node fds.
> A far shorter and more portable solution is possible, so let me
> prepare a Mesa patch.

Comparing two DMA-BUFs can be done with their inode number, I think.

Comparing two device FDs is more subtle, because of GEM handle
ref'counting. You sometimes really want to check whether two FDs are
backed by the same file *description*. See [1] for details.

[1]: https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/110

WARNING: multiple messages have this Message-ID (diff)
From: Simon Ser <contact@emersion.fr>
To: Emil Velikov <emil.l.velikov@gmail.com>
Cc: Will Drewry <wad@chromium.org>, Kees Cook <keescook@chromium.org>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	"Linux-Kernel@Vger. Kernel. Org" <linux-kernel@vger.kernel.org>,
	ML dri-devel <dri-devel@lists.freedesktop.org>,
	Chris Wilson <chris@chris-wilson.co.uk>,
	Cyrill Gorcunov <gorcunov@gmail.com>,
	"# 3.13+" <stable@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Andy Lutomirski <luto@amacapital.net>
Subject: Re: [PATCH v3] kcmp: Support selection of SYS_kcmp without CHECKPOINT_RESTORE
Date: Fri, 12 Feb 2021 13:14:19 +0000	[thread overview]
Message-ID: <pIyZ-Jj7O2MYk1vKeyghnFmiFWk_5ZWm-Ze1gUqdDaXzImOVjVdjPh2uyHa-sxOPovRk1ApSKk_5zKBvOrzoSwXeXUu0LbZ75Q1D3gIK2Kk=@emersion.fr> (raw)
In-Reply-To: <CACvgo52u1ASWXOuWuDwoXvbZhoq+RHn_GTxD5y9k+kO_dzmT7w@mail.gmail.com>

On Friday, February 12th, 2021 at 1:57 PM, Emil Velikov <emil.l.velikov@gmail.com> wrote:

> On Fri, 5 Feb 2021 at 22:01, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> >
> > Userspace has discovered the functionality offered by SYS_kcmp and has
> > started to depend upon it. In particular, Mesa uses SYS_kcmp for
> > os_same_file_description() in order to identify when two fd (e.g. device
> > or dmabuf)
>
> As you rightfully point out, SYS_kcmp is a bit of a two edged sword.
> While you mention the CONFIG issue, there is also a portability aspect
> (mesa runs on more than just linux) and as well as sandbox filtering
> of the extra syscall.
>
> Last time I looked, the latter was still an issue and mesa was using
> SYS_kcmp to compare device node fds.
> A far shorter and more portable solution is possible, so let me
> prepare a Mesa patch.

Comparing two DMA-BUFs can be done with their inode number, I think.

Comparing two device FDs is more subtle, because of GEM handle
ref'counting. You sometimes really want to check whether two FDs are
backed by the same file *description*. See [1] for details.

[1]: https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/110
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

WARNING: multiple messages have this Message-ID (diff)
From: Simon Ser <contact@emersion.fr>
To: Emil Velikov <emil.l.velikov@gmail.com>
Cc: Will Drewry <wad@chromium.org>, Kees Cook <keescook@chromium.org>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	"Linux-Kernel@Vger. Kernel. Org" <linux-kernel@vger.kernel.org>,
	ML dri-devel <dri-devel@lists.freedesktop.org>,
	Chris Wilson <chris@chris-wilson.co.uk>,
	Cyrill Gorcunov <gorcunov@gmail.com>,
	"# 3.13+" <stable@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Andy Lutomirski <luto@amacapital.net>
Subject: Re: [Intel-gfx] [PATCH v3] kcmp: Support selection of SYS_kcmp without CHECKPOINT_RESTORE
Date: Fri, 12 Feb 2021 13:14:19 +0000	[thread overview]
Message-ID: <pIyZ-Jj7O2MYk1vKeyghnFmiFWk_5ZWm-Ze1gUqdDaXzImOVjVdjPh2uyHa-sxOPovRk1ApSKk_5zKBvOrzoSwXeXUu0LbZ75Q1D3gIK2Kk=@emersion.fr> (raw)
In-Reply-To: <CACvgo52u1ASWXOuWuDwoXvbZhoq+RHn_GTxD5y9k+kO_dzmT7w@mail.gmail.com>

On Friday, February 12th, 2021 at 1:57 PM, Emil Velikov <emil.l.velikov@gmail.com> wrote:

> On Fri, 5 Feb 2021 at 22:01, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> >
> > Userspace has discovered the functionality offered by SYS_kcmp and has
> > started to depend upon it. In particular, Mesa uses SYS_kcmp for
> > os_same_file_description() in order to identify when two fd (e.g. device
> > or dmabuf)
>
> As you rightfully point out, SYS_kcmp is a bit of a two edged sword.
> While you mention the CONFIG issue, there is also a portability aspect
> (mesa runs on more than just linux) and as well as sandbox filtering
> of the extra syscall.
>
> Last time I looked, the latter was still an issue and mesa was using
> SYS_kcmp to compare device node fds.
> A far shorter and more portable solution is possible, so let me
> prepare a Mesa patch.

Comparing two DMA-BUFs can be done with their inode number, I think.

Comparing two device FDs is more subtle, because of GEM handle
ref'counting. You sometimes really want to check whether two FDs are
backed by the same file *description*. See [1] for details.

[1]: https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/110
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2021-02-12 13:17 UTC|newest]

Thread overview: 88+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-05 16:37 [PATCH] kernel: Expose SYS_kcmp by default Chris Wilson
2021-02-05 16:37 ` [Intel-gfx] " Chris Wilson
2021-02-05 16:37 ` Chris Wilson
2021-02-05 17:02 ` Lucas Stach
2021-02-05 17:02   ` [Intel-gfx] " Lucas Stach
2021-02-05 17:02   ` Lucas Stach
2021-02-05 18:37 ` Kees Cook
2021-02-05 18:37   ` [Intel-gfx] " Kees Cook
2021-02-05 18:37   ` Kees Cook
2021-02-05 20:53   ` Daniel Vetter
2021-02-05 20:53     ` [Intel-gfx] " Daniel Vetter
2021-02-05 20:53     ` Daniel Vetter
2021-02-08 11:49     ` Michel Dänzer
2021-02-08 11:49       ` [Intel-gfx] " Michel Dänzer
2021-02-08 11:49       ` Michel Dänzer
2021-02-08 13:11       ` Michel Dänzer
2021-02-08 13:11         ` [Intel-gfx] " Michel Dänzer
2021-02-08 13:11         ` Michel Dänzer
2021-02-08 13:34       ` Daniel Vetter
2021-02-08 13:34         ` [Intel-gfx] " Daniel Vetter
2021-02-08 13:34         ` Daniel Vetter
2021-02-08 13:49         ` Michel Dänzer
2021-02-08 13:49           ` [Intel-gfx] " Michel Dänzer
2021-02-08 13:49           ` Michel Dänzer
2021-02-05 19:25 ` kernel test robot
2021-02-05 19:25   ` kernel test robot
2021-02-05 19:25   ` [Intel-gfx] " kernel test robot
2021-02-05 19:25   ` kernel test robot
2021-02-05 19:46 ` kernel test robot
2021-02-05 19:46   ` kernel test robot
2021-02-05 19:46   ` [Intel-gfx] " kernel test robot
2021-02-05 19:46   ` kernel test robot
2021-02-05 21:06 ` [PATCH v2] " Chris Wilson
2021-02-05 21:06   ` [Intel-gfx] " Chris Wilson
2021-02-05 21:06   ` Chris Wilson
2021-02-05 21:16   ` Chris Wilson
2021-02-05 21:16     ` [Intel-gfx] " Chris Wilson
2021-02-05 21:16     ` Chris Wilson
2021-02-05 21:20     ` Kees Cook
2021-02-05 21:20       ` [Intel-gfx] " Kees Cook
2021-02-05 21:20       ` Kees Cook
2021-02-05 21:28       ` Chris Wilson
2021-02-05 21:28         ` [Intel-gfx] " Chris Wilson
2021-02-05 21:28         ` Chris Wilson
2021-02-05 21:48         ` Daniel Vetter
2021-02-05 21:48           ` [Intel-gfx] " Daniel Vetter
2021-02-05 21:48           ` Daniel Vetter
2021-02-05 21:47   ` Rasmus Villemoes
2021-02-05 21:47     ` [Intel-gfx] " Rasmus Villemoes
2021-02-05 21:47     ` Rasmus Villemoes
2021-02-05 22:00 ` [PATCH v3] kcmp: Support selection of SYS_kcmp without CHECKPOINT_RESTORE Chris Wilson
2021-02-05 22:00   ` [Intel-gfx] " Chris Wilson
2021-02-05 22:00   ` Chris Wilson
2021-02-06 12:47   ` Cyrill Gorcunov
2021-02-06 12:47     ` [Intel-gfx] " Cyrill Gorcunov
2021-02-06 12:47     ` Cyrill Gorcunov
2021-02-08 22:12   ` Kees Cook
2021-02-08 22:12     ` [Intel-gfx] " Kees Cook
2021-02-08 22:12     ` Kees Cook
2021-02-16  9:02     ` Daniel Vetter
2021-02-16  9:02       ` [Intel-gfx] " Daniel Vetter
2021-02-16  9:02       ` Daniel Vetter
2021-02-12 12:57   ` Emil Velikov
2021-02-12 12:57     ` [Intel-gfx] " Emil Velikov
2021-02-12 12:57     ` Emil Velikov
2021-02-12 13:14     ` Simon Ser [this message]
2021-02-12 13:14       ` [Intel-gfx] " Simon Ser
2021-02-12 13:14       ` Simon Ser
2021-02-12 14:07       ` Emil Velikov
2021-02-12 14:07         ` [Intel-gfx] " Emil Velikov
2021-02-12 14:07         ` Emil Velikov
2021-02-12 14:01     ` Michel Dänzer
2021-02-12 14:01       ` [Intel-gfx] " Michel Dänzer
2021-02-12 14:01       ` Michel Dänzer
2021-02-12 14:09       ` Emil Velikov
2021-02-12 14:09         ` [Intel-gfx] " Emil Velikov
2021-02-12 14:09         ` Emil Velikov
2021-02-15  8:56   ` Thomas Zimmermann
2021-02-15  8:56     ` [Intel-gfx] " Thomas Zimmermann
2021-02-15  8:56     ` Thomas Zimmermann
2021-02-06  2:01 ` [Intel-gfx] ✓ Fi.CI.BAT: success for kernel: Expose SYS_kcmp by default (rev3) Patchwork
2021-02-06 14:21 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2021-02-13 17:40 ` [PATCH] kernel: Expose SYS_kcmp by default Pavel Machek
2021-02-13 17:40   ` [Intel-gfx] " Pavel Machek
2021-02-13 17:40   ` Pavel Machek
2021-02-15 10:23   ` Lucas Stach
2021-02-15 10:23     ` [Intel-gfx] " Lucas Stach
2021-02-15 10:23     ` Lucas Stach

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='pIyZ-Jj7O2MYk1vKeyghnFmiFWk_5ZWm-Ze1gUqdDaXzImOVjVdjPh2uyHa-sxOPovRk1ApSKk_5zKBvOrzoSwXeXUu0LbZ75Q1D3gIK2Kk=@emersion.fr' \
    --to=contact@emersion.fr \
    --cc=akpm@linux-foundation.org \
    --cc=chris@chris-wilson.co.uk \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emil.l.velikov@gmail.com \
    --cc=gorcunov@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=luto@amacapital.net \
    --cc=stable@vger.kernel.org \
    --cc=wad@chromium.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.