Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1045214rwb; Fri, 23 Sep 2022 07:33:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4rAMI8PZnx0BTh8VE8hBwBWrLv3j4o3scT04/3RJhEGs87+1JMsoOFoF8EWn43F+hX6N3U X-Received: by 2002:a05:6402:3806:b0:450:bad8:8cd5 with SMTP id es6-20020a056402380600b00450bad88cd5mr8800660edb.305.1663943588116; Fri, 23 Sep 2022 07:33:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663943588; cv=none; d=google.com; s=arc-20160816; b=YkDGp2Pb4MwhyZHecDNByYeIAr05v3daDomx9ssCXF9lxeLBYIF8IOJgc1YoinDtlX Lh3EdZflkQYBYF573d7GLimMJWC13gkI5UcShQDY8pQb7wAgzh6p7Amg4/uF8TaifWbs ujNqJABzgtt255YFT5pmWJqWv5CKokaKxmsbKgz6B+d7/xf3AKcX1OUgKkcSYxEDjX8v 3Dkiu9ZPICrjsHeaf9P5r7Vfsh6tw9/PlTYSG0tGNpn++okLzFL+bMGhylw14AXOmHJw 7tlobxeILbnBVMI5CWYwWX1ghAXD70Kdii5pu8kvH8jNjtEvtvXXBhE/SatRWxmqB4JW xdWA== 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=c25qKkQtr8eg0uMGbc/9kUwAiXIlPBy7C//4rh/Zkj4=; b=OKWKHyoXtS57Mh6AssmHYoG36ZI4TLeR6gBLBnseO60RKlM+SRlklA5wqHLiJ+yPOi pb721u9GAIvP93zjjtouE5VIacKm9o8RPpzT1WOwxoG1mqWjMplnhWcjZOtZCnogYJMk SkDvQn1AXzkigB1/M0bkSZq+Qm3mIrRIi9jmMShcr2i0nirJUmgxUEG9F8NFCOWWz4Gb wB82rcyGLYaLThawheBf+TQVdgvXA8DaPiQ8529TEVBtPVywN2FG+RH67slKWmtPP+/v v0+kFV7AR5gXEZIY/GYtVwJ0v4yBSFQbo6v/0vfZuSiPW4YpE8asbzXH9hsMAgn5HWpL CR3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=e44oD4sB; 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 n11-20020a05640205cb00b0043a9bb390d3si9502414edx.278.2022.09.23.07.32.41; Fri, 23 Sep 2022 07:33:08 -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=e44oD4sB; 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 S232348AbiIWNsp (ORCPT + 99 others); Fri, 23 Sep 2022 09:48:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232133AbiIWNsi (ORCPT ); Fri, 23 Sep 2022 09:48:38 -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 54ED6E7431 for ; Fri, 23 Sep 2022 06:48:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663940916; 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=c25qKkQtr8eg0uMGbc/9kUwAiXIlPBy7C//4rh/Zkj4=; b=e44oD4sBQZO8FhVm2nnEn119Y1BwrIqqdiC/qWqvuRkiaoWKIQwMNnLannHjRZgtbSldjM 9Ppj9WeTwjWxsxuf/ZeTNZ1IyvqGA0RUBQVv7B7WPYwpgRWdzezJt0o6/IV8/0CofiVzlw b+ZtjIu9u16gQ7S29XeWJmjUPLYdbbk= 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-464-bL9OT4CAPrKPz1CnLhjiWA-1; Fri, 23 Sep 2022 09:48:25 -0400 X-MC-Unique: bL9OT4CAPrKPz1CnLhjiWA-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 796A985A59D; Fri, 23 Sep 2022 13:48:25 +0000 (UTC) Received: from T590 (ovpn-8-24.pek2.redhat.com [10.72.8.24]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1BCD840E0426; Fri, 23 Sep 2022 13:48:20 +0000 (UTC) Date: Fri, 23 Sep 2022 21:48:15 +0800 From: Ming Lei To: ZiyangZhang Cc: axboe@kernel.dk, xiaoguang.wang@linux.alibaba.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, joseph.qi@linux.alibaba.com Subject: Re: [RESEND PATCH V5 4/7] ublk_drv: consider recovery feature in aborting mechanism Message-ID: References: <20220923061505.52007-1-ZiyangZhang@linux.alibaba.com> <20220923061505.52007-5-ZiyangZhang@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220923061505.52007-5-ZiyangZhang@linux.alibaba.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, 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 Fri, Sep 23, 2022 at 02:15:02PM +0800, ZiyangZhang wrote: > With USER_RECOVERY feature enabled, the monitor_work schedules > quiesce_work after finding a dying ubq_daemon. The monitor_work > should also abort all rqs issued to userspace before the ubq_daemon is > dying. The quiesce_work's job is to: > (1) quiesce request queue. > (2) check if there is any INFLIGHT rq. If so, we retry until all these > rqs are requeued and become IDLE. These rqs should be requeued by > ublk_queue_rq(), task work, io_uring fallback wq or monitor_work. > (3) complete all ioucmds by calling io_uring_cmd_done(). We are safe to > do so because no ioucmd can be referenced now. > (5) set ub's state to UBLK_S_DEV_QUIESCED, which means we are ready for > recovery. This state is exposed to userspace by GET_DEV_INFO. > > The driver can always handle STOP_DEV and cleanup everything no matter > ub's state is LIVE or QUIESCED. After ub's state is UBLK_S_DEV_QUIESCED, > user can recover with new process. > > Note: we do not change the default behavior with reocvery feature > disabled. monitor_work still schedules stop_work and abort inflight > rqs. And finally ublk_device is released. > > Signed-off-by: ZiyangZhang Looks fine, Reviewed-by: Ming Lei Thanks, Ming