Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp6028980ioo; Wed, 1 Jun 2022 19:06:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLmRY4wcyUezI7G049tbWqIjSsVIaEHfj7xW0yGzaz0v6JAPfwHJdXTLCqO9Z39b0U1gNh X-Received: by 2002:a63:cd01:0:b0:3f2:7f8d:14e8 with SMTP id i1-20020a63cd01000000b003f27f8d14e8mr2026934pgg.491.1654135603805; Wed, 01 Jun 2022 19:06:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654135603; cv=none; d=google.com; s=arc-20160816; b=Dc2DRMJC3twnrva3lMEgsfESDpCQD8zkuW+87ggYvYcVtt4T8t3/GpDgK0eF2TaszY C6qasl8vRFVKIq97OsWZUOPLL6GVvd4AlpDdBbozF4b3dfMAqp6Qc3aZco5TXp+LtYDf pDRtBdmJwkTR4RB7SDWFVe1XAVRYFMkPCgJBEWAwudLiocNqcVnKMdp2+g73jV3oFXdE hhtG+aOW+D9xLagaunu9Q61p0/FZ3crQZaxKPUUg1rvVuXsPhamVG9T9Ypk0+6fhEWdl qYvVhiAHOcFFrT1r6Jhg6MoRyOhfEPUBIR/1P4eh1vEQJtSU2wi/3oabVHrqoTfH2Cex kJow== 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=JbogCu4cCieqVdCMmZW/jFyVB+BvEMhJqOq5Ni57RGQ=; b=Y5tmybC1YwLzCUIOkWpSsendbvZfDLFtK2Paq3V0fTsaw8cqXjrqiRegD99h8FRL/a lL2eJs2KsU3PR2LOTj2QVvXfYWA5XBqVx5YQn8U0W2fnl09ITYVS/DtPp6PBOh+M3UwH pEaO698RycY56iPh7CgwQspyRlUgD8iwdDmhb1ywHznSa9qAaxYlDb9zMPZIdTGqUsJN zSGuRt+XaDBVukEGMrViyqL5g5VVO4uWayBpwSODYm1qKyqW8n/5Sf+XHOjOzLj4LPk4 T++aBMQMWZmzZ884Mv7GeUAIUpmQNGheQydBHHZC1CqKOgxET83H3Q14ZMf65ufohb3y 4fyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Z1zMlQAh; 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 j20-20020a170902f25400b00163ed137ad8si3673229plc.181.2022.06.01.19.06.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 19:06:43 -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=Z1zMlQAh; 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 44EBBAE75; Wed, 1 Jun 2022 19:03:28 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233240AbiFBCDJ (ORCPT + 99 others); Wed, 1 Jun 2022 22:03:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233241AbiFBCDH (ORCPT ); Wed, 1 Jun 2022 22:03:07 -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 AC0C2630B for ; Wed, 1 Jun 2022 19:03:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654135382; 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=JbogCu4cCieqVdCMmZW/jFyVB+BvEMhJqOq5Ni57RGQ=; b=Z1zMlQAh6buEfpcSZmwBQ6zPuQah7G7gwYXdsXKUhYvMZIXgRiAc8g3CX9pDifA/a2KCPO 81gsBz1hM2g5UYtjVFMJKzZ+kSXWz/052nAWvBdAYGsVb0el9Bw1ZLTOYT5TkhPRkvGdzn vqW29a+KV8yQIuWZO4DdkMHGK5UHTA8= Received: from mail-lf1-f69.google.com (mail-lf1-f69.google.com [209.85.167.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-135-FEHVmdy3POmh5LVODOkXeQ-1; Wed, 01 Jun 2022 22:03:01 -0400 X-MC-Unique: FEHVmdy3POmh5LVODOkXeQ-1 Received: by mail-lf1-f69.google.com with SMTP id bf30-20020a056512259e00b00478a8b7ab63so1770059lfb.17 for ; Wed, 01 Jun 2022 19:03:01 -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=JbogCu4cCieqVdCMmZW/jFyVB+BvEMhJqOq5Ni57RGQ=; b=deHUBp4LIvz0v+J/PfmPK8H3rnLLlYSHJsF/TXTRT6IkZsn1s/oRFxHtifgeVR4xAZ PGcOlFtLMr+pxaBXV8ljeLSGX43916uarExehW/qgv6IjwxVP+axox7vTcNl5QbwDPN2 cbjCTnxMbYN8qQC1z4QgY9aJ1XrqS5ktaoyI2jkrhQwkNEW1Pu3I6P2rwoKLBjo6/fj8 LAYHsxDbAPdGPO73lRPfNbMI2PnFi1OmDr5/w3547y0L1IVxKKDfJhk8OrF99nK9KWSt dUBxA0x5FWucvD54IObCleLd2hr/P22jAGUnJHzVFhlZTUQ73DsJs3QkQoj2U/Pdq+7h W8QQ== X-Gm-Message-State: AOAM532Vb6c+y21xYxNmn+bjkI6hNud2GD25ct6Je13LWW5oAJq2vDqO wtaXLRH/IAD/oWWLeGOhi3MyLvncpOOKgo9H+X2agRDvDLBSIQEIJRbOpOEtWzsCPyzYcRvi5I5 Y4/jKZjcRtu7mBPqUY5OZpSTpXKpAS7bZUGuA9/dT X-Received: by 2002:a05:6512:c0e:b0:478:5a91:20bb with SMTP id z14-20020a0565120c0e00b004785a9120bbmr42956282lfu.587.1654135380300; Wed, 01 Jun 2022 19:03:00 -0700 (PDT) X-Received: by 2002:a05:6512:c0e:b0:478:5a91:20bb with SMTP id z14-20020a0565120c0e00b004785a9120bbmr42956248lfu.587.1654135380074; Wed, 01 Jun 2022 19:03:00 -0700 (PDT) MIME-Version: 1.0 References: <20220526124338.36247-1-eperezma@redhat.com> <20220527065442-mutt-send-email-mst@kernel.org> In-Reply-To: From: Jason Wang Date: Thu, 2 Jun 2022 10:02:48 +0800 Message-ID: Subject: Re: [PATCH v4 0/4] Implement vdpasim stop operation To: Parav Pandit Cc: Eugenio Perez Martin , "Michael S. Tsirkin" , "kvm@vger.kernel.org" , "virtualization@lists.linux-foundation.org" , "linux-kernel@vger.kernel.org" , "netdev@vger.kernel.org" , "martinh@xilinx.com" , Stefano Garzarella , "martinpo@xilinx.com" , "lvivier@redhat.com" , "pabloc@xilinx.com" , Eli Cohen , Dan Carpenter , Xie Yongji , Christophe JAILLET , Zhang Min , Wu Zongyong , "lulu@redhat.com" , Zhu Lingshan , "Piotr.Uminski@intel.com" , Si-Wei Liu , "ecree.xilinx@gmail.com" , "gautam.dawar@amd.com" , "habetsm.xilinx@gmail.com" , "tanuj.kamde@amd.com" , "hanand@xilinx.com" , "dinang@xilinx.com" , Longpeng Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 On Thu, Jun 2, 2022 at 3:30 AM Parav Pandit wrote: > > > > > From: Eugenio Perez Martin > > Sent: Wednesday, June 1, 2022 5:50 AM > > > > On Tue, May 31, 2022 at 10:19 PM Parav Pandit wrote: > > > > > > > > > > From: Jason Wang > > > > Sent: Sunday, May 29, 2022 11:39 PM > > > > > > > > On Fri, May 27, 2022 at 6:56 PM Michael S. Tsirkin > > wrote: > > > > > > > > > > On Thu, May 26, 2022 at 12:54:32PM +0000, Parav Pandit wrote: > > > > > > > > > > > > > > > > > > > From: Eugenio P=C3=A9rez > > > > > > > Sent: Thursday, May 26, 2022 8:44 AM > > > > > > > > > > > > > Implement stop operation for vdpa_sim devices, so vhost-vdpa > > > > > > > will offer > > > > > > > > > > > > > > that backend feature and userspace can effectively stop the d= evice. > > > > > > > > > > > > > > > > > > > > > > > > > > > > This is a must before get virtqueue indexes (base) for live > > > > > > > migration, > > > > > > > > > > > > > > since the device could modify them after userland gets them. > > > > > > > There are > > > > > > > > > > > > > > individual ways to perform that action for some devices > > > > > > > > > > > > > > (VHOST_NET_SET_BACKEND, VHOST_VSOCK_SET_RUNNING, ...) > > but > > > > there > > > > > > > was no > > > > > > > > > > > > > > way to perform it for any vhost device (and, in particular, v= host- > > vdpa). > > > > > > > > > > > > > > > > > > > > > > > > > > > > After the return of ioctl with stop !=3D 0, 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= . > > > > > > > The > > > > > > > > > > > > > > device must not change its configuration after that point. > > > > > > > > > > > > > > > > > > > > > > > > > > > > After the return of ioctl with stop =3D=3D 0, the device can > > > > > > > continue > > > > > > > > > > > > > > processing buffers as long as typical conditions are met (vq > > > > > > > is enabled, > > > > > > > > > > > > > > DRIVER_OK status bit is enabled, etc). > > > > > > > > > > > > Just to be clear, we are adding vdpa level new ioctl() that > > > > > > doesn=E2=80=99t map to > > > > any mechanism in the virtio spec. > > > > > > > > > > > > Why can't we use this ioctl() to indicate driver to start/stop > > > > > > the device > > > > instead of driving it through the driver_ok? > > > > > > This is in the context of other discussion we had in the LM ser= ies. > > > > > > > > > > If there's something in the spec that does this then let's use th= at. > > > > > > > > Actually, we try to propose a independent feature here: > > > > > > > > https://lists.oasis-open.org/archives/virtio-dev/202111/msg00020.ht= m > > > > l > > > > > > > This will stop the device for all the operations. > > > Once the device is stopped, its state cannot be queried further as de= vice > > won't respond. > > > It has limited use case. > > > What we need is to stop non admin queue related portion of the device= . > > > > > > > Still don't follow this, sorry. > Once a device it stopped its state etc cannot be queried. This is not what is proposed here. > if you want to stop and still allow certain operations, a better spec def= inition is needed that says, > > stop A, B, C, but allow D, E, F, G. > A =3D stop CVQs and save its state somewhere > B =3D stop data VQs and save it state somewhere > C =3D stop generic config interrupt Actually, it's the stop of the config space change. And what more, any guest visible state must not be changed. > > D =3D query state of multiple VQs > E =3D query device statistics and other elements/objects in future This is the device state I believe. > F =3D setup/config/restore certain fields This is the reverse of D and E, that is setting the state. > G =3D resume the device > Thanks > > > > Adding the admin vq to the mix, this would stop a device of a device gr= oup, > > but not the whole virtqueue group. If the admin VQ is offered by the PF > > (since it's not exposed to the guest), it will continue accepting reque= sts as > > normal. If it's exposed in the VF, I think the best bet is to shadow it= , since > > guest and host requests could conflict. > > > > Since this is offered through vdpa, the device backend driver can route= it to > > whatever method works better for the hardware. For example, to send an > > admin vq command to the PF. That's why it's important to keep the featu= re > > as self-contained and orthogonal to others as possible. > > > > I replied in other thread to continue there.