All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Pekka Enberg <penberg@kernel.org>
Cc: KVM General <kvm@vger.kernel.org>, Ingo Molnar <mingo@elte.hu>,
	Cyrill Gorcunov <gorcunov@gmail.com>
Subject: Re: Is KVM_GET_SREGS safe from other threads?
Date: Sun, 08 May 2011 11:50:57 +0300	[thread overview]
Message-ID: <4DC65971.7060203@redhat.com> (raw)
In-Reply-To: <BANLkTikB0NmgSzOV5YO-+Qm2fh1MFw6utw@mail.gmail.com>

On 05/08/2011 11:24 AM, Pekka Enberg wrote:
> Hi!
>
> We've noticed that sometimes KVM_GET_SREGS from a signal handler
> hangs. We use it like this:
>
> static void handle_sigquit(int sig)
> {
>           int i;
>
>           for (i = 0; i<  nrcpus; i++) {
>                   struct kvm_cpu *cpu = kvm_cpus[i];
>
>                   kvm_cpu__show_registers(cpu);<-- here
>                   kvm_cpu__show_code(cpu);
>                   kvm_cpu__show_page_tables(cpu);
>           }
>
> and
>
> void kvm_cpu__show_registers(struct kvm_cpu *self)
> {
> [...]
> 	if (ioctl(self->vcpu_fd, KVM_GET_SREGS,&sregs)<  0)
> 		die("KVM_GET_REGS failed");
>
> is it not OK to call KVM_GET_SREGS from other threads than the one
> that's doing KVM_RUN?

 From Documentation/kvm/api.txt:

  - vcpu ioctls: These query and set attributes that control the operation
    of a single virtual cpu.

    Only run vcpu ioctls from the same thread that was used to create the
    vcpu.


So no, it is not okay (nor is it meaningful, you get a register snapshot 
that is disconnected from all other vcpu state).

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


  reply	other threads:[~2011-05-08  8:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-08  8:24 Is KVM_GET_SREGS safe from other threads? Pekka Enberg
2011-05-08  8:50 ` Avi Kivity [this message]
2011-05-08  9:07   ` Pekka Enberg

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=4DC65971.7060203@redhat.com \
    --to=avi@redhat.com \
    --cc=gorcunov@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=penberg@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.