qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: patches@linaro.org, Richard Henderson <rth@twiddle.net>,
	Laurent Vivier <laurent@vivier.eu>
Subject: [Qemu-devel] [PATCH 0/2] tcg: fix TLB miss check in get_page_addr_code()
Date: Fri, 29 Jun 2018 17:21:20 +0100	[thread overview]
Message-ID: <20180629162122.19376-1-peter.maydell@linaro.org> (raw)

In commit 71b9a45330fe220d1 we changed the condition we use to
determine whether we need to refill the TLB in get_page_addr_code() to
        if (unlikely(env->tlb_table[mmu_idx][index].addr_code !=
                     (addr & (TARGET_PAGE_MASK | TLB_INVALID_MASK)))) {

This isn't the right check (it will falsely fail if the
input addr happens to have the low bit corresponding to
TLB_INVALID_MASK set, for instance).

This patchset first factors out the "check for a hit" logic
into some new functions tlb_hit() and tlb_hit_page() (the
latter is for when the address is known to be page-aligned),
uses those functions in the various places that do TLB hit tests,
and then uses tlb_hit() to replace the erroneous code in
get_page_addr_code().

I noticed this while trying to debug Laurent's m68k test case:
it meant that we would come into get_page_addr_code() for a
TLB hit, falsely decide it was a miss, and then fish an
older entry out of the TLB victim cache...


Peter Maydell (2):
  tcg: Define and use new tlb_hit() and tlb_hit_page() functions
  accel/tcg: Correct "is this a TLB miss" check in get_page_addr_code()

 accel/tcg/softmmu_template.h | 16 ++++++----------
 include/exec/cpu-all.h       | 23 +++++++++++++++++++++++
 include/exec/cpu_ldst.h      |  3 +--
 accel/tcg/cputlb.c           | 18 ++++++------------
 4 files changed, 36 insertions(+), 24 deletions(-)

-- 
2.17.1

             reply	other threads:[~2018-06-29 16:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-29 16:21 Peter Maydell [this message]
2018-06-29 16:21 ` [Qemu-devel] [PATCH 1/2] tcg: Define and use new tlb_hit() and tlb_hit_page() functions Peter Maydell
2018-06-29 16:21 ` [Qemu-devel] [PATCH 2/2] accel/tcg: Correct "is this a TLB miss" check in get_page_addr_code() Peter Maydell
2018-06-29 17:39 ` [Qemu-devel] [PATCH 0/2] tcg: fix TLB miss " Richard Henderson

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=20180629162122.19376-1-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=laurent@vivier.eu \
    --cc=patches@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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).