From: <ltaylorsimpson@gmail.com>
To: "'Matheus Tavares Bernardino'" <matheus.bernardino@oss.qualcomm.com>
Cc: <brian.cain@oss.qualcomm.com>, <qemu-devel@nongnu.org>,
<richard.henderson@linaro.org>, <philmd@linaro.org>, <ale@rev.ng>,
<anjo@rev.ng>, <marco.liebel@oss.qualcomm.com>,
<alex.bennee@linaro.org>, <quic_mburton@quicinc.com>,
<sidneym@quicinc.com>
Subject: RE: [PATCH v3 5/5] target/hexagon: Remove unreachable
Date: Mon, 14 Apr 2025 14:59:17 -0600 [thread overview]
Message-ID: <05df01dbad80$17e73890$47b5a9b0$@gmail.com> (raw)
In-Reply-To: <20250414180939.3575845-1-matheus.bernardino@oss.qualcomm.com>
> -----Original Message-----
> From: Matheus Tavares Bernardino
> <matheus.bernardino@oss.qualcomm.com>
> Sent: Monday, April 14, 2025 12:10 PM
> To: ltaylorsimpson@gmail.com
> Cc: brian.cain@oss.qualcomm.com; qemu-devel@nongnu.org;
> richard.henderson@linaro.org; philmd@linaro.org;
> matheus.bernardino@oss.qualcomm.com; ale@rev.ng; anjo@rev.ng;
> marco.liebel@oss.qualcomm.com; alex.bennee@linaro.org;
> quic_mburton@quicinc.com; sidneym@quicinc.com
> Subject: RE: [PATCH v3 5/5] target/hexagon: Remove unreachable
>
> On Mon, 14 Apr 2025 11:19:38 -0600 <ltaylorsimpson@gmail.com> wrote:
> >
> > > -----Original Message-----
> > > From: Brian Cain <brian.cain@oss.qualcomm.com>
> > > Sent: Monday, April 7, 2025 1:27 PM
> > > To: qemu-devel@nongnu.org
> > > Cc: brian.cain@oss.qualcomm.com; richard.henderson@linaro.org;
> > > philmd@linaro.org; matheus.bernardino@oss.qualcomm.com;
> ale@rev.ng;
> > > anjo@rev.ng; marco.liebel@oss.qualcomm.com;
> > > ltaylorsimpson@gmail.com; alex.bennee@linaro.org;
> > > quic_mburton@quicinc.com; sidneym@quicinc.com
> > > Subject: [PATCH v3 5/5] target/hexagon: Remove unreachable
> > >
> > > We should raise an exception in the event that we encounter a packet
> > > that can't be correctly decoded, not fault.
> > >
> > > Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
> > > ---
> > > target/hexagon/decode.c | 6 +++++-
> > > 1 file changed, 5 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/target/hexagon/decode.c b/target/hexagon/decode.c index
> > > b5ece60450..1db7f1950f 100644
> > > --- a/target/hexagon/decode.c
> > > +++ b/target/hexagon/decode.c
> > > @@ -489,7 +489,6 @@ decode_insns(DisasContext *ctx, Insn *insn,
> > > uint32_t
> > > encoding)
> > > insn->iclass = iclass_bits(encoding);
> > > return 1;
> > > }
> > > - g_assert_not_reached();
> > > } else {
> > > uint32_t iclass = get_duplex_iclass(encoding);
> > > unsigned int slot0_subinsn = get_slot0_subinsn(encoding);
> > > @@ -512,6
> > > +511,11 @@ decode_insns(DisasContext *ctx, Insn *insn, uint32_t
> > > +encoding)
> > > }
> > > g_assert_not_reached();
> >
> > Why leave this one rather than raising an exception?
>
> Good point. I think this one should be removed as well. We have removed it
> downstream already.
>
> > > }
> > > + /*
> > > + * invalid/unrecognized opcode; return 1 and let gen_insn() raise
an
> > > + * exception when it sees this empty insn.
> > > + */
> > > + return 1;
> >
> > You should set insn->generate to NULL if you want to guarantee that
> > gen_insn will raise an exception.
>
> The caller already memset's it to 0 before passing `insn` down.
>
> > Do you have a test case for this?
>
> We do have a softmmu test for this downstream. Maybe we can adjust it for
> user-mode and upstream it with this patch.
Take a look at tests/tcg/hexagon/invalid-slots.c to see how to do this in
linux-user mode. You'll also need to modify Makefile.target in that
directory.
HTH,
Taylor
next prev parent reply other threads:[~2025-04-14 21:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <058801dbad61_68ff5b00_3afe1100_@gmail.com>
2025-04-14 18:09 ` [PATCH v3 5/5] target/hexagon: Remove unreachable Matheus Tavares Bernardino
2025-04-14 20:59 ` ltaylorsimpson [this message]
2025-04-16 22:21 ` Brian Cain
2025-04-16 23:27 ` ltaylorsimpson
2025-04-07 19:27 [PATCH v3 0/5] misc hexagon patches Brian Cain
2025-04-07 19:27 ` [PATCH v3 5/5] target/hexagon: Remove unreachable Brian Cain
2025-04-14 17:19 ` ltaylorsimpson
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='05df01dbad80$17e73890$47b5a9b0$@gmail.com' \
--to=ltaylorsimpson@gmail.com \
--cc=ale@rev.ng \
--cc=alex.bennee@linaro.org \
--cc=anjo@rev.ng \
--cc=brian.cain@oss.qualcomm.com \
--cc=marco.liebel@oss.qualcomm.com \
--cc=matheus.bernardino@oss.qualcomm.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=quic_mburton@quicinc.com \
--cc=richard.henderson@linaro.org \
--cc=sidneym@quicinc.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.