All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nikhil Kumar Singh <nikhilks@linux.ibm.com>
To: Shivang Upadhyay <shivangu@linux.ibm.com>, linuxppc-dev@lists.ozlabs.org
Cc: Sourabh Jain <sourabhjain@linux.ibm.com>
Subject: Re: [PATCH v2] powerpc/powernv: Cache OPAL check_token() results
Date: Thu, 9 Jul 2026 11:34:59 +0530	[thread overview]
Message-ID: <38c260b6-2811-427b-9a3c-fa15a6610f87@linux.ibm.com> (raw)
In-Reply-To: <fa47cb85e275b9374efbf0f992281fa196ddf8ec.camel@linux.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 940 bytes --]

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:
>> 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.

[-- Attachment #2: Type: text/html, Size: 1957 bytes --]

      reply	other threads:[~2026-07-09  6:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-26 12:35 [PATCH v2] powerpc/powernv: Cache OPAL check_token() results Shivang Upadhyay
2026-06-30 13:50 ` Sourabh Jain
2026-07-07  7:06 ` Nikhil Kumar Singh
2026-07-08  8:32   ` Shivang Upadhyay
2026-07-09  6:04     ` Nikhil Kumar Singh [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=38c260b6-2811-427b-9a3c-fa15a6610f87@linux.ibm.com \
    --to=nikhilks@linux.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=shivangu@linux.ibm.com \
    --cc=sourabhjain@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.