From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 446E3C433EF for ; Tue, 5 Apr 2022 07:26:46 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id CD405400CE; Tue, 5 Apr 2022 07:26:45 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vnDcueJ75aAt; Tue, 5 Apr 2022 07:26:45 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp2.osuosl.org (Postfix) with ESMTPS id 712BA40531; Tue, 5 Apr 2022 07:26:44 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 38921C001D; Tue, 5 Apr 2022 07:26:44 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 98F1AC0012 for ; Tue, 5 Apr 2022 07:26:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 875F4823E0 for ; Tue, 5 Apr 2022 07:26:42 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp1.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vNmlHCcPF7Lt for ; Tue, 5 Apr 2022 07:26:41 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp1.osuosl.org (Postfix) with ESMTPS id C110E81360 for ; Tue, 5 Apr 2022 07:26:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649143599; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=DtRKacOwwOeXGaBsH2DzeX8idyChR5dRn3lTIEka55E=; b=egvYv/0GbHgVilTTIa4O4iFxOHjGGXlOP2l0rflYeWWcR1SP/6Ytda2dJ6rJGVo4jLYo8j ozWJQFBjPrMISEogdiEwSAjU8M2qka2etCFgJthiPlNBc53FaX0d5BlWqEpzXMl1RG81mv CaihLDSRKgF34aWzP6lM0WaY48Xrx3s= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-132-qtmh9eRYPSGpAzNM5esJfg-1; Tue, 05 Apr 2022 03:26:36 -0400 X-MC-Unique: qtmh9eRYPSGpAzNM5esJfg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A17D7185A794; Tue, 5 Apr 2022 07:26:35 +0000 (UTC) Received: from localhost (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id 383D440E84E0; Tue, 5 Apr 2022 07:26:35 +0000 (UTC) Date: Tue, 5 Apr 2022 08:26:34 +0100 From: Stefan Hajnoczi To: Suwan Kim Subject: Re: [PATCH v4 1/2] virtio-blk: support polling I/O Message-ID: References: <20220405053122.77626-1-suwan.kim027@gmail.com> <20220405053122.77626-2-suwan.kim027@gmail.com> MIME-Version: 1.0 In-Reply-To: <20220405053122.77626-2-suwan.kim027@gmail.com> X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 Cc: mgurtovoy@nvidia.com, mst@redhat.com, virtualization@lists.linux-foundation.org, linux-block@vger.kernel.org, pbonzini@redhat.com X-BeenThere: virtualization@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux virtualization List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============0302413873292258832==" Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" --===============0302413873292258832== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Jp8XQicBu+MZNkcI" Content-Disposition: inline --Jp8XQicBu+MZNkcI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Apr 05, 2022 at 02:31:21PM +0900, Suwan Kim wrote: > +static int virtblk_poll(struct blk_mq_hw_ctx *hctx, struct io_comp_batch= *iob) > +{ > + struct virtio_blk *vblk =3D hctx->queue->queuedata; > + struct virtio_blk_vq *vq =3D hctx->driver_data; > + struct virtblk_req *vbr; > + bool req_done =3D false; > + unsigned long flags; > + unsigned int len; > + int found =3D 0; > + > + spin_lock_irqsave(&vq->lock, flags); > + > + while ((vbr =3D virtqueue_get_buf(vq->vq, &len)) !=3D NULL) { > + struct request *req =3D blk_mq_rq_from_pdu(vbr); > =20 > - return blk_mq_virtio_map_queues(&set->map[HCTX_TYPE_DEFAULT], > - vblk->vdev, 0); > + found++; > + if (!blk_mq_add_to_batch(req, iob, vbr->status, > + virtblk_complete_batch)) > + blk_mq_complete_request(req); > + req_done =3D true; > + } > + > + if (req_done) Minor nit: req_done can be replaced with found > 0. > + blk_mq_start_stopped_hw_queues(vblk->disk->queue, true); > + > + spin_unlock_irqrestore(&vq->lock, flags); > + > + return found; > +} --Jp8XQicBu+MZNkcI Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEyBAEBCAAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAmJL7yoACgkQnKSrs4Gr c8jUsgf2JdI3U+9wOFUIjYhSgc6aLyfvp5Z/e/qlArMH91NRMqQYPdhVExmmJTsw RTcidyru8K34V0PxslJOl1hqOQrO3GsIZ3x2H2uq00lc8rySclyLgWsToUst3Pew Lc7DML09u6E/OaGBGhN7HY30kJlpE0oCdjDvmn7OdfA6i/fsFj8Ca8QlZARDuOGG zcTvw97nbRJimZ76xnd9ApOrdjyk1s6d3RtbXfoehpL11UM7HDEWm45C5wAy6W0n Dy3zYnG3j0BVhU+2Z48rZ+vUxZ6m7NhystgCiMYd4TqD0Z5kssY8jp7T1mpjSPre hyns9kyCB1Aqx5fekBeHVDwfLh+T =2Ve7 -----END PGP SIGNATURE----- --Jp8XQicBu+MZNkcI-- --===============0302413873292258832== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization --===============0302413873292258832==-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14748C433F5 for ; Tue, 5 Apr 2022 07:26:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231667AbiDEH2o (ORCPT ); Tue, 5 Apr 2022 03:28:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231518AbiDEH2l (ORCPT ); Tue, 5 Apr 2022 03:28:41 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7C9AB3969F for ; Tue, 5 Apr 2022 00:26:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649143600; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=DtRKacOwwOeXGaBsH2DzeX8idyChR5dRn3lTIEka55E=; b=AbWhSaod2NFOP7Fir1HQwzbXdm34CBgT8BLiPesheD9dQh3SETY/r77HVrYe90zbdQ3zJm zBKAhZxFStT/Wb3Nui014Ua7h/HTO6Dm92ggKo28AmUFkWt+RBpdMrc6eq+f47dLmOSzPe xL+BH79/mEpd28F0FmSLsjM1EvgzMqY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-132-qtmh9eRYPSGpAzNM5esJfg-1; Tue, 05 Apr 2022 03:26:36 -0400 X-MC-Unique: qtmh9eRYPSGpAzNM5esJfg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A17D7185A794; Tue, 5 Apr 2022 07:26:35 +0000 (UTC) Received: from localhost (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id 383D440E84E0; Tue, 5 Apr 2022 07:26:35 +0000 (UTC) Date: Tue, 5 Apr 2022 08:26:34 +0100 From: Stefan Hajnoczi To: Suwan Kim Cc: mst@redhat.com, jasowang@redhat.com, pbonzini@redhat.com, mgurtovoy@nvidia.com, dongli.zhang@oracle.com, virtualization@lists.linux-foundation.org, linux-block@vger.kernel.org Subject: Re: [PATCH v4 1/2] virtio-blk: support polling I/O Message-ID: References: <20220405053122.77626-1-suwan.kim027@gmail.com> <20220405053122.77626-2-suwan.kim027@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Jp8XQicBu+MZNkcI" Content-Disposition: inline In-Reply-To: <20220405053122.77626-2-suwan.kim027@gmail.com> X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org --Jp8XQicBu+MZNkcI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Apr 05, 2022 at 02:31:21PM +0900, Suwan Kim wrote: > +static int virtblk_poll(struct blk_mq_hw_ctx *hctx, struct io_comp_batch= *iob) > +{ > + struct virtio_blk *vblk =3D hctx->queue->queuedata; > + struct virtio_blk_vq *vq =3D hctx->driver_data; > + struct virtblk_req *vbr; > + bool req_done =3D false; > + unsigned long flags; > + unsigned int len; > + int found =3D 0; > + > + spin_lock_irqsave(&vq->lock, flags); > + > + while ((vbr =3D virtqueue_get_buf(vq->vq, &len)) !=3D NULL) { > + struct request *req =3D blk_mq_rq_from_pdu(vbr); > =20 > - return blk_mq_virtio_map_queues(&set->map[HCTX_TYPE_DEFAULT], > - vblk->vdev, 0); > + found++; > + if (!blk_mq_add_to_batch(req, iob, vbr->status, > + virtblk_complete_batch)) > + blk_mq_complete_request(req); > + req_done =3D true; > + } > + > + if (req_done) Minor nit: req_done can be replaced with found > 0. > + blk_mq_start_stopped_hw_queues(vblk->disk->queue, true); > + > + spin_unlock_irqrestore(&vq->lock, flags); > + > + return found; > +} --Jp8XQicBu+MZNkcI Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEyBAEBCAAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAmJL7yoACgkQnKSrs4Gr c8jUsgf2JdI3U+9wOFUIjYhSgc6aLyfvp5Z/e/qlArMH91NRMqQYPdhVExmmJTsw RTcidyru8K34V0PxslJOl1hqOQrO3GsIZ3x2H2uq00lc8rySclyLgWsToUst3Pew Lc7DML09u6E/OaGBGhN7HY30kJlpE0oCdjDvmn7OdfA6i/fsFj8Ca8QlZARDuOGG zcTvw97nbRJimZ76xnd9ApOrdjyk1s6d3RtbXfoehpL11UM7HDEWm45C5wAy6W0n Dy3zYnG3j0BVhU+2Z48rZ+vUxZ6m7NhystgCiMYd4TqD0Z5kssY8jp7T1mpjSPre hyns9kyCB1Aqx5fekBeHVDwfLh+T =2Ve7 -----END PGP SIGNATURE----- --Jp8XQicBu+MZNkcI--