All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/2] vhost-user: support SET_MEM_TABLE waite the result of mmap
@ 2015-02-10  3:24 linhaifeng
  2015-02-10  3:24 ` [Qemu-devel] [PATCH 2/2] vhost-user: add reply for set_mem_table linhaifeng
  0 siblings, 1 reply; 4+ messages in thread
From: linhaifeng @ 2015-02-10  3:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Linhaifeng, mst

From: Linhaifeng <haifeng.lin@huawei.com>

Slave should reply to master and set u64 to 0 if
mmap all regions success otherwise set u64 to 1.

Signed-off-by: Linhaifeng <haifeng.lin@huawei.com>
---
 docs/specs/vhost-user.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/docs/specs/vhost-user.txt b/docs/specs/vhost-user.txt
index 650bb18..c96bf6b 100644
--- a/docs/specs/vhost-user.txt
+++ b/docs/specs/vhost-user.txt
@@ -171,6 +171,7 @@ Message types
       Id: 5
       Equivalent ioctl: VHOST_SET_MEM_TABLE
       Master payload: memory regions description
+      Slave payload: u64 (0:success >0:failed)
 
       Sets the memory map regions on the slave so it can translate the vring
       addresses. In the ancillary data there is an array of file descriptors
-- 
1.7.12.4

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

* [Qemu-devel] [PATCH 2/2] vhost-user: add reply for set_mem_table
  2015-02-10  3:24 [Qemu-devel] [PATCH 1/2] vhost-user: support SET_MEM_TABLE waite the result of mmap linhaifeng
@ 2015-02-10  3:24 ` linhaifeng
  2015-02-10  3:57   ` Gonglei
  0 siblings, 1 reply; 4+ messages in thread
From: linhaifeng @ 2015-02-10  3:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: Linhaifeng, mst

From: Linhaifeng <haifeng.lin@huawei.com>

If u64 is not 0 we should return -1 to tell qemu not going on.

Signed-off-by: Linhaifeng <haifeng.lin@huawei.com>
---
 hw/virtio/vhost-user.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index aefe0bb..a68ce36 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -243,7 +243,7 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned long int request,
         msg.size = sizeof(m.memory.nregions);
         msg.size += sizeof(m.memory.padding);
         msg.size += fd_num * sizeof(VhostUserMemoryRegion);
-
+        need_reply = 1;
         break;
 
     case VHOST_SET_LOG_FD:
@@ -315,6 +315,17 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned long int request,
             }
             memcpy(arg, &msg.state, sizeof(struct vhost_vring_state));
             break;
+        case VHOST_SET_MEM_TABLE:
+            if (msg.size != sizeof(m.u64)) {
+                error_report("Received bad msg size.\n");
+                return -1;
+            } else {
+                if (m.u64) {
+                    error_report("Failed to set memory table.\n");
+                    return -1;
+                }
+            }
+            break;
         default:
             error_report("Received unexpected msg type.\n");
             return -1;
-- 
1.7.12.4

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

* Re: [Qemu-devel] [PATCH 2/2] vhost-user: add reply for set_mem_table
  2015-02-10  3:24 ` [Qemu-devel] [PATCH 2/2] vhost-user: add reply for set_mem_table linhaifeng
@ 2015-02-10  3:57   ` Gonglei
  2015-02-10  5:33     ` Linhaifeng
  0 siblings, 1 reply; 4+ messages in thread
From: Gonglei @ 2015-02-10  3:57 UTC (permalink / raw)
  To: linhaifeng, qemu-devel; +Cc: mst

