Received: by 2002:a19:771d:0:0:0:0:0 with SMTP id s29csp1250776lfc; Wed, 1 Jun 2022 13:05:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmhEJePUA0FaZLv0AudK2WOvTjEqow068irfFXNbJp4XinuV9P3UwoQvM0TSWDVf7UuYe9 X-Received: by 2002:a63:9602:0:b0:3fc:46b9:1374 with SMTP id c2-20020a639602000000b003fc46b91374mr930597pge.400.1654113955673; Wed, 01 Jun 2022 13:05:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654113955; cv=none; d=google.com; s=arc-20160816; b=iZQ4TtNA0fefITgxu8I9hD0lR0Jl5JSyCNkMNP0tCM6Th9RGuYkxzfpafi8kVoUKuj WirfwN+HydbhQtI0Y7WAr9H6HTjZgH6Q6o+SgaWIEyFmLzAvB+i/AJUXqVW7hCTNqdFp OziGwCBvpnC1k3MkX7rFBE/aMRHt8puPdlpQtd0mySLWSMdGcMjzCPrjCe3dk+ICj1/t s1HALm1nO9KnSFGUndB1zXMumZ3O53Qk3Df1e7byXtmVqvJXrmwQaPlsDtPNAdiC6cZY ryvAdKdxaSlOSfi0qRXt5TfpGcbG+tZ02y0wrfFQV3b2ivYK7QFiGEu9FS9M8Bt4hTz/ CoeA== 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=33Q+kZ3exxiCIGxTXejuFhcm2TRKe5xhqodtK0AziM4=; b=steprFdQm77DvkzlIzl+pm9rJFSmzIGHObrat0chdm1p157Kp7BD+AkPlCG1scXBvM Gr5Y97Axx0s+wcFlCWTtGVjq/Knk7mDaJLJq7FJKLAdjvch/V0wPJLvCV3wLx7O9LKg8 9Ldd4BEh8EyHA5VqrMA2dkP4i9anV28knmCDurM15UUg2x3V43YbjLtLcUkJ2HRJdkZ2 Y8D9486F5FHGf3YmuBFAbh4iMlvcZ0/7MwGxvGe+FQaEzlS1HilNghKQCtFb/lv5Vxvw 2piP7SybAGn+gWpeWJ37vD7rhPMm+wem23HXTGifJITYU2VPL8DnQdx8uuJM/dX1mL3W 6N9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KCEEKl3G; 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 j186-20020a638bc3000000b003fb882c85fasi1255613pge.64.2022.06.01.13.05.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 13:05:55 -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=KCEEKl3G; 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 CC5DD2271B5; Wed, 1 Jun 2022 12:22:08 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244449AbiEaHOV (ORCPT + 99 others); Tue, 31 May 2022 03:14:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244450AbiEaHOT (ORCPT ); Tue, 31 May 2022 03:14:19 -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 10220915AF for ; Tue, 31 May 2022 00:14:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1653981257; 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=33Q+kZ3exxiCIGxTXejuFhcm2TRKe5xhqodtK0AziM4=; b=KCEEKl3GXEmz3ruD79j2/X3BRFeQj3yLqJCUny6x63GQ2Xy1kIitu7qQJ+GbGvmJtIpIsK AJGIqwZy+fpEGLa4Gb4CH/JDyXL4oD/WdE4hnVTpAEPt8D2FmNq2LjV3JIPug8YTLn+o3t 8s6cm1s3kX5iKhYJgwud+Te3TBHPqkg= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-317-BuO1X3eCNei4KF9YOnCMWw-1; Tue, 31 May 2022 03:14:15 -0400 X-MC-Unique: BuO1X3eCNei4KF9YOnCMWw-1 Received: by mail-qk1-f200.google.com with SMTP id g14-20020ae9e10e000000b006a394d35dbfso9955794qkm.5 for ; Tue, 31 May 2022 00:14:15 -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=33Q+kZ3exxiCIGxTXejuFhcm2TRKe5xhqodtK0AziM4=; b=F+kIr31v0C8kMv/EE6kU3gaIOgC8XqoIjYuICPWGRT9G/tb1vPcEufhZVSAnLgPnmp TXackeIOgzLLLgBSHlweogWOtx/QEEwn9pZTqa/cWaul4XJ8CHwkYSPbaG+Sk+btplTa s5lsaC/AgZDAzHgValFMtIoBLDejQo2ShfQMlehcAft/t3d6dJAT9pVsmw+8DL23gqIC bHf9lx/HsO6imP6rv/wqcOzNTIxsHcDNy/w+f9Ew/N8obzQc5NgFT428IsPNQdk/1o1Z g0TBGZD3Y1cfCZr+r1Xhaddh4QCNLF0tq6H8Z51gYJ9nYUBqBXjOB6wvMfycS4VZgt+/ FctA== X-Gm-Message-State: AOAM533chRmgaMNch3PlCgPs/+WMz4/wf2jDTO00+G4oFYrf5beQR3TW OjQ1sHI9jvmcmCjiWBiKn5Ic+FDLTG8UgDJxpwXri4AIWJbWs7q7ueLQI5fbA1Mj4qxqRfj5fhr qF66KSYDqvIkkyHiLw8d6ZJ2udjOgj0CNF5aUPk5m X-Received: by 2002:ac8:5ad0:0:b0:2f3:e37a:e768 with SMTP id d16-20020ac85ad0000000b002f3e37ae768mr45957241qtd.592.1653981254776; Tue, 31 May 2022 00:14:14 -0700 (PDT) X-Received: by 2002:ac8:5ad0:0:b0:2f3:e37a:e768 with SMTP id d16-20020ac85ad0000000b002f3e37ae768mr45957224qtd.592.1653981254525; Tue, 31 May 2022 00:14:14 -0700 (PDT) MIME-Version: 1.0 References: <20220526124338.36247-1-eperezma@redhat.com> <20220531014108-mutt-send-email-mst@kernel.org> In-Reply-To: <20220531014108-mutt-send-email-mst@kernel.org> From: Eugenio Perez Martin Date: Tue, 31 May 2022 09:13:38 +0200 Message-ID: Subject: Re: [PATCH v4 0/4] Implement vdpasim stop operation To: "Michael S. Tsirkin" 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 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 Tue, May 31, 2022 at 7:42 AM Michael S. Tsirkin wrote: > > On Thu, May 26, 2022 at 02:43:34PM +0200, 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. > > > > 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. > > > 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! > > 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=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 | 14 ++++++++++++ > > include/uapi/linux/vhost_types.h | 2 ++ > > 8 files changed, 83 insertions(+), 1 deletion(-) > > > > -- > > 2.31.1 > > >