diff options
author | Jun Lin <CHLin56@nuvoton.com> | 2022-06-01 10:38:39 +0800 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-06-02 02:18:39 +0000 |
commit | 07cd645b47c06925fc198e83a98364f46e2fb321 (patch) | |
tree | 42137911805a2a87f4f4624c13899f1b0b100183 | |
parent | fc85f0c71f726e5e64bb04be452723d8fefa4064 (diff) | |
download | chrome-ec-07cd645b47c06925fc198e83a98364f46e2fb321.tar.gz |
zephyr: override HOOK task priority in EC APP's default Kconfig
The Zephyr-EC application leverages the system workqueue thread to
implement the hook task. By default, its priority level is the lowest
cooperative priority and higher than any EC task. The priority is
overridden to 24 (NUM_PREEMPT_PRIORITIES - 1) after the application
starts to run for a while. Before it is changed, it violates the
CROS-EC's principle (HOOK task's priority should be only higher than
the IDLE task) and may cause unexpected behavior like #5 in b:230663570.
This CL overrides the priority level in APP's default Kconfig and
removes the runtime priority setting to make it consistent at level 24
all the time.
BRANCH:none
BUG=b:230663570
TEST= "zmake testall --clobber"
TEST= the symptom in #5 is fixed
Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
Change-Id: Ia4bfe4e657b299294024cffe6e07685324f56498
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3682979
Reviewed-by: Wai-Hong Tam <waihong@google.com>
Tested-by: Wai-Hong Tam <waihong@google.com>
Tested-by: CH Lin <chlin56@nuvoton.com>
Reviewed-by: Keith Short <keithshort@chromium.org>
Commit-Queue: CH Lin <chlin56@nuvoton.com>
-rw-r--r-- | zephyr/app/ec/Kconfig | 8 | ||||
-rw-r--r-- | zephyr/app/ec/ec_app_main.c | 9 |
2 files changed, 8 insertions, 9 deletions
diff --git a/zephyr/app/ec/Kconfig b/zephyr/app/ec/Kconfig index 52e9b43308..b8d46f8678 100644 --- a/zephyr/app/ec/Kconfig +++ b/zephyr/app/ec/Kconfig @@ -26,6 +26,14 @@ orsource "chip/$(ARCH)/*/Kconfig.*" config NUM_PREEMPT_PRIORITIES default 25 +# +# In Zephyr, the default system workqueue thread priority level is the lowest +# cooperative priority. Override its priority to the second lowest preempt +# priority. (i.e. NUM_PREEMPT_PRIORITIES - 1) +# +config SYSTEM_WORKQUEUE_PRIORITY + default 24 + config LTO bool "Link Time Optimization (LTO)" default y if !SOC_POSIX diff --git a/zephyr/app/ec/ec_app_main.c b/zephyr/app/ec/ec_app_main.c index 2ff38fefc1..12043a3c4a 100644 --- a/zephyr/app/ec/ec_app_main.c +++ b/zephyr/app/ec/ec_app_main.c @@ -71,15 +71,6 @@ void ec_app_main(void) vboot_main(); } - /* - * Hooks run from the system workqueue and must be the lowest priority - * thread. By default, the system workqueue is run at the lowest - * cooperative thread priority, blocking all preemptive threads until - * the deferred work is completed. - */ - k_thread_priority_set(&k_sys_work_q.thread, - EC_TASK_PRIORITY(EC_SYSWORKQ_PRIO)); - /* Call init hooks before main tasks start */ if (IS_ENABLED(CONFIG_PLATFORM_EC_HOOKS)) { hook_notify(HOOK_INIT); |