From nobody Mon Apr 29 15:30:14 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1498823319711724.6920830638757; Fri, 30 Jun 2017 04:48:39 -0700 (PDT) Received: from localhost ([::1]:43881 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQuPb-0000pN-W2 for importer@patchew.org; Fri, 30 Jun 2017 07:48:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48128) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQuNp-0008Af-Oj for qemu-devel@nongnu.org; Fri, 30 Jun 2017 07:46:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dQuNo-0004q9-NN for qemu-devel@nongnu.org; Fri, 30 Jun 2017 07:46:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40532) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dQuNo-0004pQ-FH for qemu-devel@nongnu.org; Fri, 30 Jun 2017 07:46:44 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7963F7AEBE; Fri, 30 Jun 2017 11:46:43 +0000 (UTC) Received: from localhost (ovpn-116-222.ams2.redhat.com [10.36.116.222]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4961082297; Fri, 30 Jun 2017 11:46:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7963F7AEBE Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=stefanha@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 7963F7AEBE From: Stefan Hajnoczi To: Date: Fri, 30 Jun 2017 12:46:29 +0100 Message-Id: <20170630114635.9286-2-stefanha@redhat.com> In-Reply-To: <20170630114635.9286-1-stefanha@redhat.com> References: <20170630114635.9286-1-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 30 Jun 2017 11:46:43 +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: [Qemu-devel] [PULL 1/7] virtio-blk: trace vdev so devices can be distinguished 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: Peter Maydell , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" It is hard to analyze trace logs with multiple virtio-blk devices because none of the trace events include the VirtIODevice *vdev. This patch adds vdev so it's clear which device a request is associated with. I considered using VirtIOBlock *s instead but VirtIODevice *vdev is more general and may be correlated with generic virtio trace events like virtio_set_status. Signed-off-by: Stefan Hajnoczi Reviewed-by: Fam Zheng Message-id: 20170614092930.11234-1-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi --- hw/block/virtio-blk.c | 12 +++++++----- hw/block/trace-events | 10 +++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 604d37d..c0bd247 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -50,7 +50,7 @@ static void virtio_blk_req_complete(VirtIOBlockReq *req, = unsigned char status) VirtIOBlock *s =3D req->dev; VirtIODevice *vdev =3D VIRTIO_DEVICE(s); =20 - trace_virtio_blk_req_complete(req, status); + trace_virtio_blk_req_complete(vdev, req, status); =20 stb_p(&req->in->status, status); virtqueue_push(req->vq, &req->elem, req->in_len); @@ -88,12 +88,13 @@ static void virtio_blk_rw_complete(void *opaque, int re= t) { VirtIOBlockReq *next =3D opaque; VirtIOBlock *s =3D next->dev; + VirtIODevice *vdev =3D VIRTIO_DEVICE(s); =20 aio_context_acquire(blk_get_aio_context(s->conf.conf.blk)); while (next) { VirtIOBlockReq *req =3D next; next =3D req->mr_next; - trace_virtio_blk_rw_complete(req, ret); + trace_virtio_blk_rw_complete(vdev, req, ret); =20 if (req->qiov.nalloc !=3D -1) { /* If nalloc is !=3D 1 req->qiov is a local copy of the origin= al @@ -355,7 +356,8 @@ static inline void submit_requests(BlockBackend *blk, M= ultiReqBuffer *mrb, mrb->reqs[i - 1]->mr_next =3D mrb->reqs[i]; } =20 - trace_virtio_blk_submit_multireq(mrb, start, num_reqs, + trace_virtio_blk_submit_multireq(VIRTIO_DEVICE(mrb->reqs[start]->d= ev), + mrb, start, num_reqs, sector_num << BDRV_SECTOR_BITS, qiov->size, is_write); block_acct_merge_done(blk_get_stats(blk), @@ -526,11 +528,11 @@ static int virtio_blk_handle_request(VirtIOBlockReq *= req, MultiReqBuffer *mrb) =20 if (is_write) { qemu_iovec_init_external(&req->qiov, iov, out_num); - trace_virtio_blk_handle_write(req, req->sector_num, + trace_virtio_blk_handle_write(vdev, req, req->sector_num, req->qiov.size / BDRV_SECTOR_SIZ= E); } else { qemu_iovec_init_external(&req->qiov, in_iov, in_num); - trace_virtio_blk_handle_read(req, req->sector_num, + trace_virtio_blk_handle_read(vdev, req, req->sector_num, req->qiov.size / BDRV_SECTOR_SIZE= ); } =20 diff --git a/hw/block/trace-events b/hw/block/trace-events index 65e83dc..c332c01 100644 --- a/hw/block/trace-events +++ b/hw/block/trace-events @@ -1,11 +1,11 @@ # See docs/tracing.txt for syntax documentation. =20 # hw/block/virtio-blk.c -virtio_blk_req_complete(void *req, int status) "req %p status %d" -virtio_blk_rw_complete(void *req, int ret) "req %p ret %d" -virtio_blk_handle_write(void *req, uint64_t sector, size_t nsectors) "req = %p sector %"PRIu64" nsectors %zu" -virtio_blk_handle_read(void *req, uint64_t sector, size_t nsectors) "req %= p sector %"PRIu64" nsectors %zu" -virtio_blk_submit_multireq(void *mrb, int start, int num_reqs, uint64_t of= fset, size_t size, bool is_write) "mrb %p start %d num_reqs %d offset %"PRI= u64" size %zu is_write %d" +virtio_blk_req_complete(void *vdev, void *req, int status) "vdev %p req %p= status %d" +virtio_blk_rw_complete(void *vdev, void *req, int ret) "vdev %p req %p ret= %d" +virtio_blk_handle_write(void *vdev, void *req, uint64_t sector, size_t nse= ctors) "vdev %p req %p sector %"PRIu64" nsectors %zu" +virtio_blk_handle_read(void *vdev, void *req, uint64_t sector, size_t nsec= tors) "vdev %p req %p sector %"PRIu64" nsectors %zu" +virtio_blk_submit_multireq(void *vdev, void *mrb, int start, int num_reqs,= uint64_t offset, size_t size, bool is_write) "vdev %p mrb %p start %d num_= reqs %d offset %"PRIu64" size %zu is_write %d" =20 # hw/block/hd-geometry.c hd_geometry_lchs_guess(void *blk, int cyls, int heads, int secs) "blk %p L= CHS %d %d %d" --=20 2.9.4 From nobody Mon Apr 29 15:30:14 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1498823322382465.8799915529586; Fri, 30 Jun 2017 04:48:42 -0700 (PDT) Received: from localhost ([::1]:43882 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQuPh-0000sS-2c for importer@patchew.org; Fri, 30 Jun 2017 07:48:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48139) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQuNs-0008BZ-8C for qemu-devel@nongnu.org; Fri, 30 Jun 2017 07:46:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dQuNr-0004sG-G2 for qemu-devel@nongnu.org; Fri, 30 Jun 2017 07:46:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33818) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dQuNr-0004ry-AR for qemu-devel@nongnu.org; Fri, 30 Jun 2017 07:46:47 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3F75420A9A; Fri, 30 Jun 2017 11:46:46 +0000 (UTC) Received: from localhost (ovpn-116-222.ams2.redhat.com [10.36.116.222]) by smtp.corp.redhat.com (Postfix) with ESMTP id B4E3317261; Fri, 30 Jun 2017 11:46:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3F75420A9A Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=stefanha@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 3F75420A9A From: Stefan Hajnoczi To: Date: Fri, 30 Jun 2017 12:46:30 +0100 Message-Id: <20170630114635.9286-3-stefanha@redhat.com> In-Reply-To: <20170630114635.9286-1-stefanha@redhat.com> References: <20170630114635.9286-1-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Fri, 30 Jun 2017 11:46:46 +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: [Qemu-devel] [PULL 2/7] libqos: fix typo in virtio.h QVirtQueue->used comment 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: Peter Maydell , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Stefan Hajnoczi Reviewed-by: Michael S. Tsirkin Reviewed-by: Fam Zheng Tested-by: Eric Blake Tested-by: Kevin Wolf Message-id: 20170628184724.21378-2-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi --- tests/libqos/virtio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/libqos/virtio.h b/tests/libqos/virtio.h index 3397a08..829de5e 100644 --- a/tests/libqos/virtio.h +++ b/tests/libqos/virtio.h @@ -26,7 +26,7 @@ typedef struct QVirtioDevice { typedef struct QVirtQueue { uint64_t desc; /* This points to an array of struct vring_desc */ uint64_t avail; /* This points to a struct vring_avail */ - uint64_t used; /* This points to a struct vring_desc */ + uint64_t used; /* This points to a struct vring_used */ uint16_t index; uint32_t size; uint32_t free_head; --=20 2.9.4 From nobody Mon Apr 29 15:30:14 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 149882332848525.72997791932653; Fri, 30 Jun 2017 04:48:48 -0700 (PDT) Received: from localhost ([::1]:43883 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQuPn-0000ww-52 for importer@patchew.org; Fri, 30 Jun 2017 07:48:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48152) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQuNu-0008DR-DN for qemu-devel@nongnu.org; Fri, 30 Jun 2017 07:46:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dQuNt-0004so-9D for qemu-devel@nongnu.org; Fri, 30 Jun 2017 07:46:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52892) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dQuNt-0004sZ-1d for qemu-devel@nongnu.org; Fri, 30 Jun 2017 07:46:49 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1C32A80463; Fri, 30 Jun 2017 11:46:48 +0000 (UTC) Received: from localhost (ovpn-116-222.ams2.redhat.com [10.36.116.222]) by smtp.corp.redhat.com (Postfix) with ESMTP id A197960A98; Fri, 30 Jun 2017 11:46:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 1C32A80463 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=stefanha@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 1C32A80463 From: Stefan Hajnoczi To: Date: Fri, 30 Jun 2017 12:46:31 +0100 Message-Id: <20170630114635.9286-4-stefanha@redhat.com> In-Reply-To: <20170630114635.9286-1-stefanha@redhat.com> References: <20170630114635.9286-1-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 30 Jun 2017 11:46:48 +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: [Qemu-devel] [PULL 3/7] libqos: add virtio used ring support 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: Peter Maydell , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Existing tests do not touch the virtqueue used ring. Instead they poll the virtqueue ISR register and peek into their request's device-specific status field. It turns out that the virtqueue ISR register can be set to 1 more than once for a single notification (see commit 83d768b5640946b7da55ce8335509df297e2c7cd "virtio: set ISR on dataplane notifications"). This causes problems for tests that assume a 1:1 correspondence between the ISR being 1 and request completion. Peeking at device-specific status fields is also problematic if the device has no field that can be abused for EINPROGRESS polling semantics. This is the case if all the field's values may be set by the device; there's no magic constant left for polling. It's time to process the used ring for completed requests, just like a real virtio guest driver. This patch adds the necessary APIs. Signed-off-by: Stefan Hajnoczi Reviewed-by: Michael S. Tsirkin Reviewed-by: Fam Zheng Tested-by: Eric Blake Tested-by: Kevin Wolf Message-id: 20170628184724.21378-3-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi --- tests/libqos/virtio.h | 6 ++++++ tests/libqos/virtio.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++= ++++ 2 files changed, 66 insertions(+) diff --git a/tests/libqos/virtio.h b/tests/libqos/virtio.h index 829de5e..8fbcd18 100644 --- a/tests/libqos/virtio.h +++ b/tests/libqos/virtio.h @@ -32,6 +32,7 @@ typedef struct QVirtQueue { uint32_t free_head; uint32_t num_free; uint32_t align; + uint16_t last_used_idx; bool indirect; bool event; } QVirtQueue; @@ -120,6 +121,10 @@ uint8_t qvirtio_wait_status_byte_no_isr(QVirtioDevice = *d, QVirtQueue *vq, uint64_t addr, gint64 timeout_us); +void qvirtio_wait_used_elem(QVirtioDevice *d, + QVirtQueue *vq, + uint32_t desc_idx, + gint64 timeout_us); void qvirtio_wait_config_isr(QVirtioDevice *d, gint64 timeout_us); QVirtQueue *qvirtqueue_setup(QVirtioDevice *d, QGuestAllocator *alloc, uint16_t index); @@ -135,6 +140,7 @@ uint32_t qvirtqueue_add(QVirtQueue *vq, uint64_t data, = uint32_t len, bool write, bool n= ext); uint32_t qvirtqueue_add_indirect(QVirtQueue *vq, QVRingIndirectDesc *indir= ect); void qvirtqueue_kick(QVirtioDevice *d, QVirtQueue *vq, uint32_t free_head); +bool qvirtqueue_get_buf(QVirtQueue *vq, uint32_t *desc_idx); =20 void qvirtqueue_set_used_event(QVirtQueue *vq, uint16_t idx); #endif diff --git a/tests/libqos/virtio.c b/tests/libqos/virtio.c index ec30cb9..9880a69 100644 --- a/tests/libqos/virtio.c +++ b/tests/libqos/virtio.c @@ -116,6 +116,35 @@ uint8_t qvirtio_wait_status_byte_no_isr(QVirtioDevice = *d, return val; } =20 +/* + * qvirtio_wait_used_elem: + * @desc_idx: The next expected vq->desc[] index in the used ring + * @timeout_us: How many microseconds to wait before failing + * + * This function waits for the next completed request on the used ring. + */ +void qvirtio_wait_used_elem(QVirtioDevice *d, + QVirtQueue *vq, + uint32_t desc_idx, + gint64 timeout_us) +{ + gint64 start_time =3D g_get_monotonic_time(); + + for (;;) { + uint32_t got_desc_idx; + + clock_step(100); + + if (d->bus->get_queue_isr_status(d, vq) && + qvirtqueue_get_buf(vq, &got_desc_idx)) { + g_assert_cmpint(got_desc_idx, =3D=3D, desc_idx); + return; + } + + g_assert(g_get_monotonic_time() - start_time <=3D timeout_us); + } +} + void qvirtio_wait_config_isr(QVirtioDevice *d, gint64 timeout_us) { gint64 start_time =3D g_get_monotonic_time(); @@ -272,6 +301,37 @@ void qvirtqueue_kick(QVirtioDevice *d, QVirtQueue *vq,= uint32_t free_head) } } =20 +/* + * qvirtqueue_get_buf: + * @desc_idx: A pointer that is filled with the vq->desc[] index, may be N= ULL + * + * This function gets the next used element if there is one ready. + * + * Returns: true if an element was ready, false otherwise + */ +bool qvirtqueue_get_buf(QVirtQueue *vq, uint32_t *desc_idx) +{ + uint16_t idx; + + idx =3D readw(vq->used + offsetof(struct vring_used, idx)); + if (idx =3D=3D vq->last_used_idx) { + return false; + } + + if (desc_idx) { + uint64_t elem_addr; + + elem_addr =3D vq->used + + offsetof(struct vring_used, ring) + + (vq->last_used_idx % vq->size) * + sizeof(struct vring_used_elem); + *desc_idx =3D readl(elem_addr + offsetof(struct vring_used_elem, i= d)); + } + + vq->last_used_idx++; + return true; +} + void qvirtqueue_set_used_event(QVirtQueue *vq, uint16_t idx) { g_assert(vq->event); --=20 2.9.4 From nobody Mon Apr 29 15:30:14 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1498823459913811.8321415715424; Fri, 30 Jun 2017 04:50:59 -0700 (PDT) Received: from localhost ([::1]:43894 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQuRu-0003RW-Mg for importer@patchew.org; Fri, 30 Jun 2017 07:50:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48177) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQuNy-0008HJ-GM for qemu-devel@nongnu.org; Fri, 30 Jun 2017 07:46:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dQuNx-0004vy-JW for qemu-devel@nongnu.org; Fri, 30 Jun 2017 07:46:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55068) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dQuNx-0004vn-Dm for qemu-devel@nongnu.org; Fri, 30 Jun 2017 07:46:53 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 61C4465984; Fri, 30 Jun 2017 11:46:52 +0000 (UTC) Received: from localhost (ovpn-116-222.ams2.redhat.com [10.36.116.222]) by smtp.corp.redhat.com (Postfix) with ESMTP id 79F20179FF; Fri, 30 Jun 2017 11:46:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 61C4465984 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=stefanha@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 61C4465984 From: Stefan Hajnoczi To: Date: Fri, 30 Jun 2017 12:46:32 +0100 Message-Id: <20170630114635.9286-5-stefanha@redhat.com> In-Reply-To: <20170630114635.9286-1-stefanha@redhat.com> References: <20170630114635.9286-1-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 30 Jun 2017 11:46:52 +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: [Qemu-devel] [PULL 4/7] tests: fix virtio-scsi-test ISR dependence 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: Peter Maydell , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Use the new used ring APIs instead of assuming ISR being set means the request has completed. Signed-off-by: Stefan Hajnoczi Reviewed-by: Michael S. Tsirkin Reviewed-by: Fam Zheng Tested-by: Eric Blake Tested-by: Kevin Wolf Message-id: 20170628184724.21378-4-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi --- tests/virtio-scsi-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/virtio-scsi-test.c b/tests/virtio-scsi-test.c index eff71df..87a3b6e 100644 --- a/tests/virtio-scsi-test.c +++ b/tests/virtio-scsi-test.c @@ -121,7 +121,7 @@ static uint8_t virtio_scsi_do_command(QVirtIOSCSI *vs, = const uint8_t *cdb, } =20 qvirtqueue_kick(vs->dev, vq, free_head); - qvirtio_wait_queue_isr(vs->dev, vq, QVIRTIO_SCSI_TIMEOUT_US); + qvirtio_wait_used_elem(vs->dev, vq, free_head, QVIRTIO_SCSI_TIMEOUT_US= ); =20 response =3D readb(resp_addr + offsetof(struct virtio_scsi_cmd_resp, response)); --=20 2.9.4 From nobody Mon Apr 29 15:30:14 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1498823453216859.9714134998782; Fri, 30 Jun 2017 04:50:53 -0700 (PDT) Received: from localhost ([::1]:43893 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQuRn-0003Kl-Jd for importer@patchew.org; Fri, 30 Jun 2017 07:50:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48194) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQuO2-0008KH-U5 for qemu-devel@nongnu.org; Fri, 30 Jun 2017 07:47:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dQuO1-0004xM-OC for qemu-devel@nongnu.org; Fri, 30 Jun 2017 07:46:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55154) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dQuO1-0004x9-Ft for qemu-devel@nongnu.org; Fri, 30 Jun 2017 07:46:57 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 811A0CD65D; Fri, 30 Jun 2017 11:46:56 +0000 (UTC) Received: from localhost (ovpn-116-222.ams2.redhat.com [10.36.116.222]) by smtp.corp.redhat.com (Postfix) with ESMTP id C3C8086C2F; Fri, 30 Jun 2017 11:46:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 811A0CD65D Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=stefanha@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 811A0CD65D From: Stefan Hajnoczi To: Date: Fri, 30 Jun 2017 12:46:33 +0100 Message-Id: <20170630114635.9286-6-stefanha@redhat.com> In-Reply-To: <20170630114635.9286-1-stefanha@redhat.com> References: <20170630114635.9286-1-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 30 Jun 2017 11:46:56 +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: [Qemu-devel] [PULL 5/7] tests: fix virtio-blk-test ISR dependence 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: Peter Maydell , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Use the new used ring APIs instead of assuming ISR being set means the request has completed. Signed-off-by: Stefan Hajnoczi Reviewed-by: Michael S. Tsirkin Reviewed-by: Fam Zheng Tested-by: Eric Blake Tested-by: Kevin Wolf Message-id: 20170628184724.21378-5-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi --- tests/virtio-blk-test.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/tests/virtio-blk-test.c b/tests/virtio-blk-test.c index fd2078c..0576cb1 100644 --- a/tests/virtio-blk-test.c +++ b/tests/virtio-blk-test.c @@ -196,7 +196,7 @@ static void test_basic(QVirtioDevice *dev, QGuestAlloca= tor *alloc, =20 qvirtqueue_kick(dev, vq, free_head); =20 - qvirtio_wait_queue_isr(dev, vq, QVIRTIO_BLK_TIMEOUT_US); + qvirtio_wait_used_elem(dev, vq, free_head, QVIRTIO_BLK_TIMEOUT_US); status =3D readb(req_addr + 528); g_assert_cmpint(status, =3D=3D, 0); =20 @@ -218,7 +218,7 @@ static void test_basic(QVirtioDevice *dev, QGuestAlloca= tor *alloc, =20 qvirtqueue_kick(dev, vq, free_head); =20 - qvirtio_wait_queue_isr(dev, vq, QVIRTIO_BLK_TIMEOUT_US); + qvirtio_wait_used_elem(dev, vq, free_head, QVIRTIO_BLK_TIMEOUT_US); status =3D readb(req_addr + 528); g_assert_cmpint(status, =3D=3D, 0); =20 @@ -246,7 +246,7 @@ static void test_basic(QVirtioDevice *dev, QGuestAlloca= tor *alloc, qvirtqueue_add(vq, req_addr + 528, 1, true, false); qvirtqueue_kick(dev, vq, free_head); =20 - qvirtio_wait_queue_isr(dev, vq, QVIRTIO_BLK_TIMEOUT_US); + qvirtio_wait_used_elem(dev, vq, free_head, QVIRTIO_BLK_TIMEOUT_US); status =3D readb(req_addr + 528); g_assert_cmpint(status, =3D=3D, 0); =20 @@ -267,7 +267,7 @@ static void test_basic(QVirtioDevice *dev, QGuestAlloca= tor *alloc, =20 qvirtqueue_kick(dev, vq, free_head); =20 - qvirtio_wait_queue_isr(dev, vq, QVIRTIO_BLK_TIMEOUT_US); + qvirtio_wait_used_elem(dev, vq, free_head, QVIRTIO_BLK_TIMEOUT_US); status =3D readb(req_addr + 528); g_assert_cmpint(status, =3D=3D, 0); =20 @@ -348,7 +348,7 @@ static void pci_indirect(void) free_head =3D qvirtqueue_add_indirect(&vqpci->vq, indirect); qvirtqueue_kick(&dev->vdev, &vqpci->vq, free_head); =20 - qvirtio_wait_queue_isr(&dev->vdev, &vqpci->vq, + qvirtio_wait_used_elem(&dev->vdev, &vqpci->vq, free_head, QVIRTIO_BLK_TIMEOUT_US); status =3D readb(req_addr + 528); g_assert_cmpint(status, =3D=3D, 0); @@ -373,7 +373,7 @@ static void pci_indirect(void) free_head =3D qvirtqueue_add_indirect(&vqpci->vq, indirect); qvirtqueue_kick(&dev->vdev, &vqpci->vq, free_head); =20 - qvirtio_wait_queue_isr(&dev->vdev, &vqpci->vq, + qvirtio_wait_used_elem(&dev->vdev, &vqpci->vq, free_head, QVIRTIO_BLK_TIMEOUT_US); status =3D readb(req_addr + 528); g_assert_cmpint(status, =3D=3D, 0); @@ -484,7 +484,7 @@ static void pci_msix(void) qvirtqueue_add(&vqpci->vq, req_addr + 528, 1, true, false); qvirtqueue_kick(&dev->vdev, &vqpci->vq, free_head); =20 - qvirtio_wait_queue_isr(&dev->vdev, &vqpci->vq, + qvirtio_wait_used_elem(&dev->vdev, &vqpci->vq, free_head, QVIRTIO_BLK_TIMEOUT_US); =20 status =3D readb(req_addr + 528); @@ -509,7 +509,7 @@ static void pci_msix(void) qvirtqueue_kick(&dev->vdev, &vqpci->vq, free_head); =20 =20 - qvirtio_wait_queue_isr(&dev->vdev, &vqpci->vq, + qvirtio_wait_used_elem(&dev->vdev, &vqpci->vq, free_head, QVIRTIO_BLK_TIMEOUT_US); =20 status =3D readb(req_addr + 528); @@ -540,6 +540,8 @@ static void pci_idx(void) uint64_t capacity; uint32_t features; uint32_t free_head; + uint32_t write_head; + uint32_t desc_idx; uint8_t status; char *data; =20 @@ -581,7 +583,8 @@ static void pci_idx(void) qvirtqueue_add(&vqpci->vq, req_addr + 528, 1, true, false); qvirtqueue_kick(&dev->vdev, &vqpci->vq, free_head); =20 - qvirtio_wait_queue_isr(&dev->vdev, &vqpci->vq, QVIRTIO_BLK_TIMEOUT_US); + qvirtio_wait_used_elem(&dev->vdev, &vqpci->vq, free_head, + QVIRTIO_BLK_TIMEOUT_US); =20 /* Write request */ req.type =3D VIRTIO_BLK_T_OUT; @@ -600,6 +603,7 @@ static void pci_idx(void) qvirtqueue_add(&vqpci->vq, req_addr + 16, 512, false, true); qvirtqueue_add(&vqpci->vq, req_addr + 528, 1, true, false); qvirtqueue_kick(&dev->vdev, &vqpci->vq, free_head); + write_head =3D free_head; =20 /* No notification expected */ status =3D qvirtio_wait_status_byte_no_isr(&dev->vdev, @@ -625,8 +629,11 @@ static void pci_idx(void) =20 qvirtqueue_kick(&dev->vdev, &vqpci->vq, free_head); =20 - qvirtio_wait_queue_isr(&dev->vdev, &vqpci->vq, + /* We get just one notification for both requests */ + qvirtio_wait_used_elem(&dev->vdev, &vqpci->vq, write_head, QVIRTIO_BLK_TIMEOUT_US); + g_assert(qvirtqueue_get_buf(&vqpci->vq, &desc_idx)); + g_assert_cmpint(desc_idx, =3D=3D, free_head); =20 status =3D readb(req_addr + 528); g_assert_cmpint(status, =3D=3D, 0); --=20 2.9.4 From nobody Mon Apr 29 15:30:14 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1498823538867473.82239039899537; Fri, 30 Jun 2017 04:52:18 -0700 (PDT) Received: from localhost ([::1]:43904 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQuTA-0004PD-MV for importer@patchew.org; Fri, 30 Jun 2017 07:52:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48208) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQuO6-0008Mf-Dt for qemu-devel@nongnu.org; Fri, 30 Jun 2017 07:47:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dQuO5-0004yp-HV for qemu-devel@nongnu.org; Fri, 30 Jun 2017 07:47:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52074) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dQuO5-0004yV-Bm for qemu-devel@nongnu.org; Fri, 30 Jun 2017 07:47:01 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6260083F44; Fri, 30 Jun 2017 11:47:00 +0000 (UTC) Received: from localhost (ovpn-116-222.ams2.redhat.com [10.36.116.222]) by smtp.corp.redhat.com (Postfix) with ESMTP id 490CD80702; Fri, 30 Jun 2017 11:46:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6260083F44 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=stefanha@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 6260083F44 From: Stefan Hajnoczi To: Date: Fri, 30 Jun 2017 12:46:34 +0100 Message-Id: <20170630114635.9286-7-stefanha@redhat.com> In-Reply-To: <20170630114635.9286-1-stefanha@redhat.com> References: <20170630114635.9286-1-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 30 Jun 2017 11:47:00 +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: [Qemu-devel] [PULL 6/7] tests: fix virtio-net-test ISR dependence 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: Peter Maydell , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Use the new used ring APIs instead of assuming ISR being set means the request has completed. Signed-off-by: Stefan Hajnoczi Reviewed-by: Michael S. Tsirkin Reviewed-by: Fam Zheng Tested-by: Eric Blake Tested-by: Kevin Wolf Message-id: 20170628184724.21378-6-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi --- tests/virtio-net-test.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/virtio-net-test.c b/tests/virtio-net-test.c index 8f94360..635b942 100644 --- a/tests/virtio-net-test.c +++ b/tests/virtio-net-test.c @@ -108,7 +108,7 @@ static void rx_test(QVirtioDevice *dev, ret =3D iov_send(socket, iov, 2, 0, sizeof(len) + sizeof(test)); g_assert_cmpint(ret, =3D=3D, sizeof(test) + sizeof(len)); =20 - qvirtio_wait_queue_isr(dev, vq, QVIRTIO_NET_TIMEOUT_US); + qvirtio_wait_used_elem(dev, vq, free_head, QVIRTIO_NET_TIMEOUT_US); memread(req_addr + VNET_HDR_SIZE, buffer, sizeof(test)); g_assert_cmpstr(buffer, =3D=3D, "TEST"); =20 @@ -131,7 +131,7 @@ static void tx_test(QVirtioDevice *dev, free_head =3D qvirtqueue_add(vq, req_addr, 64, false, false); qvirtqueue_kick(dev, vq, free_head); =20 - qvirtio_wait_queue_isr(dev, vq, QVIRTIO_NET_TIMEOUT_US); + qvirtio_wait_used_elem(dev, vq, free_head, QVIRTIO_NET_TIMEOUT_US); guest_free(alloc, req_addr); =20 ret =3D qemu_recv(socket, &len, sizeof(len), 0); @@ -182,7 +182,7 @@ static void rx_stop_cont_test(QVirtioDevice *dev, rsp =3D qmp("{ 'execute' : 'cont'}"); QDECREF(rsp); =20 - qvirtio_wait_queue_isr(dev, vq, QVIRTIO_NET_TIMEOUT_US); + qvirtio_wait_used_elem(dev, vq, free_head, QVIRTIO_NET_TIMEOUT_US); memread(req_addr + VNET_HDR_SIZE, buffer, sizeof(test)); g_assert_cmpstr(buffer, =3D=3D, "TEST"); =20 --=20 2.9.4 From nobody Mon Apr 29 15:30:14 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1498823448467203.3260204531249; Fri, 30 Jun 2017 04:50:48 -0700 (PDT) Received: from localhost ([::1]:43892 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQuRi-0003HV-SZ for importer@patchew.org; Fri, 30 Jun 2017 07:50:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48222) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQuOC-0008R4-8X for qemu-devel@nongnu.org; Fri, 30 Jun 2017 07:47:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dQuOB-00052J-Gy for qemu-devel@nongnu.org; Fri, 30 Jun 2017 07:47:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45448) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dQuOB-00051u-Aq for qemu-devel@nongnu.org; Fri, 30 Jun 2017 07:47:07 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 52A62D64BC; Fri, 30 Jun 2017 11:47:06 +0000 (UTC) Received: from localhost (ovpn-116-222.ams2.redhat.com [10.36.116.222]) by smtp.corp.redhat.com (Postfix) with ESMTP id BEB417E878; Fri, 30 Jun 2017 11:47:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 52A62D64BC Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=stefanha@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 52A62D64BC From: Stefan Hajnoczi To: Date: Fri, 30 Jun 2017 12:46:35 +0100 Message-Id: <20170630114635.9286-8-stefanha@redhat.com> In-Reply-To: <20170630114635.9286-1-stefanha@redhat.com> References: <20170630114635.9286-1-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 30 Jun 2017 11:47:06 +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: [Qemu-devel] [PULL 7/7] virtio-pci: use ioeventfd even when KVM is disabled 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: Peter Maydell , Stefan Hajnoczi , "Michael S . Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Old kvm.ko versions only supported a tiny number of ioeventfds so virtio-pci avoids ioeventfds when kvm_has_many_ioeventfds() returns 0. Do not check kvm_has_many_ioeventfds() when KVM is disabled since it always returns 0. Since commit 8c56c1a592b5092d91da8d8943c17777d6462a6f ("memory: emulate ioeventfd") it has been possible to use ioeventfds in qtest or TCG mode. This patch makes -device virtio-blk-pci,iothread=3Diothread0 work even when KVM is disabled. I have tested that virtio-blk-pci works under TCG both with and without iothread. This patch fixes qemu-iotests 068, which was accidentally merged early despite the dependency on ioeventfd. Cc: Michael S. Tsirkin Signed-off-by: Stefan Hajnoczi Reviewed-by: Michael S. Tsirkin Reviewed-by: Fam Zheng Tested-by: Eric Blake Tested-by: Kevin Wolf Message-id: 20170628184724.21378-7-stefanha@redhat.com Message-id: 20170615163813.7255-2-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi --- hw/virtio/virtio-pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 20d6a08..301920e 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1740,7 +1740,7 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Er= ror **errp) bool pcie_port =3D pci_bus_is_express(pci_dev->bus) && !pci_bus_is_root(pci_dev->bus); =20 - if (!kvm_has_many_ioeventfds()) { + if (kvm_enabled() && !kvm_has_many_ioeventfds()) { proxy->flags &=3D ~VIRTIO_PCI_FLAG_USE_IOEVENTFD; } =20 --=20 2.9.4