linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* arm64: some question about default_idle_call flow
@ 2019-01-09  9:03 yoma sophian
  2019-01-09 10:11 ` Julien Thierry
  0 siblings, 1 reply; 4+ messages in thread
From: yoma sophian @ 2019-01-09  9:03 UTC (permalink / raw)
  To: linux-arm-kernel

hi all:
In "default_idle_call", if
a) "NOT" current_clr_polling_and_test
then  arch_cpu_idle will call cpu_do_idle().
(And below is excerpted from arch/arm64/mm/proc.S)
ENTRY(cpu_do_idle)
        dsb     sy                              // WFI may enter a
low-power mode
        wfi
        ret
ENDPROC(cpu_do_idle)

But before calling default_idle_call, the local interrupt has been disabled.
Who or what kind of even will wake up this CPU after it runs wfi?

thanks for ur kind help in advance,

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: arm64: some question about default_idle_call flow
  2019-01-09  9:03 arm64: some question about default_idle_call flow yoma sophian
@ 2019-01-09 10:11 ` Julien Thierry
  2019-01-10  8:53   ` yoma sophian
  0 siblings, 1 reply; 4+ messages in thread
From: Julien Thierry @ 2019-01-09 10:11 UTC (permalink / raw)
  To: yoma sophian, linux-arm-kernel

Hi Yoma,

On 09/01/2019 09:03, yoma sophian wrote:
> hi all:
> In "default_idle_call", if
> a) "NOT" current_clr_polling_and_test
> then  arch_cpu_idle will call cpu_do_idle().
> (And below is excerpted from arch/arm64/mm/proc.S)
> ENTRY(cpu_do_idle)
>         dsb     sy                              // WFI may enter a
> low-power mode
>         wfi
>         ret
> ENDPROC(cpu_do_idle)
> 
> But before calling default_idle_call, the local interrupt has been disabled.
> Who or what kind of even will wake up this CPU after it runs wfi?
> 

The subtlety is that when interrupts are disabled (i.e. PSTATE.I == 1),
the CPU still receives interrupts, but it does not take them (i.e. does
not jump to the vector entry corresponding to irqs).

For WFI, having an interrupt pending an a CPU is a wake up event as
stated in section D1.17.2 "Wait For interrupt", subsection "WFI wake-up
events":

"The following are WFI wake-up events:
- Any physical SError interrupt, IRQ interrupt, or FIQ interrupt
received by the PE, that is marked as A, B or A/B in the tables in
Asynchronous exception masking on page D1-2202, regardless of the value
of the corresponding PSTATE.{A, I, F} mask bit.
- In EL1 or EL0, any virtual SError interrupt, IRQ interrupt, or FIQ
interrupt received by the PE, that is marked as B in Table D1-19 on page
D1-2205 in Virtual interrupts on page D1-2204, regardless of the value
of the corresponding PSTATE.{A, I, F} mask bit."


A note in the same section adds:
"WFI wake-up events are never disabled by EDSCR.INTdis, and are never
masked by the PSTATE.{A, I, F} mask bits. If wake-up is invoked by an
interrupt that is disabled or masked the interrupt is not taken."

Cheers,

-- 
Julien Thierry

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: arm64: some question about default_idle_call flow
  2019-01-09 10:11 ` Julien Thierry
@ 2019-01-10  8:53   ` yoma sophian
  2019-01-10  9:45     ` Julien Thierry
  0 siblings, 1 reply; 4+ messages in thread
From: yoma sophian @ 2019-01-10  8:53 UTC (permalink / raw)
  To: Julien Thierry; +Cc: linux-arm-kernel

hi Julien:
> A note in the same section adds:
> "WFI wake-up events are never disabled by EDSCR.INTdis, and are never
> masked by the PSTATE.{A, I, F} mask bits. If wake-up is invoked by an
> interrupt that is disabled or masked the interrupt is not taken."
I have one question:
a) if not only local_irq_disabled but also turn off GIC, the CPU will
not be waked up after run WFI, right?
(The PE will not receive any  SError interrupt, IRQ interrupt, or FIQ interrupt,
since GIC is turned off. And at this time, only legacy fiq/irq can wake up CPU)

Appreciate ur thoughtful explanation.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: arm64: some question about default_idle_call flow
  2019-01-10  8:53   ` yoma sophian
@ 2019-01-10  9:45     ` Julien Thierry
  0 siblings, 0 replies; 4+ messages in thread
From: Julien Thierry @ 2019-01-10  9:45 UTC (permalink / raw)
  To: yoma sophian; +Cc: linux-arm-kernel



On 10/01/2019 08:53, yoma sophian wrote:
> hi Julien:
>> A note in the same section adds:
>> "WFI wake-up events are never disabled by EDSCR.INTdis, and are never
>> masked by the PSTATE.{A, I, F} mask bits. If wake-up is invoked by an
>> interrupt that is disabled or masked the interrupt is not taken."
> I have one question:
> a) if not only local_irq_disabled but also turn off GIC, the CPU will
> not be waked up after run WFI, right?
> (The PE will not receive any  SError interrupt, IRQ interrupt, or FIQ interrupt,
> since GIC is turned off. And at this time, only legacy fiq/irq can wake up CPU)
> 

I'm not entirely sure what you mean by "turn off the GIC". But yes, if
for some reason the GIC does not send interrupts to the CPU (because
interrupts are disabled at the GIC level or even because there is a
priority mask too high in the PMR), it might not be able to wake up from
a WFI.

But I'm not sure why you'd turn off all interrupts at the GIC level
after boot time. If for some reason you do, make sure they are
re-enabled before doing WFI or anything that would rely on receiving
interrupts.

Cheers,

-- 
Julien Thierry

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-01-10  9:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-09  9:03 arm64: some question about default_idle_call flow yoma sophian
2019-01-09 10:11 ` Julien Thierry
2019-01-10  8:53   ` yoma sophian
2019-01-10  9:45     ` Julien Thierry

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).