Received: from eggs.gnu.org ([2001:4830:134:3::10]:55799) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y36TM-0005po-AZ for qemu-devel@nongnu.org; Mon, 22 Dec 2014 12:08:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y36TF-00043d-U9 for qemu-devel@nongnu.org; Mon, 22 Dec 2014 12:08:44 -0500 Received: from nm43-vm9.bullet.mail.gq1.yahoo.com ([67.195.87.212]:48929) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y36TF-00042g-Ir for qemu-devel@nongnu.org; Mon, 22 Dec 2014 12:08:37 -0500 Date: Mon, 22 Dec 2014 17:05:46 +0000 (UTC) From: Ronex Dicapriyo Message-ID: <1862078449.263378.1419267946532.JavaMail.yahoo@jws10915.mail.sg3.yahoo.com> In-Reply-To: References: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_263377_1699216139.1419267946527" Subject: Re: [Qemu-devel] Need some help in understanding qemu infrastructure and execution flow Reply-To: Ronex Dicapriyo List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: "qemu-devel@nongnu.org" ------=_Part_263377_1699216139.1419267946527 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable =C2=A0Thanks for the explanations, I have some more doubts on the same, Kin= dly clarify. On Monday, 22 December 2014 10:10 PM, Peter Maydell wrote: =20 =20 > 1) the basic execution flow of QEMU simulation engine > 2) Notion of time, events in QEMU We don't have quite the same kind of view of the world that a more strictly timed simulation would. Mostly QEMU aims for "execute correct code as fast as possible". We don't have any kind of cycle accuracy, for instance. Generally we just execute code, and events such as timer interrupts happen at the intervals that the host clock says they should (ie a 50Hz interrupt will tick every 1/50th of a second). [Ronex] Ok, As I can understand, QEMU is functional accurate, rather than c= ycle for fast simulation. But there must be some kind of reference clock, l= ike say for example any timer device which raises an interrupt after couple= of cycles (i.e after each 50ns it increments it timer counter register), H= ow it can be implemented in QEMU, I could not understand what you are refer= ring by host clock, are you pointing at the real-time clock of the host sys= tem where any qemu binary or executable runs (it sounds quite wierd to me )= ? > 3) Multithreading or multi-processing Currently we implement SMP guest configurations by simply doing a round-robin execution of each CPU on a single host thread. (There is work planned to change this so we can make use of multiple host threads.) Suppose I am directly accessing some X address of memory, which falls into = the memory of device A, Now, if transaction doesn't involves CPU (may be us= ing DMA), then how it calls the read/write methods associated with any devi= ce (for updating a device's register and carry out some specific functional= ity) ? Can you please suggest any memory management unit which is responsib= le for this ? > 6) Debugging in QEMU Debugging of QEMU, or of the guest? How to debug any device code of QEMU, as well as some application running o= n Guest ? > Kindly direct me on proper path, and help me in learning QEMU. Kindly > suggest any links and books which can be used for comprehension. In general we don't have much documentation of QEMU's internals. The source code is always your best resource for figuring out exactly what we do. I understand this, Thanks for all the suggestions, I was looking some for d= ocumentation to avoid any wrong interpretations. > While checking some hardware device source code, I found the use of > VMSTATE_UINTx kind of macros, Can anyone please suggest what is the purpo= se > of VMSTATE_xxx_xxx in QEMU ? They describe the state of the device so we can serialise it for live migration and VM snapshot save/restore. This one actually is documented -- see docs/migration.txt. thanks -- PMM ------=_Part_263377_1699216139.1419267946527 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
 Thanks for the explanations, I h= ave some more doubts on the same, Kindly clarify.


On Monday, 22 December 2014 10:10 PM, Peter M= aydell <peter.maydell@linaro.org> wrote:

> 1) the = basic execution flow of QEMU simulation engine
> 2) No= tion of time, events in QEMU

We don't = have quite the same kind of view of the world
that a more= strictly timed simulation would. Mostly QEMU
aims for "e= xecute correct code as fast as possible".
We don't have a= ny kind of cycle accuracy, for instance.
Generally we jus= t execute code, and events such as timer
interrupts happe= n at the intervals that the host clock
says they should (= ie a 50Hz interrupt will tick every
1/50th of a second).<= br clear=3D"none">

[Ron= ex] Ok, As I can understand, QEMU is functional accurate, rather than c= ycle for fast simulation. But there must be some kind of reference clock, l= ike say for example any timer device which raises an interrupt after couple= of cycles (i.e after each 50ns it increments it timer counter register), H= ow it can be implemented in QEMU, I could not understand what you are refer= ring by host clock, are you pointing at the real-time clock of the host sys= tem where any qemu binary or executable runs (it sounds quite wierd to me )= ?

= > 3) Multithreading or multi-processing

Currently we implement SMP guest configurations by simply
doing a round-robin execution of each CPU on a single host
thread. (There is work planned to change this so we can make
use of multiple host threads.)

Suppose I am directly accessing some X address of memory, which falls int= o the memory of device A, Now, if transaction doesn't involves CPU (may be = using DMA), then how it calls the read/write methods associated with any de= vice (for updating a device's register and carry out some specific function= ality) ? Can you please suggest any memory management unit which is respons= ible for this ?

>= 6) Debugging in QEMU

Debugging of QEM= U, or of the guest?
How to debug any device code of QEMU, as w= ell as some application running on Guest ?


> Kindly= direct me on proper path, and help me in learning QEMU. Kindly
> suggest any links and books which can be used for comprehension= .

In general we don't have much docume= ntation of QEMU's
internals. The source code is always yo= ur best resource
for figuring out exactly what we do.
I understand this, Thanks for all the= suggestions, I was looking some for documentation to avoid any wrong inter= pretations.

> While checking= some hardware device source code, I found the use of
>= ; VMSTATE_UINTx kind of macros, Can anyone please suggest what is the purpo= se
> of VMSTATE_xxx_xxx in QEMU ?
Th= ey describe the state of the device so we can serialise
i= t for live migration and VM snapshot save/restore.
This o= ne actually is documented -- see docs/migration.txt.

=

t= hanks
-- PMM



------=_Part_263377_1699216139.1419267946527--