From nobody Tue Nov 11 17:31:52 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1564414251; cv=none; d=zoho.com; s=zohoarc; b=GeRx2A/Dx4FfNznpGYlgUkjnMPUl9QayKFxl5nvCY1prwBlDIk0rXr1uGym4Kl5qO5hrfMK5Q4XnqoHaNKZxyb0LzU3vpKVsVjfsMtB4994R0d+PIIyiT2VqQa9E35PIn5GoemgE7V0DVq2C6aU6sDToApeHV9ALt16/j0JX25o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564414251; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=CsviC0H5kxruu2nLsmjsEXhYUXVsWAJ6x54pOSbsHRI=; b=N7PzQWDYKpb2a1C53T3afbJUOrA1r4AxdBkfiC1zcr74U3Tb9z7HnAdpO4fRp81JiqeTtX9rQYrMTVgFTu+bMp2jhZYUOSaLe5tIi9ckRQxcydnyxshquD8muKMCImIqaLRGIedualfNoxNj3USJW/1qxOiLRwlCvELOwUORlsc= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1564414251409110.9606198725653; Mon, 29 Jul 2019 08:30:51 -0700 (PDT) Received: from localhost ([::1]:54014 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hs7bu-0007Fo-Bp for importer@patchew.org; Mon, 29 Jul 2019 11:30:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43904) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hs7Q5-0007dN-1Y for qemu-devel@nongnu.org; Mon, 29 Jul 2019 11:18:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hs7Q3-0000Fu-DQ for qemu-devel@nongnu.org; Mon, 29 Jul 2019 11:18:36 -0400 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:45809) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hs7Q3-0000BZ-6d; Mon, 29 Jul 2019 11:18:35 -0400 Received: by mail-pf1-x441.google.com with SMTP id r1so28194353pfq.12; Mon, 29 Jul 2019 08:18:34 -0700 (PDT) Received: from localhost.localdomain ([136.233.9.97]) by smtp.gmail.com with ESMTPSA id h129sm58693941pfb.110.2019.07.29.08.18.27 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 29 Jul 2019 08:18:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CsviC0H5kxruu2nLsmjsEXhYUXVsWAJ6x54pOSbsHRI=; b=UA1sQSbD0BgpnzosE2aBx6h50xVsRxYAyBmrVJAqvm4/r5nBCUp2mnMoNbOwF65Uxj PcOE8KTYHJLgfU7wsn6fKEovnGkJEPz3mOaiHZ5DbTLP+GtX3gMqKu5ombKdrfmPcpbu Bw3dzf0toAW6dFB+dGWTBND7RkLbl9w2Gq8cgRtOqGjhOdeSdNeRuDfBdhS3CmVuWzmd 3lF2kCykgyKmlorn7qoG5BifniuSjTKet8Q0nJSCUz2R/6CypW1NKIRYGcyr4G3p9H/K 4VFTwnDn/r4CWOgBIXmiVP+YQdbWV4R0EEQSFb/11NrLnAoIlI8YYJDTkusv7fFiyvYi 5pXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CsviC0H5kxruu2nLsmjsEXhYUXVsWAJ6x54pOSbsHRI=; b=Ml/htjH8J9GrZWv/s0UDKV5563BY24L+Qu0cI1QnS1gkNpaXd3mBsJlZ6sZDrxBR6y bFvBBeXE8pD1ypS3of6b4Qcr70CoAwz65Hq/wqp9wGrHc0/st+QCbRJX+O0Wycp7GH0+ 8AHJjz+FoKa8SLgPEEDQCU0wIjTg3H/wWG25p0+O7AU7AmQzpZPt9s7gArCRMId8bza2 BdZ2dB88UpkMvNZUcxVOtXpxoig7Ss2ZA8xoTCvoO5CKXCim3mn9L0KyejqF0JJgYNmi fozBaPze8vWV3kAbhL619vP/+NZAKAUI3cHatnrf4TqpLvY8RJuSKfe9xwJdfxjZoHdy ev/g== X-Gm-Message-State: APjAAAVx/+Q75tYYzP9yTwZWmZ/1te3CzhdJREeV32QB3VvSC3YXL0BA JchJrsE1LJlPJsHMyOWbFTJlMeEop67cUg== X-Google-Smtp-Source: APXvYqwhfc8cf11gHszg58e12d9z9XNipulSiZOpcPHjdGpkRXhow6dgx4fA06qABMo3PKEGvDP2/w== X-Received: by 2002:a63:6f41:: with SMTP id k62mr58949394pgc.32.1564413513477; Mon, 29 Jul 2019 08:18:33 -0700 (PDT) From: Aarushi Mehta To: qemu-devel@nongnu.org Date: Mon, 29 Jul 2019 20:46:45 +0530 Message-Id: <20190729151651.21306-10-mehta.aaru20@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190729151651.21306-1-mehta.aaru20@gmail.com> References: <20190729151651.21306-1-mehta.aaru20@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::441 Subject: [Qemu-devel] [PATCH v7 09/15] block: add trace events for io_uring X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Kevin Wolf , qemu-block@nongnu.org, Sergio Lopez , Markus Armbruster , Maxim Levitsky , saket.sinha89@gmail.com, Max Reitz , Stefan Hajnoczi , Paolo Bonzini , Stefan Hajnoczi , Julia Suvorova , Aarushi Mehta Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Aarushi Mehta Reviewed-by: Stefan Hajnoczi --- block/io_uring.c | 22 +++++++++++++++++++--- block/trace-events | 12 ++++++++++++ 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/block/io_uring.c b/block/io_uring.c index d33e554862..c7b2b0a9e2 100644 --- a/block/io_uring.c +++ b/block/io_uring.c @@ -17,6 +17,7 @@ #include "block/raw-aio.h" #include "qemu/coroutine.h" #include "qapi/error.h" +#include "trace.h" =20 #define MAX_EVENTS 128 =20 @@ -93,6 +94,8 @@ static void luring_resubmit_short_read(LuringState *s, Lu= ringAIOCB *luringcb, QEMUIOVector *resubmit_qiov; size_t remaining; =20 + trace_luring_resubmit_short_read(s, luringcb, nread); + /* Update read position */ luringcb->total_read =3D nread; remaining =3D luringcb->qiov->size - luringcb->total_read; @@ -163,6 +166,7 @@ static void luring_process_completions(LuringState *s) =20 /* Change counters one-by-one because we can be nested. */ s->io_q.in_flight--; + trace_luring_process_completion(s, luringcb, ret); =20 /* total_read is non-zero only for resubmitted read requests */ total_bytes =3D ret + luringcb->total_read; @@ -263,6 +267,7 @@ static int ioq_submit(LuringState *s) QSIMPLEQ_REMOVE_HEAD(&s->io_q.submit_queue, next); } ret =3D io_uring_submit(&s->ring); + trace_luring_io_uring_submit(s, ret); /* Prevent infinite loop if submission is refused */ if (ret <=3D 0) { if (ret =3D=3D -EAGAIN) { @@ -287,12 +292,15 @@ static int ioq_submit(LuringState *s) =20 void luring_io_plug(BlockDriverState *bs, LuringState *s) { + trace_luring_io_plug(s); s->io_q.plugged++; } =20 void luring_io_unplug(BlockDriverState *bs, LuringState *s) { assert(s->io_q.plugged); + trace_luring_io_unplug(s, s->io_q.blocked, s->io_q.plugged, + s->io_q.in_queue, s->io_q.in_flight); if (--s->io_q.plugged =3D=3D 0 && !s->io_q.blocked && s->io_q.in_queue > 0) { ioq_submit(s); @@ -313,6 +321,7 @@ void luring_io_unplug(BlockDriverState *bs, LuringState= *s) static int luring_do_submit(int fd, LuringAIOCB *luringcb, LuringState *s, uint64_t offset, int type) { + int ret; struct io_uring_sqe *sqes =3D &luringcb->sqeq; =20 switch (type) { @@ -336,11 +345,14 @@ static int luring_do_submit(int fd, LuringAIOCB *luri= ngcb, LuringState *s, =20 QSIMPLEQ_INSERT_TAIL(&s->io_q.submit_queue, luringcb, next); s->io_q.in_queue++; - + trace_luring_do_submit(s, s->io_q.blocked, s->io_q.plugged, + s->io_q.in_queue, s->io_q.in_flight); if (!s->io_q.blocked && (!s->io_q.plugged || s->io_q.in_flight + s->io_q.in_queue >=3D MAX_EVENTS)) { - return ioq_submit(s); + ret =3D ioq_submit(s); + trace_luring_do_submit_done(s, ret); + return ret; } return 0; } @@ -355,8 +367,10 @@ int coroutine_fn luring_co_submit(BlockDriverState *bs= , LuringState *s, int fd, .qiov =3D qiov, .is_read =3D (type =3D=3D QEMU_AIO_READ), }; - + trace_luring_co_submit(bs, s, &luringcb, fd, offset, qiov ? qiov->size= : 0, + type); ret =3D luring_do_submit(fd, &luringcb, s, offset, type); + if (ret < 0) { return ret; } @@ -388,6 +402,7 @@ LuringState *luring_init(Error **errp) int rc; LuringState *s; s =3D g_new0(LuringState, 1); + trace_luring_init_state(s, sizeof(*s)); struct io_uring *ring =3D &s->ring; rc =3D io_uring_queue_init(MAX_EVENTS, ring, 0); if (rc < 0) { @@ -405,4 +420,5 @@ void luring_cleanup(LuringState *s) { io_uring_queue_exit(&s->ring); g_free(s); + trace_luring_cleanup_state(s); } diff --git a/block/trace-events b/block/trace-events index d724df0117..66aaf8352b 100644 --- a/block/trace-events +++ b/block/trace-events @@ -60,6 +60,18 @@ qmp_block_stream(void *bs) "bs %p" file_paio_submit(void *acb, void *opaque, int64_t offset, int count, int t= ype) "acb %p opaque %p offset %"PRId64" count %d type %d" file_copy_file_range(void *bs, int src, int64_t src_off, int dst, int64_t = dst_off, int64_t bytes, int flags, int64_t ret) "bs %p src_fd %d offset %"P= RIu64" dst_fd %d offset %"PRIu64" bytes %"PRIu64" flags %d ret %"PRId64 =20 +#io_uring.c +luring_init_state(void *s, size_t size) "s %p size %zu" +luring_cleanup_state(void *s) "%p freed" +luring_io_plug(void *s) "LuringState %p plug" +luring_io_unplug(void *s, int blocked, int plugged, int queued, int inflig= ht) "LuringState %p blocked %d plugged %d queued %d inflight %d" +luring_do_submit(void *s, int blocked, int plugged, int queued, int inflig= ht) "LuringState %p blocked %d plugged %d queued %d inflight %d" +luring_do_submit_done(void *s, int ret) "LuringState %p submitted to kerne= l %d" +luring_co_submit(void *bs, void *s, void *luringcb, int fd, uint64_t offse= t, size_t nbytes, int type) "bs %p s %p luringcb %p fd %d offset %" PRId64 = " nbytes %zd type %d" +luring_process_completion(void *s, void *aiocb, int ret) "LuringState %p l= uringcb %p ret %d" +luring_io_uring_submit(void *s, int ret) "LuringState %p ret %d" +luring_resubmit_short_read(void *s, void *luringcb, int nread) "LuringStat= e %p luringcb %p nread %d" + # qcow2.c qcow2_writev_start_req(void *co, int64_t offset, int bytes) "co %p offset = 0x%" PRIx64 " bytes %d" qcow2_writev_done_req(void *co, int ret) "co %p ret %d" --=20 2.21.0