Re: [PATCH] Add static_key_feature_checks_initialized flag
From: Christophe Leroy <hidden>
Date: 2024-03-27 15:21:27
Le 27/03/2024 à 05:59, Nicholas Miehlbradt a écrit :
JUMP_LABEL_FEATURE_CHECK_DEBUG used static_key_initialized to determine
whether {cpu,mmu}_has_feature() was used before static keys were
initialized. However, {cpu,mmu}_has_feature() should not be used before
setup_feature_keys() is called. As static_key_initalized is set much
earlier during boot there is a window in which JUMP_LABEL_FEATURE_CHECK_DEBUG
will not report errors. Add a flag specifically to indicate when
{cpu,mmu}_has_feature() is safe to use.What do you mean by "much earlier" ? As far as I can see, static_key_initialized is set by jump_label_init() as cpu_feature_keys_init() and mmu_feature_keys_init() are call immediately after. I don't think it is possible to do anything inbetween. Or maybe you mean the problem is the call to jump_label_init() in early_init_devtree() ? You should make it explicit in the message, and see if it wouldn't be better to call cpu_feature_keys_init() and mmu_feature_keys_init() as well in early_init_devtree() in that case ? Christophe