From patchwork Thu Feb 9 05:39:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fam Zheng X-Patchwork-Id: 725964 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vJn3D38jGz9s6n for ; Thu, 9 Feb 2017 16:40:08 +1100 (AEDT) Received: from localhost ([::1]:35744 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cbhSg-0007Z7-1S for incoming@patchwork.ozlabs.org; Thu, 09 Feb 2017 00:40:06 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46556) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cbhS2-0007De-CA for qemu-devel@nongnu.org; Thu, 09 Feb 2017 00:39:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cbhRx-0006GP-G0 for qemu-devel@nongnu.org; Thu, 09 Feb 2017 00:39:26 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57982) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cbhRx-0006GI-Aq for qemu-devel@nongnu.org; Thu, 09 Feb 2017 00:39:21 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 428FD88E60; Thu, 9 Feb 2017 05:39:21 +0000 (UTC) Received: from localhost (ovpn-8-16.pek2.redhat.com [10.72.8.16]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v195dJQn018053; Thu, 9 Feb 2017 00:39:20 -0500 Date: Thu, 9 Feb 2017 13:39:17 +0800 From: Fam Zheng To: Ed Swierk Message-ID: <20170209053917.GH22807@lemon.lan> References: <20170209014728.GF22807@lemon.lan> <20170209025212.GG22807@lemon.lan> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.1 (2016-10-04) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 09 Feb 2017 05:39:21 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: Re: [Qemu-devel] virtio-scsi-pci iothread spins at 100% X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, stefanha@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" On Wed, 02/08 19:44, Ed Swierk wrote: > On Wed, Feb 8, 2017 at 6:52 PM, Fam Zheng wrote: > > This means virtio-scsi event vq handler is returning true but actually no > > progress is made. Can you try the following patch to see if it's because a > > stalled cache of VQ index? > > > > diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c > > index 6365706..7f7ab57 100644 > > --- a/hw/virtio/virtio.c > > +++ b/hw/virtio/virtio.c > > @@ -2126,7 +2126,7 @@ static bool virtio_queue_host_notifier_aio_poll(void *opaque) > > EventNotifier *n = opaque; > > VirtQueue *vq = container_of(n, VirtQueue, host_notifier); > > > > - if (virtio_queue_empty(vq)) { > > + if (vring_avail_idx(vq) == vq->last_avail_idx) { > > return false; > > } > > I tried this change but the behavior is the same, unfortunately. Hmm, maybe I'm missing something. How about this: diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c index ce19eff..8b23e80 100644 --- a/hw/scsi/virtio-scsi.c +++ b/hw/scsi/virtio-scsi.c @@ -754,9 +754,7 @@ out: void virtio_scsi_handle_event_vq(VirtIOSCSI *s, VirtQueue *vq) { - if (s->events_dropped) { - virtio_scsi_push_event(s, NULL, VIRTIO_SCSI_T_NO_EVENT, 0); - } + virtio_scsi_push_event(s, NULL, VIRTIO_SCSI_T_NO_EVENT, 0); } static void virtio_scsi_handle_event(VirtIODevice *vdev, VirtQueue *vq)