Re: [Qemu-devel] [PATCH] vhost-scsi: Fix mask index err in vhost_scsi_start

2015-07-27 Thread Paolo Bonzini


On 27/07/2015 08:25, arei.gong...@huawei.com wrote:
> +++ b/hw/scsi/vhost-scsi.c
> @@ -117,7 +117,7 @@ static int vhost_scsi_start(VHostSCSI *s)
>   * enabling/disabling irqfd.
>   */
>  for (i = 0; i < s->dev.nvqs; i++) {
> -vhost_virtqueue_mask(&s->dev, vdev, i, false);
> +vhost_virtqueue_mask(&s->dev, vdev, s->dev.vq_index + i, false);
>  }
>  
>  return ret;

Is this fixing an actual bug, or just using the API correctly?
s->dev.vq_index is always 0, right?

Paolo



Re: [Qemu-devel] [PATCH] vhost-scsi: Fix mask index err in vhost_scsi_start

2015-07-27 Thread Gonglei
On 2015/7/27 18:20, Paolo Bonzini wrote:
> 
> 
> On 27/07/2015 08:25, arei.gong...@huawei.com wrote:
>> +++ b/hw/scsi/vhost-scsi.c
>> @@ -117,7 +117,7 @@ static int vhost_scsi_start(VHostSCSI *s)
>>   * enabling/disabling irqfd.
>>   */
>>  for (i = 0; i < s->dev.nvqs; i++) {
>> -vhost_virtqueue_mask(&s->dev, vdev, i, false);
>> +vhost_virtqueue_mask(&s->dev, vdev, s->dev.vq_index + i, false);
>>  }
>>  
>>  return ret;
> 
> Is this fixing an actual bug, or just using the API correctly?
> s->dev.vq_index is always 0, right?
> 
Yes.  At present, we found that s->dev.vq_index is always 0.

Regards,
-Gonglei




Re: [Qemu-devel] [PATCH] vhost-scsi: Fix mask index err in vhost_scsi_start

2015-07-27 Thread Paolo Bonzini


On 27/07/2015 13:11, Gonglei wrote:
> On 2015/7/27 18:20, Paolo Bonzini wrote:
>>
>>
>> On 27/07/2015 08:25, arei.gong...@huawei.com wrote:
>>> +++ b/hw/scsi/vhost-scsi.c
>>> @@ -117,7 +117,7 @@ static int vhost_scsi_start(VHostSCSI *s)
>>>   * enabling/disabling irqfd.
>>>   */
>>>  for (i = 0; i < s->dev.nvqs; i++) {
>>> -vhost_virtqueue_mask(&s->dev, vdev, i, false);
>>> +vhost_virtqueue_mask(&s->dev, vdev, s->dev.vq_index + i, false);
>>>  }
>>>  
>>>  return ret;
>>
>> Is this fixing an actual bug, or just using the API correctly?
>> s->dev.vq_index is always 0, right?
>>
> Yes.  At present, we found that s->dev.vq_index is always 0.

Ok, then I've applied the patch with this commit message:

vhost_virtqueue_mask takes an "absolute" virtqueue index, while the
code looks like it's passing an index that is relative to
s->dev.vq_index.  In reality, s->dev.vq_index is always zero, so
this patch does not make any difference, but the code is clearer.

Paolo



Re: [Qemu-devel] [PATCH] vhost-scsi: Fix mask index err in vhost_scsi_start

2015-07-27 Thread Gonglei
On 2015/7/27 19:35, Paolo Bonzini wrote:
> 
> 
> On 27/07/2015 13:11, Gonglei wrote:
>> On 2015/7/27 18:20, Paolo Bonzini wrote:
>>>
>>>
>>> On 27/07/2015 08:25, arei.gong...@huawei.com wrote:
 +++ b/hw/scsi/vhost-scsi.c
 @@ -117,7 +117,7 @@ static int vhost_scsi_start(VHostSCSI *s)
   * enabling/disabling irqfd.
   */
  for (i = 0; i < s->dev.nvqs; i++) {
 -vhost_virtqueue_mask(&s->dev, vdev, i, false);
 +vhost_virtqueue_mask(&s->dev, vdev, s->dev.vq_index + i, false);
  }
  
  return ret;
>>>
>>> Is this fixing an actual bug, or just using the API correctly?
>>> s->dev.vq_index is always 0, right?
>>>
>> Yes.  At present, we found that s->dev.vq_index is always 0.
> 
> Ok, then I've applied the patch with this commit message:
> 
> vhost_virtqueue_mask takes an "absolute" virtqueue index, while the
> code looks like it's passing an index that is relative to
> s->dev.vq_index.  In reality, s->dev.vq_index is always zero, so
> this patch does not make any difference, but the code is clearer.
> 
It's better, thanks.

Regards,
-Gonglei