From: Andrew Donnellan <ajd@linux.ibm.com>
To: Daniel Axtens <dja@axtens.net>,
Michael Ellerman <mpe@ellerman.id.au>,
linuxppc-dev@lists.ozlabs.org
Cc: nathanl@linux.ibm.com, leobras.c@gmail.com
Subject: Re: [PATCH] powerpc/rtas: Restrict RTAS requests from userspace
Date: Wed, 12 Aug 2020 13:13:32 +1000 [thread overview]
Message-ID: <9fac1a12-55e1-2b37-ffb4-a91cbb775d0d@linux.ibm.com> (raw)
In-Reply-To: <875z9pnvuv.fsf@dja-thinkpad.axtens.net>
On 11/8/20 11:41 pm, Daniel Axtens wrote:
>>>> +static bool block_rtas_call(int token, int nargs,
>>>> + struct rtas_args *args)
>>>> +{
>>>> + int i;
>>>> + const char *reason;
>>>> + char *token_name = rtas_token_name(token);
>>>
>>> This code isn't particularly performance critical, but I think it would
>>> be cleaner to do the token lookup once at init time, and store the token
>>> in the filter array?
>>>
>>> Then this code would only be doing token comparisons.
>>
>> Yeah that would be cleaner, can get rid of rtas_token_name().
>
> I'm not sure I quite understand what you're suggesting.
>
> You still need to do a string->token lookup at least once as the tokens
> differ between PowerVM and qemu. Are you saying that you can fold the
> token name lookup into the init function?
Yeah, mpe is suggesting adding a member to the struct to cache the token
value, and then just looping through all of them to populate that field
at init time.
--
Andrew Donnellan OzLabs, ADL Canberra
ajd@linux.ibm.com IBM Australia Limited
prev parent reply other threads:[~2020-08-12 3:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-02 16:19 [PATCH] powerpc/rtas: Restrict RTAS requests from userspace Andrew Donnellan
2020-07-10 14:02 ` Sasha Levin
2020-07-27 1:23 ` Daniel Axtens
2020-08-10 6:40 ` Michael Ellerman
2020-08-11 8:04 ` Andrew Donnellan
2020-08-11 11:48 ` Michael Ellerman
2020-08-11 13:41 ` Daniel Axtens
2020-08-12 3:13 ` Andrew Donnellan [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=9fac1a12-55e1-2b37-ffb4-a91cbb775d0d@linux.ibm.com \
--to=ajd@linux.ibm.com \
--cc=dja@axtens.net \
--cc=leobras.c@gmail.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=nathanl@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).