From nobody Sun Feb 8 13:11:09 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=1560174774; cv=none; d=zoho.com; s=zohoarc; b=OZp/pPYDx5Wcms1oS6jYRuSDeAFojzPtsdrfnBGgxSimH2OyvLmUY/5pzVkltMZiS007+bTCjLzYSoCl1tOkR9RPNK+ayQtwswQT7XZZjWc2jNG4wqxBraqU9tRgM0kB30J8pQks7BW+GJD3PIhGFJ6Bq/wnAL/jN9EzvAMorB0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560174774; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=mam4w+9UfKu9WdJoSPIimpAQV6LGmM+7szCVVJxwAcM=; b=lvizUOIFEFxm7zqM9R2YWzkN6ovUT6s4iyJ871knEKFaiizwlaLN43twqTt5gI+Rl8yfmFTQ6G7kjd0d/vvBTJ3uw//BYrTt1y7ieOUF8JStC5cfoUT04bIUtRCZuHE92OYoYa8mHJhJSqRJCDLjTHD2jexWbb3xg0xDIkW1eF4= 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 1560174774265724.5977773905703; Mon, 10 Jun 2019 06:52:54 -0700 (PDT) Received: from localhost ([::1]:46706 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haKjC-0002mg-7z for importer@patchew.org; Mon, 10 Jun 2019 09:52:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50986) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haKgB-00081Q-5a for qemu-devel@nongnu.org; Mon, 10 Jun 2019 09:49:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haKg8-0001TT-1O for qemu-devel@nongnu.org; Mon, 10 Jun 2019 09:49:41 -0400 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]:46105) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haKg5-0001Rr-VA; Mon, 10 Jun 2019 09:49:39 -0400 Received: by mail-pg1-x544.google.com with SMTP id v9so3371015pgr.13; Mon, 10 Jun 2019 06:49:37 -0700 (PDT) Received: from localhost.localdomain ([136.233.9.100]) by smtp.gmail.com with ESMTPSA id d4sm13969837pfc.149.2019.06.10.06.49.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Jun 2019 06:49:35 -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; bh=mam4w+9UfKu9WdJoSPIimpAQV6LGmM+7szCVVJxwAcM=; b=rAyJzZXLMoLscx/+WqDhRXde1jlZfQUtvzjNhz6q8M5Zzz3cYvTlwiGfDHAwjQ8FqB P7vVAE4He0zTj1F8VRBQStZMRsDMhket2DkjwdX9TvRlZiv+kEKK6m7g7p0hiww1VvWi 5Xg/RpzC5sU6882tChR4yLyfQeO1SQHIwyTKD+ZKOGSuVgKn2xqkX/RwJtyy193uzTBV 0b1Ga7XwCS0t44k62zrr8DQ1UAxgWLZCOoIBgdW5saZn/YFSrad9LGrVVvqwxDJcL0rY NgCxC45xV0zda0M2g3YtiozMMCwU9sKObtdN5XQrJ5yZt2/uZyVckEJ0yhCHUvn5Jlbf /8rw== 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; bh=mam4w+9UfKu9WdJoSPIimpAQV6LGmM+7szCVVJxwAcM=; b=DSPgZHIM/qRHNKCnaYjIk2r29zVxCFaYpyymGcHXQLV5Fdlz+4UnPBRasb774lA/cq gs0fknBIA+avI/FaEQIKQpH7uvnITReR28Vefk+4au9XF0X8dY/ZSLycwc26Yle1nGjD 2/HnHlsfYlaViBeVn6HGhY79LT93b/Q3nOXTEkfYiSsPjZw1G7/PAROb64FKXq+XGNyZ mf9cZj9nx8NJbqLima6iFs0B2ppqtPWqTKmPIl/SE36rFKRiGMdDE/3HHNMvTa4WGKv5 Dwgmd6WKZHv5L+rhs8tmBk7IoCpVxStl7NOcfARzFi19EM6IlK3PwmwBn8kZrwDIPYmT wHMw== X-Gm-Message-State: APjAAAWYYVP/emxBs5YJlwm7JoCk7+hUcA7iMw12/3BHHjHjv4xoYEd7 OW/pzCllEPFG03OUdpIPDX8WkFwQCD8Q0w== X-Google-Smtp-Source: APXvYqzlwwDBVvxUXKs8PNom0I8YERpFY023OEfEX0xJmW50/Yh8kAEs665qkLOVSjL80mzATva3IQ== X-Received: by 2002:a62:d45d:: with SMTP id u29mr10207136pfl.135.1560174576330; Mon, 10 Jun 2019 06:49:36 -0700 (PDT) From: Aarushi Mehta To: qemu-devel@nongnu.org Date: Mon, 10 Jun 2019 19:18:54 +0530 Message-Id: <20190610134905.22294-2-mehta.aaru20@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190610134905.22294-1-mehta.aaru20@gmail.com> References: <20190610134905.22294-1-mehta.aaru20@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::544 Subject: [Qemu-devel] [PATCH v5 01/12] configure: permit use of 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 , Sergio Lopez , qemu-block@nongnu.org, Markus Armbruster , Max Reitz , saket.sinha89@gmail.com, Stefan Hajnoczi , Paolo Bonzini , Maxim Levitsky , 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-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Aarushi Mehta Reviewed-by: Stefan Hajnoczi Reviewed-by: Maxim Levitsky --- configure | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/configure b/configure index b091b82cb3..7aa18d308d 100755 --- a/configure +++ b/configure @@ -365,6 +365,7 @@ xen=3D"" xen_ctrl_version=3D"" xen_pci_passthrough=3D"" linux_aio=3D"" +linux_io_uring=3D"" cap_ng=3D"" attr=3D"" libattr=3D"" @@ -1266,6 +1267,10 @@ for opt do ;; --enable-linux-aio) linux_aio=3D"yes" ;; + --disable-linux-io-uring) linux_io_uring=3D"no" + ;; + --enable-linux-io-uring) linux_io_uring=3D"yes" + ;; --disable-attr) attr=3D"no" ;; --enable-attr) attr=3D"yes" @@ -1784,6 +1789,7 @@ disabled with --disable-FEATURE, default is enabled i= f available: vde support for vde network netmap support for netmap network linux-aio Linux AIO support + linux-io-uring Linux io_uring support cap-ng libcap-ng support attr attr and xattr support vhost-net vhost-net kernel acceleration support @@ -3973,6 +3979,21 @@ EOF linux_aio=3Dno fi fi +########################################## +# linux-io-uring probe + +if test "$linux_io_uring" !=3D "no" ; then + if $pkg_config liburing; then + linux_io_uring_cflags=3D$($pkg_config --cflags liburing) + linux_io_uring_libs=3D$($pkg_config --libs liburing) + linux_io_uring=3Dyes + else + if test "$linux_io_uring" =3D "yes" ; then + feature_not_found "linux io_uring" "Install liburing devel" + fi + linux_io_uring=3Dno + fi +fi =20 ########################################## # TPM emulation is only on POSIX @@ -6396,6 +6417,7 @@ echo "PIE $pie" echo "vde support $vde" echo "netmap support $netmap" echo "Linux AIO support $linux_aio" +echo "Linux io_uring support $linux_io_uring" echo "ATTR/XATTR support $attr" echo "Install blobs $blobs" echo "KVM support $kvm" @@ -6874,6 +6896,11 @@ fi if test "$linux_aio" =3D "yes" ; then echo "CONFIG_LINUX_AIO=3Dy" >> $config_host_mak fi +if test "$linux_io_uring" =3D "yes" ; then + echo "CONFIG_LINUX_IO_URING=3Dy" >> $config_host_mak + echo "LINUX_IO_URING_CFLAGS=3D$linux_io_uring_cflags" >> $config_host_mak + echo "LINUX_IO_URING_LIBS=3D$linux_io_uring_libs" >> $config_host_mak +fi if test "$attr" =3D "yes" ; then echo "CONFIG_ATTR=3Dy" >> $config_host_mak fi --=20 2.17.1 From nobody Sun Feb 8 13:11:09 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=1560174753; cv=none; d=zoho.com; s=zohoarc; b=jteyekzDe/VbDTMiazsmLSUPhcMUvXlAAhMaoVGD1K/EMSWHZBZJ97pwbkA0mI9hTKGPwUpMSacHqqCHGfRU/w5rKSY/+TMr92A2nSSt+5UwDygHVT8VfefMmmlh27otmWCmlgq7SqViFM/shBMdSuTWoW7HTwR3uafKJTnarcI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560174753; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=WpQTGyTo9qkJp1Rc3SIkhVrtWPIrh5hywek1GByQLqQ=; b=OH7ChkstVwDkAtfGASrN9KBSGmb7x2bh3jHNQgP9qpcZv01ulJkq/tTmh5+xC3DTzHlutItgv/ZlvdPW2qE4rTXqztljBKpTPPowA8beruIuVulTd9yNM0hzQ6mfbltFKtjIAzEql44Zt6kRj1Jx5DZo3ACfMw5lrR138nG9eXA= 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 1560174753492833.9239912089796; Mon, 10 Jun 2019 06:52:33 -0700 (PDT) Received: from localhost ([::1]:46704 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haKit-00023z-Gp for importer@patchew.org; Mon, 10 Jun 2019 09:52:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51060) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haKgF-000890-Bt for qemu-devel@nongnu.org; Mon, 10 Jun 2019 09:49:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haKgE-0001XO-Bu for qemu-devel@nongnu.org; Mon, 10 Jun 2019 09:49:47 -0400 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:33189) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haKgE-0001WS-3G; Mon, 10 Jun 2019 09:49:46 -0400 Received: by mail-pf1-x441.google.com with SMTP id x15so5377220pfq.0; Mon, 10 Jun 2019 06:49:45 -0700 (PDT) Received: from localhost.localdomain ([136.233.9.100]) by smtp.gmail.com with ESMTPSA id d4sm13969837pfc.149.2019.06.10.06.49.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Jun 2019 06:49:43 -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; bh=WpQTGyTo9qkJp1Rc3SIkhVrtWPIrh5hywek1GByQLqQ=; b=BJtSV0VP9clsJLeLVSwScoklo9lGUV6Bt2KaJpFA4EAp2gfZunKF7CEvNhzhQDB+1T cWUv2uVyWR6MYTN8aTBp4IJ7M2HzA2G7K5c0I6/grPyeKpdlg6o8WyTeXdvbcmF0NjTa lvR/b9PqNVYK9cKj0qgcGKR2v1mDSW7AC8kuMf4U2PjDU/muvC8/WWXCgduNTWG3nDzC f70QRnVcB87jOW8rFIDNDlyZRzOKXWW1EEZxx/W/p428lkCoOrHx5PSV8H+GBhIOVTPA NduO12O64jKszMBgnVSAESDQ6/hfwXG8J1OILnfOO0hOYol1sxawj3Qzs3p90EdeWc1q 0Z3w== 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; bh=WpQTGyTo9qkJp1Rc3SIkhVrtWPIrh5hywek1GByQLqQ=; b=QeAF3dk/uL6hl1jdHyMLNVEFq0PHTD+EXYvHTrtEsBL+WfjVhJKjUzTlOKOM089Gpk VhnO5ieu9OQNjw72b1ukxH1RE+yWyGkgUWTbEEsgzyyFoV6m6VCMcuuGIkteZMXq7ncv 43zwXCOSGhqplGc2E6szPsD1jY6aoioSkoLclx8LYrqlrAD/2WcvlGorCY5nJ5pcmPn5 alDgAOjMnsq5u2pEFBD/MPFLYBK+dWS/4b9W0mJGxpl2DGw+zaaaILAsRFvNBvzlpben mm8WmMjT3VwyuQdLGWSPdB7kbvy5OPPSRF35NGyJDfZg5GEHL70mk7Yl8IX9RkNc0Xh/ CZuA== X-Gm-Message-State: APjAAAXlLo19/RxHA3udNrw84Wv9Yfb3S9QZdYdIM5Lc10w9G0CfTv8C 2WmV/UH4TQFL3yBx6LuaNWhOKn6vL3zqYw== X-Google-Smtp-Source: APXvYqz2F1MMZhlayqq5rabZFLPySlf1qAbYyNY/GCb09Tcstean2GVRETedqau5B4p6VP8xJlV5Bw== X-Received: by 2002:a65:4c4c:: with SMTP id l12mr14638865pgr.404.1560174584348; Mon, 10 Jun 2019 06:49:44 -0700 (PDT) From: Aarushi Mehta To: qemu-devel@nongnu.org Date: Mon, 10 Jun 2019 19:18:55 +0530 Message-Id: <20190610134905.22294-3-mehta.aaru20@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190610134905.22294-1-mehta.aaru20@gmail.com> References: <20190610134905.22294-1-mehta.aaru20@gmail.com> 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 v5 02/12] qapi/block-core: add option 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 , Sergio Lopez , qemu-block@nongnu.org, Markus Armbruster , Max Reitz , saket.sinha89@gmail.com, Stefan Hajnoczi , Paolo Bonzini , Maxim Levitsky , 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-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Option only enumerates for hosts that support it. Signed-off-by: Aarushi Mehta Reviewed-by: Stefan Hajnoczi --- qapi/block-core.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/qapi/block-core.json b/qapi/block-core.json index 1defcde048..db7eedd058 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -2792,11 +2792,13 @@ # # @threads: Use qemu's thread pool # @native: Use native AIO backend (only Linux and Windows) +# @io_uring: Use linux io_uring (since 4.1) # # Since: 2.9 ## { 'enum': 'BlockdevAioOptions', - 'data': [ 'threads', 'native' ] } + 'data': [ 'threads', 'native', + { 'name': 'io_uring', 'if': 'defined(CONFIG_LINUX_IO_URING)' }= ] } =20 ## # @BlockdevCacheOptions: --=20 2.17.1 From nobody Sun Feb 8 13:11:09 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=1560175011; cv=none; d=zoho.com; s=zohoarc; b=cfdob85KAPvJEYIUnYDLg5CSfDMkQ4N32oOLxuUU7XbmgWbL9GjO4hJHMZqcbTG5Kcmt5Tvko+oECJsTtAFmE7ZGli9WkVhJO94w+fFYwz6OipWtR2aVq4pLlSFbt1bGbX5gS97rQMptTY+J3sxW02OwcnOTGxy6LV5ZqnrxCB8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560175011; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=HgaHVcqeBW+nZCkmUpXRplMouOFQrkux2rCciZCM+MQ=; b=h0yQJJPYhqKbqLLPgIyoLdTxumAHeZ6OAa36M4g5gcHcAHSWuwpwGk+EBja0Oi81fJbxm+V3TPKhhvrTK/wEbTwrApD72ipi1FIT/H6F81j8D2xxvuhPD0/e2cRk/rVHzLV7phifmrWQmoiF/8pS4ea6bzv93r8NSG4japUAn9Q= 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 156017501122068.5875393049879; Mon, 10 Jun 2019 06:56:51 -0700 (PDT) Received: from localhost ([::1]:46746 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haKn4-00071W-7s for importer@patchew.org; Mon, 10 Jun 2019 09:56:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51107) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haKgL-0008Gh-SD for qemu-devel@nongnu.org; Mon, 10 Jun 2019 09:49:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haKgL-0001c4-12 for qemu-devel@nongnu.org; Mon, 10 Jun 2019 09:49:53 -0400 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]:45141) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haKgK-0001aM-MR; Mon, 10 Jun 2019 09:49:52 -0400 Received: by mail-pl1-x641.google.com with SMTP id bi6so3292786plb.12; Mon, 10 Jun 2019 06:49:52 -0700 (PDT) Received: from localhost.localdomain ([136.233.9.100]) by smtp.gmail.com with ESMTPSA id d4sm13969837pfc.149.2019.06.10.06.49.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Jun 2019 06:49:50 -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; bh=HgaHVcqeBW+nZCkmUpXRplMouOFQrkux2rCciZCM+MQ=; b=ZFulTqjxA8OKF9INWv+WuvQIPvJ8Bfb97GSpbjQ1T0IQ1wHwjoh8bqAXQJx3EWm3Q0 rUwzLntoeNPw4briBgTdXms+KV8ZpsTtq5hKFH015tJ+5jEYce3n1IG1XsSzGrpSVb8X D4BE3xhjJ0ttkUgyNdfcMkBLkiJZAM2PIL7jSq0xiYkZBq6FPOWNMkLJcV3s8p8zWHxH fkEbypp2ZfjnHzUANV2Iog+D6VxVoVjipz+aFJP16fxK7FkICeKnMxmb3QsHLqnyVKGU tqfcf5IL+dixNW4TVql5zNNTI5h1K8f4uu3xVZT9sGpUUbMHVizWCMweQEppCsOXPF9Q h4yw== 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; bh=HgaHVcqeBW+nZCkmUpXRplMouOFQrkux2rCciZCM+MQ=; b=PnlpvrONQ1Ow5E9j8ip+MwfnV1lJxHdoRTd8jpDZYY9CtrevEOzLXBE6I+BzW9+xXo cTiP5I91/l8vQh8AFFHT8DdWuy7ARcz9W575A/MCVEJjSI3ZzU+1FSs7c6/UaqZ3tti4 ebT7P0iwpSKoBXU5AhYa4DJF6NP7wzjqOSRB9yNuAg0juKstOtjQ2CTxum9KB/Ht+SO1 ylnCtBQxLkgvKy3fESN6HDMAv1/BbTSo5XdKhfTAbdaOe8taaQni1YHCIFeUZZDlkoIK a5tP7zA2HpTeXqfUpQvl2f0iTb4W8urnVDqS9JS8RZhyrmXLGL286h1BpItqbr8NTnHt eTgw== X-Gm-Message-State: APjAAAUnUH+6m48W6U0SkF8l+ZqbRBvggDdZ2ZLo1+VpRLKGvXiexdIg UyZquEr1Zq1a93w3XYixjXW5eAjWtqkFPQ== X-Google-Smtp-Source: APXvYqwad4+DtpL9QfTCOjAafAbnhgksTuYXOX1HnvZWcezRWilT7UT0jBAAltnuEgGIsB+24HkY7A== X-Received: by 2002:a17:902:8609:: with SMTP id f9mr65784658plo.252.1560174591211; Mon, 10 Jun 2019 06:49:51 -0700 (PDT) From: Aarushi Mehta To: qemu-devel@nongnu.org Date: Mon, 10 Jun 2019 19:18:56 +0530 Message-Id: <20190610134905.22294-4-mehta.aaru20@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190610134905.22294-1-mehta.aaru20@gmail.com> References: <20190610134905.22294-1-mehta.aaru20@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::641 Subject: [Qemu-devel] [PATCH v5 03/12] block/block: add BDRV flag 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 , Sergio Lopez , qemu-block@nongnu.org, Markus Armbruster , Max Reitz , saket.sinha89@gmail.com, Stefan Hajnoczi , Paolo Bonzini , Maxim Levitsky , 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-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Aarushi Mehta Reviewed-by: Stefan Hajnoczi Reviewed-by: Maxim Levitsky --- include/block/block.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/block/block.h b/include/block/block.h index f9415ed740..5e08df716f 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -121,6 +121,7 @@ typedef struct HDGeometry { ignoring the format layer */ #define BDRV_O_NO_IO 0x10000 /* don't initialize for I/O */ #define BDRV_O_AUTO_RDONLY 0x20000 /* degrade to read-only if opening read= -write fails */ +#define BDRV_O_IO_URING 0x40000 /* use io_uring instead of the thread p= ool */ =20 #define BDRV_O_CACHE_MASK (BDRV_O_NOCACHE | BDRV_O_NO_FLUSH) =20 --=20 2.17.1 From nobody Sun Feb 8 13:11:09 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=1560174903; cv=none; d=zoho.com; s=zohoarc; b=OIZF2HCaFf4m9e64SKy/FYbLqgKftxpLtfveJ9OhBCqHEweEIpwm0reMTJEAlshN8bLhiPaQbBLO0NvAYzbaZDfUFK/raWJKactOEmQX62NKfZ3cuYVYjRgVs0CDS8nLCAIrj/cNdin8peK3vb+37T2gTiU/BOn0GDm8zCdnVfM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560174903; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=15rT3kr3z6osLHbAzt/fcdvUpq9M9URxemKrLMPyEP4=; b=Gkvn+mOpVMBLO5fQ75a2ENC7Vqzfm2TsKvnmNP+C2OJ9DdV2L616R6G/vThz5S6i7deK+3MWAQ3BDNNJfH2nurkdYgargOZXD8lAlHwDLvwmzKCaEhCpZ3lmsiIYBKqG9jY/y7mCus5VssYn+BWAuDJg9tCcoSiFQYgGG84Tt3U= 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1560174903734786.5466158585688; Mon, 10 Jun 2019 06:55:03 -0700 (PDT) Received: from localhost ([::1]:46740 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haKlF-0005ga-EL for importer@patchew.org; Mon, 10 Jun 2019 09:54:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51204) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haKgd-0008US-LT for qemu-devel@nongnu.org; Mon, 10 Jun 2019 09:50:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haKgb-0001j2-2f for qemu-devel@nongnu.org; Mon, 10 Jun 2019 09:50:11 -0400 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:43498) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haKga-0001em-PY; Mon, 10 Jun 2019 09:50:09 -0400 Received: by mail-pf1-x444.google.com with SMTP id i189so5343092pfg.10; Mon, 10 Jun 2019 06:49:59 -0700 (PDT) Received: from localhost.localdomain ([136.233.9.100]) by smtp.gmail.com with ESMTPSA id d4sm13969837pfc.149.2019.06.10.06.49.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Jun 2019 06:49: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; bh=15rT3kr3z6osLHbAzt/fcdvUpq9M9URxemKrLMPyEP4=; b=iLIFllzdurZ7Lm98LGPYE2IncRz3yQ22M5ur2VeQ3JHUz+r18nCg+PzXTMjtNPP7hP a5Doc1SxlsGBPbUmrS1Ki7Ad9B186MWCCDH1pRNDq0oAvAcTxpKsyDCH2jNQfWl/oAwi jMaiI0ZY080IcL0rFSP4U9kF+MCcf+38enHLMKEwHjo1MV1nBwjWkMl6RSWBZtrXpy2c E582pdtjJz922eaPsxhgupKvWs6f4kFZari6Zfl3891KTcvmqGi0t8JGLCv75chLW5pi aY7RD7H035Npn3W+rJ2USE0NHGhGAyLshnzVj9SrBYBsXC5WlxKF7zzo5PfF443lBC29 XnzQ== 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; bh=15rT3kr3z6osLHbAzt/fcdvUpq9M9URxemKrLMPyEP4=; b=Yz/gsLtoD92Ff+yEIM2uDjzfTBLg/PXv1AyUt++e5ldvcbH2q63RuGRUk/SipcKGWp tOqIh2/jc3zoWwtAEoMZv6sCg93eEdb90R00lXyftD/SRidRl3EeV/hCsqTBkKjNorVk FnWLG1hFh6cxA2dzoYDbEwPNwChMP+ukxho5MF8TylS6SqO5FiG0ONit7lDE8S2MSHou zz5fZfyJbOdee+I4z+zWXwhJBPdxxrTB+azlR+V7XtdF+tPTsbPdTTi+jNLgBaHW1EDs eKI41s+RynJfWEZ2d/SWIq4m0TMTxbQj1aRkMW7di3JcvrxDrfDOnilZONIkWUvdFBxS wNlA== X-Gm-Message-State: APjAAAWys2vYP2vjTFinb56XTkL9TMnByAiWgJUJrpjXYcDtrWj2LqFZ w/DgKEXFR0Tw+svPFvA0Q3E6b53oh3WNoA== X-Google-Smtp-Source: APXvYqzF3vNWfQtQJ7ng0EVVX+yZMJvgjRCynFvuMcVdKU4p0nuI96v6u/6NpGSRQ5vWU2rM0lYySA== X-Received: by 2002:a62:5486:: with SMTP id i128mr74381394pfb.156.1560174598193; Mon, 10 Jun 2019 06:49:58 -0700 (PDT) From: Aarushi Mehta To: qemu-devel@nongnu.org Date: Mon, 10 Jun 2019 19:18:57 +0530 Message-Id: <20190610134905.22294-5-mehta.aaru20@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190610134905.22294-1-mehta.aaru20@gmail.com> References: <20190610134905.22294-1-mehta.aaru20@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::444 Subject: [Qemu-devel] [PATCH v5 04/12] block/io_uring: implements 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: Fam Zheng , Kevin Wolf , Sergio Lopez , qemu-block@nongnu.org, Markus Armbruster , Max Reitz , saket.sinha89@gmail.com, Stefan Hajnoczi , Paolo Bonzini , Maxim Levitsky , 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-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Aborts when sqe fails to be set as sqes cannot be returned to the ring. Signed-off-by: Aarushi Mehta --- MAINTAINERS | 7 + block/Makefile.objs | 3 + block/io_uring.c | 314 ++++++++++++++++++++++++++++++++++++++++ include/block/aio.h | 16 +- include/block/raw-aio.h | 12 ++ 5 files changed, 351 insertions(+), 1 deletion(-) create mode 100644 block/io_uring.c diff --git a/MAINTAINERS b/MAINTAINERS index 7be1225415..49f896796e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2516,6 +2516,13 @@ F: block/file-posix.c F: block/file-win32.c F: block/win32-aio.c =20 +Linux io_uring +M: Aarushi Mehta +R: Stefan Hajnoczi +L: qemu-block@nongnu.org +S: Maintained +F: block/io_uring.c + qcow2 M: Kevin Wolf M: Max Reitz diff --git a/block/Makefile.objs b/block/Makefile.objs index ae11605c9f..8fde7a23a5 100644 --- a/block/Makefile.objs +++ b/block/Makefile.objs @@ -18,6 +18,7 @@ block-obj-y +=3D block-backend.o snapshot.o qapi.o block-obj-$(CONFIG_WIN32) +=3D file-win32.o win32-aio.o block-obj-$(CONFIG_POSIX) +=3D file-posix.o block-obj-$(CONFIG_LINUX_AIO) +=3D linux-aio.o +block-obj-$(CONFIG_LINUX_IO_URING) +=3D io_uring.o block-obj-y +=3D null.o mirror.o commit.o io.o create.o block-obj-y +=3D throttle-groups.o block-obj-$(CONFIG_LINUX) +=3D nvme.o @@ -61,5 +62,7 @@ block-obj-$(if $(CONFIG_LZFSE),m,n) +=3D dmg-lzfse.o dmg-lzfse.o-libs :=3D $(LZFSE_LIBS) qcow.o-libs :=3D -lz linux-aio.o-libs :=3D -laio +io_uring.o-cflags :=3D $(LINUX_IO_URING_CFLAGS) +io_uring.o-libs :=3D $(LINUX_IO_URING_LIBS) parallels.o-cflags :=3D $(LIBXML2_CFLAGS) parallels.o-libs :=3D $(LIBXML2_LIBS) diff --git a/block/io_uring.c b/block/io_uring.c new file mode 100644 index 0000000000..f327c7ef96 --- /dev/null +++ b/block/io_uring.c @@ -0,0 +1,314 @@ +/* + * Linux io_uring support. + * + * Copyright (C) 2009 IBM, Corp. + * Copyright (C) 2009 Red Hat, Inc. + * Copyright (C) 2019 Aarushi Mehta + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ +#include "qemu/osdep.h" +#include +#include "qemu-common.h" +#include "block/aio.h" +#include "qemu/queue.h" +#include "block/block.h" +#include "block/raw-aio.h" +#include "qemu/coroutine.h" +#include "qapi/error.h" + +#define MAX_EVENTS 128 + +typedef struct LuringAIOCB { + Coroutine *co; + struct io_uring_sqe sqeq; + ssize_t ret; + QEMUIOVector *qiov; + bool is_read; + QSIMPLEQ_ENTRY(LuringAIOCB) next; +} LuringAIOCB; + +typedef struct LuringQueue { + int plugged; + unsigned int in_queue; + unsigned int in_flight; + bool blocked; + QSIMPLEQ_HEAD(, LuringAIOCB) sq_overflow; +} LuringQueue; + +typedef struct LuringState { + AioContext *aio_context; + + struct io_uring ring; + + /* io queue for submit at batch. Protected by AioContext lock. */ + LuringQueue io_q; + + /* I/O completion processing. Only runs in I/O thread. */ + QEMUBH *completion_bh; +} LuringState; + +/** + * ioq_submit: + * @s: AIO state + * + * Queues pending sqes and submits them + * + */ +static int ioq_submit(LuringState *s); + +/** + * qemu_luring_process_completions: + * @s: AIO state + * + * Fetches completed I/O requests, consumes cqes and invokes their callbac= ks. + * + */ +static void qemu_luring_process_completions(LuringState *s) +{ + struct io_uring_cqe *cqes; + int ret; + + /* + * Request completion callbacks can run the nested event loop. + * Schedule ourselves so the nested event loop will "see" remaining + * completed requests and process them. Without this, completion + * callbacks that wait for other requests using a nested event loop + * would hang forever. + */ + qemu_bh_schedule(s->completion_bh); + + while (io_uring_peek_cqe(&s->ring, &cqes) =3D=3D 0) { + if (!cqes) { + break; + } + LuringAIOCB *luringcb =3D io_uring_cqe_get_data(cqes); + ret =3D cqes->res; + + if (ret =3D=3D luringcb->qiov->size) { + ret =3D 0; + } else if (ret >=3D 0) { + /* Short Read/Write */ + if (luringcb->is_read) { + /* Read, pad with zeroes */ + qemu_iovec_memset(luringcb->qiov, ret, 0, + luringcb->qiov->size - ret); + } else { + ret =3D -ENOSPC;; + } + } + luringcb->ret =3D ret; + + io_uring_cqe_seen(&s->ring, cqes); + cqes =3D NULL; + /* Change counters one-by-one because we can be nested. */ + s->io_q.in_flight--; + + /* + * If the coroutine is already entered it must be in ioq_submit() + * and will notice luringcb->ret has been filled in when it + * eventually runs later. Coroutines cannot be entered recursively + * so avoid doing that! + */ + if (!qemu_coroutine_entered(luringcb->co)) { + aio_co_wake(luringcb->co); + } + } + qemu_bh_cancel(s->completion_bh); +} + +static void qemu_luring_process_completions_and_submit(LuringState *s) +{ + aio_context_acquire(s->aio_context); + qemu_luring_process_completions(s); + + if (!s->io_q.plugged && s->io_q.in_queue > 0) { + ioq_submit(s); + } + aio_context_release(s->aio_context); +} + +static void qemu_luring_completion_bh(void *opaque) +{ + LuringState *s =3D opaque; + qemu_luring_process_completions_and_submit(s); +} + +static void qemu_luring_completion_cb(void *opaque) +{ + LuringState *s =3D opaque; + qemu_luring_process_completions_and_submit(s); +} + +static void ioq_init(LuringQueue *io_q) +{ + QSIMPLEQ_INIT(&io_q->sq_overflow); + io_q->plugged =3D 0; + io_q->in_queue =3D 0; + io_q->in_flight =3D 0; + io_q->blocked =3D false; +} + +static int ioq_submit(LuringState *s) +{ + int ret =3D 0; + LuringAIOCB *luringcb, *luringcb_next; + + while (s->io_q.in_queue > 0) { + QSIMPLEQ_FOREACH_SAFE(luringcb, &s->io_q.sq_overflow, next, + luringcb_next) { + struct io_uring_sqe *sqes =3D io_uring_get_sqe(&s->ring); + if (!sqes) { + break; + } + /* Prep sqe for submission */ + *sqes =3D luringcb->sqeq; + QSIMPLEQ_REMOVE_HEAD(&s->io_q.sq_overflow, next); + } + ret =3D io_uring_submit(&s->ring); + /* Prevent infinite loop if submission is refused */ + if (ret <=3D 0) { + if (ret =3D=3D -EAGAIN) { + continue; + } + break; + } + s->io_q.in_flight +=3D ret; + s->io_q.in_queue -=3D ret; + } + s->io_q.blocked =3D (s->io_q.in_queue > 0); + + if (s->io_q.in_flight) { + /* + * We can try to complete something just right away if there are + * still requests in-flight. + */ + qemu_luring_process_completions(s); + } + return ret; +} + +void luring_io_plug(BlockDriverState *bs, LuringState *s) +{ + s->io_q.plugged++; +} + +void luring_io_unplug(BlockDriverState *bs, LuringState *s) +{ + assert(s->io_q.plugged); + if (--s->io_q.plugged =3D=3D 0 && + !s->io_q.blocked && s->io_q.in_queue > 0) { + ioq_submit(s); + } +} + +/** + * luring_do_submit: + * @fd: file descriptor for I/O + * @luringcb: AIO control block + * @s: AIO state + * @offset: offset for request + * @type: type of request + * + * Fetches sqes from ring, adds to pending queue and preps them + * + */ +static int luring_do_submit(int fd, LuringAIOCB *luringcb, LuringState *s, + uint64_t offset, int type) +{ + struct io_uring_sqe *sqes =3D io_uring_get_sqe(&s->ring); + if (!sqes) { + sqes =3D &luringcb->sqeq; + QSIMPLEQ_INSERT_TAIL(&s->io_q.sq_overflow, luringcb, next); + } + + switch (type) { + case QEMU_AIO_WRITE: + io_uring_prep_writev(sqes, fd, luringcb->qiov->iov, + luringcb->qiov->niov, offset); + break; + case QEMU_AIO_READ: + io_uring_prep_readv(sqes, fd, luringcb->qiov->iov, + luringcb->qiov->niov, offset); + break; + case QEMU_AIO_FLUSH: + io_uring_prep_fsync(sqes, fd, 0); + break; + default: + fprintf(stderr, "%s: invalid AIO request type, aborting 0x%x.\n", + __func__, type); + abort(); + } + io_uring_sqe_set_data(sqes, luringcb); + s->io_q.in_queue++; + + 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); + } + return 0; +} + +int coroutine_fn luring_co_submit(BlockDriverState *bs, LuringState *s, in= t fd, + uint64_t offset, QEMUIOVector *qiov, int t= ype) +{ + int ret; + LuringAIOCB luringcb =3D { + .co =3D qemu_coroutine_self(), + .ret =3D -EINPROGRESS, + .qiov =3D qiov, + .is_read =3D (type =3D=3D QEMU_AIO_READ), + }; + + ret =3D luring_do_submit(fd, &luringcb, s, offset, type); + if (ret < 0) { + return ret; + } + + if (luringcb.ret =3D=3D -EINPROGRESS) { + qemu_coroutine_yield(); + } + return luringcb.ret; +} + +void luring_detach_aio_context(LuringState *s, AioContext *old_context) +{ + aio_set_fd_handler(old_context, s->ring.ring_fd, false, NULL, NULL, NU= LL, + s); + qemu_bh_delete(s->completion_bh); + s->aio_context =3D NULL; +} + +void luring_attach_aio_context(LuringState *s, AioContext *new_context) +{ + s->aio_context =3D new_context; + s->completion_bh =3D aio_bh_new(new_context, qemu_luring_completion_bh= , s); + aio_set_fd_handler(s->aio_context, s->ring.ring_fd, false, + qemu_luring_completion_cb, NULL, NULL, s); +} + +LuringState *luring_init(Error **errp) +{ + int rc; + LuringState *s; + s =3D g_malloc0(sizeof(*s)); + struct io_uring *ring =3D &s->ring; + rc =3D io_uring_queue_init(MAX_EVENTS, ring, 0); + if (rc < 0) { + error_setg_errno(errp, errno, "failed to init linux io_uring ring"= ); + g_free(s); + return NULL; + } + + ioq_init(&s->io_q); + return s; + +} + +void luring_cleanup(LuringState *s) +{ + io_uring_queue_exit(&s->ring); + g_free(s); +} diff --git a/include/block/aio.h b/include/block/aio.h index 0ca25dfec6..9da3fd9793 100644 --- a/include/block/aio.h +++ b/include/block/aio.h @@ -50,6 +50,7 @@ typedef void IOHandler(void *opaque); struct Coroutine; struct ThreadPool; struct LinuxAioState; +struct LuringState; =20 struct AioContext { GSource source; @@ -118,11 +119,19 @@ struct AioContext { struct ThreadPool *thread_pool; =20 #ifdef CONFIG_LINUX_AIO - /* State for native Linux AIO. Uses aio_context_acquire/release for + /* + * State for native Linux AIO. Uses aio_context_acquire/release for * locking. */ struct LinuxAioState *linux_aio; #endif +#ifdef CONFIG_LINUX_IO_URING + /* + * State for Linux io_uring. Uses aio_context_acquire/release for + * locking. + */ + struct LuringState *linux_io_uring; +#endif =20 /* TimerLists for calling timers - one per clock type. Has its own * locking. @@ -387,6 +396,11 @@ struct LinuxAioState *aio_setup_linux_aio(AioContext *= ctx, Error **errp); /* Return the LinuxAioState bound to this AioContext */ struct LinuxAioState *aio_get_linux_aio(AioContext *ctx); =20 +/* Setup the LuringState bound to this AioContext */ +struct LuringState *aio_setup_linux_io_uring(AioContext *ctx, Error **errp= ); + +/* Return the LuringState bound to this AioContext */ +struct LuringState *aio_get_linux_io_uring(AioContext *ctx); /** * aio_timer_new_with_attrs: * @ctx: the aio context diff --git a/include/block/raw-aio.h b/include/block/raw-aio.h index 0cb7cc74a2..71d7d1395f 100644 --- a/include/block/raw-aio.h +++ b/include/block/raw-aio.h @@ -55,6 +55,18 @@ void laio_attach_aio_context(LinuxAioState *s, AioContex= t *new_context); void laio_io_plug(BlockDriverState *bs, LinuxAioState *s); void laio_io_unplug(BlockDriverState *bs, LinuxAioState *s); #endif +/* io_uring.c - Linux io_uring implementation */ +#ifdef CONFIG_LINUX_IO_URING +typedef struct LuringState LuringState; +LuringState *luring_init(Error **errp); +void luring_cleanup(LuringState *s); +int coroutine_fn luring_co_submit(BlockDriverState *bs, LuringState *s, in= t fd, + uint64_t offset, QEMUIOVector *qiov, int t= ype); +void luring_detach_aio_context(LuringState *s, AioContext *old_context); +void luring_attach_aio_context(LuringState *s, AioContext *new_context); +void luring_io_plug(BlockDriverState *bs, LuringState *s); +void luring_io_unplug(BlockDriverState *bs, LuringState *s); +#endif =20 #ifdef _WIN32 typedef struct QEMUWin32AIOState QEMUWin32AIOState; --=20 2.17.1 From nobody Sun Feb 8 13:11:09 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=1560174906; cv=none; d=zoho.com; s=zohoarc; b=Vw3I4dUVDkHBLm2cAKMFE500ttNz4OHYeQhdp1xVWjIvCVnmcGIJJxeOYTE6pn8VRNcZp0lAu/pCoATDUk5iTuFC731DJNFkTBKVV4v5O+K/YO4MoFBun3Ay6H2XkBo+mLAtmcmcH9MIhGQWfJhB+AhhvJ2yovKp60lLSqk0Kvg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560174906; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=c7OL+TvejrK+J39mndDS6U2ikA3eTizaB36rrB9ZJvI=; b=EmZQeNJE2AGoifHMf8rHd+XuJN4/9SAd49RjyHcCX9spX6c9gYlJjEXRbWPCCfF74RAKtEaE9C5pP+5s4N3On2hlmHGl0n7dq4oO0z4UniLEvo2badghZns91/ABmXtNe2NsWTTUlo8dbybj5x5k0OG2ZO0VUzk7q813Dv8sN1M= 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1560174906618782.5818397114529; Mon, 10 Jun 2019 06:55:06 -0700 (PDT) Received: from localhost ([::1]:46742 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haKlH-0005nt-7q for importer@patchew.org; Mon, 10 Jun 2019 09:54:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51160) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haKgc-0008Qp-2w for qemu-devel@nongnu.org; Mon, 10 Jun 2019 09:50:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haKga-0001it-U8 for qemu-devel@nongnu.org; Mon, 10 Jun 2019 09:50:09 -0400 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]:44450) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haKga-0001he-OK; Mon, 10 Jun 2019 09:50:08 -0400 Received: by mail-pg1-x544.google.com with SMTP id n2so5072774pgp.11; Mon, 10 Jun 2019 06:50:06 -0700 (PDT) Received: from localhost.localdomain ([136.233.9.100]) by smtp.gmail.com with ESMTPSA id d4sm13969837pfc.149.2019.06.10.06.49.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Jun 2019 06:50:04 -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; bh=c7OL+TvejrK+J39mndDS6U2ikA3eTizaB36rrB9ZJvI=; b=LH1lcG4oVWqFJWS8E3b4H2aGCryFVZ3QxDmATzLkc128RQzYVEucsV5TeH05qmhm1o zDjB/6PuOWNd7uMorcyb4hq0lh0SWhnofFY/LxQIrNuF2Pw2eXncqeVYOby6yF0XjAr6 M3U66d1Gs8Cv4WcP7WkRXMY4MIiNVILgQ/cB5+tryVw3qlPWM2whuBsXZBohZR+ThtSF i/gAWiMKhgPazxqjHX6nx0f0Gud/+FByQmuwkMTcLe6VGvdowTIZwhByBFEKBSNs7IzV x6afVvqT4T2Tt8zYgFt150ugfExsqTR9fyjK16eWrF/pFWpGkRnoM5WaLYZuwOHWjLlc HPfA== 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; bh=c7OL+TvejrK+J39mndDS6U2ikA3eTizaB36rrB9ZJvI=; b=U9JQiOCqbWRU731PR2yTsqWTxyKkelA16HDPGW0BsNa7Osxh6LrQ/RhMya4ZnzDJGh yCsCWmLhKSq01zvmp/B2KmXGrem4KB72dchoEHAszMdEWzYTRYgQCjUEW6a+Sf4doAyH MfkQGZGua4uvpKa1PNacVx1N4ZWK/XvGOmJmkREb5jn1cuJe6CN+ECpY9nzOL0N1oxo6 J3DL1zkNOQNRysvv/4XBY5l1IbNE4HxuWrMGrJCtwMZHoI6rbleTQBwG1206jGZQmRJC f9qFahwIKjbmPfmo0BOoRBy7ZuJmzZqyi7TL4dgY/tTU8+jIBD09T6x22yh7/+P/f18q e62w== X-Gm-Message-State: APjAAAUCgh5q4SkHzRFw7NB4mayDgtBg452nSoeUgBqSBSIpoLQbcsmd tFIzgH7WsVO245iii1NhBCoo967p/ClW7Q== X-Google-Smtp-Source: APXvYqw6jVJDVEmk6+UrSqnPoxHEaEqj5MqJBStBCjp32swIaq3aYZuCU8eeCj+OtcR4sOyiN/D21A== X-Received: by 2002:aa7:956d:: with SMTP id x13mr35258432pfq.132.1560174605239; Mon, 10 Jun 2019 06:50:05 -0700 (PDT) From: Aarushi Mehta To: qemu-devel@nongnu.org Date: Mon, 10 Jun 2019 19:18:58 +0530 Message-Id: <20190610134905.22294-6-mehta.aaru20@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190610134905.22294-1-mehta.aaru20@gmail.com> References: <20190610134905.22294-1-mehta.aaru20@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::544 Subject: [Qemu-devel] [PATCH v5 05/12] stubs: add stubs for io_uring interface 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 , Sergio Lopez , qemu-block@nongnu.org, Markus Armbruster , Max Reitz , saket.sinha89@gmail.com, Stefan Hajnoczi , Paolo Bonzini , Maxim Levitsky , 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-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Aarushi Mehta Reviewed-by: Stefan Hajnoczi --- MAINTAINERS | 1 + stubs/Makefile.objs | 1 + stubs/io_uring.c | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 stubs/io_uring.c diff --git a/MAINTAINERS b/MAINTAINERS index 49f896796e..bc38175124 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2522,6 +2522,7 @@ R: Stefan Hajnoczi L: qemu-block@nongnu.org S: Maintained F: block/io_uring.c +F: stubs/io_uring.c =20 qcow2 M: Kevin Wolf diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs index 9c7393b08c..5cf160a9c8 100644 --- a/stubs/Makefile.objs +++ b/stubs/Makefile.objs @@ -13,6 +13,7 @@ stub-obj-y +=3D iothread.o stub-obj-y +=3D iothread-lock.o stub-obj-y +=3D is-daemonized.o stub-obj-$(CONFIG_LINUX_AIO) +=3D linux-aio.o +stub-obj-$(CONFIG_LINUX_IO_URING) +=3D io_uring.o stub-obj-y +=3D machine-init-done.o stub-obj-y +=3D migr-blocker.o stub-obj-y +=3D change-state-handler.o diff --git a/stubs/io_uring.c b/stubs/io_uring.c new file mode 100644 index 0000000000..622d1e4648 --- /dev/null +++ b/stubs/io_uring.c @@ -0,0 +1,32 @@ +/* + * Linux io_uring support. + * + * Copyright (C) 2009 IBM, Corp. + * Copyright (C) 2009 Red Hat, Inc. + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ +#include "qemu/osdep.h" +#include "block/aio.h" +#include "block/raw-aio.h" + +void luring_detach_aio_context(LuringState *s, AioContext *old_context) +{ + abort(); +} + +void luring_attach_aio_context(LuringState *s, AioContext *new_context) +{ + abort(); +} + +LuringState *luring_init(Error **errp) +{ + abort(); +} + +void luring_cleanup(LuringState *s) +{ + abort(); +} --=20 2.17.1 From nobody Sun Feb 8 13:11:09 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=1560175167; cv=none; d=zoho.com; s=zohoarc; b=dcxZcBaxaGTnzTU3Xh4n07wbnZnGei5fgNg4M6pkIyJtNcKmT+9isPbJkuMFcgqCR/Ce2s43Vj57hpAW30PEdQQKyAnQy+42uwDFqWLD/btqEc+nJSPJ3hPXEDhSvrgtv6NJtkLTRAGFpbvRByYlcB2xIxj3QszYp1GYiq7PRnY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560175167; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=2n2TNPYPU066kE92JQNbBm7Ypw4YV4ofgNfP3dVPw+E=; b=NaTst0eskDERL1KYY94cmnVwLW7g4M/TXsGT++mBa8DoAsr/HZwAj92dCXIVDc1J3oN7xQ2cHSwvjFC627bUnE2VZ5Qsht5VmzCP5LY+sF3psMAOMQUrSmxU59+XXMlSHuzh4WcYkXfTwE9ef5DZG/4Y0LuTU5kX7ckxlAqkJyE= 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 1560175167745390.1142694046698; Mon, 10 Jun 2019 06:59:27 -0700 (PDT) Received: from localhost ([::1]:46786 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haKpW-0001Pv-5V for importer@patchew.org; Mon, 10 Jun 2019 09:59:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51267) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haKgh-0000Dm-3F for qemu-devel@nongnu.org; Mon, 10 Jun 2019 09:50:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haKgg-0001rd-2R for qemu-devel@nongnu.org; Mon, 10 Jun 2019 09:50:15 -0400 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]:39797) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haKgf-0001pY-Sf; Mon, 10 Jun 2019 09:50:14 -0400 Received: by mail-pl1-x644.google.com with SMTP id g9so3693286plm.6; Mon, 10 Jun 2019 06:50:13 -0700 (PDT) Received: from localhost.localdomain ([136.233.9.100]) by smtp.gmail.com with ESMTPSA id d4sm13969837pfc.149.2019.06.10.06.50.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Jun 2019 06:50:11 -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; bh=2n2TNPYPU066kE92JQNbBm7Ypw4YV4ofgNfP3dVPw+E=; b=OXRog9PsOSiWar8mHFlYwMqgg4OWgzV29N1Ng2Tf4KPhGk7W005Bq0+hao+Jl3AWTe SNfKyRhHFpcLlMLG8WHKrWAJlNhcC0k3H0Ba4nERvtpznsCQkNyyyv8gNtKrZMCt1hne w24XN9Hp/ii7KBSXlpJzQdwhf/xx6ShvQf0MCjsmMflOxYgigBKDS+LWCV+cVbkbpjmV G2aEV4jVgbl04z01IUpj7QuUGu9FcbSWlfjnHxe3qEPtJQRgGXxpcibTVNtHWVv3rnOo VhEuhMSWhwQMG61GsR6T6sLADxf++MMqHz9AV9nSKinoTKAVaUB+lxaJW6DE33OHkLGk kzQA== 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; bh=2n2TNPYPU066kE92JQNbBm7Ypw4YV4ofgNfP3dVPw+E=; b=epnehyGwnDXyj0sws2UfNPX5SToNdRRo6HtWsHKgIrZv9rQrGOItLL+MGjv1u/ZPVT aDNg0HOyu8/jcdLojJIL/gPI0WX+84P9ViOv8hv3lWyax6GAfQfuULlowu9/moDqsQ5w OAi0RzUuowaQTS0kUlaOvWN1Ykvb6bz0VIWQ+TkiJOg0c4D3qyL61oHlRd++1WIJO0dF SvqjhyeYknQXiqw1soMCOc9EkXL7a5zFubjg//j2JVWrBCUohzT/K4qeCHH5NJe/NKVc DFOvaRYNvZAliBsasA6/XRRyrVCNgoNHBGjk5YzEEED+FaXxaBwzTFOs9Phn1PfrCmeL WD1A== X-Gm-Message-State: APjAAAWIZXJtr3HMKERdEp981ZUh+9yZzuS4OmhytWF1QfXuA+r0grJM r6bv0J0A/1yzm6uPwOLMjFHE9tuyE2bW6g== X-Google-Smtp-Source: APXvYqzXL9yyBh5rQ/W7v841l8yeIi+4F8SMNKkf65OSRrIHS04MWNEYde3LBkPQuIV4+DR5j3c1wA== X-Received: by 2002:a17:902:2889:: with SMTP id f9mr23825514plb.230.1560174612354; Mon, 10 Jun 2019 06:50:12 -0700 (PDT) From: Aarushi Mehta To: qemu-devel@nongnu.org Date: Mon, 10 Jun 2019 19:18:59 +0530 Message-Id: <20190610134905.22294-7-mehta.aaru20@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190610134905.22294-1-mehta.aaru20@gmail.com> References: <20190610134905.22294-1-mehta.aaru20@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::644 Subject: [Qemu-devel] [PATCH v5 06/12] 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: Fam Zheng , Kevin Wolf , Sergio Lopez , qemu-block@nongnu.org, Markus Armbruster , Max Reitz , saket.sinha89@gmail.com, Stefan Hajnoczi , Paolo Bonzini , Maxim Levitsky , 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-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Aarushi Mehta Reviewed-by: Stefan Hajnoczi Reviewed-by: Maxim Levitsky --- util/async.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/util/async.c b/util/async.c index c10642a385..2709f0edc3 100644 --- a/util/async.c +++ b/util/async.c @@ -277,6 +277,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 @@ -341,6 +349,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 @@ -432,6 +463,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.17.1 From nobody Sun Feb 8 13:11:09 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=1560175266; cv=none; d=zoho.com; s=zohoarc; b=Qx8IIuFMyFb66kZ4LsD1JHJOkhenpAoCk+mb41DNGW5oTrl4ytAo361TYLBCWdpJUjUyMW7zgN/JTsD0GescLOb88SwtKQ9zNKdRmtQ25GdbPQtf04VH7nqeFC/XGomUCI9q9m98pDPLL5wZdx+HuCPO/9mZVBqRkR2QDUSoIdw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560175266; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=92hTvf/vcv0m1TMyr6r0QhwXroAf5xu/zM543QmX6EI=; b=UZwGC0Bd/8pBNfuy+lT8Z9+V57erOUgJGHCLtjBMKspx9my8XG8pAHZyvE/8CRwUbClGmVMglP30Pck1AU2pJb+Ojb4vwp8RxShg6a//qfwO5lnL2uwcnR/wMZekgHXX4vqrGG3hpGq2E5PkAsLAVgYUZUVAIrokzuwZgNvWeb0= 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 1560175266660172.02985928242992; Mon, 10 Jun 2019 07:01:06 -0700 (PDT) Received: from localhost ([::1]:46792 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haKrB-0002WO-Jd for importer@patchew.org; Mon, 10 Jun 2019 10:01:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51331) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haKgu-0000KR-2W for qemu-devel@nongnu.org; Mon, 10 Jun 2019 09:50:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haKgn-00025M-3F for qemu-devel@nongnu.org; Mon, 10 Jun 2019 09:50:24 -0400 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]:35564) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haKgm-00024h-TB; Mon, 10 Jun 2019 09:50:21 -0400 Received: by mail-pl1-x641.google.com with SMTP id p1so3700710plo.2; Mon, 10 Jun 2019 06:50:20 -0700 (PDT) Received: from localhost.localdomain ([136.233.9.100]) by smtp.gmail.com with ESMTPSA id d4sm13969837pfc.149.2019.06.10.06.50.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Jun 2019 06:50:18 -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; bh=92hTvf/vcv0m1TMyr6r0QhwXroAf5xu/zM543QmX6EI=; b=UOK69WlqP/6YjDPO7cp+NSaHQJqzXSNKmx+0wZxMGBgPiJ+VtV+j5GUNx907tvn03f IgvHbGx1bBmEBqq87ziWYKIPn3OuZXdKia3uz+eDDxRa6JwuOf588IVBSEZSQ5ImSDnl +fDfSMHmLTHw5mXUmejA5TfHr9SE87YcTGFSA7mx0nsZjVcQAY0tddgDZE/E2wW7qNyU fmS3tEL+rlD98fnBZP3KAs6JwfWJXHww2v1kap2c1zFhkIZ+2bVmir4LtxjCAf1IDtQH CUcW/TNJm8pSQepkg28D+aYUM8gYvF3IHzK5ihXq/pG+t0qvgUIpXqbL1nwqQRn9iACZ yC/A== 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; bh=92hTvf/vcv0m1TMyr6r0QhwXroAf5xu/zM543QmX6EI=; b=gBFakiTCfrUzTzSwMEWRWdgkfR2rYM3g5Cto3y8WcWu+RB4VRK2eVLKb7AAGbtZfyZ U9NCRmq5UM/xzpYcgdxk+ePvJvnTeAD7kF8uJSeE81TX+O8eztrqXcTNkUpmxWpsf7OH xKJ2hNCtqnIWE5LD+tfQ/PluCCPBUPvq4txE4IldrUt12aalLydUSf28omhIQ3cobzyo lLlwoxkAdsMiMxWOjP8nqIFxKcPO7Zu1uSiHY3OIxuJCXkG49WJuNLlbNl3tWVt91qFu imeSAl/Yc/zGBG0l/pHE1tW8OLmLqK0RNxaNwV4xhGY1l1rDdK4OxKEb1Nfc9yLLU7iu F5Pw== X-Gm-Message-State: APjAAAWlxtmsiCwmTk2KSZX/lnqmsP7RHgHIPYphZai3z7KojXmJg4ZL vYKS+mbLxt1AJn1Cy9XQZQaRy5KeeKiGyQ== X-Google-Smtp-Source: APXvYqx2ci4VwkOfQ5iyAukA//5QDPtgyf8PLYyIRBxiRIGDG7GRn1r/xY/Jy9l8hqb7l9hQPg880A== X-Received: by 2002:a17:902:848c:: with SMTP id c12mr69560703plo.17.1560174618934; Mon, 10 Jun 2019 06:50:18 -0700 (PDT) From: Aarushi Mehta To: qemu-devel@nongnu.org Date: Mon, 10 Jun 2019 19:19:00 +0530 Message-Id: <20190610134905.22294-8-mehta.aaru20@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190610134905.22294-1-mehta.aaru20@gmail.com> References: <20190610134905.22294-1-mehta.aaru20@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::641 Subject: [Qemu-devel] [PATCH v5 07/12] blockdev: accept io_uring as option 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 , Sergio Lopez , qemu-block@nongnu.org, Markus Armbruster , Max Reitz , saket.sinha89@gmail.com, Stefan Hajnoczi , Paolo Bonzini , Maxim Levitsky , 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-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Aarushi Mehta Reviewed-by: Stefan Hajnoczi Reviewed-by: Maxim Levitsky --- blockdev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/blockdev.c b/blockdev.c index 3f44b891eb..a2a5b32604 100644 --- a/blockdev.c +++ b/blockdev.c @@ -386,6 +386,8 @@ static void extract_common_blockdev_options(QemuOpts *o= pts, int *bdrv_flags, if ((aio =3D qemu_opt_get(opts, "aio")) !=3D NULL) { if (!strcmp(aio, "native")) { *bdrv_flags |=3D BDRV_O_NATIVE_AIO; + } else if (!strcmp(aio, "io_uring")) { + *bdrv_flags |=3D BDRV_O_IO_URING; } else if (!strcmp(aio, "threads")) { /* this is the default */ } else { @@ -4579,7 +4581,7 @@ QemuOptsList qemu_common_drive_opts =3D { },{ .name =3D "aio", .type =3D QEMU_OPT_STRING, - .help =3D "host AIO implementation (threads, native)", + .help =3D "host AIO implementation (threads, native, io_uring)= ", },{ .name =3D BDRV_OPT_CACHE_WB, .type =3D QEMU_OPT_BOOL, --=20 2.17.1 From nobody Sun Feb 8 13:11:09 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=1560175176; cv=none; d=zoho.com; s=zohoarc; b=IRt4dQUzmAi/VqAW+kLUb+GvX2waZHtVmCp2wglQ1zU0iWMaVaJS1uQ+grfniyerFRCSnL1FkfdX4TFH399S46R0KjQElPIwO5uxT58Ln1iQlus3xYH1vBqRV+Z+/94AVxtYqMJ3rgk3zF+1KiK2UgjK8RbA5yKR4oM150mYNbw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560175176; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=BkrqkXKw+QojOLRD6HxRpYEmbe+jRwaGL11dLaGKZ5o=; b=VNl/C2rvsw53TseEiiyZ8mlXebOj4IfFvBH0QOv/nA0XcR8aXG7tZZmHvHOdu71JBCYXlG1IfHecjqx6b7ybcsFfK5AQ4z6At0nTeiHcuPiYu/nCTgAoAIzzMmr4NPaPaPDnxEOwK3VFMqLxp4JCQl4mrNCZxDG8a2Gt2386OfA= 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 1560175176201195.57645126176294; Mon, 10 Jun 2019 06:59:36 -0700 (PDT) Received: from localhost ([::1]:46790 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haKph-0001rZ-3I for importer@patchew.org; Mon, 10 Jun 2019 09:59:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51365) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haKh5-0000S3-9B for qemu-devel@nongnu.org; Mon, 10 Jun 2019 09:50:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haKh3-0002Ck-16 for qemu-devel@nongnu.org; Mon, 10 Jun 2019 09:50:39 -0400 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:35785) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haKgx-00027P-6e; Mon, 10 Jun 2019 09:50:33 -0400 Received: by mail-pf1-x441.google.com with SMTP id d126so5364297pfd.2; Mon, 10 Jun 2019 06:50:26 -0700 (PDT) Received: from localhost.localdomain ([136.233.9.100]) by smtp.gmail.com with ESMTPSA id d4sm13969837pfc.149.2019.06.10.06.50.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Jun 2019 06:50:25 -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; bh=BkrqkXKw+QojOLRD6HxRpYEmbe+jRwaGL11dLaGKZ5o=; b=W6bx19vM75M0ca6e2UTVcmIVqjofcKVti0vnXTCULtzXI5M03HYLmrwR4Ffidbzfkz 7Y8ezAfHO1VNv3F+JiFD7FGo69bL1ZSefUiq7NX9hvuQWVQMWQjzp2dJyxSpWyAWacv4 dsvJLEUaYFvHqN9UHxTDVzJKD+yrMbG0UyyNi1OKReuOZU9dCA4IUXRKjVgY04y9go/4 ayv9NDYNDOMrq/zeFb9gY/0lvKD80e0hWD5xUPOgCwVYtH7c9xkRLynFaIMIUtRucJQU oq/UfgQxajmn4861fJuuP4rEA9f2mpyRbKqui2uuCWHiwBeNgGqIaeSjaUcExcHQV1Ou FAuw== 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; bh=BkrqkXKw+QojOLRD6HxRpYEmbe+jRwaGL11dLaGKZ5o=; b=uAv1NDxiiuwCD+AnqOvmqdfAlsqB+ny5OnvepPIBprulpBXDnwupDigDf1YjwgRqIr Mm/NBJwnGbXuqnBIc2hqpI207CSiCZUr39U31yENkerLiRgZS7MsWc2nb8n1bixE0oMQ EXLk+9ihFuGtgaccbbkRU6sKvGe6RsGkxIaMb0uNbDNc4C/0i+B3OZQPExwGK9JdW+0Z 14AsZ+9N4L4Tcu5h3CQHC9/jt98NgRCUgnDFEY0mJaGPfnRql9rb2fdI035f3tCNSKxm awRRm3llayDnxZepmqQ8pVHRMkjNbnU5UQBb9B3JwbH+kGqM6szGge7m88L+5dlnXhr9 pQCg== X-Gm-Message-State: APjAAAVWav+57agPttK2mMSOp2Lm0ttYMvoZY4yMsU/ketnblsuw9ykR ekXnA3n25T6bWVXHGLJerbhM1B74traCSA== X-Google-Smtp-Source: APXvYqzMr81NSKc5yXFVkUdzOsVEGm9uEwQFiOk8aWEpb8i7b9gsRwHT0V9saw2qrhEuGml4/8rotw== X-Received: by 2002:a17:90a:2244:: with SMTP id c62mr5214620pje.29.1560174625653; Mon, 10 Jun 2019 06:50:25 -0700 (PDT) From: Aarushi Mehta To: qemu-devel@nongnu.org Date: Mon, 10 Jun 2019 19:19:01 +0530 Message-Id: <20190610134905.22294-9-mehta.aaru20@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190610134905.22294-1-mehta.aaru20@gmail.com> References: <20190610134905.22294-1-mehta.aaru20@gmail.com> 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 v5 08/12] block/file-posix.c: extend to use 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 , Sergio Lopez , qemu-block@nongnu.org, Markus Armbruster , Max Reitz , saket.sinha89@gmail.com, Stefan Hajnoczi , Paolo Bonzini , Maxim Levitsky , 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-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Aarushi Mehta Reviewed-by: Maxim Levitsky --- block/file-posix.c | 85 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 69 insertions(+), 16 deletions(-) diff --git a/block/file-posix.c b/block/file-posix.c index d018429672..211dfe5337 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -154,6 +154,7 @@ typedef struct BDRVRawState { bool has_write_zeroes:1; bool discard_zeroes:1; bool use_linux_aio:1; + bool use_linux_io_uring:1; bool page_cache_inconsistent:1; bool has_fallocate; bool needs_alignment; @@ -423,7 +424,7 @@ static QemuOptsList raw_runtime_opts =3D { { .name =3D "aio", .type =3D QEMU_OPT_STRING, - .help =3D "host AIO implementation (threads, native)", + .help =3D "host AIO implementation (threads, native, io_uring)= ", }, { .name =3D "locking", @@ -482,9 +483,15 @@ static int raw_open_common(BlockDriverState *bs, QDict= *options, goto fail; } =20 - aio_default =3D (bdrv_flags & BDRV_O_NATIVE_AIO) - ? BLOCKDEV_AIO_OPTIONS_NATIVE - : BLOCKDEV_AIO_OPTIONS_THREADS; + if (bdrv_flags & BDRV_O_NATIVE_AIO) { + aio_default =3D BLOCKDEV_AIO_OPTIONS_NATIVE; +#ifdef CONFIG_LINUX_IO_URING + } else if (bdrv_flags & BDRV_O_IO_URING) { + aio_default =3D BLOCKDEV_AIO_OPTIONS_IO_URING; +#endif + } else { + aio_default =3D BLOCKDEV_AIO_OPTIONS_THREADS; + } aio =3D qapi_enum_parse(&BlockdevAioOptions_lookup, qemu_opt_get(opts, "aio"), aio_default, &local_err); @@ -493,7 +500,11 @@ static int raw_open_common(BlockDriverState *bs, QDict= *options, ret =3D -EINVAL; goto fail; } + s->use_linux_aio =3D (aio =3D=3D BLOCKDEV_AIO_OPTIONS_NATIVE); +#ifdef CONFIG_LINUX_IO_URING + s->use_linux_io_uring =3D (aio =3D=3D BLOCKDEV_AIO_OPTIONS_IO_URING); +#endif =20 locking =3D qapi_enum_parse(&OnOffAuto_lookup, qemu_opt_get(opts, "locking"), @@ -557,7 +568,7 @@ static int raw_open_common(BlockDriverState *bs, QDict = *options, s->shared_perm =3D BLK_PERM_ALL; =20 #ifdef CONFIG_LINUX_AIO - /* Currently Linux does AIO only for files opened with O_DIRECT */ + /* Currently Linux does AIO only for files opened with O_DIRECT */ if (s->use_linux_aio) { if (!(s->open_flags & O_DIRECT)) { error_setg(errp, "aio=3Dnative was specified, but it requires " @@ -579,6 +590,22 @@ static int raw_open_common(BlockDriverState *bs, QDict= *options, } #endif /* !defined(CONFIG_LINUX_AIO) */ =20 +#ifdef CONFIG_LINUX_IO_URING + if (s->use_linux_io_uring) { + if (!aio_setup_linux_io_uring(bdrv_get_aio_context(bs), errp)) { + error_prepend(errp, "Unable to use io_uring: "); + goto fail; + } + } +#else + if (s->use_linux_io_uring) { + error_setg(errp, "aio=3Dio_uring was specified, but is not support= ed " + "in this build."); + ret =3D -EINVAL; + goto fail; + } +#endif /* !defined(CONFIG_LINUX_IO_URING) */ + s->has_discard =3D true; s->has_write_zeroes =3D true; if ((bs->open_flags & BDRV_O_NOCACHE) !=3D 0) { @@ -1875,16 +1902,20 @@ static int coroutine_fn raw_co_prw(BlockDriverState= *bs, uint64_t offset, * If this is the case tell the low-level driver that it needs * to copy the buffer. */ - if (s->needs_alignment) { - if (!bdrv_qiov_is_aligned(bs, qiov)) { - type |=3D QEMU_AIO_MISALIGNED; + if (s->needs_alignment && !bdrv_qiov_is_aligned(bs, qiov)) { + type |=3D QEMU_AIO_MISALIGNED; +#ifdef CONFIG_LINUX_IO_URING + } else if (s->use_linux_io_uring) { + LuringState *aio =3D aio_get_linux_io_uring(bdrv_get_aio_context(b= s)); + assert(qiov->size =3D=3D bytes); + return luring_co_submit(bs, aio, s->fd, offset, qiov, type); +#endif #ifdef CONFIG_LINUX_AIO - } else if (s->use_linux_aio) { - LinuxAioState *aio =3D aio_get_linux_aio(bdrv_get_aio_context(= bs)); - assert(qiov->size =3D=3D bytes); - return laio_co_submit(bs, aio, s->fd, offset, qiov, type); + } else if (s->use_linux_aio && s->needs_alignment) { + LinuxAioState *aio =3D aio_get_linux_aio(bdrv_get_aio_context(bs)); + assert(qiov->size =3D=3D bytes); + return laio_co_submit(bs, aio, s->fd, offset, qiov, type); #endif - } } =20 acb =3D (RawPosixAIOData) { @@ -1920,24 +1951,36 @@ static int coroutine_fn raw_co_pwritev(BlockDriverS= tate *bs, uint64_t offset, =20 static void raw_aio_plug(BlockDriverState *bs) { + BDRVRawState __attribute__((unused)) *s =3D bs->opaque; #ifdef CONFIG_LINUX_AIO - BDRVRawState *s =3D bs->opaque; if (s->use_linux_aio) { LinuxAioState *aio =3D aio_get_linux_aio(bdrv_get_aio_context(bs)); laio_io_plug(bs, aio); } #endif +#ifdef CONFIG_LINUX_IO_URING + if (s->use_linux_io_uring) { + LuringState *aio =3D aio_get_linux_io_uring(bdrv_get_aio_context(b= s)); + luring_io_plug(bs, aio); + } +#endif } =20 static void raw_aio_unplug(BlockDriverState *bs) { + BDRVRawState __attribute__((unused)) *s =3D bs->opaque; #ifdef CONFIG_LINUX_AIO - BDRVRawState *s =3D bs->opaque; if (s->use_linux_aio) { LinuxAioState *aio =3D aio_get_linux_aio(bdrv_get_aio_context(bs)); laio_io_unplug(bs, aio); } #endif +#ifdef CONFIG_LINUX_IO_URING + if (s->use_linux_io_uring) { + LuringState *aio =3D aio_get_linux_io_uring(bdrv_get_aio_context(b= s)); + luring_io_unplug(bs, aio); + } +#endif } =20 static int raw_co_flush_to_disk(BlockDriverState *bs) @@ -1963,8 +2006,8 @@ static int raw_co_flush_to_disk(BlockDriverState *bs) static void raw_aio_attach_aio_context(BlockDriverState *bs, AioContext *new_context) { + BDRVRawState __attribute__((unused)) *s =3D bs->opaque; #ifdef CONFIG_LINUX_AIO - BDRVRawState *s =3D bs->opaque; if (s->use_linux_aio) { Error *local_err; if (!aio_setup_linux_aio(new_context, &local_err)) { @@ -1974,6 +2017,16 @@ static void raw_aio_attach_aio_context(BlockDriverSt= ate *bs, } } #endif +#ifdef CONFIG_LINUX_IO_URING + if (s->use_linux_io_uring) { + Error *local_err; + if (!aio_setup_linux_io_uring(new_context, &local_err)) { + error_reportf_err(local_err, "Unable to use linux io_uring, " + "falling back to thread pool: "); + s->use_linux_io_uring =3D false; + } + } +#endif } =20 static void raw_close(BlockDriverState *bs) --=20 2.17.1 From nobody Sun Feb 8 13:11:09 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=1560175168; cv=none; d=zoho.com; s=zohoarc; b=E8UwBKrh++Rw2N7bmQSmwBXnq0tMn3khr/ozBOg9H7n0I8wM0On7zkP6z4ekQU5LHcDRk5UdOMYonxBHL0CffJSfepgpF5tssNz4cYZYNwt9kmGm/C6DK2Ip4RnU6/ihpKWTCbfMnSgG+ky20tp1WSK5ntKObl22pYrWDV1UVTs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560175168; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=vDO5Ye23yozG3b4R1EbS2QLkzaqorKA/jm8V7Qr1Jtg=; b=QxlX76xb0vhqE8P+/IRxBRJjKpetFvBNA0H6o8gfmVj9m/46s1NZbDuMay97hk049QfWFY6iIueNFV85PxCzGbuTau/Szm9RA41/V4od42B+ESkADKd8LrnA6b7DpSFujGxRvTWewHXJw26La7ghTbZwg5+rpnyfafWOs7rJTMM= 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 15601751686222.1481918568189258; Mon, 10 Jun 2019 06:59:28 -0700 (PDT) Received: from localhost ([::1]:46789 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haKpZ-0001Xf-Gd for importer@patchew.org; Mon, 10 Jun 2019 09:59:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51400) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haKh8-0000Vy-4A for qemu-devel@nongnu.org; Mon, 10 Jun 2019 09:50:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haKh5-0002EF-8L for qemu-devel@nongnu.org; Mon, 10 Jun 2019 09:50:41 -0400 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]:33504) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haKh4-0002B5-6y; Mon, 10 Jun 2019 09:50:39 -0400 Received: by mail-pg1-x541.google.com with SMTP id k187so4592321pga.0; Mon, 10 Jun 2019 06:50:33 -0700 (PDT) Received: from localhost.localdomain ([136.233.9.100]) by smtp.gmail.com with ESMTPSA id d4sm13969837pfc.149.2019.06.10.06.50.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Jun 2019 06:50:31 -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; bh=vDO5Ye23yozG3b4R1EbS2QLkzaqorKA/jm8V7Qr1Jtg=; b=l8tB8QfjFkx6HUbMjkiM8FAVD6W9b2pgnNgdYCS1njuGAzn9S90X7t8AJfst6w0kul UJz6yJc4yY7qStjJmOH6ubuBot21NhvEmiHxOrtnbDEaIT5Z1A4+fKrAAgTgvkMaGTc+ I8QvXTtY0LPCvCh+EXtFUBeHuVcLUuD5LWMp5mOqdFZQA12UI2knqATDETNnOqjeXWE9 rHEoNf0vGtx3EHP8kcxDQdj3l/Nrd2hhcyc8Yt8nx4Cws/9K+YeuF5g71v05b2TJ/vj+ 5smuOKH+uAMbPicutMPwHxDt2qlHWD6hKm60yHB1Df1g1F8W5Tp6SzqojcoxXmwa78tv ydgg== 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; bh=vDO5Ye23yozG3b4R1EbS2QLkzaqorKA/jm8V7Qr1Jtg=; b=oImarehvpIKet4c4i3asB75RQ9yX7Q9M5TAyaV+BwaAi9YajZcfIJJ9Hra2KwfriKc EMHpv5erqr38pU/hOlOBlF7wukThfsVRgaV/LEiEMQ0GUs30rh+WU2xjw/wWclaDGyDG uu9SOU+9OxdeATI1NFZMzi262ddXxo5gDLx7bUILIWPTQolM30DhHX60IwHkD2oI4GfD B6e2RgfIIYfA9b4Hm3mgQCxMR6jdNhmMAJDIq8F81NId88E6q3Fzo2QBGP/yar5WzRSG 1BYsDXFxB7PG5AEugQJ6qzCWBBhx2KGrr/rUNDMfDD0K7e/e3EOiS7IF0Em2d6cIaQCq gDLQ== X-Gm-Message-State: APjAAAV3l5erB7X3NHxKfDzxVDMTITXIJ6QrdVJRO1OSmd+5yIq214wB 9+mHKExAbCjH25GD/2wKJmrmec2lQs3IUQ== X-Google-Smtp-Source: APXvYqxTIxicu62wkb3SPpCoZ4S2v/V3tkxWEGO44BRvM9+JE/nTSZuV2qeqimVH+QuetIDPTiKxuQ== X-Received: by 2002:a62:5486:: with SMTP id i128mr74383752pfb.156.1560174632531; Mon, 10 Jun 2019 06:50:32 -0700 (PDT) From: Aarushi Mehta To: qemu-devel@nongnu.org Date: Mon, 10 Jun 2019 19:19:02 +0530 Message-Id: <20190610134905.22294-10-mehta.aaru20@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190610134905.22294-1-mehta.aaru20@gmail.com> References: <20190610134905.22294-1-mehta.aaru20@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::541 Subject: [Qemu-devel] [PATCH v5 09/12] 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 , Sergio Lopez , qemu-block@nongnu.org, Markus Armbruster , Max Reitz , saket.sinha89@gmail.com, Stefan Hajnoczi , Paolo Bonzini , Maxim Levitsky , 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-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Aarushi Mehta --- block/io_uring.c | 14 ++++++++++++-- block/trace-events | 8 ++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/block/io_uring.c b/block/io_uring.c index f327c7ef96..47e027364a 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 @@ -191,12 +192,15 @@ static int ioq_submit(LuringState *s) =20 void luring_io_plug(BlockDriverState *bs, LuringState *s) { + trace_luring_io_plug(); s->io_q.plugged++; } =20 void luring_io_unplug(BlockDriverState *bs, LuringState *s) { assert(s->io_q.plugged); + trace_luring_io_unplug(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); @@ -217,6 +221,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 io_uring_get_sqe(&s->ring); if (!sqes) { sqes =3D &luringcb->sqeq; @@ -242,11 +247,14 @@ static int luring_do_submit(int fd, LuringAIOCB *luri= ngcb, LuringState *s, } io_uring_sqe_set_data(sqes, luringcb); s->io_q.in_queue++; - + trace_luring_do_submit(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(ret); + return ret; } return 0; } @@ -294,6 +302,7 @@ LuringState *luring_init(Error **errp) int rc; LuringState *s; s =3D g_malloc0(sizeof(*s)); + trace_luring_init_state((void *)s, sizeof(*s)); struct io_uring *ring =3D &s->ring; rc =3D io_uring_queue_init(MAX_EVENTS, ring, 0); if (rc < 0) { @@ -311,4 +320,5 @@ void luring_cleanup(LuringState *s) { io_uring_queue_exit(&s->ring); g_free(s); + trace_luring_cleanup_state(); } diff --git a/block/trace-events b/block/trace-events index eab51497fc..c4564dcd96 100644 --- a/block/trace-events +++ b/block/trace-events @@ -60,6 +60,14 @@ qmp_block_stream(void *bs, void *job) "bs %p job %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 freed" +disable luring_io_plug(void) "plug" +disable luring_io_unplug(int blocked, int plugged, int queued, int infligh= t) "blocked %d plugged %d queued %d inflight %d" +disable luring_do_submit(int blocked, int plugged, int queued, int infligh= t) "blocked %d plugged %d queued %d inflight %d" +disable luring_do_submit_done(int ret) "submitted to kernel %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.17.1 From nobody Sun Feb 8 13:11:09 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=1560175456; cv=none; d=zoho.com; s=zohoarc; b=XFBdh4YpiYeW0KpuvGWolJxuAAnAs4zKo3t0cZ9Bj2MkWbBCcJ+1hIpEOr0qXmN9LltHe+ooVbOwOG6gZm8XFRRq/F7CL8ccI95kqueT59EPmnq0yLzbGg91kaR7bYck11HjwjbtTHu7B6a1r5C9mFWdHXZNazPMl2dSohopoEY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560175456; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=o+uM06rvMbdh1mlRNjE9NFq4RfqKiUInPHeg9BdV1ww=; b=VMucaRPTf/5P20PdgMalERT3mECQdber8xvEbTuKK2Ih1bxMgtAUp7Qtz3juSYFTnPaZ7sFpM1vQ9CUApAmrvXjep8FbqlGufcT+BJlpJamfHIt11Fj0Y9v+2yIxmnPGa2ZCMYOPZGugoD76UCY5/cJ2BnNL3XbGYod6OHiFpS4= 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1560175456796410.83211201298695; Mon, 10 Jun 2019 07:04:16 -0700 (PDT) Received: from localhost ([::1]:46860 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haKu7-0005Ya-KR for importer@patchew.org; Mon, 10 Jun 2019 10:04:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51435) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haKh9-0000Zz-BI for qemu-devel@nongnu.org; Mon, 10 Jun 2019 09:50:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haKh8-0002GR-AD for qemu-devel@nongnu.org; Mon, 10 Jun 2019 09:50:43 -0400 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:38660) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haKh8-0002F9-3H; Mon, 10 Jun 2019 09:50:42 -0400 Received: by mail-pf1-x441.google.com with SMTP id a186so5356895pfa.5; Mon, 10 Jun 2019 06:50:40 -0700 (PDT) Received: from localhost.localdomain ([136.233.9.100]) by smtp.gmail.com with ESMTPSA id d4sm13969837pfc.149.2019.06.10.06.50.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Jun 2019 06:50:38 -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; bh=o+uM06rvMbdh1mlRNjE9NFq4RfqKiUInPHeg9BdV1ww=; b=sWcwANlxkiIS1HHnjfpvVh2SHIXdKz7v4WYAQGefrMVv8z3dLxF2vlD9+QgEMjE4Gc UraFeqoYTx5jQk2HyQSzlpcTdshGvga8+MQJHTDo3JMqypz6g7K/Q0mE3IKugl91n84n 0VrUiaMo1Q15xzCsWggg8ik4iXTclyKKbt+iWJTbZRv2EJrCQT4/yCcvyUsgDij0kgJY SrQ1bgyin/ipYcb82LYSbEeocweORFwz273rbetWGDK1NxMVuEDDOMKtjbI3wpo3XHSC VQ7yHv8OI0WbfKu2vNtN7DRXJuRbLyFgmz1quTsU2N9QtLXWGj0ZW0Ps7Y9Rcp6zHD5V 18Rw== 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; bh=o+uM06rvMbdh1mlRNjE9NFq4RfqKiUInPHeg9BdV1ww=; b=DuzLMux9bP+Dg18tFW+qH0xJamAfYuDlj4YHVCCqkWWzQlSYc0s8qJKGCwWa8QXIBD 3H6uTjz0y/u23zovbplcBjGi50DzUvbPzUgqicxfA+3VcbUQFN/5G+IWw1bajF0lR3kw 6Jx/TJ/L3KzWPtQ1crVUYeT4NYAKsU6wd/HryxpqgKW4TQ1GfLIQfZFrCAYo1i3raIRk ZA0S5WFYCJEV2CMxuRjpowapvOhY4783kbzK9jBS/137cnJtHCyl5g0sZa/SwF/FsgEn 4dZwRxfctymDJ9Cw4o3iu8Wki1HZbwM82lS+fJzb/KvZzDgjn0irteBAG3HfVZEi26f0 xmkg== X-Gm-Message-State: APjAAAWOuknNrLyHkBslmd/NDUImIJSDotIOlC16HXdLH7eZr/DYMRsa nd/7RJ1HBIFyRB1VYUVgJOFc8x4lC1aClQ== X-Google-Smtp-Source: APXvYqyBn4n3iUQK2iPhRdP8CzIFuKWI7SiEF5BjLTTM7QSqtaC3cSdmbv0Aeg+XoH+Fg6OWVBSCaw== X-Received: by 2002:a63:1854:: with SMTP id 20mr15473119pgy.366.1560174639539; Mon, 10 Jun 2019 06:50:39 -0700 (PDT) From: Aarushi Mehta To: qemu-devel@nongnu.org Date: Mon, 10 Jun 2019 19:19:03 +0530 Message-Id: <20190610134905.22294-11-mehta.aaru20@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190610134905.22294-1-mehta.aaru20@gmail.com> References: <20190610134905.22294-1-mehta.aaru20@gmail.com> 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 v5 10/12] block/io_uring: adds userspace completion polling 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 , Sergio Lopez , qemu-block@nongnu.org, Markus Armbruster , Max Reitz , saket.sinha89@gmail.com, Stefan Hajnoczi , Paolo Bonzini , Maxim Levitsky , 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-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Aarushi Mehta --- block/io_uring.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/block/io_uring.c b/block/io_uring.c index 47e027364a..acfaa48151 100644 --- a/block/io_uring.c +++ b/block/io_uring.c @@ -142,6 +142,21 @@ static void qemu_luring_completion_cb(void *opaque) qemu_luring_process_completions_and_submit(s); } =20 +static bool qemu_luring_poll_cb(void *opaque) +{ + LuringState *s =3D opaque; + struct io_uring_cqe *cqes; + + if (io_uring_peek_cqe(&s->ring, &cqes) =3D=3D 0) { + if (!cqes) { + qemu_luring_process_completions_and_submit(s); + return true; + } + } + + return false; +} + static void ioq_init(LuringQueue *io_q) { QSIMPLEQ_INIT(&io_q->sq_overflow); @@ -294,7 +309,7 @@ void luring_attach_aio_context(LuringState *s, AioConte= xt *new_context) s->aio_context =3D new_context; s->completion_bh =3D aio_bh_new(new_context, qemu_luring_completion_bh= , s); aio_set_fd_handler(s->aio_context, s->ring.ring_fd, false, - qemu_luring_completion_cb, NULL, NULL, s); + qemu_luring_completion_cb, NULL, qemu_luring_poll_c= b, s); } =20 LuringState *luring_init(Error **errp) --=20 2.17.1 From nobody Sun Feb 8 13:11:09 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=1560175427; cv=none; d=zoho.com; s=zohoarc; b=NWzt6zcJofqMMEu1NLeVhNE71QJ9izlkTqZcnQ+kyMH6ixyOmyAf0zAOnGYFwaV/YzO6zZOVMj9T5xk/BNfcgryR5l+mgeXcl7YRQcxINj5yGQyyeC+G48PIXcsoPYkGavNl5E8EOUFiTGNmj9H0rhdzhqXip/lNvSUGxqUAyBo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560175427; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=xq7PK0y6uXgG+XBSKAgO5X/znyGlJsBRbpNQw098uuk=; b=bfSc0vJ4RwFwrLNCbI8PkfgZ27y3JDmnwVr0nzb7kH3xhIk5fhNAbc55TCh+tCfmoTuNbgGxNjSQfQY8fdiS6McFvZ+ZQqWiCLP9pofyktOhIU26xu2YXnCiJwTsBbyE2YSIpD3LiFF3g2iwAMBBZU+eMyygCw8FuvjotrzZhxo= 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 15601754272763.291252634359239; Mon, 10 Jun 2019 07:03:47 -0700 (PDT) Received: from localhost ([::1]:46858 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haKth-0005Ne-B7 for importer@patchew.org; Mon, 10 Jun 2019 10:03:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51496) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haKhF-0000uV-NR for qemu-devel@nongnu.org; Mon, 10 Jun 2019 09:50:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haKhE-0002Kj-Lc for qemu-devel@nongnu.org; Mon, 10 Jun 2019 09:50:49 -0400 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:37433) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haKhE-0002KO-Ef; Mon, 10 Jun 2019 09:50:48 -0400 Received: by mail-pf1-x441.google.com with SMTP id 19so4520026pfa.4; Mon, 10 Jun 2019 06:50:48 -0700 (PDT) Received: from localhost.localdomain ([136.233.9.100]) by smtp.gmail.com with ESMTPSA id d4sm13969837pfc.149.2019.06.10.06.50.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Jun 2019 06:50:46 -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; bh=xq7PK0y6uXgG+XBSKAgO5X/znyGlJsBRbpNQw098uuk=; b=dwom0+2zTAa5cFDtsSbROUQxjnKi3OYhoFp8OA15yRoO+Mm/shvSPQxWGeRGmqDmk2 gNphADwotUC7p5cXDz2wrB9MhGRwtMI1jWdKxcGAqxMVNQ+FJjqrZe7Hbo+Luc7iRil2 zuMAxQ6BUXEmWx37Mv6WedumF/yugLXazEOe6esLQYrFhT1QvtZ4zVGfH2kavpqSbryU f8P93HoOMLZxZZ5SE27bjnW2x+INvOxzRIZHAz2cwmaRFLzfsJvSwu3N/bVFdle+Ys3H d4T0UHKWa40cISxuSJB5Ytoi+O7gmP1jHpu+OSNGpLLt4yLSlkY6uu+36sIs5ram+ErR kpUQ== 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; bh=xq7PK0y6uXgG+XBSKAgO5X/znyGlJsBRbpNQw098uuk=; b=AtCQoFQxZbD2VCCtAWzNoX5biWWAZDneiQh1RT2sCdwcGeGmUcBhRcck6CkxPLhqFJ UNsNAXzQ8dLZmXr+AULVNMrzt01jSRirGAVhpbJciTfAm6Iqg/W2p+cNilo6ZxUPr3AM i1PTEneqHcuGC1Gau5VSoDj+6sA15NLNmytQM/8uW8703GDLrLldrHKpvD+PRA/JSA+R eiuUuqX5bxl3ZUqM3djpb/hxy5Lzgb9nezl3zhubpcKEHMD8aCtW7rodZPtPQPyv96jJ wCtWmL1fUSXwJicLaE90LijOYO1ek6MTvawD3XXNXKiBIZDwgXj9jDcAhMoTa8CyTfDo YeIQ== X-Gm-Message-State: APjAAAVzPLlXo380EW7GP2jxsUmzKL+9Pxhse9koXpGDMewugDEWwzQP K9oYmXBaA56ow4MeJ6jViKEaXAlIAzsWPg== X-Google-Smtp-Source: APXvYqxwiZYHC2VRPmfK1Z7PZXElEmL7Ca7bd0y8wv7Z/tiISJcEXASUvY9MBofUbcvF+iG9gXSb6g== X-Received: by 2002:a17:90a:1706:: with SMTP id z6mr20726300pjd.108.1560174647071; Mon, 10 Jun 2019 06:50:47 -0700 (PDT) From: Aarushi Mehta To: qemu-devel@nongnu.org Date: Mon, 10 Jun 2019 19:19:04 +0530 Message-Id: <20190610134905.22294-12-mehta.aaru20@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190610134905.22294-1-mehta.aaru20@gmail.com> References: <20190610134905.22294-1-mehta.aaru20@gmail.com> 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 v5 11/12] qemu-io: adds support 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 , Sergio Lopez , qemu-block@nongnu.org, Markus Armbruster , Max Reitz , saket.sinha89@gmail.com, Stefan Hajnoczi , Paolo Bonzini , Maxim Levitsky , 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-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Aarushi Mehta --- qemu-io.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/qemu-io.c b/qemu-io.c index 8d5d5911cb..54b82151c4 100644 --- a/qemu-io.c +++ b/qemu-io.c @@ -129,6 +129,7 @@ static void open_help(void) " -n, -- disable host cache, short for -t none\n" " -U, -- force shared permissions\n" " -k, -- use kernel AIO implementation (on Linux only)\n" +" -i -- use kernel io_uring (Linux 5.1+)\n" " -t, -- use the given cache mode for the image\n" " -d, -- use the given discard mode for the image\n" " -o, -- options to be given to the block driver" @@ -188,6 +189,11 @@ static int open_f(BlockBackend *blk, int argc, char **= argv) case 'k': flags |=3D BDRV_O_NATIVE_AIO; break; +#ifdef CONFIG_LINUX_IO_URING + case 'i': + flags |=3D BDRV_O_IO_URING; + break; +#endif case 't': if (bdrv_parse_cache_mode(optarg, &flags, &writethrough) < 0) { error_report("Invalid cache option: %s", optarg); @@ -290,6 +296,7 @@ static void usage(const char *name) " -C, --copy-on-read enable copy-on-read\n" " -m, --misalign misalign allocations for O_DIRECT\n" " -k, --native-aio use kernel AIO implementation (on Linux only)\n" +" -i --io_uring use kernel io_uring (Linux 5.1+)\n" " -t, --cache=3DMODE use the given cache mode for the image\n" " -d, --discard=3DMODE use the given discard mode for the image\n" " -T, --trace [[enable=3D]][,events=3D][,file=3D]\n" @@ -499,6 +506,7 @@ int main(int argc, char **argv) { "copy-on-read", no_argument, NULL, 'C' }, { "misalign", no_argument, NULL, 'm' }, { "native-aio", no_argument, NULL, 'k' }, + { "io_uring", no_argument, NULL, 'i' }, { "discard", required_argument, NULL, 'd' }, { "cache", required_argument, NULL, 't' }, { "trace", required_argument, NULL, 'T' }, @@ -566,6 +574,11 @@ int main(int argc, char **argv) case 'k': flags |=3D BDRV_O_NATIVE_AIO; break; +#ifdef CONFIG_LINUX_IO_URING + case 'i': + flags |=3D BDRV_O_IO_URING; + break; +#endif case 't': if (bdrv_parse_cache_mode(optarg, &flags, &writethrough) < 0) { error_report("Invalid cache option: %s", optarg); --=20 2.17.1 From nobody Sun Feb 8 13:11:09 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=1560175424; cv=none; d=zoho.com; s=zohoarc; b=QrojLQ0Fp5RBYmJqffHvwJTBexTCldBG/ZCNcHUx4rS8x4djujMbmOoZyVRx7C5CDVn2HOiOChScS/fKzxfmqqhMTpqfO2IMbii4HbSL9Ywv56LokQ1xtkABbFGIjAP30946yY1rRaBkTMuZMa7JltQ9jwR1co2GUCKsp4LEmOY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560175424; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=WDYxGcU6qJa4559VsDh1i70v5FrPaZIfqXHtJVDOpyg=; b=SsFW/tcNBNbxxTYLj784G0+gDnPhofgYM3A1+D6c2W0vddwP3r1wDxdt2FMvwoFVsKQ85h6pVK7JXw659zH0f1K20z6QB6++DKvjY/VlTiiRybqdYsCZLu4h9ROe2v00JYVd/ps4bASOWa37ZCTKcL5Wos9/iQPBzCTDMPhfVYc= 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1560175424844352.19659281175143; Mon, 10 Jun 2019 07:03:44 -0700 (PDT) Received: from localhost ([::1]:46854 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haKte-0005Iw-8Y for importer@patchew.org; Mon, 10 Jun 2019 10:03:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51551) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haKhY-0001EH-29 for qemu-devel@nongnu.org; Mon, 10 Jun 2019 09:51:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haKhU-0002TB-21 for qemu-devel@nongnu.org; Mon, 10 Jun 2019 09:51:06 -0400 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:44688) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1haKhP-0002PS-1w; Mon, 10 Jun 2019 09:51:00 -0400 Received: by mail-pf1-x442.google.com with SMTP id t16so5343325pfe.11; Mon, 10 Jun 2019 06:50:55 -0700 (PDT) Received: from localhost.localdomain ([136.233.9.100]) by smtp.gmail.com with ESMTPSA id d4sm13969837pfc.149.2019.06.10.06.50.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Jun 2019 06:50:53 -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; bh=WDYxGcU6qJa4559VsDh1i70v5FrPaZIfqXHtJVDOpyg=; b=d7cLKGchJ6d7HaiTt/UdMn/z0RUwSV2YYvf2v0HYmzGbKBuWg+9FKPmqoeE3T9rGtJ Yp5IWtbjGiE87ZX5RB2HNKaAv3FuWROjMxjlh0WE9IGIOpB28EtLU5S+dy+1fqWezRmr ghry2Is8aUiz7T04MSCO2xLQ2bsaeBnpXOLqPe7MlANBLnRb9V+yvxst59ratpwIFs2E IFJh4XPr06/fF3nz9IC8byonY80wpXcbYCLjfVRZD0ONOOlcphM3y+0c7aoWd7FWUZ7j dlH35GXuRc+4U706UUZQOvjIsWbUjbZ/M4ojVe5zL/lBLS6ExuGKkriyqeqKmoZwhR65 3Rxg== 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; bh=WDYxGcU6qJa4559VsDh1i70v5FrPaZIfqXHtJVDOpyg=; b=Xyj5P0/el9jkQHd8GHgKu+2xeIL5n1Is7ykFEN/axQM8t3s4vknvHy3wmkfZeFqL4i MeiVG2ftE38bYZxdc+rQrMk4qf1p8gqOvleoF0f1iEUYFWwFzWKum6QPoLsmpw5Cbzir C+fqVvmI3gmnXL/QhhCvLrhGVnd8XV9er52mg05d+zN72puIByzO86AcWL8oohC6rCMg NBWoaj0VrFMt8Hv4sfsN3c82+sdAcaWBpiN5FWuQUNZnNadEape6+/4k2xmtlGhFqxbf EI+WqtUsxvZosTYYYA/e8TiI9iB8AED5zAaHtTE8omg1bpVRTYK1o8cuqCAhXaJwiJj6 hJ1Q== X-Gm-Message-State: APjAAAXWOrHJ9XjSRMGWAr8JbUYUZlOK1aFMEJ+SUl742b4wygO5fJ+L O9fFrHR9jpdPxdWq8cRZNYfNaiqTcLonWA== X-Google-Smtp-Source: APXvYqyyBv0imAtGgNX/o3wcnGVAO9K6Ot2bLp6jyY6DR6Y85djOmwlwR7L7OliNK1M5N9Nx2OwEGQ== X-Received: by 2002:a17:90a:9b08:: with SMTP id f8mr21604314pjp.103.1560174654294; Mon, 10 Jun 2019 06:50:54 -0700 (PDT) From: Aarushi Mehta To: qemu-devel@nongnu.org Date: Mon, 10 Jun 2019 19:19:05 +0530 Message-Id: <20190610134905.22294-13-mehta.aaru20@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190610134905.22294-1-mehta.aaru20@gmail.com> References: <20190610134905.22294-1-mehta.aaru20@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::442 Subject: [Qemu-devel] [PATCH v5 12/12] qemu-iotests/087: checks 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 , Sergio Lopez , qemu-block@nongnu.org, Markus Armbruster , Max Reitz , saket.sinha89@gmail.com, Stefan Hajnoczi , Paolo Bonzini , Maxim Levitsky , 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-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Aarushi Mehta --- tests/qemu-iotests/087 | 26 ++++++++++++++++++++++++++ tests/qemu-iotests/087.out | 10 ++++++++++ 2 files changed, 36 insertions(+) diff --git a/tests/qemu-iotests/087 b/tests/qemu-iotests/087 index d6c8613419..0cc7283ad8 100755 --- a/tests/qemu-iotests/087 +++ b/tests/qemu-iotests/087 @@ -124,6 +124,32 @@ run_qemu_filter_aio <