* [Qemu-devel] [PATCH] vhost-scsi: Fix mask index err in vhost_scsi_start
@ 2015-07-27 6:25 arei.gonglei
2015-07-27 10:20 ` Paolo Bonzini
0 siblings, 1 reply; 5+ messages in thread
From: arei.gonglei @ 2015-07-27 6:25 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, Gonglei, Lu Lina
From: Lu Lina <lina.lulina@huawei.com>
Signed-off-by: Lu Lina <lina.lulina@huawei.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
---
hw/scsi/vhost-scsi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c
index 1941aa1..174b4d2 100644
--- a/hw/scsi/vhost-scsi.c
+++ 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;
--
1.8.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] vhost-scsi: Fix mask index err in vhost_scsi_start
2015-07-27 6:25 [Qemu-devel] [PATCH] vhost-scsi: Fix mask index err in vhost_scsi_start arei.gonglei
@ 2015-07-27 10:20 ` Paolo Bonzini
2015-07-27 11:11 ` Gonglei
0 siblings, 1 reply; 5+ messages in thread
From: Paolo Bonzini @ 2015-07-27 10:20 UTC (permalink / raw)
To: arei.gonglei, qemu-devel; +Cc: Lu Lina
On 27/07/2015 08:25, arei.gonglei@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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] vhost-scsi: Fix mask index err in vhost_scsi_start
2015-07-27 10:20 ` Paolo Bonzini
@ 2015-07-27 11:11 ` Gonglei
2015-07-27 11:35 ` Paolo Bonzini
0 siblings, 1 reply; 5+ messages in thread
From: Gonglei @ 2015-07-27 11:11 UTC (permalink / raw)
To: Paolo Bonzini, qemu-devel; +Cc: Lu Lina
On 2015/7/27 18:20, Paolo Bonzini wrote:
>
>
> On 27/07/2015 08:25, arei.gonglei@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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] vhost-scsi: Fix mask index err in vhost_scsi_start
2015-07-27 11:11 ` Gonglei
@ 2015-07-27 11:35 ` Paolo Bonzini
2015-07-27 11:41 ` Gonglei
0 siblings, 1 reply; 5+ messages in thread
From: Paolo Bonzini @ 2015-07-27 11:35 UTC (permalink / raw)
To: Gonglei, qemu-devel; +Cc: Lu Lina
On 27/07/2015 13:11, Gonglei wrote:
> On 2015/7/27 18:20, Paolo Bonzini wrote:
>>
>>
>> On 27/07/2015 08:25, arei.gonglei@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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] vhost-scsi: Fix mask index err in vhost_scsi_start
2015-07-27 11:35 ` Paolo Bonzini
@ 2015-07-27 11:41 ` Gonglei
0 siblings, 0 replies; 5+ messages in thread
From: Gonglei @ 2015-07-27 11:41 UTC (permalink / raw)
To: Paolo Bonzini, qemu-devel; +Cc: Lu Lina
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.gonglei@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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-07-27 11:42 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-27 6:25 [Qemu-devel] [PATCH] vhost-scsi: Fix mask index err in vhost_scsi_start arei.gonglei
2015-07-27 10:20 ` Paolo Bonzini
2015-07-27 11:11 ` Gonglei
2015-07-27 11:35 ` Paolo Bonzini
2015-07-27 11:41 ` Gonglei
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).