AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Emil Velikov <emil.l.velikov@gmail.com>
To: "Koenig, Christian" <Christian.Koenig@amd.com>
Cc: "Deucher, Alexander" <Alexander.Deucher@amd.com>,
	David Airlie <airlied@linux.ie>,
	"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH 01/13] drm/amdgpu: introduce and honour DRM_FORCE_AUTH workaround
Date: Wed, 29 May 2019 17:29:08 +0100	[thread overview]
Message-ID: <20190529162908.GA19679@arch-x1c3> (raw)
In-Reply-To: <9bfd8a01-1e0a-c4b3-6b6f-86d5d05fac31@amd.com>

On 2019/05/29, Koenig, Christian wrote:
> Am 29.05.19 um 15:03 schrieb Emil Velikov:
> > On 2019/05/29, Dave Airlie wrote:
> >> On Wed, 29 May 2019 at 02:47, Emil Velikov <emil.l.velikov@gmail.com> wrote:
> >>> On 2019/05/28, Koenig, Christian wrote:
> >>>> Am 28.05.19 um 18:10 schrieb Emil Velikov:
> >>>>> On 2019/05/28, Daniel Vetter wrote:
> >>>>>> On Tue, May 28, 2019 at 10:03 AM Koenig, Christian
> >>>>>> <Christian.Koenig@amd.com> wrote:
> >>>>>>> Am 28.05.19 um 09:38 schrieb Daniel Vetter:
> >>>>>>>> [SNIP]
> >>>>>>>>> Might be a good idea looking into reverting it partially, so that at
> >>>>>>>>> least command submission and buffer allocation is still blocked.
> >>>>>>>> I thought the issue is a lot more than vainfo, it's pretty much every
> >>>>>>>> hacked up compositor under the sun getting this wrong one way or
> >>>>>>>> another. Thinking about this some more, I also have no idea how you'd
> >>>>>>>> want to deprecate rendering on primary nodes in general. Apparently
> >>>>>>>> that breaks -modesetting already, and probably lots more compositors.
> >>>>>>>> And it looks like we're finally achieve the goal kms set out to 10
> >>>>>>>> years ago, and new compositors are sprouting up all the time. I guess
> >>>>>>>> we could just break them all (on new hardware) and tell them to all
> >>>>>>>> suck it up. But I don't think that's a great option. And just
> >>>>>>>> deprecating this on amdgpu is going to be even harder, since then
> >>>>>>>> everywhere else it'll keep working, and it's just amdgpu.ko that looks
> >>>>>>>> broken.
> >>>>>>>>
> >>>>>>>> Aside: I'm not supporting Emil's idea here because it fixes any issues
> >>>>>>>> Intel has - Intel doesn't care. I support it because reality sucks,
> >>>>>>>> people get this render vs. primary vs. multi-gpu prime wrong all the
> >>>>>>>> time (that's also why we have hardcoded display+gpu pairs in mesa for
> >>>>>>>> the various soc combinations out there), and this looks like a
> >>>>>>>> pragmatic solution. It'd be nice if every compositor and everything
> >>>>>>>> else would perfectly support multi gpu and only use render nodes for
> >>>>>>>> rendering, and only primary nodes for display. But reality is that
> >>>>>>>> people hack on stuff until gears on screen and then move on to more
> >>>>>>>> interesting things (to them). So I don't think we'll ever win this :-/
> >>>>>>> Yeah, but this is a classic case of working around user space issues by
> >>>>>>> making kernel changes instead of fixing user space.
> >>>>>>>
> >>>>>>> Having privileged (output control) and unprivileged (rendering control)
> >>>>>>> functionality behind the same node is a mistake we have made a long time
> >>>>>>> ago and render nodes finally seemed to be a way to fix that.
> >>>>>>>
> >>>>>>> I mean why are compositors using the primary node in the first place?
> >>>>>>> Because they want to have access to privileged resources I think and in
> >>>>>>> this case it is perfectly ok to do so.
> >>>>>>>
> >>>>>>> Now extending unprivileged access to the primary node actually sounds
> >>>>>>> like a step into the wrong direction to me.
> >>>>>>>
> >>>>>>> I rather think that we should go down the route of completely dropping
> >>>>>>> command submission and buffer allocation through the primary node for
> >>>>>>> non master clients. And then as next step at some point drop support for
> >>>>>>> authentication/flink.
> >>>>>>>
> >>>>>>> I mean we have done this with UMS as well and I don't see much other way
> >>>>>>> to move forward and get rid of those ancient interface in the long term.
> >>>>>> Well kms had some really good benefits that drove quick adoption, like
> >>>>>> "suspend/resume actually has a chance of working" or "comes with
> >>>>>> buffer management so you can run multiple gears".
> >>>>>>
> >>>>>> The render node thing is a lot more niche use case (prime, better priv
> >>>>>> separation), plus "it's cleaner design". And the "cleaner design" part
> >>>>>> is something that empirically doesn't seem to matter :-/ Just two
> >>>>>> examples:
> >>>>>> - KHR_display/leases just iterated display resources on the fd needed
> >>>>>> for rendering (and iirc there was even a patch to expose that for
> >>>>>> render nodes too so it works with DRI3), because implementing
> >>>>>> protocols is too hard. Barely managed to stop that one before it
> >>>>>> happened.
> >>>>>> - Various video players use the vblank ioctl on directly to schedule
> >>>>>> frames, without telling the compositor. I discovered that when I
> >>>>>> wanted to limite the vblank ioctl to master clients only. Again,
> >>>>>> apparently too hard to use the existing extensions, or fix the bugs in
> >>>>>> there, or whatever. One userspace got fixed last year, but it'll
> >>>>>> probably get copypasted around forever :-/
> >>>>>>
> >>>>>> So I don't think we'll ever manage to roll a clean split out, and best
> >>>>>> we can do is give in and just hand userspace what it wants. As much as
> >>>>>> that's misguided and unclean and all that. Maybe it'll result in a
> >>>>>> least fewer stuff getting run as root to hack around this, because
> >>>>>> fixing properly seems not to be on the table.
> >>>>>>
> >>>>>> The beauty of kms is that we've achieved the mission, everyone's
> >>>>>> writing their own thing. Which is also terrible, and I don't think
> >>>>>> it'll get better.
> >>>>> With the risk of coming rude I will repeat my earlier comment:
> >>>>>
> >>>>> The problem is _neither_ Intel nor libva specific.
> >>>>>
> >>>>>
> >>>>>
> >>>>> That said, let's step back for a moment and consider:
> >>>>>
> >>>>>    - the "block everything but KMS via the primary node" idea is great but
> >>>>> orthogonal
> >>>>>
> >>>>>    - the series does address issues that are vendor-agnostic
> >>>>>
> >>>>>    - by default this series does _not_ cause any regression be that for
> >>>>> new or old userspace
> >>>>>
> >>>>>    - there are two trivial solutions, if the AMD team has concerns about
> >>>>> closed-source/private stack depending on the old behaviour
> >>>>> If they want I can even write the patches ;-)
> >>>>>
> >>>>>
> >>>>> That said, the notable comments received so far are:
> >>>>>    - rework patch 13/13 to remove the DRM_AUTH from prime fd to/from
> >>>>> handle. I'm OK but this will change the return code - from EACCES to
> >>>>> ENOSYS
> >>>>>
> >>>>>    - vmwgfx will need a check on the reference ioctl(s) - IIRC Thomas is
> >>>>> planning to drop nearly all DRM_AUTH instances in their driver.
> >>>>>
> >>>>>
> >>>>> Christian, as mentioned before - this series does _not_ add
> >>>>> functionality to render nodes. It effectively paves a way towards
> >>>>> removing DRM_AUTH.
> >>>> But it adds functionality to the primary node.
> >>>>
> >>> Behaviour is adjusted - functionality was there since day 1.
> >>>
> >>>>> I understand the series may feel a bit dirty. Yet I would gladly address
> >>>>> any technical concerns you have.
> >>>> Well putting compatibility issues aside my concern is that this is
> >>>> simply a bad design decision which we can't revert later on.
> >>>>
> >>> As sad above - any concerns (theoretical or actual regressions) can be
> >>> trivially fixed _without_ reverting any of this.
> >>>
> >>> I am more than happy to step up and address any regressions in timely
> >>> manner.
> >>>
> >>>
> >>> As a reminder without this series, some of your customers are forced to
> >>> run their applications as root.
> >> I'm torn here on whether this is worth it. Have we got more use cases
> >> to justify it?
> >>
> > Should have mentioned: three DRM drivers (not counting i915) have
> > dropped DRM_AUTH, assumingly for the same reasons I'm bringing here.
> >
> > Apart from the libva, kmscube + gst and mesa, I'm expecting other
> > projects to make the same mistake. Since the former three define the
> > norm of using DRM.
> >
> > The "fix" for all of these being "run as root" :-\
> >
> >> I'm wary of opening this up just because we can.
> >>
> > What can I do to alleviate that worry? I have spent over a week auditing
> > code and designed so that we can reinstate the authentication only where
> > needed.
> 
> Well I don't think the worry here is about regressions,
Glad to hear.

