qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH 0/6] target/microblaze: Use tcg_gen_lookup_and_goto_ptr
Date: Tue, 1 Sep 2020 09:08:57 +0200	[thread overview]
Message-ID: <20200901070857.GK14249@toto> (raw)
In-Reply-To: <20200831184018.839906-1-richard.henderson@linaro.org>

On Mon, Aug 31, 2020 at 11:40:12AM -0700, Richard Henderson wrote:
> Based-on: <20200831160601.833692-1-richard.henderson@linaro.org>
> ("[PULL 00/76] target/microblaze improvements")
> 
> Hello again, Edgar.
> 
> I had dropped the tcg_gen_lookup_and_goto_ptr patch from the
> previous omnibus patch set, as you had reported lockups.
> 
> I have identified, by inspection, two cases in which we failed
> to return to the main loop even though we should have:
> 
> (1) Return-from-exception type instructions.
> 
> I had missed these before because they hadn't set cpustate_changed.
> This still worked fine because they are all indirect branches, and
> had exited immediately.
> 
> Fixed by distinguishing these cases from normal indirect branches
> before we start using lookup_and_goto_ptr.
> 
> (2) MTS in a branch delay slot.
> 
> We did not check dc->cpustate_changed before setting
> dc->base.is_jmp to DISAS_JUMP, which lost the fact that we
> need to return to the main loop.
> 
> This mostly works fine without lookup_and_goto_ptr, because
> we either (a) finished an indirect branch and returned to the
> main loop anyway or (b) we'd return to the main loop via some
> subsequent indirect branch, which would happen "soon enough".
> 
> We should have been able to see soft-lockup with the existing
> code in the case of a cpustate_changed in the delay slot of
> a loop of direct branches that all use goto_tb.  E.g.
> 
> 	brid	0
> 	 msrset MSR_IE
> 
> I.e. an immediate branch back to the same branch insn,
> re-enabling interrupts in the delay slot.  Probably not
> something that shows up in the wild.


Nice! Yes, this seems to fix the problem we ran into before.
Series looks good both in review and testing except for minor typo in a comment.

With the typo in patch #4 fixed:
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Tested-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>



> 
> ----
> 
> Follow-up question: The manual says that several classes of
> instructions are invalid in a branch delay slot, but does
> not say what action is taken, if any.
> 
> Some of these invalid cases could leave qemu in an inconsistent
> state.  Would it be legal for us to diagnose these cases with
> trap_illegal?  If not, what *should* we be doing?  We could also
> LOG_GUEST_ERROR for these either way.
> 
> I've added some TODO comments in these patches that are relevant.

Thanks, I'll try to dig out some details. A guest-error will likely
be needed anyway since some cores don't have exceptions enabled.
But we may want both.

Cheers,
Edgar


  parent reply	other threads:[~2020-09-01  7:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-31 18:40 [PATCH 0/6] target/microblaze: Use tcg_gen_lookup_and_goto_ptr Richard Henderson
2020-08-31 18:40 ` [PATCH 1/6] target/microblaze: Rename DISAS_UPDATE to DISAS_EXIT Richard Henderson
2020-08-31 18:40 ` [PATCH 2/6] target/microblaze: Introduce DISAS_EXIT_NEXT, DISAS_EXIT_JUMP Richard Henderson
2020-08-31 18:40 ` [PATCH 3/6] target/microblaze: Replace cpustate_changed with DISAS_EXIT_NEXT Richard Henderson
2020-08-31 18:40 ` [PATCH 4/6] target/microblaze: Handle DISAS_EXIT_NEXT in delay slot Richard Henderson
2020-09-01  7:02   ` Edgar E. Iglesias
2020-08-31 18:40 ` [PATCH 5/6] target/microblaze: Force rtid, rted, rtbd to exit Richard Henderson
2020-08-31 18:40 ` [PATCH 6/6] target/microblaze: Use tcg_gen_lookup_and_goto_ptr Richard Henderson
2020-09-01  7:08 ` Edgar E. Iglesias [this message]
2020-09-01 10:00 ` [PATCH 0/6] " Edgar E. Iglesias

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=20200901070857.GK14249@toto \
    --to=edgar.iglesias@xilinx.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.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 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).