Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp78893ioo; Wed, 25 May 2022 21:28:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwANSgSU7gz2edb1yk0ayzLgskyG2mCRfbzSVTPm7aSUE26D+yVICqmRQVqgN2j5jYJUAP X-Received: by 2002:a17:907:6da4:b0:6fe:fa71:a726 with SMTP id sb36-20020a1709076da400b006fefa71a726mr14302825ejc.518.1653539337896; Wed, 25 May 2022 21:28:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653539337; cv=none; d=google.com; s=arc-20160816; b=XY7s1qB0FJrfgy9e4BlsWvU4Wm/NUxc+E2rwbd8fN26dgX/WJ+BsR3ACQK0bm5wAr/ Op75s1dtInbb0ic+crH00FMUtxOfOeSrtwAcAGXPuodngRD+yvAbX/ic65D16Yq3itC4 BOctKGVqiH2QaPobtgvGrmsU9pHgjM31BxRHeYODKk1FP8+Unu3UmBpcJKP+NLeBEhFX sA38pcbGhEY8/7nhqp/bqwC5wGBN8o/1bNmHItHr+Ld2/gctI4Q0/6HKVocbj+wkYIPE 6wHeQYxsL1zD+dY8I5uxAzDid1nH8oEWopxFiiXNoMUFi3U3VehjQe9bAFM6cE59M96S +jyA== 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=t2Zld6JK1r8zgbUydwUdmco7GN3nEwbTaFoGldh5jsg=; b=D5OUX/OeAQ6e0bpxMDZ/+BZOivv6Yc/G+S7sOzn48dS+/BQmJzvxzlilDTvVflTUju WwUg2carPUU8igpir591c8A3SnjEeOQBY8zCn+lYSwX+nr3C7FhOaWXaXFbDZITrQJT/ Xd6MlufscA2wqt/axTl4Nbapi7nxBbh997qwzNmOHO3e6Wl81mPGedy/A4o2PxsBjNnk 4yA7vDkPUCoWJtAfRVFYS3TPJjPA4JgPnvXV1Gy2CaNvutzr5cGvT/LN1VsK9WHCV5NM uo+vLj1Q/DPGtnpQXSRXmTwZQcCgkweVTRRLcH59/IniCqG5Wkbgjra9mW2/+ZDjIo4l AK7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=abmB+yS2; 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 hg6-20020a1709072cc600b006fe9e53b67esi439351ejc.814.2022.05.25.21.28.32; Wed, 25 May 2022 21:28:57 -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=abmB+yS2; 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 S244194AbiEYGnf (ORCPT + 99 others); Wed, 25 May 2022 02:43:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244186AbiEYGnd (ORCPT ); Wed, 25 May 2022 02:43:33 -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 421A85DA2D for ; Tue, 24 May 2022 23:43:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1653461010; 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=t2Zld6JK1r8zgbUydwUdmco7GN3nEwbTaFoGldh5jsg=; b=abmB+yS2IO2djQn1lWcV1T6g0o7r7MlMUx60sb9J2zMjTEOZ/9jdA/IdxTdlLCOLXPDmcF b3LcZtixnRHVLq0P+SnqeBAbj0I6bzoyN4bsvBRvdCUcZnJek8F2h7t0lHpHCqZEzP5y1T Ip90vgVI4a4s9sQpsZt+lwEbmc6+HNw= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-385-Er9RRiyBNBeOqxlVXKTpFA-1; Wed, 25 May 2022 02:43:28 -0400 X-MC-Unique: Er9RRiyBNBeOqxlVXKTpFA-1 Received: by mail-qt1-f200.google.com with SMTP id d4-20020a05622a15c400b002f3bd4b80f7so15608959qty.3 for ; Tue, 24 May 2022 23:43:28 -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=t2Zld6JK1r8zgbUydwUdmco7GN3nEwbTaFoGldh5jsg=; b=dw3JueTuatkihAlCSvutkVUs2gk43nmpfm0tDjcebOSqdqcVo8ZzaW46VUV3diy97J +gpzUcXxgiYSQj/Dl1Mif5NGY0TsDZOVtdTwh56gM9xztJ0406gl7F7HqYnq/LGbN0vg Ou4HwZSYKbXkTYtzERH9XZNU5kZ1ZNXWEKqMPSozjDSx+GO9HJdW8eEwfR+L6TSSJtRR 7ujE3JKVU5Vx7cPoxvwhxHj9V7W/v6E6Jv8jTGDrLUQdumW26GSyr2gQC6uCRm18d7I6 V3/XO/swvPlSZuwyEw9LLZXZyy1OZTtKmXkx0vJ4OXhp5UFsaYNjG3cB2q1OcFRCsVG3 v9Ig== X-Gm-Message-State: AOAM530sXJVmI4qdc23C68GSf0SEBT2/GoXB3rmoWpQZsjf9eosZOs3M fpyln+dR9ua6a5t6rixVEumZ3UHfZwipZKanjMDBz0itDBpGIsRqrtkbwm9k7SmicTzkmZZ1au6 8/Za6JVYD0RxIDlf1oUPoFl4dSt23xqZX5CXaod7w X-Received: by 2002:a05:622a:110c:b0:2f3:d347:6f8d with SMTP id e12-20020a05622a110c00b002f3d3476f8dmr23194829qty.403.1653461008275; Tue, 24 May 2022 23:43:28 -0700 (PDT) X-Received: by 2002:a05:622a:110c:b0:2f3:d347:6f8d with SMTP id e12-20020a05622a110c00b002f3d3476f8dmr23194805qty.403.1653461008055; Tue, 24 May 2022 23:43:28 -0700 (PDT) MIME-Version: 1.0 References: <20220524170610.2255608-1-eperezma@redhat.com> In-Reply-To: From: Eugenio Perez Martin Date: Wed, 25 May 2022 08:42:52 +0200 Message-ID: Subject: Re: [PATCH v2 0/4] Implement vdpasim stop operation To: Jason Wang Cc: netdev , virtualization , "Michael S. Tsirkin" , kvm , linux-kernel , Parav Pandit , Zhang Min , Harpreet Singh Anand , Zhu Lingshan , tanuj.kamde@amd.com, "Dawar, Gautam" , Christophe JAILLET , Xie Yongji , Dinan Gunawardena , habetsm.xilinx@gmail.com, Eli Cohen , Pablo Cascon Katchadourian , Laurent Vivier , Dan Carpenter , Cindy Lu , Wu Zongyong , ecree.xilinx@gmail.com, "Uminski, Piotr" , Martin Porter , Stefano Garzarella , Si-Wei Liu , Longpeng , Martin Petrus Hubertus Habets 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 Wed, May 25, 2022 at 4:49 AM Jason Wang wrote: > > On Wed, May 25, 2022 at 1:06 AM Eugenio P=C3=A9rez = wrote: > > > > Implement stop operation for vdpa_sim devices, so vhost-vdpa will offer > > that backend feature and userspace can effectively stop the device. > > > > 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, vhost-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. > > I'd suggest documenting this in the code maybe around ops->stop()? > I agree it'd be better to put in the source code, but both vdpa_config_ops and ops->stop don't have a lot of space for docs. Would it work to document at drivers/vdpa/vdpa.c:vhost_vdpa_stop() and redirect config ops like "for more info, see vhost_vdpa_stop"? Thanks! > Thanks > > > > > 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). > > > > In the future, we will provide features similar to VHOST_USER_GET_INFLI= GHT_FD > > so the device can save pending operations. > > > > Comments are welcome. > > > > v2: > > * Replace raw _F_STOP with BIT_ULL(_F_STOP). > > * Fix obtaining of stop ioctl arg (it was not obtained but written). > > * Add stop to vdpa_sim_blk. > > > > Eugenio P=C3=A9rez (4): > > vdpa: Add stop operation > > vhost-vdpa: introduce STOP backend feature bit > > vhost-vdpa: uAPI to stop the device > > vdpa_sim: Implement stop vdpa op > > > > drivers/vdpa/vdpa_sim/vdpa_sim.c | 21 +++++++++++++++++ > > drivers/vdpa/vdpa_sim/vdpa_sim.h | 1 + > > drivers/vdpa/vdpa_sim/vdpa_sim_blk.c | 3 +++ > > drivers/vdpa/vdpa_sim/vdpa_sim_net.c | 3 +++ > > drivers/vhost/vdpa.c | 34 +++++++++++++++++++++++++++- > > include/linux/vdpa.h | 6 +++++ > > include/uapi/linux/vhost.h | 3 +++ > > include/uapi/linux/vhost_types.h | 2 ++ > > 8 files changed, 72 insertions(+), 1 deletion(-) > > > > -- > > 2.27.0 > > > > >