qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] vhost-user: fix mmap offset calculation
@ 2014-11-02 18:01 Michael S. Tsirkin
  2014-11-02 20:24 ` Nikolay Nikolaev
  2014-11-03  1:28 ` Linhaifeng
  0 siblings, 2 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2014-11-02 18:01 UTC (permalink / raw)
  To: qemu-devel

qemu_get_ram_block_host_ptr should get ram_addr_t,
vhost-user passes in GPA.
That's very wrong.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/virtio/vhost-user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index 4e88d9c..aefe0bb 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -226,7 +226,7 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned long int request,
                 msg.memory.regions[fd_num].memory_size  = reg->memory_size;
                 msg.memory.regions[fd_num].guest_phys_addr = reg->guest_phys_addr;
                 msg.memory.regions[fd_num].mmap_offset = reg->userspace_addr -
-                    (uintptr_t) qemu_get_ram_block_host_ptr(reg->guest_phys_addr);
+                    (uintptr_t) qemu_get_ram_block_host_ptr(ram_addr);
                 assert(fd_num < VHOST_MEMORY_MAX_NREGIONS);
                 fds[fd_num++] = fd;
             }
-- 
MST

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] vhost-user: fix mmap offset calculation
  2014-11-02 18:01 [Qemu-devel] [PATCH] vhost-user: fix mmap offset calculation Michael S. Tsirkin
@ 2014-11-02 20:24 ` Nikolay Nikolaev
  2014-11-03  1:28 ` Linhaifeng
  1 sibling, 0 replies; 3+ messages in thread
From: Nikolay Nikolaev @ 2014-11-02 20:24 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Luke Gorrie, VirtualOpenSystems Technical Team, qemu-devel

Hello,

I can confirm the issue, and this patch fixes it for me. Thanks.

regards,
Nikolay Nikolaev
Virtual Open Systems

On Sun, Nov 2, 2014 at 8:01 PM, Michael S. Tsirkin <mst@redhat.com> wrote:
> qemu_get_ram_block_host_ptr should get ram_addr_t,
> vhost-user passes in GPA.
> That's very wrong.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  hw/virtio/vhost-user.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
> index 4e88d9c..aefe0bb 100644
> --- a/hw/virtio/vhost-user.c
> +++ b/hw/virtio/vhost-user.c
> @@ -226,7 +226,7 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned long int request,
>                  msg.memory.regions[fd_num].memory_size  = reg->memory_size;
>                  msg.memory.regions[fd_num].guest_phys_addr = reg->guest_phys_addr;
>                  msg.memory.regions[fd_num].mmap_offset = reg->userspace_addr -
> -                    (uintptr_t) qemu_get_ram_block_host_ptr(reg->guest_phys_addr);
> +                    (uintptr_t) qemu_get_ram_block_host_ptr(ram_addr);
>                  assert(fd_num < VHOST_MEMORY_MAX_NREGIONS);
>                  fds[fd_num++] = fd;
>              }
> --
> MST
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] vhost-user: fix mmap offset calculation
  2014-11-02 18:01 [Qemu-devel] [PATCH] vhost-user: fix mmap offset calculation Michael S. Tsirkin
  2014-11-02 20:24 ` Nikolay Nikolaev
@ 2014-11-03  1:28 ` Linhaifeng
  1 sibling, 0 replies; 3+ messages in thread
From: Linhaifeng @ 2014-11-03  1:28 UTC (permalink / raw)
  To: Michael S. Tsirkin, qemu-devel

good job!passed test bigger than 3.5G VM.

On 2014/11/3 2:01, Michael S. Tsirkin wrote:
> qemu_get_ram_block_host_ptr should get ram_addr_t,
> vhost-user passes in GPA.
> That's very wrong.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  hw/virtio/vhost-user.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
> index 4e88d9c..aefe0bb 100644
> --- a/hw/virtio/vhost-user.c
> +++ b/hw/virtio/vhost-user.c
> @@ -226,7 +226,7 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned long int request,
>                  msg.memory.regions[fd_num].memory_size  = reg->memory_size;
>                  msg.memory.regions[fd_num].guest_phys_addr = reg->guest_phys_addr;
>                  msg.memory.regions[fd_num].mmap_offset = reg->userspace_addr -
> -                    (uintptr_t) qemu_get_ram_block_host_ptr(reg->guest_phys_addr);
> +                    (uintptr_t) qemu_get_ram_block_host_ptr(ram_addr);
>                  assert(fd_num < VHOST_MEMORY_MAX_NREGIONS);
>                  fds[fd_num++] = fd;
>              }
> 

-- 
Regards,
Haifeng

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-11-03  1:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-02 18:01 [Qemu-devel] [PATCH] vhost-user: fix mmap offset calculation Michael S. Tsirkin
2014-11-02 20:24 ` Nikolay Nikolaev
2014-11-03  1:28 ` Linhaifeng

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).