From nobody Mon Feb 9 22:20:14 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.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 (zohomail.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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576687371; cv=none; d=zohomail.com; s=zohoarc; b=WRLJrQiSbukXdc2a+u9ebnOo6DCFWZYw2tl//2jgDST9iSVPDLFqLxJpMTJSNfIB4GOTTN6UFNJ4FJdfhVQUsBbRI6WFZey6eugur51Bv5SNeNik+cu23QB1jFIqCWkz48sPdgarbOWxErKlamsX60+prcWh9r6JP3aLFTk4/NQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576687371; h=Content-Type: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; bh=CH5VXwZlwL83zczRIPWaQ6ySqX8xzOLWMH4GZYtfmQo=; b=XUSF8AtT6yBfT2qftVgQEH7sQKA+esoRHRpWIGmuLi/FUvykHTZ9EyQP858d86w/4cgRq+ngt+UMSR1yg6X7Dh1/94WzNg1s8lNmbpiWOLlv04C9oSPUtFtsbawwE1zOAENEnzizFtjot+wjyzZwExZpDJRuiB6QCroT3LvpJ9w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1576687371277389.535583517589; Wed, 18 Dec 2019 08:42:51 -0800 (PST) Received: from localhost ([::1]:57102 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihcPR-0007EM-Rg for importer@patchew.org; Wed, 18 Dec 2019 11:42:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44964) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihcGL-0003Lj-4G for qemu-devel@nongnu.org; Wed, 18 Dec 2019 11:33:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihcGJ-0001x0-PS for qemu-devel@nongnu.org; Wed, 18 Dec 2019 11:33:24 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:21546 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ihcGJ-0001sq-Jf for qemu-devel@nongnu.org; Wed, 18 Dec 2019 11:33:23 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-416-aDBM15ZbOS6RWTkFcajAwg-1; Wed, 18 Dec 2019 11:33:21 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 88606800D4E; Wed, 18 Dec 2019 16:33:20 +0000 (UTC) Received: from localhost (unknown [10.36.118.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id E731F5C1D4; Wed, 18 Dec 2019 16:33:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576686803; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CH5VXwZlwL83zczRIPWaQ6ySqX8xzOLWMH4GZYtfmQo=; b=Gu6DlJvOekIvbvrJORpwPTKVjCJmXkKPzaM6pChpChdX1Vt9Ufx4vfVLkE59DciKyO/8pv 6WItvHgOcokiWp0BVPgI4kIGzsz8CjUpG81zLfmreA9EKkpdjHI8u0uC7EyQWmjSWnHepW v7IuoNTNY/w8xg9wa5iKW83n/ViuS9Y= From: Stefan Hajnoczi To: Subject: [PATCH v3 06/15] util/async: add aio interfaces for io_uring Date: Wed, 18 Dec 2019 16:32:19 +0000 Message-Id: <20191218163228.1613099-7-stefanha@redhat.com> In-Reply-To: <20191218163228.1613099-1-stefanha@redhat.com> References: <20191218163228.1613099-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: aDBM15ZbOS6RWTkFcajAwg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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, oleksandr@redhat.com, Julia Suvorova , Markus Armbruster , Max Reitz , Stefan Hajnoczi , Paolo Bonzini , 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" From: Aarushi Mehta Signed-off-by: Aarushi Mehta Signed-off-by: Stefan Hajnoczi --- util/async.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/util/async.c b/util/async.c index b1fa5319e5..c192a24a61 100644 --- a/util/async.c +++ b/util/async.c @@ -276,6 +276,14 @@ aio_ctx_finalize(GSource *source) } #endif =20 +#ifdef CONFIG_LINUX_IO_URING + if (ctx->linux_io_uring) { + luring_detach_aio_context(ctx->linux_io_uring, ctx); + luring_cleanup(ctx->linux_io_uring); + ctx->linux_io_uring =3D NULL; + } +#endif + assert(QSLIST_EMPTY(&ctx->scheduled_coroutines)); qemu_bh_delete(ctx->co_schedule_bh); =20 @@ -340,6 +348,29 @@ LinuxAioState *aio_get_linux_aio(AioContext *ctx) } #endif =20 +#ifdef CONFIG_LINUX_IO_URING +LuringState *aio_setup_linux_io_uring(AioContext *ctx, Error **errp) +{ + if (ctx->linux_io_uring) { + return ctx->linux_io_uring; + } + + ctx->linux_io_uring =3D luring_init(errp); + if (!ctx->linux_io_uring) { + return NULL; + } + + luring_attach_aio_context(ctx->linux_io_uring, ctx); + return ctx->linux_io_uring; +} + +LuringState *aio_get_linux_io_uring(AioContext *ctx) +{ + assert(ctx->linux_io_uring); + return ctx->linux_io_uring; +} +#endif + void aio_notify(AioContext *ctx) { /* Write e.g. bh->scheduled before reading ctx->notify_me. Pairs @@ -434,6 +465,11 @@ AioContext *aio_context_new(Error **errp) #ifdef CONFIG_LINUX_AIO ctx->linux_aio =3D NULL; #endif + +#ifdef CONFIG_LINUX_IO_URING + ctx->linux_io_uring =3D NULL; +#endif + ctx->thread_pool =3D NULL; qemu_rec_mutex_init(&ctx->lock); timerlistgroup_init(&ctx->tlg, aio_timerlist_notify, ctx); --=20 2.23.0