qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: 解壁伟 <xiebiwei@ict.ac.cn>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Round robin of multi-vcpu in qemu
Date: Mon, 15 Apr 2013 22:43:41 +0800	[thread overview]
Message-ID: <516C121D.40703@ict.ac.cn> (raw)
In-Reply-To: <513EF6A0.4000601@ict.ac.cn>

[-- Attachment #1: Type: text/plain, Size: 1518 bytes --]

Hi there:

I'm studying the execution details of multi-vcpu in TCG mode.

The vcpus in TCG mode are executed one by one in a sequencial way.

I read the function [tcg_exec_all] in Qemu 1.3.0 as bellow, but the
implementation is not as I expected.

[tcg_exec_all] will finally call [cpu_exec] to excute a loop to excute
the TBs in code cache

So,how does these functions control the running time of each VCPU?

That is,when will the execution of one VCPU return, in order to execute
the next_cpu in the loop of [tcg_exec_all].

I've examined the alarm timmer, this timer is used to interrupt the
execution of VCPUs to handle interruptions.

Does Qemu use a similar way (timer) to control the round robin of these
VCPUs?

Or, does Qemu use the iCount to prevent a VCPU from running too long?

        staticvoidtcg_exec_all(void)
        {
        intr;

        /* Account partial waits to the vm_clock. */
        qemu_clock_warp(vm_clock);

        if(next_cpu==NULL){
        next_cpu=first_cpu;
        }
        for(;next_cpu!=NULL&&!exit_request;next_cpu=next_cpu->next_cpu){
        CPUArchState*env=next_cpu;
        CPUState*cpu=ENV_GET_CPU(env);

        qemu_clock_enable(vm_clock,
        (env->singlestep_enabled&SSTEP_NOTIMER)==0);

        if(cpu_can_run(cpu)){
        r=tcg_cpu_exec(env);
        if(r==EXCP_DEBUG){
        cpu_handle_guest_debug(env);
        break;
        }
        }elseif(cpu->stop||cpu->stopped){
        break;
        }
        }
        exit_request=0;
        }

Yours
Biwei

[-- Attachment #2: Type: text/html, Size: 11091 bytes --]

  parent reply	other threads:[~2013-04-15 14:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-12  9:34 [Qemu-devel] About the Thread model in Qemu【 Is it one thread per vcpu?】 解壁伟
2013-03-12 22:26 ` Laszlo Ersek
2013-03-13  8:59   ` 解壁伟
2013-03-13  8:45 ` Stefan Hajnoczi
2013-03-13  9:32   ` 解壁伟
2013-03-13  9:51     ` Peter Maydell
2013-03-13  9:56       ` Laurent Desnogues
2013-03-13 12:21         ` Paolo Bonzini
2013-04-15 14:43 ` 解壁伟 [this message]
2013-04-23  1:25   ` [Qemu-devel] Round robin of multi-vcpu in qemu 陳韋任 (Wei-Ren Chen)

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=516C121D.40703@ict.ac.cn \
    --to=xiebiwei@ict.ac.cn \
    --cc=qemu-devel@nongnu.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 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).