All of lore.kernel.org
 help / color / mirror / Atom feed
From: Don Slutz <dslutz@verizon.com>
To: Alexander Graf <agraf@suse.de>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Don Slutz <dslutz@verizon.com>,
	qemu-devel@nongnu.org
Cc: xen-devel@lists.xensource.com,
	"Marcel Apfelbaum" <marcel.a@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Anthony Liguori" <aliguori@amazon.com>,
	"Andreas Färber" <afaerber@suse.de>,
	"Stefano Stabellini" <stefano.stabellini@eu.citrix.com>
Subject: Re: [Qemu-devel] [PATCH 1/1] xen-hvm.c: Add support for Xen access to vmport
Date: Mon, 29 Sep 2014 21:00:55 -0400	[thread overview]
Message-ID: <542A00C7.2030509@terremark.com> (raw)
In-Reply-To: <54294832.9060001@suse.de>

On 09/29/14 07:53, Alexander Graf wrote:
>
> On 29.09.14 13:10, Paolo Bonzini wrote:
>> Il 29/09/2014 10:12, Alexander Graf ha scritto:
>>> Could you instead plug into the existing cpu_synchronize_registers()
>>> framework and just implement register synchronization for the Xen side,
>>> just like it's been done for KVM? :)
>> No, because here it's Xen that sends out the register contents.  With
>> KVM, it's QEMU that requests the register contents.
> So? We could still reuse the same infrastructure:
>
>
>    cpu_handle_ioreq()
>    {
>      ...
>
>      if (req->type == IOPORT_REGISTERS_SYNCHRONIZED) {
>          cpu->xen_vcpu_dirty = true;

I am assuming that you mean something like:

     X86CPU *cpu = X86_CPU(current_cpu);
     cpu->xen_vcpu_dirty = true;

because cpu is not defined here.  And this has a major issue
because current_cpu is NULL for Xen, so you have added a SIGSEGV.

If you are trying to say "lets build a CPUState state object here
and set current_cpu to it, and then set the xen_vcpu_dirty" then
yes that could be done.  Adding all the code to build a CPUState state
object and X86CPUClass object correctly just to use the code in
vmport.c looked to me to be a lot of work for little benefit.


If you want to go with not adding the objects, I could change
to having a "xen X86CPU" that I set current_cpu to and
then back to NULL when done.  That (I think) would drop
all changes to vmport.c

>          synchronize_xen_to_env(xenptr, cpu);
>      }
>
>      handle_ioreq();
>
>      if (req->type == IOPORT_REGISTERS_SYNCHRONIZED) {
>          cpu->xen_vcpu_dirty = false;
>          synchronize_env_to_xen(xenptr, cpu);
>      }
>
>      ...
>    }
>
>    void xen_cpu_synchronize_state(CPUState *cpu)
>    {
>      assert(cpu->xen_vcpu_dirty);
>    }
>
> Then no changes to the vmport code would be necessary and this problems
> where some code path wants to do direct access to registers
> automatically tells us that things are broken.

The SIGSEGV already does this.

     -Don Slutz

>
> Alex

WARNING: multiple messages have this Message-ID (diff)
From: Don Slutz <dslutz@verizon.com>
To: Alexander Graf <agraf@suse.de>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Don Slutz <dslutz@verizon.com>,
	qemu-devel@nongnu.org
Cc: xen-devel@lists.xensource.com,
	"Marcel Apfelbaum" <marcel.a@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Anthony Liguori" <aliguori@amazon.com>,
	"Andreas Färber" <afaerber@suse.de>,
	"Stefano Stabellini" <stefano.stabellini@eu.citrix.com>
Subject: Re: [PATCH 1/1] xen-hvm.c: Add support for Xen access to vmport
Date: Mon, 29 Sep 2014 21:00:55 -0400	[thread overview]
Message-ID: <542A00C7.2030509@terremark.com> (raw)
In-Reply-To: <54294832.9060001@suse.de>

