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] [thread-next>] [day] [month] [year] [list]
Message-ID: <87857a82-99af-a941-9374-3bbe373ff74a@allwinnertech.com>
Date:   Fri, 7 Apr 2023 14:51:12 +0800
From:   Victor Hassan <victor@...winnertech.com>
To:     Frederic Weisbecker <frederic@...nel.org>
Cc:     fweisbec@...il.com, tglx@...utronix.de, mingo@...nel.org,
        jindong.yue@....com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] tick/broadcast: Do not set oneshot_mask except
 was_periodic was true



On 4/4/2023 8:21 PM, Frederic Weisbecker wrote:
> On Tue, Apr 04, 2023 at 07:37:06PM +0800, Victor Hassan wrote:
>>>
>>> Leading to such race:
>>>
>>> * CPU 1 stop its tick, next event is in one hour
>>> * CPU 0 registers new broadcast and sets CPU 1 in tick_broadcast_oneshot_mask
>>> * CPU 1 runs into cpuidle_enter_state(), and tick_broadcast_enter() is ignored because
>>>     the CPU is already in tick_broadcast_oneshot_mask
>>
>> Yes.
>>
>>> * CPU 1 goes to sleep
>>> * CPU 0 runs the broadcast callback, sees that the next timer for CPU 1
>>>     is in one hour, program the broadcast to that deadline
>>> * CPU 1 gets an interrupt that enqueues a new timer expiring in the next jiffy
>>> * CPU 1 don't call tick_broadcast_exit and thus don't remove itself from
>>>     tick_broadcast_oneshot_mask
>>
>> I'm not sure about this... Actually, I believe CPU 1 *will* call
>> tick_broadcast_exit in this condition because I cannot find a limitation on
>> this execution path.
> 
> You're right, what I wrote doesn't make sense. Let me try again:
> 
> * CPU 1 stop its tick, next event is in one hour. It calls
>    tick_broadcast_enter() and goes to sleep.
>    
> * CPU 1 gets an interrupt that enqueues a new timer expiring in the next jiffy
>    (note it's not yet actually programmed in the tick device)
>    
> * CPU 1 call tick_broadcast_exit().
> 
> * CPU 0 registers new broadcast device and sets CPU 1 in tick_broadcast_oneshot_mask
> 
> * CPU 0 runs the broadcast callback, sees that the next timer for CPU 1
>    is in one hour (because the recently enqueued timer for CPU 1 hasn't been programmed
>    yet), so it programs the broadcast to that 1 hour deadline.
> 
> * CPU 1 runs tick_nohz_idle_stop_tick() which eventually writes and program
>    dev->next_event to next jiffy
>    
> * CPU 1 runs into cpuidle_enter_state(), and tick_broadcast_enter() is ignored because
>    the CPU is already in tick_broadcast_oneshot_mask, so the dev->next_event
>    change isn't propagated to broadcast.
> 
> * CPU 1 goes to sleep for 1 hour.

Hi Frederic,
   Yes, I think that make sense :)


> 
> Does it make more sense? There might be more simple scenario of course.
> 
> Thanks.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