On 2015/2/10 11:24, linhaifeng wrote:
> From: Linhaifeng <haifeng.lin@huawei.com>
> 
> If u64 is not 0 we should return -1 to tell qemu not going on.
> 
> Signed-off-by: Linhaifeng <haifeng.lin@huawei.com>
> ---
>  hw/virtio/vhost-user.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
> index aefe0bb..a68ce36 100644
> --- a/hw/virtio/vhost-user.c
> +++ b/hw/virtio/vhost-user.c
> @@ -243,7 +243,7 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned long int request,
>          msg.size = sizeof(m.memory.nregions);
>          msg.size += sizeof(m.memory.padding);
>          msg.size += fd_num * sizeof(VhostUserMemoryRegion);
> -
> +        need_reply = 1;
>          break;
>  
>      case VHOST_SET_LOG_FD:
> @@ -315,6 +315,17 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned long int request,
>              }
>              memcpy(arg, &msg.state, sizeof(struct vhost_vring_state));
>              break;
> +        case VHOST_SET_MEM_TABLE:
> +            if (msg.size != sizeof(m.u64)) {
> +                error_report("Received bad msg size.\n");
A superfluous "\n" character.
> +                return -1;
> +            } else {
> +                if (m.u64) {
> +                    error_report("Failed to set memory table.\n");
A superfluous "\n" character.

Regards,
-Gonglei
> +                    return -1;
> +                }
> +            }
> +            break;
>          default:
>              error_report("Received unexpected msg type.\n");
>              return -1;
> 

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

* Re: [Qemu-devel] [PATCH 2/2] vhost-user: add reply for set_mem_table
  2015-02-10  3:57   ` Gonglei
@ 2015-02-10  5:33     ` Linhaifeng
  0 siblings, 0 replies; 4+ messages in thread
From: Linhaifeng @ 2015-02-10  5:33 UTC (permalink / raw)
  To: Gonglei, qemu-devel; +Cc: mst



On 2015/2/10 11:57, Gonglei wrote:
> On 2015/2/10 11:24, linhaifeng wrote:
>> From: Linhaifeng <haifeng.lin@huawei.com>
>>
>> If u64 is not 0 we should return -1 to tell qemu not going on.
>>
>> Signed-off-by: Linhaifeng <haifeng.lin@huawei.com>
>> ---
>>  hw/virtio/vhost-user.c | 13 ++++++++++++-
>>  1 file changed, 12 insertions(+), 1 deletion(-)
>>
>> diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
>> index aefe0bb..a68ce36 100644
>> --- a/hw/virtio/vhost-user.c
>> +++ b/hw/virtio/vhost-user.c
>> @@ -243,7 +243,7 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned long int request,
>>          msg.size = sizeof(m.memory.nregions);
>>          msg.size += sizeof(m.memory.padding);
>>          msg.size += fd_num * sizeof(VhostUserMemoryRegion);
>> -
>> +        need_reply = 1;
>>          break;
>>  
>>      case VHOST_SET_LOG_FD:
>> @@ -315,6 +315,17 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned long int request,
>>              }
>>              memcpy(arg, &msg.state, sizeof(struct vhost_vring_state));
>>              break;
>> +        case VHOST_SET_MEM_TABLE:
>> +            if (msg.size != sizeof(m.u64)) {
>> +                error_report("Received bad msg size.\n");
> A superfluous "\n" character.

Hi Gonglei

Thank you for your review.

Yes, error_report has printed '\n'.
I will remove it.

>> +                return -1;
>> +            } else {
>> +                if (m.u64) {
>> +                    error_report("Failed to set memory table.\n");
> A superfluous "\n" character.
> 
> Regards,
> -Gonglei
>> +                    return -1;
>> +                }
>> +            }
>> +            break;
>>          default:
>>              error_report("Received unexpected msg type.\n");
>>              return -1;
>>
> 
> 
> 
> .
> 

-- 
Regards,
Haifeng

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

end of thread, other threads:[~2015-02-10  5:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-10  3:24 [Qemu-devel] [PATCH 1/2] vhost-user: support SET_MEM_TABLE waite the result of mmap linhaifeng
2015-02-10  3:24 ` [Qemu-devel] [PATCH 2/2] vhost-user: add reply for set_mem_table linhaifeng
2015-02-10  3:57   ` Gonglei
2015-02-10  5:33     ` Linhaifeng

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.