Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-17 Thread Marek Olšák
Timeline semaphore waits (polling on memory) will be unmonitored and as fast as the roundtrip to memory. Semaphore writes will be slower because the copy of those write requests will also be forwarded to the kernel. Arbitrary writes are not protected by the hw but the kernel will take action

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-17 Thread Daniel Vetter
On Thu, Jun 17, 2021 at 02:28:06PM -0400, Marek Olšák wrote: > The kernel will know who should touch the implicit-sync semaphore next, and > at the same time, the copy of all write requests to the implicit-sync > semaphore will be forwarded to the kernel for monitoring and bo_wait. > > Syncobjs

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-17 Thread Marek Olšák
The kernel will know who should touch the implicit-sync semaphore next, and at the same time, the copy of all write requests to the implicit-sync semaphore will be forwarded to the kernel for monitoring and bo_wait. Syncobjs could either use the same monitored access as implicit sync or be

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-17 Thread Daniel Vetter
On Mon, Jun 14, 2021 at 07:13:00PM +0200, Christian König wrote: > As long as we can figure out who touched to a certain sync object last that > would indeed work, yes. Don't you need to know who will touch it next, i.e. who is holding up your fence? Or maybe I'm just again totally confused.

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-14 Thread Christian König
As long as we can figure out who touched to a certain sync object last that would indeed work, yes. Christian. Am 14.06.21 um 19:10 schrieb Marek Olšák: The call to the hw scheduler has a limitation on the size of all parameters combined. I think we can only pass a 32-bit sequence number and

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-14 Thread Marek Olšák
The call to the hw scheduler has a limitation on the size of all parameters combined. I think we can only pass a 32-bit sequence number and a ~16-bit global (per-GPU) syncobj handle in one call and not much else. The syncobj handle can be an element index in a global (per-GPU) syncobj table and

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-10 Thread Christian König
Hi guys, maybe soften that a bit. Reading from the shared memory of the user fence is ok for everybody. What we need to take more care of is the writing side. So my current thinking is that we allow read only access, but writing a new sequence value needs to go through the scheduler/kernel.

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-10 Thread Marek Olšák
Hi Daniel, We just talked about this whole topic internally and we came up to the conclusion that the hardware needs to understand sync object handles and have high-level wait and signal operations in the command stream. Sync objects will be backed by memory, but they won't be readable or

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-09 Thread Daniel Vetter
On Wed, Jun 09, 2021 at 03:58:26PM +0200, Christian König wrote: > Am 09.06.21 um 15:19 schrieb Daniel Vetter: > > [SNIP] > > > Yeah, we call this the lightweight and the heavyweight tlb flush. > > > > > > The lighweight can be used when you are sure that you don't have any of > > > the > > >

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-09 Thread Christian König
Am 09.06.21 um 15:19 schrieb Daniel Vetter: [SNIP] Yeah, we call this the lightweight and the heavyweight tlb flush. The lighweight can be used when you are sure that you don't have any of the PTEs currently in flight in the 3D/DMA engine and you just need to invalidate the TLB. The

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-09 Thread Daniel Vetter
On Fri, Jun 04, 2021 at 01:27:15PM +0200, Christian König wrote: > Am 04.06.21 um 10:57 schrieb Daniel Vetter: > > On Fri, Jun 04, 2021 at 09:00:31AM +0200, Christian König wrote: > > > Am 02.06.21 um 21:19 schrieb Daniel Vetter: > > > > On Wed, Jun 02, 2021 at 08:52:38PM +0200, Christian König

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-04 Thread Christian König
Am 04.06.21 um 10:57 schrieb Daniel Vetter: On Fri, Jun 04, 2021 at 09:00:31AM +0200, Christian König wrote: Am 02.06.21 um 21:19 schrieb Daniel Vetter: On Wed, Jun 02, 2021 at 08:52:38PM +0200, Christian König wrote: Am 02.06.21 um 20:48 schrieb Daniel Vetter: On Wed, Jun 02, 2021 at

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-04 Thread Daniel Vetter
On Fri, Jun 04, 2021 at 09:00:31AM +0200, Christian König wrote: > Am 02.06.21 um 21:19 schrieb Daniel Vetter: > > On Wed, Jun 02, 2021 at 08:52:38PM +0200, Christian König wrote: > > > > > > Am 02.06.21 um 20:48 schrieb Daniel Vetter: > > > > On Wed, Jun 02, 2021 at 05:38:51AM -0400, Marek Olšák

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-04 Thread Christian König
Am 02.06.21 um 21:19 schrieb Daniel Vetter: On Wed, Jun 02, 2021 at 08:52:38PM +0200, Christian König wrote: Am 02.06.21 um 20:48 schrieb Daniel Vetter: On Wed, Jun 02, 2021 at 05:38:51AM -0400, Marek Olšák wrote: On Wed, Jun 2, 2021 at 5:34 AM Marek Olšák wrote: Yes, we can't break

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-03 Thread Marek Olšák
On Thu., Jun. 3, 2021, 15:18 Daniel Vetter, wrote: > On Thu, Jun 3, 2021 at 7:53 PM Marek Olšák wrote: > > > > Daniel, I think what you are suggesting is that we need to enable user > queues with the drm scheduler and dma_fence first, and once that works, we > can investigate how much of that

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-03 Thread Daniel Vetter
On Thu, Jun 3, 2021 at 7:53 PM Marek Olšák wrote: > > Daniel, I think what you are suggesting is that we need to enable user queues > with the drm scheduler and dma_fence first, and once that works, we can > investigate how much of that kernel logic can be moved to the hw. Would that > work?

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-03 Thread Marek Olšák
Daniel, I think what you are suggesting is that we need to enable user queues with the drm scheduler and dma_fence first, and once that works, we can investigate how much of that kernel logic can be moved to the hw. Would that work? In theory it shouldn't matter whether the kernel does it or the

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-03 Thread Daniel Vetter
On Thu, Jun 3, 2021 at 12:55 PM Marek Olšák wrote: > > On Thu., Jun. 3, 2021, 06:03 Daniel Vetter, wrote: >> >> On Thu, Jun 03, 2021 at 04:20:18AM -0400, Marek Olšák wrote: >> > On Thu, Jun 3, 2021 at 3:47 AM Daniel Vetter wrote: >> > >> > > On Wed, Jun 02, 2021 at 11:16:39PM -0400, Marek Olšák

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-03 Thread Marek Olšák
On Thu., Jun. 3, 2021, 06:03 Daniel Vetter, wrote: > On Thu, Jun 03, 2021 at 04:20:18AM -0400, Marek Olšák wrote: > > On Thu, Jun 3, 2021 at 3:47 AM Daniel Vetter wrote: > > > > > On Wed, Jun 02, 2021 at 11:16:39PM -0400, Marek Olšák wrote: > > > > On Wed, Jun 2, 2021 at 2:48 PM Daniel Vetter

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-03 Thread Daniel Vetter
On Thu, Jun 03, 2021 at 04:20:18AM -0400, Marek Olšák wrote: > On Thu, Jun 3, 2021 at 3:47 AM Daniel Vetter wrote: > > > On Wed, Jun 02, 2021 at 11:16:39PM -0400, Marek Olšák wrote: > > > On Wed, Jun 2, 2021 at 2:48 PM Daniel Vetter wrote: > > > > > > > On Wed, Jun 02, 2021 at 05:38:51AM -0400,

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-03 Thread Marek Olšák
On Thu, Jun 3, 2021 at 3:47 AM Daniel Vetter wrote: > On Wed, Jun 02, 2021 at 11:16:39PM -0400, Marek Olšák wrote: > > On Wed, Jun 2, 2021 at 2:48 PM Daniel Vetter wrote: > > > > > On Wed, Jun 02, 2021 at 05:38:51AM -0400, Marek Olšák wrote: > > > > On Wed, Jun 2, 2021 at 5:34 AM Marek Olšák

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-03 Thread Daniel Vetter
On Wed, Jun 02, 2021 at 11:16:39PM -0400, Marek Olšák wrote: > On Wed, Jun 2, 2021 at 2:48 PM Daniel Vetter wrote: > > > On Wed, Jun 02, 2021 at 05:38:51AM -0400, Marek Olšák wrote: > > > On Wed, Jun 2, 2021 at 5:34 AM Marek Olšák wrote: > > > > > > > Yes, we can't break anything because we

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-02 Thread Marek Olšák
On Wed, Jun 2, 2021 at 2:48 PM Daniel Vetter wrote: > On Wed, Jun 02, 2021 at 05:38:51AM -0400, Marek Olšák wrote: > > On Wed, Jun 2, 2021 at 5:34 AM Marek Olšák wrote: > > > > > Yes, we can't break anything because we don't want to complicate things > > > for us. It's pretty much all NAK'd

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-02 Thread Daniel Vetter
On Wed, Jun 02, 2021 at 10:09:01AM +0200, Michel Dänzer wrote: > On 2021-06-01 12:49 p.m., Michel Dänzer wrote: > > On 2021-06-01 12:21 p.m., Christian König wrote: > > > >> Another question is if that is sufficient as security for the display > >> server or if we need further handling down the

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-02 Thread Daniel Vetter
On Wed, Jun 02, 2021 at 08:52:38PM +0200, Christian König wrote: > > > Am 02.06.21 um 20:48 schrieb Daniel Vetter: > > On Wed, Jun 02, 2021 at 05:38:51AM -0400, Marek Olšák wrote: > > > On Wed, Jun 2, 2021 at 5:34 AM Marek Olšák wrote: > > > > > > > Yes, we can't break anything because we

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-02 Thread Christian König
Am 02.06.21 um 20:48 schrieb Daniel Vetter: On Wed, Jun 02, 2021 at 05:38:51AM -0400, Marek Olšák wrote: On Wed, Jun 2, 2021 at 5:34 AM Marek Olšák wrote: Yes, we can't break anything because we don't want to complicate things for us. It's pretty much all NAK'd already. We are trying to

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-02 Thread Daniel Vetter
On Wed, Jun 02, 2021 at 05:38:51AM -0400, Marek Olšák wrote: > On Wed, Jun 2, 2021 at 5:34 AM Marek Olšák wrote: > > > Yes, we can't break anything because we don't want to complicate things > > for us. It's pretty much all NAK'd already. We are trying to gather more > > knowledge and then make

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-02 Thread Christian König
Am 02.06.21 um 11:58 schrieb Marek Olšák: On Wed, Jun 2, 2021 at 5:44 AM Christian König > wrote: Am 02.06.21 um 10:57 schrieb Daniel Stone: > Hi Christian, > > On Tue, 1 Jun 2021 at 13:51, Christian König >

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-02 Thread Marek Olšák
On Wed, Jun 2, 2021 at 5:44 AM Christian König < ckoenig.leichtzumer...@gmail.com> wrote: > Am 02.06.21 um 10:57 schrieb Daniel Stone: > > Hi Christian, > > > > On Tue, 1 Jun 2021 at 13:51, Christian König > > wrote: > >> Am 01.06.21 um 14:30 schrieb Daniel Vetter: > >>> If you want to enable

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-02 Thread Christian König
Am 02.06.21 um 10:57 schrieb Daniel Stone: Hi Christian, On Tue, 1 Jun 2021 at 13:51, Christian König wrote: Am 01.06.21 um 14:30 schrieb Daniel Vetter: If you want to enable this use-case with driver magic and without the compositor being aware of what's going on, the solution is

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-02 Thread Marek Olšák
On Wed, Jun 2, 2021 at 5:34 AM Marek Olšák wrote: > Yes, we can't break anything because we don't want to complicate things > for us. It's pretty much all NAK'd already. We are trying to gather more > knowledge and then make better decisions. > > The idea we are considering is that we'll expose

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-02 Thread Marek Olšák
Yes, we can't break anything because we don't want to complicate things for us. It's pretty much all NAK'd already. We are trying to gather more knowledge and then make better decisions. The idea we are considering is that we'll expose memory-based sync objects to userspace for read only, and the

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-02 Thread Daniel Stone
Hi Christian, On Tue, 1 Jun 2021 at 13:51, Christian König wrote: > Am 01.06.21 um 14:30 schrieb Daniel Vetter: > > If you want to enable this use-case with driver magic and without the > > compositor being aware of what's going on, the solution is EGLStreams. > > Not sure we want to go there,

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-02 Thread Michel Dänzer
On 2021-06-01 12:49 p.m., Michel Dänzer wrote: > On 2021-06-01 12:21 p.m., Christian König wrote: > >> Another question is if that is sufficient as security for the display server >> or if we need further handling down the road? I mean essentially we are >> moving the reliability problem into

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-01 Thread Daniel Stone
Hi, On Tue, 1 Jun 2021 at 14:18, Michel Dänzer wrote: > On 2021-06-01 2:10 p.m., Christian König wrote: > > Am 01.06.21 um 12:49 schrieb Michel Dänzer: > >> There isn't a choice for Wayland compositors in general, since there can > >> be arbitrary other state which needs to be applied

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-01 Thread Michel Dänzer
On 2021-06-01 3:18 p.m., Michel Dänzer wrote: > On 2021-06-01 2:10 p.m., Christian König wrote: >> Am 01.06.21 um 12:49 schrieb Michel Dänzer: >>> On 2021-06-01 12:21 p.m., Christian König wrote: Am 01.06.21 um 11:02 schrieb Michel Dänzer: > On 2021-05-27 11:51 p.m., Marek Olšák wrote:

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-01 Thread Michel Dänzer
On 2021-06-01 3:01 p.m., Marek Olšák wrote: > > > On Tue., Jun. 1, 2021, 08:51 Christian König, > mailto:ckoenig.leichtzumer...@gmail.com>> > wrote: > > Am 01.06.21 um 14:30 schrieb Daniel Vetter: > > On Tue, Jun 1, 2021 at 2:10 PM Christian König > >

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-01 Thread Michel Dänzer
On 2021-06-01 2:10 p.m., Christian König wrote: > Am 01.06.21 um 12:49 schrieb Michel Dänzer: >> On 2021-06-01 12:21 p.m., Christian König wrote: >>> Am 01.06.21 um 11:02 schrieb Michel Dänzer: On 2021-05-27 11:51 p.m., Marek Olšák wrote: > 3) Compositors (and other privileged processes,

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-01 Thread Marek Olšák
On Tue., Jun. 1, 2021, 08:51 Christian König, < ckoenig.leichtzumer...@gmail.com> wrote: > Am 01.06.21 um 14:30 schrieb Daniel Vetter: > > On Tue, Jun 1, 2021 at 2:10 PM Christian König > > wrote: > >> Am 01.06.21 um 12:49 schrieb Michel Dänzer: > >>> On 2021-06-01 12:21 p.m., Christian König

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-01 Thread Christian König
Am 01.06.21 um 14:30 schrieb Daniel Vetter: On Tue, Jun 1, 2021 at 2:10 PM Christian König wrote: Am 01.06.21 um 12:49 schrieb Michel Dänzer: On 2021-06-01 12:21 p.m., Christian König wrote: Am 01.06.21 um 11:02 schrieb Michel Dänzer: On 2021-05-27 11:51 p.m., Marek Olšák wrote: 3)

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-01 Thread Daniel Vetter
On Tue, Jun 1, 2021 at 2:10 PM Christian König wrote: > > Am 01.06.21 um 12:49 schrieb Michel Dänzer: > > On 2021-06-01 12:21 p.m., Christian König wrote: > >> Am 01.06.21 um 11:02 schrieb Michel Dänzer: > >>> On 2021-05-27 11:51 p.m., Marek Olšák wrote: > 3) Compositors (and other

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-01 Thread Christian König
Am 01.06.21 um 12:49 schrieb Michel Dänzer: On 2021-06-01 12:21 p.m., Christian König wrote: Am 01.06.21 um 11:02 schrieb Michel Dänzer: On 2021-05-27 11:51 p.m., Marek Olšák wrote: 3) Compositors (and other privileged processes, and display flipping) can't trust imported/exported fences.

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-01 Thread Michel Dänzer
On 2021-06-01 12:21 p.m., Christian König wrote: > Am 01.06.21 um 11:02 schrieb Michel Dänzer: >> On 2021-05-27 11:51 p.m., Marek Olšák wrote: >>> 3) Compositors (and other privileged processes, and display flipping) can't >>> trust imported/exported fences. They need a timeout recovery mechanism

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-01 Thread Christian König
Am 01.06.21 um 11:02 schrieb Michel Dänzer: On 2021-05-27 11:51 p.m., Marek Olšák wrote: 3) Compositors (and other privileged processes, and display flipping) can't trust imported/exported fences. They need a timeout recovery mechanism from the beginning, and the following are some possible

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-06-01 Thread Michel Dänzer
On 2021-05-27 11:51 p.m., Marek Olšák wrote: > > 3) Compositors (and other privileged processes, and display flipping) can't > trust imported/exported fences. They need a timeout recovery mechanism from > the beginning, and the following are some possible solutions to timeouts: > > a) use a

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-05-31 Thread Christian König
Yes, exactly that's my thinking and also the reason why I'm pondering so hard on the requirement that the memory for shared user fences should not be modifiable by userspace directly. Christian. Am 29.05.21 um 05:33 schrieb Marek Olšák: My first email can be ignored except for the sync

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-05-28 Thread Marek Olšák
My first email can be ignored except for the sync files. Oh well. I think I see what you mean, Christian. If we assume that an imported fence is always read only (the buffer with the sequence number is read only), only the process that created and exported the fence can signal it. If the fence is

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-05-28 Thread Marek Olšák
If both implicit and explicit synchronization are handled the same, then the kernel won't be able to identify the process that caused an implicit sync deadlock. The process that is stuck waiting for a fence can be innocent, and the kernel can't punish it. Likewise, the GPU reset guery that reports

Re: [Mesa-dev] Linux Graphics Next: Userspace submission update

2021-05-28 Thread Christian König
Hi Marek, well I don't think that implicit and explicit synchronization needs to be mutual exclusive. What we should do is to have the ability to transport an synchronization object with each BO. Implicit and explicit synchronization then basically become the same, they just transport the

[Mesa-dev] Linux Graphics Next: Userspace submission update

2021-05-27 Thread Marek Olšák
Hi, Since Christian believes that we can't deadlock the kernel with some changes there, we just need to make everything nice for userspace too. Instead of explaining how it will work, I will explain the cases where future hardware (and its kernel driver) will break existing userspace in order to