On 09/29/14 07:53, Alexander Graf wrote:
>
> On 29.09.14 13:10, Paolo Bonzini wrote:
>> Il 29/09/2014 10:12, Alexander Graf ha scritto:
>>> Could you instead plug into the existing cpu_synchronize_registers()
>>> framework and just implement register synchronization for the Xen side,
>>> just like it's been done for KVM? :)
>> No, because here it's Xen that sends out the register contents.  With
>> KVM, it's QEMU that requests the register contents.
> So? We could still reuse the same infrastructure:
>
>
>    cpu_handle_ioreq()
>    {
>      ...
>
>      if (req->type == IOPORT_REGISTERS_SYNCHRONIZED) {
>          cpu->xen_vcpu_dirty = true;

I am assuming that you mean something like:

     X86CPU *cpu = X86_CPU(current_cpu);
     cpu->xen_vcpu_dirty = true;

because cpu is not defined here.  And this has a major issue
because current_cpu is NULL for Xen, so you have added a SIGSEGV.

If you are trying to say "lets build a CPUState state object here
and set current_cpu to it, and then set the xen_vcpu_dirty" then
yes that could be done.  Adding all the code to build a CPUState state
object and X86CPUClass object correctly just to use the code in
vmport.c looked to me to be a lot of work for little benefit.


If you want to go with not adding the objects, I could change
to having a "xen X86CPU" that I set current_cpu to and
then back to NULL when done.  That (I think) would drop
all changes to vmport.c

>          synchronize_xen_to_env(xenptr, cpu);
>      }
>
>      handle_ioreq();
>
>      if (req->type == IOPORT_REGISTERS_SYNCHRONIZED) {
>          cpu->xen_vcpu_dirty = false;
>          synchronize_env_to_xen(xenptr, cpu);
>      }
>
>      ...
>    }
>
>    void xen_cpu_synchronize_state(CPUState *cpu)
>    {
>      assert(cpu->xen_vcpu_dirty);
>    }
>
> Then no changes to the vmport code would be necessary and this problems
> where some code path wants to do direct access to registers
> automatically tells us that things are broken.

The SIGSEGV already does this.

     -Don Slutz

>
> Alex

  parent reply	other threads:[~2014-09-30  1:01 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-26 18:47 [Qemu-devel] [PATCH 0/1] Add support for Xen access to vmport Don Slutz
2014-09-26 18:47 ` Don Slutz
2014-09-26 18:47 ` [Qemu-devel] [PATCH 1/1] xen-hvm.c: " Don Slutz
2014-09-26 18:47   ` Don Slutz
2014-09-29  8:12   ` [Qemu-devel] " Alexander Graf
2014-09-29  8:12     ` Alexander Graf
2014-09-29 11:10     ` [Qemu-devel] " Paolo Bonzini
2014-09-29 11:10       ` Paolo Bonzini
2014-09-29 11:53       ` [Qemu-devel] " Alexander Graf
2014-09-29 11:53         ` Alexander Graf
2014-09-29 12:21         ` [Qemu-devel] " Paolo Bonzini
2014-09-29 12:21           ` Paolo Bonzini
2014-09-29 12:57           ` [Qemu-devel] " Alexander Graf
2014-09-29 12:57             ` Alexander Graf
2014-09-29 13:14             ` [Qemu-devel] " Paolo Bonzini
2014-09-29 13:14               ` Paolo Bonzini
2014-09-30  1:05               ` [Qemu-devel] " Don Slutz
2014-09-30  1:05                 ` Don Slutz
2014-09-30  8:14                 ` [Qemu-devel] " Paolo Bonzini
2014-09-30  8:14                   ` Paolo Bonzini
2014-09-30  1:00         ` Don Slutz [this message]
2014-09-30  1:00           ` Don Slutz
2014-09-29 10:15   ` [Qemu-devel] " Stefano Stabellini
2014-09-29 10:15     ` Stefano Stabellini
2014-09-29 10:25     ` [Qemu-devel] " Stefano Stabellini
2014-09-29 10:25       ` Stefano Stabellini
2014-09-30  0:32       ` [Qemu-devel] " Don Slutz
2014-09-30  0:32         ` Don Slutz
2014-09-30 10:35         ` [Qemu-devel] " Stefano Stabellini
2014-09-30 10:35           ` Stefano Stabellini
2014-10-01  5:21           ` [Qemu-devel] " Slutz, Donald Christopher
2014-10-01  5:21             ` Slutz, Donald Christopher
2014-10-01  9:20             ` [Qemu-devel] " Stefano Stabellini
2014-10-01  9:20               ` Stefano Stabellini
2014-10-01 12:33               ` [Qemu-devel] " Don Slutz
2014-10-01 12:33                 ` Don Slutz
2014-10-01 14:44               ` [Qemu-devel] [Xen-devel] " Ian Campbell
2014-10-01 14:44                 ` Ian Campbell
2014-10-01 16:01                 ` [Qemu-devel] " Anthony Liguori
2014-10-01 16:01                   ` Anthony Liguori
2014-10-01 15:08               ` [Qemu-devel] " Paul Durrant
2014-10-01 15:08                 ` Paul Durrant

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=542A00C7.2030509@terremark.com \
    --to=dslutz@verizon.com \
    --cc=afaerber@suse.de \
    --cc=agraf@suse.de \
    --cc=aliguori@amazon.com \
    --cc=armbru@redhat.com \
    --cc=marcel.a@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /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.