Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2663942ioo; Tue, 24 May 2022 03:15:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPusDhKjfdLPIcU4oiIwCYIbUnvuoZ/QNKFSf7Te0XYsE0IbTS0Z+jYNRorQfKjUxHDZXh X-Received: by 2002:a17:906:4fd1:b0:6f3:be23:7ad5 with SMTP id i17-20020a1709064fd100b006f3be237ad5mr23732142ejw.264.1653387354138; Tue, 24 May 2022 03:15:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653387354; cv=none; d=google.com; s=arc-20160816; b=RGPIIAIudktdcUZxy12GUd63bKHdDRiqfPGGFZ+r0bTTJzaLvwDyF3q6WK1d+VNidI nXCrisoHqQNWehI/38NOoo7yx85VDXb4TRWDmCOjxMLrajhIHY5O6OQEUdfi2V+5uaiH L4cyLMpKkN0njJaDto02sasbtuPrgK0zVl56Kdob8/Zv6xWZXD2C9chDOyIwUkDEWZbY Pun/5aL4YvpT8lJaStixOs9V/6ziwPynVljuqmsO1lrGq1t+EDJK5TD+AkJf4TxwT5ei xPYaCGZvK+xG7Au3FyNATR+kAERyrrIZ8df5ES6rZS31fdVuPtvtEX8D1gQWoJQaoOG3 0jpw== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=eLiRBJigFuDJflEBL1yIFfpnc5pdYqpynwY7vvoEGYo=; b=l55w4t4q0GF9MKgRyMvcj8wMtw5J81/0TwUG+yeb7x23Nyh+wVVyzHQPT3rq4dbz5x Sl8SExGLUunvJ90XgL+AM1E+haQPsyCoCWA1sfF/ZrwdpFTTA1mucY4ewOe8w9j5JzjD BHwhfdRxWXByjliqv6xYJ0Mih7JKthlNOBHWXIknNjZNkepAsoTEI7Y4XBT3ZBBpt7ED 3foXg2SR5hvwu8839JJnldeecg9VvvVPxOkAS8YOFTKHAfbYauQVb6CgUwc/L7gvID91 Cf/gvNgmQ27DjDdTB5d1aQ2SxmucZRvTCE4aLXK8RKeBe48F3DPoIrfw4C9xsVq4Rb/S VQbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="IE/9BcFi"; 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 t12-20020a1709067c0c00b006fea05c0ccasi7807157ejo.680.2022.05.24.03.15.17; Tue, 24 May 2022 03:15: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="IE/9BcFi"; 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 S233276AbiEXHwR (ORCPT + 99 others); Tue, 24 May 2022 03:52:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233650AbiEXHwN (ORCPT ); Tue, 24 May 2022 03:52:13 -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 86E4549902 for ; Tue, 24 May 2022 00:52:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1653378729; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eLiRBJigFuDJflEBL1yIFfpnc5pdYqpynwY7vvoEGYo=; b=IE/9BcFiIGagO6t34yXM5AIaMaYECPX95rsyj6l7DHDK1Hg/lEk/EeRzciuTyyfdyIX1ku O7qT54jXtuJi4N1rp0TnTJMXYvlXhFci3ZifeQ+Eyb7K63rg+FtQaHzsnuVXNzaCYVkdmM iJJD3/9Wx8BJxlQY1G4hpzQ/TF43Tn4= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-346-WoFxa9JfPySEya_cDoE1Fg-1; Tue, 24 May 2022 03:52:08 -0400 X-MC-Unique: WoFxa9JfPySEya_cDoE1Fg-1 Received: by mail-qv1-f70.google.com with SMTP id az11-20020ad4550b000000b00461ea78ec33so12376081qvb.16 for ; Tue, 24 May 2022 00:52:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=eLiRBJigFuDJflEBL1yIFfpnc5pdYqpynwY7vvoEGYo=; b=plRqCsoEK197yTL+7VS0SD2v4SUttPdcnKnqEsR+E7JUbYPHQ39lqosCm/qY5nORw2 84Lf30S0fh3bPaymracFYfIy2/ou78uoTU8YOMKKEdXH3AQLxDfMfO73b6wzxB416r07 56bZb5kOIZvMuWuRcwinQLvGOA/AU23inX06JbK6YnxEK78d6mIDo6I4W/k4DZp+zemh HWMJW8svXLSQjINfJlGTurxkFRMGB07btySOasNvhpfSf8/NCaqgyWedLaBE3MpWc6Ld WfKcRm+GkgczArcuO4fPrJDhO1jfAgur+lqTlqIGi0q/SAW6MtDL88rEe2PRLPS8gh8+ Q4UQ== X-Gm-Message-State: AOAM531lSaMDgUdYgLU3bS+7UozoKW+xKATntS31AdwGVfBgQ/RD3Q7y H2CFZWnH+tetOMs8w8Y9u9tqVzoEXrOP4v7Rg1fknjEBn7yjjsVuEEo3je2DkLwbDXO+Fb5PPLL +xhpH5Hxq2xRXMYWua976+POy X-Received: by 2002:a05:622a:216:b0:2f9:30b3:45ee with SMTP id b22-20020a05622a021600b002f930b345eemr9051383qtx.397.1653378728043; Tue, 24 May 2022 00:52:08 -0700 (PDT) X-Received: by 2002:a05:622a:216:b0:2f9:30b3:45ee with SMTP id b22-20020a05622a021600b002f930b345eemr9051362qtx.397.1653378727818; Tue, 24 May 2022 00:52:07 -0700 (PDT) Received: from sgarzare-redhat (host-87-12-25-16.business.telecomitalia.it. [87.12.25.16]) by smtp.gmail.com with ESMTPSA id o62-20020a37a541000000b006a34df5a9a9sm5288177qke.126.2022.05.24.00.52.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 May 2022 00:52:07 -0700 (PDT) Date: Tue, 24 May 2022 09:51:58 +0200 From: Stefano Garzarella To: Eugenio Perez Martin Cc: Si-Wei Liu , virtualization , Jason Wang , kvm list , "Michael S. Tsirkin" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Longpeng , Zhu Lingshan , Martin Petrus Hubertus Habets , Harpreet Singh Anand , dinang@xilinx.com, Eli Cohen , Laurent Vivier , pabloc@xilinx.com, "Dawar, Gautam" , Xie Yongji , habetsm.xilinx@gmail.com, Christophe JAILLET , tanuj.kamde@amd.com, Wu Zongyong , martinpo@xilinx.com, Cindy Lu , ecree.xilinx@gmail.com, Parav Pandit , Dan Carpenter , Zhang Min Subject: Re: [PATCH 1/4] vdpa: Add stop operation Message-ID: <20220524075158.2vyuw7ga72xub7pp@sgarzare-redhat> References: <20220520172325.980884-1-eperezma@redhat.com> <20220520172325.980884-2-eperezma@redhat.com> <79089dc4-07c4-369b-826c-1c6e12edcaff@oracle.com> <20220524070900.ak7a5frwtezjhhrq@sgarzare-redhat> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-3.5 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,T_SCC_BODY_TEXT_LINE autolearn=ham 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, May 24, 2022 at 09:42:06AM +0200, Eugenio Perez Martin wrote: >On Tue, May 24, 2022 at 9:09 AM Stefano Garzarella wrote: >> >> On Mon, May 23, 2022 at 09:20:14PM +0200, Eugenio Perez Martin wrote: >> >On Sat, May 21, 2022 at 12:13 PM Si-Wei Liu wrote: >> >> >> >> >> >> >> >> On 5/20/2022 10:23 AM, Eugenio P?rez wrote: >> >> > This operation is optional: It it's not implemented, backend feature bit >> >> > will not be exposed. >> >> > >> >> > Signed-off-by: Eugenio P?rez >> >> > --- >> >> > include/linux/vdpa.h | 6 ++++++ >> >> > 1 file changed, 6 insertions(+) >> >> > >> >> > diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h >> >> > index 15af802d41c4..ddfebc4e1e01 100644 >> >> > --- a/include/linux/vdpa.h >> >> > +++ b/include/linux/vdpa.h >> >> > @@ -215,6 +215,11 @@ struct vdpa_map_file { >> >> > * @reset: Reset device >> >> > * @vdev: vdpa device >> >> > * Returns integer: success (0) or error (< 0) >> >> > + * @stop: Stop or resume the device (optional, but it must >> >> > + * be implemented if require device stop) >> >> > + * @vdev: vdpa device >> >> > + * @stop: stop (true), not stop (false) >> >> > + * Returns integer: success (0) or error (< 0) >> >> Is this uAPI meant to address all use cases described in the full blown >> >> _F_STOP virtio spec proposal, such as: >> >> >> >> --------------%<-------------- >> >> >> >> ...... the device MUST finish any in flight >> >> operations after the driver writes STOP. Depending on the device, it >> >> can do it >> >> in many ways as long as the driver can recover its normal operation >> >> if it >> >> resumes the device without the need of resetting it: >> >> >> >> - Drain and wait for the completion of all pending requests until a >> >> convenient avail descriptor. Ignore any other posterior descriptor. >> >> - Return a device-specific failure for these descriptors, so the driver >> >> can choose to retry or to cancel them. >> >> - Mark them as done even if they are not, if the kind of device can >> >> assume to lose them. >> >> --------------%<-------------- >> >> >> > >> >Right, this is totally underspecified in this series. >> > >> >I'll expand on it in the next version, but that text proposed to >> >virtio-comment was complicated and misleading. I find better to get >> >the previous version description. Would the next description work? >> > >> >``` >> >After the return of ioctl, the device MUST finish any pending operations like >> >in flight requests. It must also preserve all the necessary state (the >> >virtqueue vring base plus the possible device specific states) that is required >> >for restoring in the future. >> >> For block devices wait for all in-flight requests could take several >> time. >> >> Could this be a problem if the caller gets stuck on this ioctl? >> >> If it could be a problem, maybe we should use an eventfd to signal that >> the device is successfully stopped. >> > >For that particular problem I'd very much prefer to add directly an >ioctl to get the inflight descriptors. We know for sure we will need >them, and it will be cleaner in the long run. Makes sense! > >As I understand the vdpa block simulator, there is no need to return >the inflight descriptors since all of the requests are processed in a >synchronous way. So, for this iteration, we could offer the stop >feature to qemu. Right, the simulator handles everything synchronously. > >Other non-simulated devices would need it. Could it be delayed to >future development? Yep, sure, it sounds like you already have a plan, so no problem :-) Thanks, Stefano