Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4231206rwl; Mon, 3 Apr 2023 01:42:46 -0700 (PDT) X-Google-Smtp-Source: AKy350YQ6sFL/QxTs0+hcRZ5mKTdExl3oxDhmNkLquYsG1OZ8T5/oMz3bWNs73+pHBcxpW3Vdh95 X-Received: by 2002:a17:907:3f82:b0:92e:c4c9:7a43 with SMTP id hr2-20020a1709073f8200b0092ec4c97a43mr42283163ejc.25.1680511366356; Mon, 03 Apr 2023 01:42:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680511366; cv=none; d=google.com; s=arc-20160816; b=Oy0VQmXkSe20b6OXhfSI/ErPGtysJ8KALW4ow1j32vqRfUzWCg52Ka1QSsqPTVxlIg 1YO/tIGTMR09yE6GSv4QkEIkRrWQphZfo7fMgVJKdXKcQc4JYb0A1XoMVJnOSOLpaHEz Zyc0DJ0w2PURNqbhOUDXMjSYqKEZMvVDyBvfvlvI0VWNhYvcBl5Z/OLbsQEosoJ/JxQa A0kMHSbYLg6eKsGfO+r3wEeKh49SwDhy9DpyD7o/oeojt0xDTGxk99jytw4bHMHkqx2l id3HkaF+lGHWmwDCoghZGAaDQsyCHl8EsmRIk7cIRQu+GGwhBT7QeCXRh54vx435v5Dg l8zQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=/NsIRiY4Fu04dDv74jXtbbCz9V+H2VdyP3pYLQBxejU=; b=LiARUObxnacdv13P8wxxqf8XGmHJ9CVE5z8FrmVd4onaI9ojo5zX9/deLvjDGoeJ2b wFqNs7KIAkpr0tRseq/oS4guZAAnww9OQN2sxyCU3D6HhPqnBme7G7OiB7CspFFKR8Uu pLKtnwJj3pfTE+dAUKmDIf1On27QLo4zyarZw3bXjPpXpJkNB85ti+wFuP7wykmIJ+7X 2waZ2oAjtBG33rCMYqB43fLunsB90PY9VH7p8FFqQxdZoAZVPtICABNYMAQ25cdW2YqE glzZI4KnRjwXN7Avr0qkOkpTLm9dgShE0hJ39CumwQcS6LqiWjTp6abyIyYLYjI1ZOJM yCHQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q22-20020a056402033600b00501d50c1416si144150edw.411.2023.04.03.01.42.22; Mon, 03 Apr 2023 01:42:46 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231758AbjDCIin (ORCPT + 99 others); Mon, 3 Apr 2023 04:38:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231741AbjDCIii (ORCPT ); Mon, 3 Apr 2023 04:38:38 -0400 Received: from out30-99.freemail.mail.aliyun.com (out30-99.freemail.mail.aliyun.com [115.124.30.99]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2C527A98; Mon, 3 Apr 2023 01:38:35 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045168;MF=ziyangzhang@linux.alibaba.com;NM=1;PH=DS;RN=11;SR=0;TI=SMTPD_---0VfFpU8U_1680511110; Received: from 30.97.57.8(mailfrom:ZiyangZhang@linux.alibaba.com fp:SMTPD_---0VfFpU8U_1680511110) by smtp.aliyun-inc.com; Mon, 03 Apr 2023 16:38:31 +0800 Message-ID: <1d74e886-89af-bbbb-9bae-37d20ce07fb2@linux.alibaba.com> Date: Mon, 3 Apr 2023 16:38:30 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH V5 16/16] block: ublk_drv: apply io_uring FUSED_CMD for supporting zero copy Content-Language: en-US To: Ming Lei 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 References: <20230328150958.1253547-1-ming.lei@redhat.com> <20230328150958.1253547-17-ming.lei@redhat.com> <2e3c20e0-a0be-eaf3-b288-c3c8fa31d1fa@linux.alibaba.com> <08b047a8-c577-a717-81a8-db8fca8ebab6@linux.alibaba.com> From: Ziyang Zhang In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-9.3 required=5.0 tests=ENV_AND_HDR_SPF_MATCH, NICE_REPLY_A,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL 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 2023/3/29 18:52, Ming Lei wrote: > On Wed, Mar 29, 2023 at 06:01:16PM +0800, Ziyang Zhang wrote: >> On 2023/3/29 17:00, Ming Lei wrote: >>> 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, >> >> OK, so UBLK_IO_FUSED_SUBMIT_IO is guaranteed to be completed because it is >> not queued. FETCH_REQ and COMMIT_AMD_FETCH are queued io commands and could >> not be completed forever so they have to be issued from ubq_daemon. Right? > > Yeah, any io command should be issued from ubq daemon context. > >> >> BTW, maybe NEED_GET_DATA can be issued from other context... > > So far it won't be supported. > > As I mentioned in the link, if io_uring can provide io_uring exit > callback, we may relax this limit. > Hi, Ming Sorry, I do not understand... I think UBLK_IO_NEED_GET_DATA is normal IO just like UBLK_IO_FUSED_SUBMIT_IO. It is issued from one pthread(ubq_daemon for now) and is completed just in time(not queued). So I think we can allow UBLK_IO_NEED_GET_DATA to be issued from other context.