[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] TCG: Fix TB invalidation after breakpoint inser

From: Max Filippov
Subject: Re: [Qemu-devel] [PATCH] TCG: Fix TB invalidation after breakpoint insertion/deletion
Date: Thu, 24 May 2012 16:08:08 +0400

On Thu, May 24, 2012 at 3:25 PM, Jan Kiszka <address@hidden> wrote:
> On 2012-05-24 07:51, Max Filippov wrote:
>> On Thu, May 24, 2012 at 6:34 AM, Jan Kiszka <address@hidden> wrote:
>>> From: Jan Kiszka <address@hidden>
>>> tb_invalidate_phys_addr has to called with the exact physical address of
>>> the breakpoint we add/remove, not just the page's base address.
>>> Otherwise we easily fail to flush the right TB.
>>> Regression of 1e7855a558.
>> Sorry, I fail to see how 1e7855a558 could introduce a regression, it
>> just rearranged the code.
>> Even more, AFAIK cpu_get_phys_page_debug returns complete physical
>> address, not just
>> physical page. Probably it has a misleading name.
> Unfortunately, cpu_get_phys_page_debug does NOT deliver the sub-page
> offset, only the page base address.

Ok, i386 has probably the most explicit implementation,
let's look at the target-i386/helper.c:876

    page_offset = (addr & TARGET_PAGE_MASK) & (page_size - 1);
    paddr = (pte & TARGET_PAGE_MASK) + page_offset;
    return paddr;

that's clearly physical page plus in-page offset.
I can provide other samples (:

> So the regression was caused by this
> refactoring.

The refactoring is this:

-static void breakpoint_invalidate(CPUArchState *env, target_ulong pc)
+void tb_invalidate_phys_addr(target_phys_addr_t addr)
-    target_phys_addr_t addr;
     ram_addr_t ram_addr;
     MemoryRegionSection *section;

-    addr = cpu_get_phys_page_debug(env, pc);
     section = phys_page_find(addr >> TARGET_PAGE_BITS);
     if (!(memory_region_is_ram(section->mr)
           || (section->mr->rom_device && section->mr->readable))) {
@@ -1479,6 +1477,11 @@ static void breakpoint_invalidate(CPUArchState
*env, target_ulong pc)
         + section_addr(section, addr);
     tb_invalidate_phys_page_range(ram_addr, ram_addr + 1, 0);
+static void breakpoint_invalidate(CPUArchState *env, target_ulong pc)
+    tb_invalidate_phys_addr(cpu_get_phys_page_debug(env, pc));

so it's literally just code move.

Is there a real bug that is fixed by the patch?

-- Max

reply via email to

[Prev in Thread] Current Thread [Next in Thread]