qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: <ltaylorsimpson@gmail.com>
To: "'Brian Cain'" <brian.cain@oss.qualcomm.com>,
	"'Matheus Tavares Bernardino'"
	<matheus.bernardino@oss.qualcomm.com>
Cc: <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: Wed, 16 Apr 2025 17:27:53 -0600	[thread overview]
Message-ID: <07bc01dbaf27$2f1c49d0$8d54dd70$@gmail.com> (raw)
In-Reply-To: <b8f2eb78-1cc6-4d82-8597-6d994a6a6f66@oss.qualcomm.com>



> -----Original Message-----
> From: Brian Cain <brian.cain@oss.qualcomm.com>
> Sent: Wednesday, April 16, 2025 4:22 PM
> To: ltaylorsimpson@gmail.com; 'Matheus Tavares Bernardino'
> <matheus.bernardino@oss.qualcomm.com>
> Cc: 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
> 
> 
> On 4/14/2025 3:59 PM, ltaylorsimpson@gmail.com wrote:
> >
> >> -----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.
> 
> 
> Taylor, is it satisfactory to include that update in a subsequent patch
> series?  Or should this one replace the second unreachable too?

If you just remove that line, it will fall through to the "return 1" below.


> >>
> >>>>       }
> >>>> +    /*
> >>>> +     * 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.
> 
> 
> Matheus provided a linux-user test offline.  I'll include it in an
> updated patch.
> 
> 
> >
> > HTH,
> > Taylor
> >
> >



  reply	other threads:[~2025-04-16 23:29 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
2025-04-16 22:21     ` Brian Cain
2025-04-16 23:27       ` ltaylorsimpson [this message]
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='07bc01dbaf27$2f1c49d0$8d54dd70$@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 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).