kernel: Remove clock_always_on control from k_busy_wait()

This feature was a useless noop based on mistaken API understanding.

The idea seems to have been that k_busy_wait() included guards to
ensure "clock_always_on" was true duing the loop, presumably because
the original author was afraid that "turning the clock off" would
affect the operation of k_cycle_get_32().

Then later someone came around and "optimized" this for Quark SE,
where the cycle counter is the RTC and unrelated to the timer driver
used by the clock_always_on feature.  (Except even there it presumably
should have been done at the SoC level and not just in the C1000
devboard -- note that Arduino 101 never would have gotten this).

But it was all a mistake: "clock_always_on" has nothing to do with
en/disabling the system cycle timer (which never happens when the
system is active, that's a feature of idle), it's a control over the
delivery of timer interrupts.  And needless to say we don't care about
timer interrupts when we're spinning on a cycle counter.

Yank the whole mess.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
Andy Ross 2018-09-23 07:11:10 -07:00 committed by Anas Nashif
commit 25863549be
3 changed files with 0 additions and 27 deletions

View file

@ -8,14 +8,6 @@ config BOARD
config UART_QMSI_0_HW_FC
def_bool y
if SYS_POWER_MANAGEMENT
config BUSY_WAIT_USES_ALTERNATE_CLOCK
default y
endif
if IEEE802154_CC2520
config SPI

View file

@ -97,15 +97,4 @@ config TICKLESS_KERNEL
clock interrupt generation would be stopped at all times. This option
requires Tickless Idle option to be enabled.
config BUSY_WAIT_USES_ALTERNATE_CLOCK
bool "Busy wait uses alternate clock in tickless kernel mode"
help
In tickless kernel mode, the system clock will be stopped when
there are no timer events programmed. If the system clock is to
be used to keep time e.g. to get a delta of time cycles then it
needs to be turned on using provided APIs. Some platforms have
alternate clocks which can be used instead. In that case this flag
would be set to true. This flag would be checked before turning
on the system clock in APIs that do busy wait reading clock
cycles.
endif

View file

@ -97,10 +97,6 @@ int _is_thread_essential(void)
#if !defined(CONFIG_ARCH_HAS_CUSTOM_BUSY_WAIT)
void k_busy_wait(u32_t usec_to_wait)
{
#if defined(CONFIG_TICKLESS_KERNEL) && \
!defined(CONFIG_BUSY_WAIT_USES_ALTERNATE_CLOCK)
int saved_always_on = k_enable_sys_clock_always_on();
#endif
/* use 64-bit math to prevent overflow when multiplying */
u32_t cycles_to_wait = (u32_t)(
(u64_t)usec_to_wait *
@ -117,10 +113,6 @@ int saved_always_on = k_enable_sys_clock_always_on();
break;
}
}
#if defined(CONFIG_TICKLESS_KERNEL) && \
!defined(CONFIG_BUSY_WAIT_USES_ALTERNATE_CLOCK)
_sys_clock_always_on = saved_always_on;
#endif
}
#endif