Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2616222ioo; Tue, 24 May 2022 01:54:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBzzFRClmtd6n/3x9ICidyO5iepDjsvVq9nJLZVJ9Id57XUhteNs0XbCw19IuVlaYOEmkh X-Received: by 2002:a05:6402:1399:b0:410:9fa2:60d6 with SMTP id b25-20020a056402139900b004109fa260d6mr27706092edv.35.1653382489899; Tue, 24 May 2022 01:54:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653382489; cv=none; d=google.com; s=arc-20160816; b=sbx8iCQOZ8mmkn1x9m5czPD5VXVwGznviNJIYq7j8sbtpw8z17Fu6WeyqGQg8yCZl8 f63v41PiHOnLJgpB3jmGsBxXDcDU0gAI/RR6eomwldV/14y0zTjOTdTIv6Bu8dCpBxvG om4UjwB38YG71HQw7X8jbD+QWDa+Ijw47dH5xSkqLBLlGL+BxOJbOtpMBiG0NSZDtxg6 b0EuDsiaiPyTNXImElVs+wcnXweXGWIJhKm7quP2D1H58r+xy7eH7B+g8ARr5gpE3yjl nlrMeBv1eLNsHpYLNnNpDxsB67+/gxjzOGdk4RgRnrvILjRyyptHKcOH0d55MUAod6nt 8RoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=Xr0lHvjXTVWXEeMcpfBHikGqMQxP8Brjy+Y5r5qUUtk=; b=i8RfntHlPxU68ts1Frok7zCYqlvGI+ketQgU3ButM18LvsR0wSMmECmEyR5lks1ioP wWeopkEs7ogx1W5NQH6Xiiflbr8WgHJ3pyC9myLEjz7XSOuo8F67UMP7cKiCnPzB8+B5 6QoV3eyC3ixcO+7eUpYMhTrqLIH20q5cVB8pTh061eM+rOBGgznsxxymGr9QqsHwT+HK lo5cE/fSyIMqSmw7VMi5UAyxHPnsikqilyO/KHcOE4raTQQuvxYOiPTR+u1p1+fdscR+ xQuuHKqHw/t3Z4u308OtvqNuRupatyk/AnxnU588+qv+ZS7LYuzu+skah2b/enRGALcu pORA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZVLaeawm; 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 o21-20020aa7dd55000000b00420fff231a3si16697697edw.160.2022.05.24.01.54.23; Tue, 24 May 2022 01:54:49 -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=ZVLaeawm; 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 S233399AbiEXHmy (ORCPT + 99 others); Tue, 24 May 2022 03:42:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229451AbiEXHmt (ORCPT ); Tue, 24 May 2022 03:42:49 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E2D9974DF7 for ; Tue, 24 May 2022 00:42:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1653378165; 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=Xr0lHvjXTVWXEeMcpfBHikGqMQxP8Brjy+Y5r5qUUtk=; b=ZVLaeawmXC3KZGRg2OWYidAXhTcuuo9CeMvFvsgXf6SiJx6G9EWYUtLCZ7BXd4G9npZ1b0 1l6NYdJjv6O+V8LnnzOrSK7z0TNZ6bXf/Ou64cJfemmxMK7b0QLPf35I3LubdWmvLMgCGS WpshDWj/mRt+TQ93TrAUsRKWM1I3z3w= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-479-MmPUUE1DND6WWshmb25XUw-1; Tue, 24 May 2022 03:42:43 -0400 X-MC-Unique: MmPUUE1DND6WWshmb25XUw-1 Received: by mail-qt1-f199.google.com with SMTP id cn8-20020a05622a248800b002f3c7be2744so13301160qtb.17 for ; Tue, 24 May 2022 00:42:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=Xr0lHvjXTVWXEeMcpfBHikGqMQxP8Brjy+Y5r5qUUtk=; b=annYXx2RHSWId11M9YSW8FYJWKnOuQwWFJXj4QGs4BqlQiotcV3XDY2E61KG6+uTiB QUuix/lWzlXhNCmD7OdS9/5MdjogUwfcAiWIPesMywBHXM3NUjD0OdFVRP5TB9Vhva8j a0EjADXpoWMwkq7UCTHSqczd6oSh6qREt5vD+AsVhJc/J4WhlN6D+3mLpUEWCXrQdRd6 fLTHAKYJUwN1iueO5b+NsukQqH8m63H/dNip5Ske6GoOiPdfh3g3ZYGAdgVhrpaTeriz LeVrgo1Y0A1tKxfChSztTlrpfsU4h8hdYaTJGgEVR0ct4dR2bpDhLWgC/oSe8MOwkLIy XR6Q== X-Gm-Message-State: AOAM530AITWaGedI4RcuUAJJWmHGokGgPbPCwyJ7D4FxAwn/dh7cPNDo G9dMyo7abLM8hnYFPt2na67jF+acu0T9tAU3imtgUGm9sboL1IO9i9FHGbkJJ/KHOnjoXQymWLn cVblU177I1iI277gZAafBXEwrhhK1OkhEf0L1d0M2 X-Received: by 2002:a05:622a:110c:b0:2f3:d347:6f8d with SMTP id e12-20020a05622a110c00b002f3d3476f8dmr19024580qty.403.1653378162807; Tue, 24 May 2022 00:42:42 -0700 (PDT) X-Received: by 2002:a05:622a:110c:b0:2f3:d347:6f8d with SMTP id e12-20020a05622a110c00b002f3d3476f8dmr19024558qty.403.1653378162580; Tue, 24 May 2022 00:42:42 -0700 (PDT) MIME-Version: 1.0 References: <20220520172325.980884-1-eperezma@redhat.com> <20220520172325.980884-2-eperezma@redhat.com> <79089dc4-07c4-369b-826c-1c6e12edcaff@oracle.com> <20220524070900.ak7a5frwtezjhhrq@sgarzare-redhat> In-Reply-To: <20220524070900.ak7a5frwtezjhhrq@sgarzare-redhat> From: Eugenio Perez Martin Date: Tue, 24 May 2022 09:42:06 +0200 Message-ID: Subject: Re: [PATCH 1/4] vdpa: Add stop operation To: Stefano Garzarella 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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=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, May 24, 2022 at 9:09 AM Stefano Garzarella wr= ote: > > 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 wrot= e: > >> > >> > >> > >> On 5/20/2022 10:23 AM, Eugenio P=C3=A9rez wrote: > >> > This operation is optional: It it's not implemented, backend feature= bit > >> > will not be exposed. > >> > > >> > Signed-off-by: Eugenio P=C3=A9rez > >> > --- > >> > 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, b= ut 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 blow= n > >> _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 drive= r > >> 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 r= equired > >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. 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. Other non-simulated devices would need it. Could it be delayed to future development? Thanks! > Thanks, > Stefano >