Daniel Vetter
2014-Jul-22 15:17 UTC
[Nouveau] [PATCH 09/17] drm/radeon: use common fence implementation for fences
On Tue, Jul 22, 2014 at 3:45 PM, Christian K?nig <deathsimple at vodafone.de> wrote:>> Would that be something you can agree to? > > > No, the whole enable_signaling stuff should go away. No callback from the > driver into the fence code, only the other way around. > > fence->signaled as well as fence->wait should become mandatory and only > called from process context without holding any locks, neither atomic nor > any mutex/semaphore (rcu might be ok).So for the enable_signaling, that's optional already. It's only for drivers that don't want to keep interrupts enabled all the time. You can opt out of that easily. Wrt holding no locks at all while calling into any fence functions, that's just not going to work out. The point here is to make different drivers work together and we can rework all the ttm and i915 code to work locklessly in all cases where they need to wait for someone to complete rendering. Or at least I don't think that's feasible. So if you insist that no one might call into radeon code then we simply need to exclude radeon from participating in any shared fencing. But that's a bit pointless.>> Like I've said I think restricting the insanity other people are willing >> to live with just because you don't like it isn't right. But it is >> certainly right for you to insist on not being forced into any such >> design. I think the above would achieve this. > > > I don't think so. If it's just me I would say that I'm just to cautious and > the idea is still save to apply to the whole kernel. > > But since Dave, Jerome and Ben seems to have similar concerns I think we > need to agree to a minimum and save interface for all drivers.Well I haven't yet seen a proposal that actually works. From an intel pov I don't care that much since we don't care about desktop prime, so if radeon/nouveau don't want to do that, meh. Imo the design as-is is fairly sound, and as simple as it can get given the requirements. I haven't heard an argument convincing me otherwise, so I guess we won't have prime support on linux that actually works, ever. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Christian König
2014-Jul-22 15:35 UTC
[Nouveau] [PATCH 09/17] drm/radeon: use common fence implementation for fences
Am 22.07.2014 17:17, schrieb Daniel Vetter:> On Tue, Jul 22, 2014 at 3:45 PM, Christian K?nig > <deathsimple at vodafone.de> wrote: >>> Would that be something you can agree to? >> >> No, the whole enable_signaling stuff should go away. No callback from the >> driver into the fence code, only the other way around. >> >> fence->signaled as well as fence->wait should become mandatory and only >> called from process context without holding any locks, neither atomic nor >> any mutex/semaphore (rcu might be ok). > So for the enable_signaling, that's optional already. It's only for > drivers that don't want to keep interrupts enabled all the time. You > can opt out of that easily. > > Wrt holding no locks at all while calling into any fence functions, > that's just not going to work out. The point here is to make different > drivers work together and we can rework all the ttm and i915 code to > work locklessly in all cases where they need to wait for someone to > complete rendering. Or at least I don't think that's feasible. So if > you insist that no one might call into radeon code then we simply need > to exclude radeon from participating in any shared fencing. But that's > a bit pointless. > >>> Like I've said I think restricting the insanity other people are willing >>> to live with just because you don't like it isn't right. But it is >>> certainly right for you to insist on not being forced into any such >>> design. I think the above would achieve this. >> >> I don't think so. If it's just me I would say that I'm just to cautious and >> the idea is still save to apply to the whole kernel. >> >> But since Dave, Jerome and Ben seems to have similar concerns I think we >> need to agree to a minimum and save interface for all drivers. > Well I haven't yet seen a proposal that actually works.How about this: Drivers exporting fences need to provide a fence->signaled and a fence->wait function, everything else like fence->enable_signaling or calling fence_signaled() from the driver is optional. Drivers wanting to use exported fences don't call fence->signaled or fence->wait in atomic or interrupt context, and not with holding any global locking primitives (like mmap_sem etc...). Holding locking primitives local to the driver is ok, as long as they don't conflict with anything possible used by their own fence implementation. Christian.> From an intel > pov I don't care that much since we don't care about desktop prime, so > if radeon/nouveau don't want to do that, meh. Imo the design as-is is > fairly sound, and as simple as it can get given the requirements. I > haven't heard an argument convincing me otherwise, so I guess we > won't have prime support on linux that actually works, ever. > -Daniel
Daniel Vetter
2014-Jul-22 15:42 UTC
[Nouveau] [PATCH 09/17] drm/radeon: use common fence implementation for fences
On Tue, Jul 22, 2014 at 5:35 PM, Christian K?nig <christian.koenig at amd.com> wrote:> Drivers exporting fences need to provide a fence->signaled and a fence->wait > function, everything else like fence->enable_signaling or calling > fence_signaled() from the driver is optional. > > Drivers wanting to use exported fences don't call fence->signaled or > fence->wait in atomic or interrupt context, and not with holding any global > locking primitives (like mmap_sem etc...). Holding locking primitives local > to the driver is ok, as long as they don't conflict with anything possible > used by their own fence implementation.Well that's almost what we have right now with the exception that drivers are allowed (actually must for correctness when updating fences) the ww_mutexes for dma-bufs (or other buffer objects). Locking correctness is enforced with some extremely nasty lockdep annotations + additional debugging infrastructure enabled with CONFIG_DEBUG_WW_MUTEX_SLOWPATH. We really need to be able to hold dma-buf ww_mutexes while updating fences or waiting for them. And obviously for ->wait we need non-atomic context, not just non-interrupt. Agreed that any shared locks are out of the way (especially stuff like dev->struct_mutex or other non-strictly driver-private stuff, i915 is really bad here still). So from the core fence framework I think we already have exactly this, and we only need to adjust the radeon implementation a bit to make it less risky and invasive to the radeon driver logic. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Apparently Analagous Threads
- [PATCH 09/17] drm/radeon: use common fence implementation for fences
- [PATCH 09/17] drm/radeon: use common fence implementation for fences
- [PATCH 09/17] drm/radeon: use common fence implementation for fences
- [PATCH 09/17] drm/radeon: use common fence implementation for fences
- [PATCH 09/17] drm/radeon: use common fence implementation for fences