Re: [PATCH v3] kcov: move kcov_remote_data to task_struct for RT and remove local_lock
From: Tetsuo Handa
Date: Wed May 20 2026 - 06:37:53 EST
On 2026/05/15 16:10, Dmitry Vyukov wrote:
>> Only compile tested. I don't have environment to measure how not
>
> +Aleksandr Nogikh
>
> I don't see this patch on syzbot CI:
> https://ci.syzbot.org/?name=kcov%3A+move+kcov_remote_data+to+task_struct+for+RT+and+remove+local_lock
I didn't include syzbot related mail address.
What is needed to make this patch detected by syzbot CI?
>
> How can we make it at least tested on syzbot CI? Otherwise it risks
> breaking syzbot when merged.
Someone who can run syzkaller will be able to test this patch.
If nobody can try, I can try sending this patch to only linux-next tree via my tree.
>> +#ifdef CONFIG_PREEMPT_RT
>
> Is it possible to unify the logic between RT and non-RT kernels (not
> have any ifdef's)?
> The logic is already rather complicated, having 2 work modes, and
> limited testing will be problematic in the future.
Always using per task_struct temporary storage will be possible if we don't mind
bloating sizeof(struct task_struct). But we can't unify buffer allocation part
because allocating large buffer using kmalloc(GFP_ATOMIC) for CONFIG_PREEMPT_RT=n
is unreliable. Preallocating global non-percpu buffers for CONFIG_PREEMPT_RT=y
would be possible, but we don't know how many we should allocate due to
possibility of preemption in CONFIG_PREEMPT_RT=y.
>> @@ -915,6 +937,10 @@ void kcov_remote_start(u64 handle)
>> */
>> mode = context_unsafe(kcov->mode);
>> sequence = kcov->sequence;
>> +#ifdef CONFIG_PREEMPT_RT
>> + size = kcov->remote_size;
>> + area = kcov_remote_area_get(size);
>> +#else
>> if (in_task()) {
>> size = kcov->remote_size;
>> area = kcov_remote_area_get(size);
>> @@ -922,17 +948,16 @@ void kcov_remote_start(u64 handle)
>> size = CONFIG_KCOV_IRQ_AREA_SIZE;
>> area = this_cpu_ptr(&kcov_percpu_data)->irq_area;
>> }
>> +#endif
>> spin_unlock(&kcov_remote_lock);
>>
>> - /* Can only happen when in_task(). */
>> + /* Can only happen when CONFIG_PREEMPT_RT=y or in_task(). */
>> if (!area) {
>> - local_unlock_irqrestore(&kcov_percpu_data.lock, flags);
>> area = vmalloc(size * sizeof(unsigned long));
>> if (!area) {
>> kcov_put(kcov);
>> return;
>> }
>> - local_lock_irqsave(&kcov_percpu_data.lock, flags);
>> }
>>
>> /* Reset coverage size. */