Thread (5 messages) flat view 5 messages, 3 authors, 2026-07-09

Re: [PATCH v2] powerpc/powernv: Cache OPAL check_token() results

From: Nikhil Kumar Singh <hidden>
Date: 2026-07-09 06:05:12

I discussed this with Sourabh, and we confirmed this function is 
actually not on a hot path. However, he is open to the idea. Please take 
a look and see if adding unlikely() provides a meaningful benefit here, 
or if it falls into premature optimization.

Thanks
~ Nikhil

On 08/07/26 14:02, Shivang Upadhyay wrote:
On Tue, 2026-07-07 at 12:36 +0530, Nikhil Kumar Singh wrote:
quoted
You can wrap the if (token_cache[token] == SUPP_UNKNOWN) check, as 
well as the if (token > OPAL_LAST) check above it, with unlikely(), 
since this function is in the hot path. Out-of-bounds tokens are very 
rare, and after the cache is populated, the SUPP_UNKNOWN condition is 
expected to be false in almost all cases. Wrapping these checks with 
unlikely() will help the compiler optimize branch
Thanks for your suggestion, but Which hotpath code is calling this?
we can maybe change that hotpath to not do rtas calls.

~Shivang.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help