* [PATCH] dma-buf: use irq work for dma_fence_array_enable_signaling
@ 2018-11-09 12:20 Christian König
2018-11-09 14:21 ` Chunming Zhou
2018-11-09 17:18 ` Eric Anholt
0 siblings, 2 replies; 4+ messages in thread
From: Christian König @ 2018-11-09 12:20 UTC (permalink / raw)
To: dri-devel
Also use the irq work for dma_fence_array_enable_signaling to make sure
that the spinlock for the dma-fence-array is always unrelated to all
other spinlocks.
This fixes a lockdep warning if a dma-fence-array is embedded into
another dma-fence-array.
Signed-off-by: Christian König <christian.koenig@amd.com>
---
drivers/dma-buf/dma-fence-array.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/drivers/dma-buf/dma-fence-array.c b/drivers/dma-buf/dma-fence-array.c
index a8c254497251..3adf6b04f5fd 100644
--- a/drivers/dma-buf/dma-fence-array.c
+++ b/drivers/dma-buf/dma-fence-array.c
@@ -31,7 +31,7 @@ static const char *dma_fence_array_get_timeline_name(struct dma_fence *fence)
return "unbound";
}
-static void irq_dma_fence_array_work(struct irq_work *wrk)
+static void dma_fence_array_cb_work(struct irq_work *wrk)
{
struct dma_fence_array *array = container_of(wrk, typeof(*array), work);
@@ -52,12 +52,13 @@ static void dma_fence_array_cb_func(struct dma_fence *f,
dma_fence_put(&array->base);
}
-static bool dma_fence_array_enable_signaling(struct dma_fence *fence)
+static void dma_fence_array_enable_signaling_work(struct irq_work *wrk)
{
- struct dma_fence_array *array = to_dma_fence_array(fence);
+ struct dma_fence_array *array = container_of(wrk, typeof(*array), work);
struct dma_fence_array_cb *cb = (void *)(&array[1]);
unsigned i;
+ init_irq_work(&array->work, dma_fence_array_cb_work);
for (i = 0; i < array->num_fences; ++i) {
cb[i].array = array;
/*
@@ -71,12 +72,19 @@ static bool dma_fence_array_enable_signaling(struct dma_fence *fence)
dma_fence_get(&array->base);
if (dma_fence_add_callback(array->fences[i], &cb[i].cb,
dma_fence_array_cb_func)) {
- dma_fence_put(&array->base);
if (atomic_dec_and_test(&array->num_pending))
- return false;
+ dma_fence_signal(&array->base);
+ dma_fence_put(&array->base);
}
}
+}
+static bool dma_fence_array_enable_signaling(struct dma_fence *fence)
+{
+ struct dma_fence_array *array = to_dma_fence_array(fence);
+
+ init_irq_work(&array->work, dma_fence_array_enable_signaling_work);
+ irq_work_queue(&array->work);
return true;
}
@@ -144,8 +152,6 @@ struct dma_fence_array *dma_fence_array_create(int num_fences,
spin_lock_init(&array->lock);
dma_fence_init(&array->base, &dma_fence_array_ops, &array->lock,
context, seqno);
- init_irq_work(&array->work, irq_dma_fence_array_work);
-
array->num_fences = num_fences;
atomic_set(&array->num_pending, signal_on_any ? 1 : num_fences);
array->fences = fences;
--
2.14.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] dma-buf: use irq work for dma_fence_array_enable_signaling
2018-11-09 12:20 [PATCH] dma-buf: use irq work for dma_fence_array_enable_signaling Christian König
@ 2018-11-09 14:21 ` Chunming Zhou
2018-11-09 14:25 ` Chunming Zhou
2018-11-09 17:18 ` Eric Anholt
1 sibling, 1 reply; 4+ messages in thread
From: Chunming Zhou @ 2018-11-09 14:21 UTC (permalink / raw)
To: Christian König, dri-devel@lists.freedesktop.org
Tested-And-Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
在 2018/11/9 20:20, Christian König 写道:
> Also use the irq work for dma_fence_array_enable_signaling to make sure
> that the spinlock for the dma-fence-array is always unrelated to all
> other spinlocks.
>
> This fixes a lockdep warning if a dma-fence-array is embedded into
> another dma-fence-array.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
> drivers/dma-buf/dma-fence-array.c | 20 +++++++++++++-------
> 1 file changed, 13 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/dma-buf/dma-fence-array.c b/drivers/dma-buf/dma-fence-array.c
> index a8c254497251..3adf6b04f5fd 100644
> --- a/drivers/dma-buf/dma-fence-array.c
> +++ b/drivers/dma-buf/dma-fence-array.c
> @@ -31,7 +31,7 @@ static const char *dma_fence_array_get_timeline_name(struct dma_fence *fence)
> return "unbound";
> }
>
> -static void irq_dma_fence_array_work(struct irq_work *wrk)
> +static void dma_fence_array_cb_work(struct irq_work *wrk)
> {
> struct dma_fence_array *array = container_of(wrk, typeof(*array), work);
>
> @@ -52,12 +52,13 @@ static void dma_fence_array_cb_func(struct dma_fence *f,
> dma_fence_put(&array->base);
> }
>
> -static bool dma_fence_array_enable_signaling(struct dma_fence *fence)
> +static void dma_fence_array_enable_signaling_work(struct irq_work *wrk)
> {
> - struct dma_fence_array *array = to_dma_fence_array(fence);
> + struct dma_fence_array *array = container_of(wrk, typeof(*array), work);
> struct dma_fence_array_cb *cb = (void *)(&array[1]);
> unsigned i;
>
> + init_irq_work(&array->work, dma_fence_array_cb_work);
> for (i = 0; i < array->num_fences; ++i) {
> cb[i].array = array;
> /*
> @@ -71,12 +72,19 @@ static bool dma_fence_array_enable_signaling(struct dma_fence *fence)
> dma_fence_get(&array->base);
> if (dma_fence_add_callback(array->fences[i], &cb[i].cb,
> dma_fence_array_cb_func)) {
> - dma_fence_put(&array->base);
> if (atomic_dec_and_test(&array->num_pending))
> - return false;
> + dma_fence_signal(&array->base);
> + dma_fence_put(&array->base);
> }
> }
> +}
>
> +static bool dma_fence_array_enable_signaling(struct dma_fence *fence)
> +{
> + struct dma_fence_array *array = to_dma_fence_array(fence);
> +
> + init_irq_work(&array->work, dma_fence_array_enable_signaling_work);
> + irq_work_queue(&array->work);
> return true;
> }
>
> @@ -144,8 +152,6 @@ struct dma_fence_array *dma_fence_array_create(int num_fences,
> spin_lock_init(&array->lock);
> dma_fence_init(&array->base, &dma_fence_array_ops, &array->lock,
> context, seqno);
> - init_irq_work(&array->work, irq_dma_fence_array_work);
> -
> array->num_fences = num_fences;
> atomic_set(&array->num_pending, signal_on_any ? 1 : num_fences);
> array->fences = fences;
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] dma-buf: use irq work for dma_fence_array_enable_signaling
2018-11-09 14:21 ` Chunming Zhou
@ 2018-11-09 14:25 ` Chunming Zhou
0 siblings, 0 replies; 4+ messages in thread
From: Chunming Zhou @ 2018-11-09 14:25 UTC (permalink / raw)
To: Christian König, dri-devel@lists.freedesktop.org,
Eric Anholt
+Eric Anholt to aware this.
在 2018/11/9 22:21, Chunming Zhou 写道:
> Tested-And-Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
>
>
> 在 2018/11/9 20:20, Christian König 写道:
>> Also use the irq work for dma_fence_array_enable_signaling to make sure
>> that the spinlock for the dma-fence-array is always unrelated to all
>> other spinlocks.
>>
>> This fixes a lockdep warning if a dma-fence-array is embedded into
>> another dma-fence-array.
>>
>> Signed-off-by: Christian König <christian.koenig@amd.com>
>> ---
>> drivers/dma-buf/dma-fence-array.c | 20 +++++++++++++-------
>> 1 file changed, 13 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/dma-buf/dma-fence-array.c b/drivers/dma-buf/dma-fence-array.c
>> index a8c254497251..3adf6b04f5fd 100644
>> --- a/drivers/dma-buf/dma-fence-array.c
>> +++ b/drivers/dma-buf/dma-fence-array.c
>> @@ -31,7 +31,7 @@ static const char *dma_fence_array_get_timeline_name(struct dma_fence *fence)
>> return "unbound";
>> }
>>
>> -static void irq_dma_fence_array_work(struct irq_work *wrk)
>> +static void dma_fence_array_cb_work(struct irq_work *wrk)
>> {
>> struct dma_fence_array *array = container_of(wrk, typeof(*array), work);
>>
>> @@ -52,12 +52,13 @@ static void dma_fence_array_cb_func(struct dma_fence *f,
>> dma_fence_put(&array->base);
>> }
>>
>> -static bool dma_fence_array_enable_signaling(struct dma_fence *fence)
>> +static void dma_fence_array_enable_signaling_work(struct irq_work *wrk)
>> {
>> - struct dma_fence_array *array = to_dma_fence_array(fence);
>> + struct dma_fence_array *array = container_of(wrk, typeof(*array), work);
>> struct dma_fence_array_cb *cb = (void *)(&array[1]);
>> unsigned i;
>>
>> + init_irq_work(&array->work, dma_fence_array_cb_work);
>> for (i = 0; i < array->num_fences; ++i) {
>> cb[i].array = array;
>> /*
>> @@ -71,12 +72,19 @@ static bool dma_fence_array_enable_signaling(struct dma_fence *fence)
>> dma_fence_get(&array->base);
>> if (dma_fence_add_callback(array->fences[i], &cb[i].cb,
>> dma_fence_array_cb_func)) {
>> - dma_fence_put(&array->base);
>> if (atomic_dec_and_test(&array->num_pending))
>> - return false;
>> + dma_fence_signal(&array->base);
>> + dma_fence_put(&array->base);
>> }
>> }
>> +}
>>
>> +static bool dma_fence_array_enable_signaling(struct dma_fence *fence)
>> +{
>> + struct dma_fence_array *array = to_dma_fence_array(fence);
>> +
>> + init_irq_work(&array->work, dma_fence_array_enable_signaling_work);
>> + irq_work_queue(&array->work);
>> return true;
>> }
>>
>> @@ -144,8 +152,6 @@ struct dma_fence_array *dma_fence_array_create(int num_fences,
>> spin_lock_init(&array->lock);
>> dma_fence_init(&array->base, &dma_fence_array_ops, &array->lock,
>> context, seqno);
>> - init_irq_work(&array->work, irq_dma_fence_array_work);
>> -
>> array->num_fences = num_fences;
>> atomic_set(&array->num_pending, signal_on_any ? 1 : num_fences);
>> array->fences = fences;
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] dma-buf: use irq work for dma_fence_array_enable_signaling
2018-11-09 12:20 [PATCH] dma-buf: use irq work for dma_fence_array_enable_signaling Christian König
2018-11-09 14:21 ` Chunming Zhou
@ 2018-11-09 17:18 ` Eric Anholt
1 sibling, 0 replies; 4+ messages in thread
From: Eric Anholt @ 2018-11-09 17:18 UTC (permalink / raw)
To: Christian König, dri-devel
[-- Attachment #1.1: Type: text/plain, Size: 541 bytes --]
Christian König <ckoenig.leichtzumerken@gmail.com> writes:
> Also use the irq work for dma_fence_array_enable_signaling to make sure
> that the spinlock for the dma-fence-array is always unrelated to all
> other spinlocks.
>
> This fixes a lockdep warning if a dma-fence-array is embedded into
> another dma-fence-array.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
Tested-by: Eric Anholt <eric@anholt.net>
With just the reset revert still in place, I've now made it an hour into
a conformance test run.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-11-09 17:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-09 12:20 [PATCH] dma-buf: use irq work for dma_fence_array_enable_signaling Christian König
2018-11-09 14:21 ` Chunming Zhou
2018-11-09 14:25 ` Chunming Zhou
2018-11-09 17:18 ` Eric Anholt
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.