Message ID | 20210903184806.1680887-8-robdclark@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | dma-fence: Deadline awareness | expand |
On Fri, Sep 03, 2021 at 11:47:58AM -0700, Rob Clark wrote: > From: Rob Clark <robdclark@chromium.org> > > Signed-off-by: Rob Clark <robdclark@chromium.org> > --- > drivers/dma-buf/dma-fence-chain.c | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/drivers/dma-buf/dma-fence-chain.c b/drivers/dma-buf/dma-fence-chain.c > index 1b4cb3e5cec9..736a9ad3ea6d 100644 > --- a/drivers/dma-buf/dma-fence-chain.c > +++ b/drivers/dma-buf/dma-fence-chain.c > @@ -208,6 +208,18 @@ static void dma_fence_chain_release(struct dma_fence *fence) > dma_fence_free(fence); > } > > + > +static void dma_fence_chain_set_deadline(struct dma_fence *fence, > + ktime_t deadline) > +{ > + dma_fence_chain_for_each(fence, fence) { > + struct dma_fence_chain *chain = to_dma_fence_chain(fence); > + struct dma_fence *f = chain ? chain->fence : fence; Doesn't this just end up calling set_deadline on a chain, potenetially resulting in recursion? Also I don't think this should ever happen, why did you add that? -Daniel > + > + dma_fence_set_deadline(f, deadline); > + } > +} > + > const struct dma_fence_ops dma_fence_chain_ops = { > .use_64bit_seqno = true, > .get_driver_name = dma_fence_chain_get_driver_name, > @@ -215,6 +227,7 @@ const struct dma_fence_ops dma_fence_chain_ops = { > .enable_signaling = dma_fence_chain_enable_signaling, > .signaled = dma_fence_chain_signaled, > .release = dma_fence_chain_release, > + .set_deadline = dma_fence_chain_set_deadline, > }; > EXPORT_SYMBOL(dma_fence_chain_ops); > > -- > 2.31.1 >
On Wed, Sep 8, 2021 at 10:54 AM Daniel Vetter <daniel@ffwll.ch> wrote: > > On Fri, Sep 03, 2021 at 11:47:58AM -0700, Rob Clark wrote: > > From: Rob Clark <robdclark@chromium.org> > > > > Signed-off-by: Rob Clark <robdclark@chromium.org> > > --- > > drivers/dma-buf/dma-fence-chain.c | 13 +++++++++++++ > > 1 file changed, 13 insertions(+) > > > > diff --git a/drivers/dma-buf/dma-fence-chain.c b/drivers/dma-buf/dma-fence-chain.c > > index 1b4cb3e5cec9..736a9ad3ea6d 100644 > > --- a/drivers/dma-buf/dma-fence-chain.c > > +++ b/drivers/dma-buf/dma-fence-chain.c > > @@ -208,6 +208,18 @@ static void dma_fence_chain_release(struct dma_fence *fence) > > dma_fence_free(fence); > > } > > > > + > > +static void dma_fence_chain_set_deadline(struct dma_fence *fence, > > + ktime_t deadline) > > +{ > > + dma_fence_chain_for_each(fence, fence) { > > + struct dma_fence_chain *chain = to_dma_fence_chain(fence); > > + struct dma_fence *f = chain ? chain->fence : fence; > > Doesn't this just end up calling set_deadline on a chain, potenetially > resulting in recursion? Also I don't think this should ever happen, why > did you add that? Tbh the fence-chain was the part I was a bit fuzzy about, and the main reason I added igt tests. The iteration is similar to how, for ex, dma_fence_chain_signaled() work, and according to the igt test it does what was intended BR, -R > -Daniel > > > + > > + dma_fence_set_deadline(f, deadline); > > + } > > +} > > + > > const struct dma_fence_ops dma_fence_chain_ops = { > > .use_64bit_seqno = true, > > .get_driver_name = dma_fence_chain_get_driver_name, > > @@ -215,6 +227,7 @@ const struct dma_fence_ops dma_fence_chain_ops = { > > .enable_signaling = dma_fence_chain_enable_signaling, > > .signaled = dma_fence_chain_signaled, > > .release = dma_fence_chain_release, > > + .set_deadline = dma_fence_chain_set_deadline, > > }; > > EXPORT_SYMBOL(dma_fence_chain_ops); > > > > -- > > 2.31.1 > > > > -- > Daniel Vetter > Software Engineer, Intel Corporation > http://blog.ffwll.ch
On Wed, Sep 08, 2021 at 11:19:15AM -0700, Rob Clark wrote: > On Wed, Sep 8, 2021 at 10:54 AM Daniel Vetter <daniel@ffwll.ch> wrote: > > > > On Fri, Sep 03, 2021 at 11:47:58AM -0700, Rob Clark wrote: > > > From: Rob Clark <robdclark@chromium.org> > > > > > > Signed-off-by: Rob Clark <robdclark@chromium.org> > > > --- > > > drivers/dma-buf/dma-fence-chain.c | 13 +++++++++++++ > > > 1 file changed, 13 insertions(+) > > > > > > diff --git a/drivers/dma-buf/dma-fence-chain.c b/drivers/dma-buf/dma-fence-chain.c > > > index 1b4cb3e5cec9..736a9ad3ea6d 100644 > > > --- a/drivers/dma-buf/dma-fence-chain.c > > > +++ b/drivers/dma-buf/dma-fence-chain.c > > > @@ -208,6 +208,18 @@ static void dma_fence_chain_release(struct dma_fence *fence) > > > dma_fence_free(fence); > > > } > > > > > > + > > > +static void dma_fence_chain_set_deadline(struct dma_fence *fence, > > > + ktime_t deadline) > > > +{ > > > + dma_fence_chain_for_each(fence, fence) { > > > + struct dma_fence_chain *chain = to_dma_fence_chain(fence); > > > + struct dma_fence *f = chain ? chain->fence : fence; > > > > Doesn't this just end up calling set_deadline on a chain, potenetially > > resulting in recursion? Also I don't think this should ever happen, why > > did you add that? > > Tbh the fence-chain was the part I was a bit fuzzy about, and the main > reason I added igt tests. The iteration is similar to how, for ex, > dma_fence_chain_signaled() work, and according to the igt test it does > what was intended Huh indeed. Maybe something we should fix, like why does the dma_fence_chain_for_each not give you the upcast chain pointer ... I guess this also needs more Christian and less me. -Daniel > > BR, > -R > > > -Daniel > > > > > + > > > + dma_fence_set_deadline(f, deadline); > > > + } > > > +} > > > + > > > const struct dma_fence_ops dma_fence_chain_ops = { > > > .use_64bit_seqno = true, > > > .get_driver_name = dma_fence_chain_get_driver_name, > > > @@ -215,6 +227,7 @@ const struct dma_fence_ops dma_fence_chain_ops = { > > > .enable_signaling = dma_fence_chain_enable_signaling, > > > .signaled = dma_fence_chain_signaled, > > > .release = dma_fence_chain_release, > > > + .set_deadline = dma_fence_chain_set_deadline, > > > }; > > > EXPORT_SYMBOL(dma_fence_chain_ops); > > > > > > -- > > > 2.31.1 > > > > > > > -- > > Daniel Vetter > > Software Engineer, Intel Corporation > > http://blog.ffwll.ch
Am 08.09.21 um 20:45 schrieb Daniel Vetter: > On Wed, Sep 08, 2021 at 11:19:15AM -0700, Rob Clark wrote: >> On Wed, Sep 8, 2021 at 10:54 AM Daniel Vetter <daniel@ffwll.ch> wrote: >>> On Fri, Sep 03, 2021 at 11:47:58AM -0700, Rob Clark wrote: >>>> From: Rob Clark <robdclark@chromium.org> >>>> >>>> Signed-off-by: Rob Clark <robdclark@chromium.org> >>>> --- >>>> drivers/dma-buf/dma-fence-chain.c | 13 +++++++++++++ >>>> 1 file changed, 13 insertions(+) >>>> >>>> diff --git a/drivers/dma-buf/dma-fence-chain.c b/drivers/dma-buf/dma-fence-chain.c >>>> index 1b4cb3e5cec9..736a9ad3ea6d 100644 >>>> --- a/drivers/dma-buf/dma-fence-chain.c >>>> +++ b/drivers/dma-buf/dma-fence-chain.c >>>> @@ -208,6 +208,18 @@ static void dma_fence_chain_release(struct dma_fence *fence) >>>> dma_fence_free(fence); >>>> } >>>> >>>> + >>>> +static void dma_fence_chain_set_deadline(struct dma_fence *fence, >>>> + ktime_t deadline) >>>> +{ >>>> + dma_fence_chain_for_each(fence, fence) { >>>> + struct dma_fence_chain *chain = to_dma_fence_chain(fence); >>>> + struct dma_fence *f = chain ? chain->fence : fence; >>> Doesn't this just end up calling set_deadline on a chain, potenetially >>> resulting in recursion? Also I don't think this should ever happen, why >>> did you add that? >> Tbh the fence-chain was the part I was a bit fuzzy about, and the main >> reason I added igt tests. The iteration is similar to how, for ex, >> dma_fence_chain_signaled() work, and according to the igt test it does >> what was intended > Huh indeed. Maybe something we should fix, like why does the > dma_fence_chain_for_each not give you the upcast chain pointer ... I guess > this also needs more Christian and less me. Yeah I was also already thinking about having a dma_fence_chain_for_each_contained() macro which directly returns the containing fence, just didn't had time to implement/clean that up. And yes the patch is correct as it is and avoid the recursion, so Reviewed-by: Christian König <christian.koenig@amd.com> for this one. Regards, Christian. > -Daniel > >> BR, >> -R >> >>> -Daniel >>> >>>> + >>>> + dma_fence_set_deadline(f, deadline); >>>> + } >>>> +} >>>> + >>>> const struct dma_fence_ops dma_fence_chain_ops = { >>>> .use_64bit_seqno = true, >>>> .get_driver_name = dma_fence_chain_get_driver_name, >>>> @@ -215,6 +227,7 @@ const struct dma_fence_ops dma_fence_chain_ops = { >>>> .enable_signaling = dma_fence_chain_enable_signaling, >>>> .signaled = dma_fence_chain_signaled, >>>> .release = dma_fence_chain_release, >>>> + .set_deadline = dma_fence_chain_set_deadline, >>>> }; >>>> EXPORT_SYMBOL(dma_fence_chain_ops); >>>> >>>> -- >>>> 2.31.1 >>>> >>> -- >>> Daniel Vetter >>> Software Engineer, Intel Corporation >>> http://blog.ffwll.ch
diff --git a/drivers/dma-buf/dma-fence-chain.c b/drivers/dma-buf/dma-fence-chain.c index 1b4cb3e5cec9..736a9ad3ea6d 100644 --- a/drivers/dma-buf/dma-fence-chain.c +++ b/drivers/dma-buf/dma-fence-chain.c @@ -208,6 +208,18 @@ static void dma_fence_chain_release(struct dma_fence *fence) dma_fence_free(fence); } + +static void dma_fence_chain_set_deadline(struct dma_fence *fence, + ktime_t deadline) +{ + dma_fence_chain_for_each(fence, fence) { + struct dma_fence_chain *chain = to_dma_fence_chain(fence); + struct dma_fence *f = chain ? chain->fence : fence; + + dma_fence_set_deadline(f, deadline); + } +} + const struct dma_fence_ops dma_fence_chain_ops = { .use_64bit_seqno = true, .get_driver_name = dma_fence_chain_get_driver_name, @@ -215,6 +227,7 @@ const struct dma_fence_ops dma_fence_chain_ops = { .enable_signaling = dma_fence_chain_enable_signaling, .signaled = dma_fence_chain_signaled, .release = dma_fence_chain_release, + .set_deadline = dma_fence_chain_set_deadline, }; EXPORT_SYMBOL(dma_fence_chain_ops);