From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49685) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZJghQ-000705-Ho for qemu-devel@nongnu.org; Mon, 27 Jul 2015 07:36:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZJghL-0008RB-FC for qemu-devel@nongnu.org; Mon, 27 Jul 2015 07:36:04 -0400 Received: from mail-wi0-x232.google.com ([2a00:1450:400c:c05::232]:36235) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZJghL-0008Qe-7n for qemu-devel@nongnu.org; Mon, 27 Jul 2015 07:35:59 -0400 Received: by wicgb10 with SMTP id gb10so107942380wic.1 for ; Mon, 27 Jul 2015 04:35:58 -0700 (PDT) Sender: Paolo Bonzini References: <1437978359-17960-1-git-send-email-arei.gonglei@huawei.com> <55B605EE.5050502@redhat.com> <55B611FA.4000203@huawei.com> From: Paolo Bonzini Message-ID: <55B6179D.8030108@redhat.com> Date: Mon, 27 Jul 2015 13:35:57 +0200 MIME-Version: 1.0 In-Reply-To: <55B611FA.4000203@huawei.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: Gonglei , qemu-devel@nongnu.org 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