Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp6065262ioo; Wed, 1 Jun 2022 20:22:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCWK46JkarV5TATT0sLIdx6bfpKXfiDgpCkzFyjf+Tdnd8+uzpLuLGthUB591MtlrN7lBi X-Received: by 2002:a17:902:e788:b0:163:73fc:5140 with SMTP id cp8-20020a170902e78800b0016373fc5140mr2640637plb.88.1654140165839; Wed, 01 Jun 2022 20:22:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654140165; cv=none; d=google.com; s=arc-20160816; b=UvxTZkZyuqtvIocXI6Ympnv6E5axaUmoBf5avV40IF4VqekLfiKcaqTDhKh4TJxlDA mUHtaoEgAFIjWUEw2ixz1OnyJILKwZjJskjSIspa/yQMZAusY1PahDYt3JuMrQ2yeU0X RkxUm6zw0583C7N43vLyQ4SVJQ4eCB8e8YuwwrvMZkwVpDKhtkSDEyzFbUPPJGsVAWb8 WiBx5dK41uZ0T3PR8cUxQ2K1Z9SXeITH+z+gNjdUQnVWUBhpRdmdPIeP5ic17GyLrlFW ogi3DYBmp8iThs7zh+38lNOPZL2sJKtS2PmllPYE3xo235aXWW9kWZPIIX5aurCVWU0X 1WEA== 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=VAgArk0BcNk+9GP0AOx8PMvAT8X1PDlB7xL7ZWCfJ7g=; b=guqxzRaLuMq2jyh54J0/d6oL5DTTE0OjaE7M0EHdhUFr5dXFJKb+naxYaITrY4v6oa ofP/FkliRrRgxAKgEPaqDkO35PcUyB6yWPTh3iQoXcHVdTptLPx0mjiwSTBWHxtRTYkB KdkvYRqGb2B4Yu6/AnXSsmiPVOdFRGrwF/57/WFMTSKGDM28oYALaeJybeIUVvqtpFT8 BY4vuA+W9S0gmc3wMWAlGxBA7QSo8wV+PvZA5L9/wz/2AwFkij1f+tR53P97k+Owt84Q m1DM/76raxwSkDLgkyP+QzQlY6Lz2wNdWjlqmIC3702LPDiXKlIp6ZWpCFK6QGnHuBjY 973A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IniU+KbT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id s23-20020a632157000000b003f74cb24826si4618807pgm.11.2022.06.01.20.22.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 20:22:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IniU+KbT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 89C5E24A1F7; Wed, 1 Jun 2022 20:20:19 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233586AbiFBDUN (ORCPT + 99 others); Wed, 1 Jun 2022 23:20:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233597AbiFBDUC (ORCPT ); Wed, 1 Jun 2022 23:20:02 -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 639D524408A for ; Wed, 1 Jun 2022 20:20:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654140000; 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=VAgArk0BcNk+9GP0AOx8PMvAT8X1PDlB7xL7ZWCfJ7g=; b=IniU+KbTaV4Rb5CsKHTMxkQcySSQBye5kHN7GIbAw5ktp1/ZDwt9VCBZNBjoea3euXAedM 28CKkkzhgUNHxtDFhRWbS5BOktjTPGwpMdjN3tkdYT48wLPnyne/+ikJw3XCOxRtmXkdN0 Nxg8uvhKV8dxZnVeaOPM0tPcWP+b9+w= 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-170-Uw4D5aDwNOa_EmLS7mxQdw-1; Wed, 01 Jun 2022 23:19:54 -0400 X-MC-Unique: Uw4D5aDwNOa_EmLS7mxQdw-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 B0CA38032E5; Thu, 2 Jun 2022 03:19:53 +0000 (UTC) Received: from T590 (ovpn-8-29.pek2.redhat.com [10.72.8.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5F8C140CF8EB; Thu, 2 Jun 2022 03:19:47 +0000 (UTC) Date: Thu, 2 Jun 2022 11:19:42 +0800 From: Ming Lei To: Pavel Machek Cc: Jens Axboe , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, io-uring@vger.kernel.org, Gabriel Krisman Bertazi , ZiyangZhang , Xiaoguang Wang Subject: Re: [RFC PATCH] ubd: add io_uring based userspace block driver Message-ID: References: <20220509092312.254354-1-ming.lei@redhat.com> <20220530070700.GF1363@bug> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220530070700.GF1363@bug> X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_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 Hello Pavel, On Mon, May 30, 2022 at 09:07:00AM +0200, Pavel Machek wrote: > Hi! > > > This is the driver part of userspace block driver(ubd driver), the other > > part is userspace daemon part(ubdsrv)[1]. > > > @@ -0,0 +1,1193 @@ > > +// SPDX-License-Identifier: GPL-2.0-or-later > > +/* > > + * Userspace block device - block device which IO is handled from userspace > > + * > > + * Take full use of io_uring passthrough command for communicating with > > + * ubd userspace daemon(ubdsrvd) for handling basic IO request. > > > + > > +static inline unsigned int ubd_req_build_flags(struct request *req) > > +{ > ... > > + if (req->cmd_flags & REQ_SWAP) > > + flags |= UBD_IO_F_SWAP; > > + > > + return flags; > > +} > > Does it work? How do you guarantee operation will be deadlock-free with swapping and > writebacks going on? The above is just for providing command flags to user side, so that the user side can understand/handle the request better. prtrl(PR_SET_IO_FLUSHER) has been merged for avoiding the deadlock. > > What are restriction on ubdsrv? What happens when it needs to allocate memory, or is > swapped out? Yeah, ubd_copy_pages() needs to pin pages for copying data between user VM and block request pages, and get_user_pages may run out of pages. But I think forward progress can still be provided by reserving one VM buffer with single page locked. > Have mm people seen this? I remembered that the early RFC with related discussion is CCed to mm list, and all follow-up are CC to linux-kernel. Not one big deal, will Cc mm list in the future post. thanks, Ming