From nobody Sun Feb 8 14:52:52 2026 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=1564508583; cv=none; d=zoho.com; s=zohoarc; b=WrUNyWiVGLXdAvdxovfz90fSwo/oW1ZtY7mCWWX2fQpzuQkM/U4NJHTgFO0ygDhbyc1TQUgQBY9wM984oicrGULhFSfSKJZRlq5ZzilLRs54O4XclCmS/Nwm3ECyItpFGKds9z2ihWSXWwU1eiZI2xNIJ+xIAGTvjSCESsv1/54= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564508583; 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=eFjnzxuAegStXPBjOt40eXvFDqL2hXLnGuTLIfY9ow8=; b=cPf5cAfYD9gFtTI1lBRXGaA2Q+B+A6gxT0yQUQgl3VNnSZo0DBaQok+Y4OTZW+XDOjqtQVcxWAmZqJuUWYfUD36mj8fNCfsWKyQg/2lGd7wyEJ4PKO93x7UtZePi2vnhqzoab8eEpPgCX2CbETUi7py6jyjGTdKLnPA23eRyt3o= 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 1564508583143382.9898713123828; Tue, 30 Jul 2019 10:43:03 -0700 (PDT) Received: from localhost ([::1]:35246 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsW9O-0002Fm-5B for importer@patchew.org; Tue, 30 Jul 2019 13:43:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35663) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsW2Y-00056E-UE for qemu-devel@nongnu.org; Tue, 30 Jul 2019 13:36:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hsW2X-0000EZ-SI for qemu-devel@nongnu.org; Tue, 30 Jul 2019 13:35:58 -0400 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:44006) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hsW2X-0000ED-Mh; Tue, 30 Jul 2019 13:35:57 -0400 Received: by mail-pf1-x441.google.com with SMTP id i189so30209422pfg.10; Tue, 30 Jul 2019 10:35:57 -0700 (PDT) Received: from localhost.localdomain ([136.233.9.97]) by smtp.gmail.com with ESMTPSA id q24sm59122895pjp.14.2019.07.30.10.35.51 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 30 Jul 2019 10:35:55 -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=eFjnzxuAegStXPBjOt40eXvFDqL2hXLnGuTLIfY9ow8=; b=IEHBNA4wCzR/WLVY69tWk23bixlghsSjEiZvxxlGvrqVQn9n8DBA5+UmPBmNjAJ+lZ XKZq9mXA59WfOn2kOACQs09eAJp93AgUtvQ1lLhAUiHKu0XAf6pt65jcQ1VevzJUpghK TyY4kuWGGzBk73gFP2katugWZtNG9+C/k3U5d0kNFLhTRUw/LSY4yXiPzFRyxL6Y6sTK fpZtC+Jw/t3Le2pxIT08KasZ8NkAC8SgoFIlYraUJbb99qDCHF4l3mzk9Mzw5XzX8MBO yrUvIS8MVjQo65A9CEG1saB9svIGblDx5S5M1lIvMMSEnVAgjEsAy1C/ZJTmJ+LRrFyu srsg== 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=eFjnzxuAegStXPBjOt40eXvFDqL2hXLnGuTLIfY9ow8=; b=nIOeWxdhhGZ/+k9BGPz10X+c3PyU4ViEaapTjxZCuiONgwBoq5IBgEoke6WlweJ8Na zaQai1wnMf/1dSYpob2yWqy5p5EmB2VTRT33egfwHPHetsLitLbHsiuSfDnA+ZZw14Qm /fNtqtitEzWdzFqSUYRMIjDJ2gT9o93+lHMN8X+dOBi8L8MkPDTjuohoJGGX56Q6gUZn sedJvA3hSz5Nuakwb/0oOtRGmz1alqzyHux4jN8P4QZpcwscxckXIx9gMVYwlod0gYma CiaDAZRuqtkWYd2yg+ChKr4sAiimlpThxvmXNer1gFdGhKq/J1TH7OMN2jxC91ebXTdx 0yYw== X-Gm-Message-State: APjAAAU7sdDk7wTqsaxfQq4eatalLcIfPFpu663bYYdb/qJ1Q5oLrFEq oDaNsQ7yRWGfBGR66e4VQSRbyC3eyB5Eug== X-Google-Smtp-Source: APXvYqznxYt4YP/D+oo4aKEEFg6OqbhMxzdw9MuaJIM8ksCrZqUV2e1Wa83Rso4ALoiYPzPYM5UD2A== X-Received: by 2002:a17:90a:d998:: with SMTP id d24mr90531674pjv.89.1564508156399; Tue, 30 Jul 2019 10:35:56 -0700 (PDT) From: Aarushi Mehta To: qemu-devel@nongnu.org Date: Tue, 30 Jul 2019 23:04:31 +0530 Message-Id: <20190730173441.26486-7-mehta.aaru20@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190730173441.26486-1-mehta.aaru20@gmail.com> References: <20190730173441.26486-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 v8 06/16] util/async: add aio interfaces 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: Kevin Wolf , Fam Zheng , Sergio Lopez , qemu-block@nongnu.org, 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 --- util/async.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/util/async.c b/util/async.c index 8d2105729c..2e0a5e20ac 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 @@ -431,6 +462,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.21.0