[Top][All Lists]

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

Re: [Qemu-devel] The reason behind block linking constraint?

From: 陳韋任
Subject: Re: [Qemu-devel] The reason behind block linking constraint?
Date: Sat, 24 Sep 2011 15:00:21 +0800
User-agent: Mutt/1.5.21 (2010-09-15)

Hi, Max

> I meant TLB change by e.g. tlb_set_page. If you change single page
> mapping then all TBs in that page will be gone.
> This may be the result of e.g. a page swapping, or a task switch.

  You said "all TBs in that page will be gone". Does it mean QEMU will
invalidate those TBs by for example, tb_invalidate_phys_page_range? Or
it just leave those TBs there (without executing them)? Because I don't
see functions like tb_invalidate_phys_page_range are called after
tlb_set_page, I am not sure what "gone" actually means.
> If there's no direct link between TBs then softmmu will be used during
> the target TB search and softmmu will generate an appropriate guest
> exception. See cpu_exec -> tb_find_fast -> tb_find_slow ->
> get_page_addr_code.
> But if there is a direct link, then softmmu has no chance to do it.

  Let me try to describe the flow. Correct me if I am wrong. Assume tb1
and tb2 belong to different guest pages.

  If there's NO direct link between tb1 and tb2. After executing tb1,
the control is transfered back to QEMU (cpu_exec), QEMU then call
tb_find_fast to find the next TB, i.e., tb2.

  I assume that "all TBs in that page will be gone" means QEMU will
invalidate those TBs. If not, I think tb_find_fast will return tb2
which should not be executed. So, tb_find_fast calls tb_find_slow,
then tb_find_slow calls get_page_addr_code.

  get_page_addr_code return the guest physical address which
corresponds to the pc (tb2). It looks up TLB (env1->tlb_table), and
get a TLB miss since tlb_set_page has changed the mapping. 

  if (unlikely(env1->tlb_table[mmu_idx][page_index].addr_code !=
               (addr & TARGET_PAGE_MASK))) {

  But I am not sure what happen after the TLB miss. You said the
softmmu will generate a guest exception. Take x86 as an example,
do you mean the raise_exception_err in tlb_fill?

  void tlb_fill(target_ulong addr, ...) {
    ret = cpu_x86_handle_mmu_fault(env, addr, is_write, mmu_idx, 1);
    if (ret) {
        if (retaddr) {
        raise_exception_err(env->exception_index, env->error_code);



Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667

reply via email to

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