Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4165766imw; Tue, 12 Jul 2022 03:11:05 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vsKXeMW2YCUGz44NqIuLHXp6owPqg91g5EEIlI7Kb0iWNJ92fMBJDeIaOjX/uwtEktQa+n X-Received: by 2002:a17:903:41cc:b0:16c:4e4c:7480 with SMTP id u12-20020a17090341cc00b0016c4e4c7480mr8514678ple.83.1657620664739; Tue, 12 Jul 2022 03:11:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657620664; cv=none; d=google.com; s=arc-20160816; b=A42KVv0wcMekfACCM5hWO3r82+O4HSBCJeKV3Ub8HD4vLrhc1oHo9k42MVCCQRRJ63 YCAsX+4yRttHjw1WwwUi918sXUZu8DXMXcUOPk6iLA+uLsWhK4hyBR+nJb139n0cZX6I 4II5CVPQ0NKQW4o23XbQ13Gns85GThM/H0GK4oCZSJb3MJL3ByoSJ1tOHwawTGj0K4qu g9N7Equt3VGiKVJA+SrunFIET5LyPI0ocWLge7Ax0qZcz7ELytUvJx0LJt9bMcwOOptJ Zg9DRuCxstTmNidtpSOsbnqwhf7KB6FnbuCnrpvFjjnl6pwASqRuvyAegEV9tuCPgOJ/ rY5Q== 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=rFweDuIk2SBo5KB2wklW/S9Ar1k61Yu0hajCwnXEGu0=; b=SGtSpF4s7QXhUnI6GpkEsLuiVHeVVaa00EsvdqRGMg5aoVcyFni5wtjvNf4bM8zYkH PJDhXKDws24tMKJ5GH/Aa2wy7+075YsF/RZ33Rb8IOC/FjEd54leBAZAwFTiM3Tf1hEl Dra0YK79YV2uhtpAzw3nmcC/PxGfo5OQbvdyELLHj94J78PF8cUeBFjzan8WF+0e0dSF B/nktxtfm+e/ehVDClaxoN/3U3nJw2leYOoDa6JafqsSQvs0PRpmJaqc9bvwV9vW+sg3 +kk2ck3LSGcuyB0dEyyPBMdnAYQ2Ij8/zrQtwwzpU27k9uhz7Fszxf+ABoam6Gqa35IK izPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=C9rxvL4a; 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 w31-20020a63161f000000b0040c7d4c3d90si11688954pgl.361.2022.07.12.03.10.47; Tue, 12 Jul 2022 03:11:04 -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=C9rxvL4a; 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 S232897AbiGLKI5 (ORCPT + 99 others); Tue, 12 Jul 2022 06:08:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232846AbiGLKIr (ORCPT ); Tue, 12 Jul 2022 06:08:47 -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 649ECAE77 for ; Tue, 12 Jul 2022 03:08:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657620519; 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=rFweDuIk2SBo5KB2wklW/S9Ar1k61Yu0hajCwnXEGu0=; b=C9rxvL4art2yalZx6Dnt05MTVp2YSOkxkWfsZ30jQn//fTz1pmqUS1ps6B8hQcfi++uUyc ARe6SKrZ1SlihzXUM/cjeyRT+PtjjWPErKwRagxkL7D3McCnGsqr9pswKFHY7dTwS38jnI Ozy3rqKcGgD4MRRIpekcZlxt0L+N6Cw= 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-114-bPi2MNEPMj2hs1inCXRbsA-1; Tue, 12 Jul 2022 06:08:30 -0400 X-MC-Unique: bPi2MNEPMj2hs1inCXRbsA-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9B3758032F0; Tue, 12 Jul 2022 10:08:29 +0000 (UTC) Received: from T590 (ovpn-8-24.pek2.redhat.com [10.72.8.24]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 143F8492C3B; Tue, 12 Jul 2022 10:08:23 +0000 (UTC) Date: Tue, 12 Jul 2022 18:08:18 +0800 From: Ming Lei To: Gabriel Krisman Bertazi Cc: Jens Axboe , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, io-uring@vger.kernel.org, ZiyangZhang , Xiaoguang Wang , Oleg Nesterov , ming.lei@redhat.com Subject: Re: [PATCH V4 2/2] ublk_drv: add UBLK_IO_REFETCH_REQ for supporting to build as module Message-ID: References: <20220711022024.217163-1-ming.lei@redhat.com> <20220711022024.217163-3-ming.lei@redhat.com> <87lesze7o3.fsf@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 Tue, Jul 12, 2022 at 10:33:34AM +0800, Ming Lei wrote: > Hi Gabriel, > > On Mon, Jul 11, 2022 at 04:06:04PM -0400, Gabriel Krisman Bertazi wrote: > > Ming Lei writes: > > > > > Add UBLK_IO_REFETCH_REQ command to fetch the incoming io request in > > > ubq daemon context, so we can avoid to call task_work_add(), then > > > it is fine to build ublk driver as module. > > > > > > In this way, iops is affected a bit, but just by ~5% on ublk/null, > > > given io_uring provides pretty good batching issuing & completing. > > > > > > One thing to be careful is race between ->queue_rq() and handling > > > abort, which is avoided by quiescing queue when aborting queue. > > > Except for that, handling abort becomes much easier with > > > UBLK_IO_REFETCH_REQ since aborting handler is strictly exclusive with > > > anything done in ubq daemon kernel context. > > > > Hi Ming, > > > > FWIW, I'm not very fond this change. It adds complexity to the kernel > > driver and to the userspace server implementation, who now have to deal > > IMO, this way just adds dozens line of code, no much complexity. The only > complexity in ublk driver should be in aborting code, which is actually > originated from concurrent aborting work and running task work which may be > run after task is exiting. But any storage driver's aborting/error > handling code is complicated. > > Using REFETCH_REQ actually becomes much easier for handling abort which is > run exclusively with any code running in ubq daemon context, but with > performance cost. > > > with different interface semantics just because the driver was built-in > > or built as a module. I don't think the tristate support warrants such > > complexity. I was hoping we might get away with exporting that symbol > > or adding a built-in ubd-specific wrapper that can be exported and > > invokes task_work_add. > > If task_work_add can be exported, that would be very great. Another choice is to use io_uring_cmd_complete_in_task which is actually exported, now we can build ublk_drv as module by using io_uring_cmd_complete_in_task without needing one new command. Thanks, Ming