qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Re: [6684] Fix "info registers" under kvm.
Date: Mon, 09 Mar 2009 11:41:20 +0200	[thread overview]
Message-ID: <49B4E440.1090307@redhat.com> (raw)
In-Reply-To: <49B3F418.4090805@codemonkey.ws>

Anthony Liguori wrote:
>
> In the case of save/load registers, I'd prefer wrapper functions like:
>
> cpu_state_update(CPUState *env, int is_dirty)
>
> That could be hooked by something like Xen.  The implementation would be:
>
> static void cpu_state_update(CPUState *env, int is_dirty)
> {
>    if (kvm_enabled()) {
>        if (is_dirty)
>           kvm_arch_save_registers(env);
>        else
>           kvm_arch_load_registers(env);
>    }
> } 

That reduces readability IMO (boolean parameters do that, as well as a 
function where the direction of data movement isn't clear).

But we could keep dirty in the environment, and do everything automatically.

random qemu code:
  cpu_state_sync(env);
  // read registers
  // write registers
  cpu_state_dirty(env);

kvm arch code:
  if (env->registers_dirty) {
      copy registers to kernel
      env->registers_dirty = 0;
  }

The kernel code does similar things for registers which can be either in 
memory or in the vmcs; it uses accessors so cpu_state_sync() and 
cpu_state_dirty() aren't needed;

-- 
error compiling committee.c: too many arguments to function

      reply	other threads:[~2009-03-09 20:59 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-04 21:00 [Qemu-devel] [6684] Fix "info registers" under kvm Andrzej Zaborowski
2009-03-08 15:56 ` [Qemu-devel] " Jan Kiszka
2009-03-08 16:10   ` Anthony Liguori
2009-03-08 16:32     ` Jan Kiszka
2009-03-08 16:40       ` Anthony Liguori
2009-03-09  7:46         ` Gerd Hoffmann
2009-03-08 16:35     ` Andreas Färber
2009-03-09  9:42       ` Avi Kivity
2009-03-08 16:18   ` Avi Kivity
2009-03-08 16:23     ` Avi Kivity
2009-03-08 16:36       ` Blue Swirl
2009-03-09  9:42         ` Avi Kivity
2009-03-08 16:36       ` Anthony Liguori
2009-03-09  9:41         ` Avi Kivity [this message]

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=49B4E440.1090307@redhat.com \
    --to=avi@redhat.com \
    --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).