> but rather about 
> a design decision we will never be able to revert.
> 
Can you think of any reason/issue why we would want to revert this? I
will gladly spend some thing exploring how to address it.

> So the question we have to ask is rather if it's a good design decision 
> to resurrect the primary node with all its related compability burdens 
> to work around an issue which is essentially an userspace coding error.
> 

Can see you're not happy on the topic - I'm not too excited either. The
truth to the matter is - DRM drivers have dropped DRM_AUTH regardless of
my work.

It's very unfortunate, if AMDGPU stands out. Perhaps after some time and
unhappy users you'll reconsider.

I believe that Linus has pointed out a number of times that kernel
developers should care about our users. Even when it's an userspace
error.


HTH
Emil
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2019-05-29 16:29 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-27  8:17 [PATCH 01/13] drm/amdgpu: introduce and honour DRM_FORCE_AUTH workaround Emil Velikov
     [not found] ` <20190527081741.14235-1-emil.l.velikov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-05-27  8:17   ` [PATCH 02/13] drm/amdgpu: drop DRM_AUTH usage from the driver Emil Velikov
2019-05-27  8:17   ` [PATCH 10/13] drm/radeon: drop DRM_AUTH from DRM_RENDER_ALLOW ioctls Emil Velikov
2019-05-27 10:47   ` [PATCH 01/13] drm/amdgpu: introduce and honour DRM_FORCE_AUTH workaround Koenig, Christian
     [not found]     ` <3c9b5688-5e83-f173-00e3-6e139e05d466-5C7GfCeVMHo@public.gmane.org>
2019-05-27 12:05       ` Emil Velikov
2019-05-27 12:20         ` Koenig, Christian
2019-05-27 12:52           ` Emil Velikov
2019-05-27 13:26             ` Daniel Vetter
2019-05-27 13:34               ` Daniel Vetter
2019-05-27 13:20     ` Daniel Vetter
     [not found]       ` <20190527132041.GP21222-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2019-05-27 13:26         ` Emil Velikov
2019-05-27 13:42           ` Koenig, Christian
     [not found]             ` <0426fb3e-e7bc-2464-cb42-4d5753956d23-5C7GfCeVMHo@public.gmane.org>
2019-05-27 15:26               ` Daniel Vetter
     [not found]                 ` <CAKMK7uE_pRro8PxTwUq+pC_1GVVT7nUxan1T-kqSYT=BMHTf2g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-05-28  6:58                   ` Koenig, Christian
     [not found]                     ` <d12a7dd4-595b-d0aa-a87d-527392fb0384-5C7GfCeVMHo@public.gmane.org>
2019-05-28  7:38                       ` Daniel Vetter
     [not found]                         ` <CAKMK7uE1ZWjCeg3q7qDrbcj89+DuPQwfjMqC8hTjDAMU5bhh-w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-05-28  8:03                           ` Koenig, Christian
     [not found]                             ` <98c3d891-6966-2043-9709-4e718dbc6bac-5C7GfCeVMHo@public.gmane.org>
2019-05-28  8:18                               ` Daniel Vetter
     [not found]                                 ` <CAKMK7uGsc7WzBBrfxape4Yy7fbKoDFH5J2F87Kx=7rE1+pXcXw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-05-28 16:10                                   ` Emil Velikov
