Re: [PATCH V4 8/9] jump_label: Batch updates if arch supports it

From: Daniel Bristot de Oliveira
Date: Wed Feb 06 2019 - 10:59:51 EST


On 2/6/19 7:34 AM, Masami Hiramatsu wrote:
> On Mon, 4 Feb 2019 20:59:01 +0100
> Daniel Bristot de Oliveira <bristot@xxxxxxxxxx> wrote:
>
>> --- a/kernel/jump_label.c
>> +++ b/kernel/jump_label.c
>> @@ -407,6 +407,7 @@ bool jump_label_can_update_check(struct jump_entry *entry, bool init)
>> return 0;
>> }
>>
>> +#ifndef HAVE_JUMP_LABEL_BATCH
>> static void __jump_label_update(struct static_key *key,
>> struct jump_entry *entry,
>> struct jump_entry *stop,
>> @@ -419,6 +420,34 @@ static void __jump_label_update(struct static_key *key,
>> }
>> }
>> }
>> +#else
>> +static void __jump_label_update(struct static_key *key,
>> + struct jump_entry *entry,
>> + struct jump_entry *stop,
>> + bool init)
>> +{
>> + for_each_label_entry(key, entry, stop) {
>> +
>> + if (!jump_label_can_update_check(entry, init))
>> + continue;
>> +
>> + if (arch_jump_label_transform_queue(entry,
>> + jump_label_type(entry)))
>> + continue;
>> +
>> + /*
>> + * Queue's overflow: Apply the current queue, and then
>> + * queue again. If it stills not possible to queue, BUG!
>> + */
>> + arch_jump_label_transform_apply();
>> + if (!arch_jump_label_transform_queue(entry,
>> + jump_label_type(entry))) {
>> + BUG();
>
> Please do not relay on BUG(), since in both case (applied or not),
> jump_label is not critical for normal operation. I think you should use
> WARN_ONCE() here and lock the jump_label so that root user can report it
> to us :)

Oops! I wrote a patch changing this, removing the BUG(). It was a request from
steve, but somehow I ended up missing it.

Thanks for reviewing this...

My bad, sorry :-(

-- Daniel
> Thank you,
>
>