public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Victor Hassan <victor@allwinnertech.com>
To: Frederic Weisbecker <frederic@kernel.org>
Cc: fweisbec@gmail.com, tglx@linutronix.de, mingo@kernel.org,
	jindong.yue@nxp.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tick/broadcast: Do not set oneshot_mask except was_periodic was true
Date: Mon, 10 Apr 2023 15:06:15 +0800	[thread overview]
Message-ID: <32b53d3c-b026-fbda-511f-9d2b4274a364@allwinnertech.com> (raw)
In-Reply-To: <87857a82-99af-a941-9374-3bbe373ff74a@allwinnertech.com>



On 4/7/2023 2:51 PM, Victor Hassan wrote:
> 
> 
> 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 :)

Hi Frederic,
     If we have reached a consensus, may I add "Reviewed-by: Frederic" 
in the next patch?
> 
> 
>>
>> Does it make more sense? There might be more simple scenario of course.
>>
>> Thanks.
> 

  reply	other threads:[~2023-04-10  7:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-28  6:36 [PATCH] tick/broadcast: Do not set oneshot_mask except was_periodic was true Victor Hassan
2023-03-31  1:46 ` Victor Hassan
2023-04-03 10:26 ` Frederic Weisbecker
2023-04-04 11:37   ` Victor Hassan
2023-04-04 12:21     ` Frederic Weisbecker
2023-04-07  6:51       ` Victor Hassan
2023-04-10  7:06         ` Victor Hassan [this message]
2023-04-11  8:55           ` Frederic Weisbecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=32b53d3c-b026-fbda-511f-9d2b4274a364@allwinnertech.com \
    --to=victor@allwinnertech.com \
    --cc=frederic@kernel.org \
    --cc=fweisbec@gmail.com \
    --cc=jindong.yue@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox