[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200520110320.GT206103@phenom.ffwll.local>
Date: Wed, 20 May 2020 13:03:20 +0200
From: Daniel Vetter <daniel@...ll.ch>
To: Christian König <christian.koenig@....com>
Cc: Daniel Vetter <daniel.vetter@...ll.ch>,
DRI Development <dri-devel@...ts.freedesktop.org>,
LKML <linux-kernel@...r.kernel.org>,
Alex Deucher <alexander.deucher@....com>,
Lucas Stach <l.stach@...gutronix.de>,
Jani Nikula <jani.nikula@...ux.intel.com>,
Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>,
Rodrigo Vivi <rodrigo.vivi@...el.com>,
Ben Skeggs <bskeggs@...hat.com>,
VMware Graphics <linux-graphics-maintainer@...are.com>,
Oded Gabbay <oded.gabbay@...il.com>,
linux-media@...r.kernel.org, linaro-mm-sig@...ts.linaro.org,
linux-rdma@...r.kernel.org, amd-gfx@...ts.freedesktop.org,
intel-gfx@...ts.freedesktop.org,
Chris Wilson <chris@...is-wilson.co.uk>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Daniel Vetter <daniel.vetter@...el.com>
Subject: Re: [PATCH] dma-fence: add might_sleep annotation to _wait()
On Wed, May 20, 2020 at 08:54:36AM +0200, Christian König wrote:
> Am 19.05.20 um 15:27 schrieb Daniel Vetter:
> > Do it uncontionally, there's a separate peek function with
> > dma_fence_is_signalled() which can be called from atomic context.
> >
> > v2: Consensus calls for an unconditional might_sleep (Chris,
> > Christian)
> >
> > Full audit:
> > - dma-fence.h: Uses MAX_SCHEDULE_TIMOUT, good chance this sleeps
> > - dma-resv.c: Timeout always at least 1
> > - st-dma-fence.c: Save to sleep in testcases
> > - amdgpu_cs.c: Both callers are for variants of the wait ioctl
> > - amdgpu_device.c: Two callers in vram recover code, both right next
> > to mutex_lock.
> > - amdgpu_vm.c: Use in the vm_wait ioctl, next to _reserve/unreserve
> > - remaining functions in amdgpu: All for test_ib implementations for
> > various engines, caller for that looks all safe (debugfs, driver
> > load, reset)
> > - etnaviv: another wait ioctl
> > - habanalabs: another wait ioctl
> > - nouveau_fence.c: hardcoded 15*HZ ... glorious
> > - nouveau_gem.c: hardcoded 2*HZ ... so not even super consistent, but
> > this one does have a WARN_ON :-/ At least this one is only a
> > fallback path for when kmalloc fails. Maybe this should be put onto
> > some worker list instead, instead of a work per unamp ...
> > - i915/selftests: Hardecoded HZ / 4 or HZ / 8
> > - i915/gt/selftests: Going up the callchain looks safe looking at
> > nearby callers
> > - i915/gt/intel_gt_requests.c. Wrapped in a mutex_lock
> > - i915/gem_i915_gem_wait.c: The i915-version which is called instead
> > for i915 fences already has a might_sleep() annotation, so all good
> >
> > Cc: Alex Deucher <alexander.deucher@....com>
> > Cc: Lucas Stach <l.stach@...gutronix.de>
> > Cc: Jani Nikula <jani.nikula@...ux.intel.com>
> > Cc: Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>
> > Cc: Rodrigo Vivi <rodrigo.vivi@...el.com>
> > Cc: Ben Skeggs <bskeggs@...hat.com>
> > Cc: "VMware Graphics" <linux-graphics-maintainer@...are.com>
> > Cc: Oded Gabbay <oded.gabbay@...il.com>
> > Cc: linux-media@...r.kernel.org
> > Cc: linaro-mm-sig@...ts.linaro.org
> > Cc: linux-rdma@...r.kernel.org
> > Cc: amd-gfx@...ts.freedesktop.org
> > Cc: intel-gfx@...ts.freedesktop.org
> > Cc: Chris Wilson <chris@...is-wilson.co.uk>
> > Cc: Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>
> > Cc: Christian König <christian.koenig@....com>
> > Signed-off-by: Daniel Vetter <daniel.vetter@...el.com>
>
> Reviewed-by: Christian König <christian.koenig@....com>
intel-gfx-ci approves too, thanks to both of you for reviews, patch merged
to drm-misc-next.
-Daniel
>
> > ---
> > drivers/dma-buf/dma-fence.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
> > index 90edf2b281b0..656e9ac2d028 100644
> > --- a/drivers/dma-buf/dma-fence.c
> > +++ b/drivers/dma-buf/dma-fence.c
> > @@ -208,6 +208,8 @@ dma_fence_wait_timeout(struct dma_fence *fence, bool intr, signed long timeout)
> > if (WARN_ON(timeout < 0))
> > return -EINVAL;
> > + might_sleep();
> > +
> > trace_dma_fence_wait_start(fence);
> > if (fence->ops->wait)
> > ret = fence->ops->wait(fence, intr, timeout);
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
Powered by blists - more mailing lists