[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <11cf1fb4-2f8b-4bcb-a270-c698afbcd20e@arm.com>
Date: Wed, 3 Jul 2024 20:49:51 +0100
From: Hongyan Xia <hongyan.xia2@....com>
To: Tejun Heo <tj@...nel.org>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] sched/ext: Add BPF functions for uclamp inc and dec
On 03/07/2024 19:15, Tejun Heo wrote:
> Hello.
>
> On Wed, Jul 03, 2024 at 11:07:48AM +0100, Hongyan Xia wrote:
>> +__bpf_kfunc void scx_bpf_uclamp_rq_inc(s32 cpu, struct task_struct *p)
>> +{
>> + uclamp_rq_inc(cpu_rq(cpu), p);
>> +}
>> +
>> +__bpf_kfunc void scx_bpf_uclamp_rq_dec(s32 cpu, struct task_struct *p)
>> +{
>> + uclamp_rq_dec(cpu_rq(cpu), p);
>> +}
>
> So, I don't think we can expose these functions directly to the BPF
> scheduler. The BPF schedulers shouldn't be able to break system integrity no
> matter what they do and with the above it'd be trivial to get the bucket
> counters unbalanced, right?
You are right.
Actually, avoiding double enqueue or dequeue is easy and might be just a
one-line change. The real concern is when the BPF scheduler somehow
still has tasks on uclamp buckets when it's unloaded. Then, unloading
the scheduler needs to do uclamp_dec().
I'll see what I can do.
Powered by blists - more mailing lists