All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: Sergey Fedorov <sergey.fedorov@linaro.org>, qemu-devel@nongnu.org
Cc: "Sergey Fedorov" <serge.fdrv@gmail.com>,
	"Peter Crosthwaite" <crosthwaite.peter@gmail.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 2/3] tcg: reorganize tb_find_physical loop
Date: Tue, 29 Mar 2016 13:26:48 -0700	[thread overview]
Message-ID: <56FAE508.1050904@twiddle.net> (raw)
In-Reply-To: <1459280892-8789-3-git-send-email-sergey.fedorov@linaro.org>

On 03/29/2016 12:48 PM, Sergey Fedorov wrote:
> +    while (tb) {
>          if (tb->pc == pc &&
>              tb->page_addr[0] == phys_page1 &&
>              tb->cs_base == cs_base &&
>              tb->flags == flags) {
> -            /* check next page if needed */
> -            if (tb->page_addr[1] != -1) {
> -                tb_page_addr_t phys_page2;
>  
> -                virt_page2 = (pc & TARGET_PAGE_MASK) +
> -                    TARGET_PAGE_SIZE;
> -                phys_page2 = get_page_addr_code(env, virt_page2);
> +            if (tb->page_addr[1] == -1) {
> +                /* done, we have a match */
> +                break;
> +            } else {
> +                /* check next page if needed */
> +                target_ulong virt_page2 = (pc & TARGET_PAGE_MASK) +
> +                                          TARGET_PAGE_SIZE;
> +                tb_page_addr_t phys_page2 = get_page_addr_code(env, virt_page2);
> +
>                  if (tb->page_addr[1] == phys_page2) {
>                      break;
>                  }
> -            } else {
> -                break;
>              }
>          }

FYI,

There's an issue here before and after this patch: calling get_page_addr_code
will cause an exception to be thrown if the page isn't mapped.

Except this is a search routine looking for matching TB's.  We shouldn't be
raising an exception within this loop.  We need a variant of get_page_addr_code
that reloads the TLB, if possible, but without generating a fault.

Something that I don't think we can actually do with the current tlb_fill
target hooks.  So not something for this patch, but something to put on
someone's radar, hopefully...


r~

  reply	other threads:[~2016-03-29 20:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-29 19:48 [Qemu-devel] [PATCH v2 0/3] tcg: Misc clean-up patches from Paolo and Alex Sergey Fedorov
2016-03-29 19:48 ` [Qemu-devel] [PATCH v2 1/3] tcg: code_bitmap is not used by user-mode emulation Sergey Fedorov
2016-03-29 20:05   ` Richard Henderson
2016-03-31 13:49   ` Alex Bennée
2016-03-29 19:48 ` [Qemu-devel] [PATCH v2 2/3] tcg: reorganize tb_find_physical loop Sergey Fedorov
2016-03-29 20:26   ` Richard Henderson [this message]
2016-03-29 20:27   ` Richard Henderson
2016-03-29 19:48 ` [Qemu-devel] [PATCH v2 3/3] cpu-exec: elide more icount code if CONFIG_USER_ONLY Sergey Fedorov

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=56FAE508.1050904@twiddle.net \
    --to=rth@twiddle.net \
    --cc=alex.bennee@linaro.org \
    --cc=crosthwaite.peter@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=serge.fdrv@gmail.com \
    --cc=sergey.fedorov@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 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.