Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp5776011ioo; Wed, 1 Jun 2022 12:19:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZ9ijAiuDaCDON7Kyq+SC6AdKC7saC1rAvVMIAK4xlgT5qxXoKP5Bne4fN52gCOl7kECg3 X-Received: by 2002:a17:902:cf0c:b0:15b:63a4:9f47 with SMTP id i12-20020a170902cf0c00b0015b63a49f47mr938741plg.1.1654111192045; Wed, 01 Jun 2022 12:19:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654111192; cv=none; d=google.com; s=arc-20160816; b=nc8NsrzmZ0ZjWXUSL7Oo/RaGJncUg8bK32+J+qpEsnNI8XLnw0UsEUo/M3j+2MdEr6 cRskAm8LGKJ35IRc+hKRFc+8vQktP/wIk+i6DEbkFoUfbru8dg99XTO/k/4EhzWrgAkh CIe5ZtkoTt+wYcWM213Uv5sfThxKKiX7t2ei7FlhpxmpNmTRItUuIxbEDpffKvqupENA Oo1o04DzCRXm7dhEE+VuffzVgr5nEyMzyEOBh5+4w0tuz8+ZfksX0PxSAliYmv8wXdEz jLkoNqfoY7YXIwSXKoDs8NUXU4iTr+8IpdFWXJR2ztAp5RatJkOTnW98Q5V3DQoqA6Ll hDcQ== 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=R1t1NBmkNMBO5DYdEINGWFlHVzMhXZpx3lk8YtT0vEg=; b=lK+JDl4poZK/MvgrS2oiKEWn54sg5pM5/ce4qmmtPj/TbayVybNs6B6x858oL5iWU1 RNJRumaAEPXO5kLYpGozPuntEhGqiOoXDO0dy55sKpBUf8XOJ/Ug8UuX9GNDg3DmhdJY mkSB/vKFmaVYzJaUe+9mNLUE/xVc2GALDabdxt0yJIACbs94eqmM+hIYYUaoMcq01Y01 k85vwuSQJKWLBoqqx7ks7rbZtmD410SikGhNVPrijsio+TOpM8a3reVGDDhEirZ/r1Jz doSV3fx4UaWFt2VcRkq/zAa17uIg7vADOEew8K6tHt84+rt/3EXPJELfte9K2pMy3RTW HaaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="TjXHxF/8"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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. [23.128.96.19]) by mx.google.com with ESMTPS id l12-20020a170903244c00b00158da867027si3695157pls.624.2022.06.01.12.19.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 12:19:52 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="TjXHxF/8"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 A3ED97982A; Wed, 1 Jun 2022 11:55:51 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245142AbiEaJXa (ORCPT + 99 others); Tue, 31 May 2022 05:23:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245134AbiEaJX2 (ORCPT ); Tue, 31 May 2022 05:23:28 -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 E49E184A36 for ; Tue, 31 May 2022 02:23:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1653989007; 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=R1t1NBmkNMBO5DYdEINGWFlHVzMhXZpx3lk8YtT0vEg=; b=TjXHxF/8P0h+Yf0nJMbN1Lxd4aGIcCCUqvpL1DEKCQcg/8LcNdbpW961yYXBCRLSBHaeQe bVQq0OAXG3/ajAAAWb4jDZodAtKc14Di5xjOPUOFT0W3TRysNUYg5+MqDV/aixzJzxYZVt lUTTBHuUrjTXERRXWTbYx7vCRpSIk6k= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-152-E0ZfxczVOK6q9DD1XFlu5w-1; Tue, 31 May 2022 05:23:24 -0400 X-MC-Unique: E0ZfxczVOK6q9DD1XFlu5w-1 Received: by mail-wm1-f70.google.com with SMTP id n25-20020a05600c3b9900b0039733081b4dso982432wms.7 for ; Tue, 31 May 2022 02:23:24 -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=R1t1NBmkNMBO5DYdEINGWFlHVzMhXZpx3lk8YtT0vEg=; b=PFFaJ1cdME8XeG1UenAmBNdK/RbaiASK/GsGXeGptwA6UWbmtTImGPbY7rVBzFTcFK 5j5IC67uvkjfY2QMvQwN3YBcrwiqqg2a2kI36rrER2Pyd9XbPkAfRPmnkOTopSVy+Qyp HBmhGzgAmWtUEbIgCj6hIK3kFAYYRnd9VayzzfACscbQvkd8+dlnowbt6RlDNx+whBSq OpGhlynI3+UlLLwPOBY8AaDGhyxDgGhJtTT+SuEB9XJS2O9QQmnaGwZTnVxBdN+jCJ8J vc8MSiEGX1Spvk5TLmeD3TfDL6HCM4q9stp9HSf/MylN80CZqfqk3HiDwNNVkzRvaQbd Xraw== X-Gm-Message-State: AOAM53159JBY6oQw3UvOVfsL/MetYK6KF0NoOIZh5Y6nFJwbrHf7e9A4 NaLDE3zfH0JcM8QC5kasTt+/U/ypvzte7yEnbxNxdgmpI812pK1x4m0sko4JYGcJphuYCsmU1+H f6MoYNTPDaLvg9LCTyhiN4uGK X-Received: by 2002:adf:fb0d:0:b0:20d:97e:17ce with SMTP id c13-20020adffb0d000000b0020d097e17cemr50794556wrr.585.1653989003673; Tue, 31 May 2022 02:23:23 -0700 (PDT) X-Received: by 2002:adf:fb0d:0:b0:20d:97e:17ce with SMTP id c13-20020adffb0d000000b0020d097e17cemr50794524wrr.585.1653989003358; Tue, 31 May 2022 02:23:23 -0700 (PDT) Received: from redhat.com ([2.52.157.68]) by smtp.gmail.com with ESMTPSA id k66-20020a1ca145000000b0039c15861001sm1605939wme.21.2022.05.31.02.23.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 02:23:22 -0700 (PDT) Date: Tue, 31 May 2022 05:23:14 -0400 From: "Michael S. Tsirkin" To: Eugenio Perez Martin Cc: kvm list , virtualization , linux-kernel , Jason Wang , netdev , Martin Petrus Hubertus Habets , Stefano Garzarella , Martin Porter , Laurent Vivier , Pablo Cascon Katchadourian , Parav Pandit , Eli Cohen , Dan Carpenter , Xie Yongji , Christophe JAILLET , Zhang Min , Wu Zongyong , Cindy Lu , Zhu Lingshan , "Uminski, Piotr" , Si-Wei Liu , ecree.xilinx@gmail.com, "Dawar, Gautam" , habetsm.xilinx@gmail.com, "Kamde, Tanuj" , Harpreet Singh Anand , Dinan Gunawardena , Longpeng Subject: Re: [PATCH v4 0/4] Implement vdpasim stop operation Message-ID: <20220531052240-mutt-send-email-mst@kernel.org> References: <20220526124338.36247-1-eperezma@redhat.com> <20220531014108-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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 Tue, May 31, 2022 at 09:13:38AM +0200, Eugenio Perez Martin wrote: > On Tue, May 31, 2022 at 7:42 AM Michael S. Tsirkin wrote: > > > > On Thu, May 26, 2022 at 02:43:34PM +0200, Eugenio P?rez 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 != 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 == 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_INFLIGHT_FD > > > so the device can save pending operations. > > > > > > Comments are welcome. > > > > > > So given this is just for simulator and affects UAPI I think it's fine > > to make it wait for the next merge window, until there's a consensus. > > Right? > > > > While the change is only implemented in the simulator at this moment, > it's just the very last missing piece in the kernel to implement > complete live migration for net devices with cvq :). All vendor > drivers can implement this call with current code, just a little bit > of plumbing is needed. And it was accepted in previous meetings. > > If it proves it works for every configuration (nested, etc), the > implementation can forward the call to the admin vq for example. At > the moment, it follows the proposed stop status bit sematic to stop > the device, which POC has been tested in these circumstances. > > Thanks! Oh absolutely, but I am guessing this plumbing won't be ready for this merge window. > > > v4: > > > * Replace VHOST_STOP to VHOST_VDPA_STOP in vhost ioctl switch case too. > > > > > > v3: > > > * s/VHOST_STOP/VHOST_VDPA_STOP/ > > > * Add documentation and requirements of the ioctl above its definition. > > > > > > 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?rez (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 | 14 ++++++++++++ > > > include/uapi/linux/vhost_types.h | 2 ++ > > > 8 files changed, 83 insertions(+), 1 deletion(-) > > > > > > -- > > > 2.31.1 > > > > >