From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50662) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZJgnC-00017n-OA for qemu-devel@nongnu.org; Mon, 27 Jul 2015 07:42:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZJgn7-0002Ks-TM for qemu-devel@nongnu.org; Mon, 27 Jul 2015 07:42:02 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:38457) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZJgn7-0002KL-A1 for qemu-devel@nongnu.org; Mon, 27 Jul 2015 07:41:57 -0400 Message-ID: <55B618EC.1020502@huawei.com> Date: Mon, 27 Jul 2015 19:41:32 +0800 From: Gonglei MIME-Version: 1.0 References: <1437978359-17960-1-git-send-email-arei.gonglei@huawei.com> <55B605EE.5050502@redhat.com> <55B611FA.4000203@huawei.com> <55B6179D.8030108@redhat.com> In-Reply-To: <55B6179D.8030108@redhat.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] vhost-scsi: Fix mask index err in vhost_scsi_start List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , qemu-devel@nongnu.org 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