Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp310027rwl; Wed, 29 Mar 2023 02:02:54 -0700 (PDT) X-Google-Smtp-Source: AKy350ZEbka6aTz1uzP6INpsFB6YGZuK+TGwwbVfstBxB3hwJDmu+RoCpk7aQi7m4T8aJ9Gn2gOJ X-Received: by 2002:a17:903:2311:b0:1a1:b656:2149 with SMTP id d17-20020a170903231100b001a1b6562149mr21505390plh.50.1680080574071; Wed, 29 Mar 2023 02:02:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680080574; cv=none; d=google.com; s=arc-20160816; b=sqEA9dFATkvBujZFVOBzMAYQh5tYs8UMxS5rLdjkzDAlVVjWmySogMpOXsa1EEHI0L QonQRpnQ//9++K5MSwEOESvEmhnJ/ohgyyxg942bjiL342rTgNgQbeiZfwxmqLgwhPAY gNdsa4xqSmTc+QhTqhkCENElH7myolIi/1n4m/H/68yq+xTTQni0qA2uFXusvgRRVIG8 i+jRhZRR8g9a1cRc4ueJQUEVsDo6beWqWNyELi73N/srWr0/Zgf+5hYtbAmq55QJqku+ lPRNcPhwtsevECAj5JAC9o4M/L/UxOVyFcU6xk+X97Gy54NfrJZl9C6PSVdHvpqCnGM4 2nzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=XUlNULMH9WDHyEuNy5Y9np3GCzRd3b+Uq3KsaeRBTfA=; b=XisByh8iX/KUJrIUw9LhfK77tAGcXjBCIKyOcAu5hqI/H1KGi8KTD2MyfwXgfZlKlv Ar1s2csviLZ0mpUpFlIS3PYo0QVkVtsXhf+S409/m3fsGGPYTAbCKobBLZWHjdPXTu2x FWaHDMBsNvpKyxypXKZnaT4ZvvT3EYwfJ4teAbp7SY8NpXPLQB9Yd7hYWZEraCMO2q8Y nnjlgwCJEbevs35fgO5qoC5i5V9hIMBfdVcaZj1HkLtTUX+vM9OpymHF6Ae9V4Dpohy1 mkf6wO492cwb4SNi/ZP1hdNd0wLir6K+0nND8JB3SHTXbeWzqDU9p/6oy7OA3ddcdu81 42RA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LZZIEUMg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c6-20020a170902d48600b001a1faee77fesi16229360plg.302.2023.03.29.02.02.37; Wed, 29 Mar 2023 02:02:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LZZIEUMg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229627AbjC2JCS (ORCPT + 99 others); Wed, 29 Mar 2023 05:02:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229539AbjC2JCR (ORCPT ); Wed, 29 Mar 2023 05:02:17 -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 ESMTPS id C2E054C20 for ; Wed, 29 Mar 2023 02:00:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680080448; 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=XUlNULMH9WDHyEuNy5Y9np3GCzRd3b+Uq3KsaeRBTfA=; b=LZZIEUMgNpQdh63ezetUpR2MNPXCtrCjdoBPqPRbiY1+yzf5G1PCT5/PqLTuOsXzWPKdJF zPjr6WuSsUmfhkMXWGUSCocaqVYlEX1YBOtJpeGDacNF3cxCUL6FBtrSaRcINq4fsPJSzK vVXGxGu3TNaItKs4Yjk6wuOo3SBBvnw= 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-190-qcHCf6lbPsqMnhLn9hmC6Q-1; Wed, 29 Mar 2023 05:00:44 -0400 X-MC-Unique: qcHCf6lbPsqMnhLn9hmC6Q-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 38BF88028B3; Wed, 29 Mar 2023 09:00:44 +0000 (UTC) Received: from ovpn-8-26.pek2.redhat.com (ovpn-8-26.pek2.redhat.com [10.72.8.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 20A9EC15BA0; Wed, 29 Mar 2023 09:00:36 +0000 (UTC) Date: Wed, 29 Mar 2023 17:00:31 +0800 From: Ming Lei To: Ziyang Zhang Cc: linux-kernel@vger.kernel.org, Miklos Szeredi , Xiaoguang Wang , Bernd Schubert , Pavel Begunkov , io-uring@vger.kernel.org, Stefan Hajnoczi , linux-block@vger.kernel.org, Jens Axboe , Dan Williams , ming.lei@redhat.com Subject: Re: [PATCH V5 16/16] block: ublk_drv: apply io_uring FUSED_CMD for supporting zero copy Message-ID: References: <20230328150958.1253547-1-ming.lei@redhat.com> <20230328150958.1253547-17-ming.lei@redhat.com> <2e3c20e0-a0be-eaf3-b288-c3c8fa31d1fa@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2e3c20e0-a0be-eaf3-b288-c3c8fa31d1fa@linux.alibaba.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 29, 2023 at 10:57:53AM +0800, Ziyang Zhang wrote: > On 2023/3/28 23:09, Ming Lei wrote: > > Apply io_uring fused command for supporting zero copy: > > > > [...] > > > > > @@ -1374,7 +1533,12 @@ static int ublk_ch_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags) > > if (!ubq || ub_cmd->q_id != ubq->q_id) > > goto out; > > > > - if (ubq->ubq_daemon && ubq->ubq_daemon != current) > > + /* > > + * The fused command reads the io buffer data structure only, so it > > + * is fine to be issued from other context. > > + */ > > + if ((ubq->ubq_daemon && ubq->ubq_daemon != current) && > > + (cmd_op != UBLK_IO_FUSED_SUBMIT_IO)) > > goto out; > > > > Hi Ming, > > What is your use case that fused io_uring cmd is issued from another thread? > I think it is good practice to operate one io_uring instance in one thread > only. So far we limit io command has to be issued from the queue context, which is still not friendly from userspace viewpoint, the reason is that we can't get io_uring exit notification and ublk's use case is very special since the queued io command may not be completed forever, see: https://lore.kernel.org/linux-fsdevel/ZBxTdCj60+s1aZqA@ovpn-8-16.pek2.redhat.com/ I remember that people raised concern about this implementation. But for normal IO, it could be issued from io wq simply because of link(dependency) or whatever, and userspace is still allowed to submit io from another pthread via same io_uring ctx. thanks, Ming