2019-05-28 16:22                                     ` Koenig, Christian
2019-05-28 16:46                                       ` Emil Velikov
2019-05-28 20:05                                         ` Dave Airlie
     [not found]                                           ` <CAPM=9tzuQX4iQU=w4QfbE1ryq6sXc4k5SVh6V1_4AyH_O+D_oA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-05-29 13:03                                             ` Emil Velikov
2019-05-29 13:14                                               ` Koenig, Christian
2019-05-29 16:29                                                 ` Emil Velikov [this message]
2019-05-31 12:20                                                   ` Koenig, Christian
2019-06-04 17:59                                                     ` Emil Velikov
2019-06-04 10:50                               ` Michel Dänzer
     [not found]                                 ` <ee1b8980-3d78-aa6d-fe46-2c0d45c2bbdd-otUistvHUpPR7s880joybQ@public.gmane.org>
2019-06-04 11:24                                   ` Koenig, Christian
2019-06-04 13:28                                     ` Daniel Vetter
2019-05-27 15:32               ` Emil Velikov
2019-05-27 13:11   ` Daniel Vetter
     [not found]     ` <20190527131143.GN21222-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2019-05-27 13:47       ` Emil Velikov
2019-06-14 12:09 ` Emil Velikov
2019-06-14 12:55   ` Koenig, Christian
     [not found]     ` <9dbdda6c-8916-e5ae-1676-86828b9890e7-5C7GfCeVMHo@public.gmane.org>
