[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 2/3] tcg: reorganize tb_find_physical loop
From: |
Richard Henderson |
Subject: |
Re: [Qemu-devel] [PATCH v2 2/3] tcg: reorganize tb_find_physical loop |
Date: |
Tue, 29 Mar 2016 13:26:48 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 |
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~