lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87y0vip23w.ffs@tglx>
Date: Wed, 30 Apr 2025 08:58:27 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: John Stultz <jstultz@...gle.com>, Su Hui <suhui@...china.com>
Cc: sboyd@...nel.org, linux-kernel@...r.kernel.org,
 kernel-janitors@...r.kernel.org
Subject: Re: [PATCH 3/3] alarmtimer: switch spin_{lock,unlock}_irqsave() to
 guard()

On Thu, Apr 24 2025 at 16:59, John Stultz wrote:
> On Thu, Apr 24, 2025 at 7:48 AM Su Hui <suhui@...china.com> wrote:
>> -       spin_unlock_irqrestore(&freezer_delta_lock, flags);
>> +       scoped_guard(spinlock_irqsave, &freezer_delta_lock) {
>> +               min = freezer_delta;
>> +               expires = freezer_expires;
>> +               type = freezer_alarmtype;
>> +               freezer_delta = 0;
>> +       }
>
> I'm not necessarily opposed, but I'm not sure we're gaining much here.

>> @@ -352,13 +347,13 @@ EXPORT_SYMBOL_GPL(alarm_init);
>>  void alarm_start(struct alarm *alarm, ktime_t start)
>>  {
>>         struct alarm_base *base = &alarm_bases[alarm->type];
>> -       unsigned long flags;
>>
>> -       spin_lock_irqsave(&base->lock, flags);
>> -       alarm->node.expires = start;
>> -       alarmtimer_enqueue(base, alarm);
>> -       hrtimer_start(&alarm->timer, alarm->node.expires, HRTIMER_MODE_ABS);
>> -       spin_unlock_irqrestore(&base->lock, flags);
>> +       scoped_guard(spinlock_irqsave, &base->lock) {
>> +               alarm->node.expires = start;
>> +               alarmtimer_enqueue(base, alarm);
>> +               hrtimer_start(&alarm->timer, alarm->node.expires,
>> +                             HRTIMER_MODE_ABS);
>> +       }
>
> Similarly, this just seems more like churn, than making the code
> particularly more clear.

I disagree. scoped_guard() is actually superior as it makes it
visually entirely clear what the actual scope of the spin lock protected
code is. That's the whole point.

Especially in alarm_suspend() this would end up with a mix of scoped
guards and open coded spinlock regions. That's obstructing the reading
flow.

I'll bring them back for consistency when applying the series.

Thanks,

        tglx


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