[PATCH 2/3] Revert "staging: vchiq_arm: Create keep-alive thread during probe"

Stefan Wahren wahrenst at gmx.net
Sun Jul 13 13:19:13 PDT 2025


Am 13.07.25 um 20:40 schrieb Maíra Canal:
> Hi Stefan,
>
> On 11/07/25 12:40, Stefan Wahren wrote:
>> The commit 86bc88217006 ("staging: vchiq_arm: Create keep-alive thread
>> during probe") introduced a regression for certain configurations,
>> which doesn't have a VCHIQ user. This results in a unused and hanging
>> keep-alive thread:
>>
>>    INFO: task vchiq-keep/0:85 blocked for more than 120 seconds.
>>          Not tainted 6.12.34-v8-+ #13
>>    "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this 
>> message.
>>    task:vchiq-keep/0    state:D stack:0 pid:85    tgid:85 ppid:2
>>    Call trace:
>>     __switch_to+0x188/0x230
>>     __schedule+0xa54/0xb28
>>     schedule+0x80/0x120
>>     schedule_preempt_disabled+0x30/0x50
>>     kthread+0xd4/0x1a0
>>     ret_from_fork+0x10/0x20
>>
>> Fixes: 86bc88217006 ("staging: vchiq_arm: Create keep-alive thread 
>> during probe")
>> Reported-by: Maíra Canal <maira.canal at usp.br>
>
> If possible, could you use my Igalia e-mail instead (mcanal at igalia.com)?
Sure
> I mistakenly sent the e-mail reporting using my university e-mail.
>
>> Closes: 
>> https://lore.kernel.org/linux-staging/ba35b960-a981-4671-9f7f-060da10feaa1@usp.br/
>> Cc: <stable at kernel.org>
>> Signed-off-by: Stefan Wahren <wahrenst at gmx.net>
>
> Reviewed-by: Maíra Canal <mcanal at igalia.com>
>
> Best Regards,
> - Maíra
>
>> ---
>>   .../interface/vchiq_arm/vchiq_arm.c           | 69 ++++++++++---------
>>   1 file changed, 35 insertions(+), 34 deletions(-)
>>
>> diff --git 
>> a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c 
>> b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
>> index cdf5687ad4f0..6434cbdc1a6e 100644
>> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
>> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
>> @@ -280,6 +280,29 @@ static int vchiq_platform_init(struct 
>> platform_device *pdev, struct vchiq_state
>>       return 0;
>>   }
>>   +int
>> +vchiq_platform_init_state(struct vchiq_state *state)
>> +{
>> +    struct vchiq_arm_state *platform_state;
>> +
>> +    platform_state = devm_kzalloc(state->dev, 
>> sizeof(*platform_state), GFP_KERNEL);
>> +    if (!platform_state)
>> +        return -ENOMEM;
>> +
>> +    rwlock_init(&platform_state->susp_res_lock);
>> +
>> +    init_completion(&platform_state->ka_evt);
>> +    atomic_set(&platform_state->ka_use_count, 0);
>> +    atomic_set(&platform_state->ka_use_ack_count, 0);
>> +    atomic_set(&platform_state->ka_release_count, 0);
>> +
>> +    platform_state->state = state;
>> +
>> +    state->platform_state = (struct opaque_platform_state 
>> *)platform_state;
>> +
>> +    return 0;
>> +}
>> +
>>   static struct vchiq_arm_state *vchiq_platform_get_arm_state(struct 
>> vchiq_state *state)
>>   {
>>       return (struct vchiq_arm_state *)state->platform_state;
>> @@ -988,39 +1011,6 @@ vchiq_keepalive_thread_func(void *v)
>>       return 0;
>>   }
>>   -int
>> -vchiq_platform_init_state(struct vchiq_state *state)
>> -{
>> -    struct vchiq_arm_state *platform_state;
>> -    char threadname[16];
>> -
>> -    platform_state = devm_kzalloc(state->dev, 
>> sizeof(*platform_state), GFP_KERNEL);
>> -    if (!platform_state)
>> -        return -ENOMEM;
>> -
>> -    snprintf(threadname, sizeof(threadname), "vchiq-keep/%d",
>> -         state->id);
>> -    platform_state->ka_thread = 
>> kthread_create(&vchiq_keepalive_thread_func,
>> -                           (void *)state, threadname);
>> -    if (IS_ERR(platform_state->ka_thread)) {
>> -        dev_err(state->dev, "couldn't create thread %s\n", threadname);
>> -        return PTR_ERR(platform_state->ka_thread);
>> -    }
>> -
>> -    rwlock_init(&platform_state->susp_res_lock);
>> -
>> -    init_completion(&platform_state->ka_evt);
>> -    atomic_set(&platform_state->ka_use_count, 0);
>> -    atomic_set(&platform_state->ka_use_ack_count, 0);
>> -    atomic_set(&platform_state->ka_release_count, 0);
>> -
>> -    platform_state->state = state;
>> -
>> -    state->platform_state = (struct opaque_platform_state 
>> *)platform_state;
>> -
>> -    return 0;
>> -}
>> -
>>   int
>>   vchiq_use_internal(struct vchiq_state *state, struct vchiq_service 
>> *service,
>>              enum USE_TYPE_E use_type)
>> @@ -1341,6 +1331,7 @@ void vchiq_platform_conn_state_changed(struct 
>> vchiq_state *state,
>>                          enum vchiq_connstate newstate)
>>   {
>>       struct vchiq_arm_state *arm_state = 
>> vchiq_platform_get_arm_state(state);
>> +    char threadname[16];
>>         dev_dbg(state->dev, "suspend: %d: %s->%s\n",
>>           state->id, get_conn_state_name(oldstate), 
>> get_conn_state_name(newstate));
>> @@ -1355,7 +1346,17 @@ void vchiq_platform_conn_state_changed(struct 
>> vchiq_state *state,
>>         arm_state->first_connect = 1;
>>       write_unlock_bh(&arm_state->susp_res_lock);
>> -    wake_up_process(arm_state->ka_thread);
>> +    snprintf(threadname, sizeof(threadname), "vchiq-keep/%d",
>> +         state->id);
>> +    arm_state->ka_thread = kthread_create(&vchiq_keepalive_thread_func,
>> +                          (void *)state,
>> +                          threadname);
>> +    if (IS_ERR(arm_state->ka_thread)) {
>> +        dev_err(state->dev, "suspend: Couldn't create thread %s\n",
>> +            threadname);
>> +    } else {
>> +        wake_up_process(arm_state->ka_thread);
>> +    }
>>   }
>>     static const struct of_device_id vchiq_of_match[] = {
>




More information about the linux-arm-kernel mailing list