From: oleksii.kurochko@gmail.com
To: Jan Beulich <jbeulich@suse.com>
Cc: Alistair Francis <alistair.francis@wdc.com>,
Bob Eshleman <bobbyeshleman@gmail.com>,
Connor Davis <connojdavis@gmail.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Julien Grall <julien@xen.org>,
Stefano Stabellini <sstabellini@kernel.org>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH v12 3/3] xen/riscv: refactor decode_trap_cause()
Date: Mon, 05 Aug 2024 11:14:02 +0200 [thread overview]
Message-ID: <3a8545f9eb661df8082efc086161024d9601f7e1.camel@gmail.com> (raw)
In-Reply-To: <361eb1c3-003b-47d2-bcd9-0f06e91bfd0a@suse.com>
On Mon, 2024-08-05 at 08:20 +0200, Jan Beulich wrote:
> On 02.08.2024 15:54, Oleksii Kurochko wrote:
> > Use array_access_nospec() to prevent guest speculation.
> >
> > Avoid double access of trap_causes[cause].
> >
> > Suggested-by: Jan Beulich <jbeulich@suse.com>
> > Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
>
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
> with ...
>
> > @@ -48,9 +49,10 @@ static const char *decode_trap_cause(unsigned
> > long cause)
> > [CAUSE_STORE_GUEST_PAGE_FAULT] = "Guest Store/AMO Page
> > Fault",
> > };
> >
> > - if ( cause < ARRAY_SIZE(trap_causes) && trap_causes[cause] )
> > - return trap_causes[cause];
> > - return "UNKNOWN";
> > + const char *res = cause < ARRAY_SIZE(trap_causes) ?
> > array_access_nospec(trap_causes, cause)
>
> ... the overly long line here suitably wrapped; commonly we'd do this
> as ...
>
> > + : NULL;
>
> const char *res = cause < ARRAY_SIZE(trap_causes)
> ? array_access_nospec(trap_causes, cause)
> : NULL;
>
> I guess I'll adjust this while committing.
I will be happy with that. Thanks!
~ Oleksii
>
> Jan
>
> > + return res ?: "UNKNOWN";
> > }
> >
> > static const char *decode_reserved_interrupt_cause(unsigned long
> > irq_cause)
>
prev parent reply other threads:[~2024-08-05 9:14 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-02 13:54 [PATCH v12 0/3] RISCV basic exception handling implementation Oleksii Kurochko
2024-08-02 13:54 ` [PATCH v12 1/3] xen/riscv: enable GENERIC_BUG_FRAME Oleksii Kurochko
2024-08-05 15:41 ` Jan Beulich
2024-08-06 10:11 ` oleksii.kurochko
2024-08-06 14:23 ` Jan Beulich
2024-08-02 13:54 ` [PATCH v12 2/3] xen/riscv: test basic exception handling stuff Oleksii Kurochko
2024-08-02 13:54 ` [PATCH v12 3/3] xen/riscv: refactor decode_trap_cause() Oleksii Kurochko
2024-08-05 6:20 ` Jan Beulich
2024-08-05 9:14 ` oleksii.kurochko [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=3a8545f9eb661df8082efc086161024d9601f7e1.camel@gmail.com \
--to=oleksii.kurochko@gmail.com \
--cc=alistair.francis@wdc.com \
--cc=andrew.cooper3@citrix.com \
--cc=bobbyeshleman@gmail.com \
--cc=connojdavis@gmail.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/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.