From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.5 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5BA46C433FF for ; Tue, 30 Jul 2019 17:42:57 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 280B22087F for ; Tue, 30 Jul 2019 17:42:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IEHBNA4w" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 280B22087F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:35246 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsW9I-0002Fm-Fi for qemu-devel@archiver.kernel.org; Tue, 30 Jul 2019 13:42:56 -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) 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) 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) 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: 8bit 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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 +#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 = NULL; + } +#endif + assert(QSLIST_EMPTY(&ctx->scheduled_coroutines)); qemu_bh_delete(ctx->co_schedule_bh); @@ -340,6 +348,29 @@ LinuxAioState *aio_get_linux_aio(AioContext *ctx) } #endif +#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 = 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 = NULL; #endif + +#ifdef CONFIG_LINUX_IO_URING + ctx->linux_io_uring = NULL; +#endif + ctx->thread_pool = NULL; qemu_rec_mutex_init(&ctx->lock); timerlistgroup_init(&ctx->tlg, aio_timerlist_notify, ctx); -- 2.21.0