2019-06-14 14:16       ` Michel Dänzer
2019-06-14 15:53       ` Emil Velikov
2019-06-14 16:00         ` Koenig, Christian
     [not found]           ` <84b3337c-0cdc-44d4-02c6-c56bd729ed47-5C7GfCeVMHo@public.gmane.org>
2019-06-14 16:25             ` Emil Velikov
2019-06-20 16:30           ` Emil Velikov
2019-06-21  7:12             ` Koenig, Christian
     [not found]               ` <9cad6e74-4751-0b0a-35d1-e8f0ac4d3efc-5C7GfCeVMHo@public.gmane.org>
2019-06-21  7:41                 ` Michel Dänzer
2019-06-21  8:23                   ` Koenig, Christian
2019-06-21  9:09               ` Daniel Vetter
2019-06-21  9:25                 ` Koenig, Christian
     [not found]                   ` <be9f38f5-6bb5-9535-f3d9-bafa83370e0f-5C7GfCeVMHo@public.gmane.org>
2019-06-21  9:35                     ` Daniel Vetter
     [not found]                       ` <CAKMK7uE5qO4q3RYNDp22gkMSSJGgz9ChxhuWPYqXO6D1UUvy6Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-06-21 10:16                         ` Christian König
2019-06-21 10:20                       ` Emil Velikov
2019-06-21 10:31                         ` Koenig, Christian
     [not found]                           ` <d241fab3-b6f0-d38a-b83f-03b70736b355-5C7GfCeVMHo@public.gmane.org>
2019-06-21 10:53                             ` Emil Velikov
2019-06-21 11:07                               ` Koenig, Christian
     [not found]                                 ` <338bb519-05f1-cb76-d965-81237f432937-5C7GfCeVMHo@public.gmane.org>
2019-06-21 11:58                                   ` Emil Velikov
2019-06-21 12:13                                     ` Koenig, Christian
     [not found]                                       ` <76158d1f-676d-2afa-244b-934967a9cb75-5C7GfCeVMHo@public.gmane.org>
2019-06-21 12:47                                         ` Emil Velikov
2019-06-21 13:00                                           ` Koenig, Christian
2019-06-21 15:37                                             ` Daniel Vetter
2019-06-21 15:24                                     ` Michel Dänzer
2019-06-21 11:03                           ` Daniel Vetter
     [not found]                             ` <CAKMK7uEVziNZJES9=JFBUu=LpmubS8=-A654cMN+QqhEmc8Fvw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-06-21 11:37                               ` Christian König
     [not found]                                 ` <c92dc683-6815-dc5a-dc2b-54517cc027de-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-06-21 11:50                                   ` Daniel Vetter
     [not found]                                     ` <CAKMK7uHsv3HOXOQq=GGRkx6f+ssRg7dO7qEoBqRS9V_KiTN3Hg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-06-21 11:59                                       ` Daniel Vetter
     [not found]                                         ` <CAKMK7uG+EUhmZafFmjzSR=eq7543OELbHVaQnZZQGx0APSozwg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-06-21 12:01                                           ` Emil Velikov
2019-06-21 15:15                                       ` Michel Dänzer
     [not found]                                         ` <b182c8e3-c060-71f0-2b3b-62600d825c9f-otUistvHUpPR7s880joybQ@public.gmane.org>
2019-06-21 15:44                                           ` Daniel Vetter
2019-06-21 15:52                                             ` Michel Dänzer
     [not found]                                               ` <13024821-4767-eeaf-86eb-9ae1056f8931-otUistvHUpPR7s880joybQ@public.gmane.org>
2019-06-24  9:37                                                 ` Michel Dänzer
     [not found]                                                   ` <b03e8977-c51a-9606-383f-cf4ba674dcdd-otUistvHUpPR7s880joybQ@public.gmane.org>
2019-06-24  9:48                                                     ` 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=20190529162908.GA19679@arch-x1c3 \
    --to=emil.l.velikov@gmail.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Christian.Koenig@amd.com \
    --cc=airlied@linux.ie \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox