Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp6031347ioo; Wed, 1 Jun 2022 19:11:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyr3lG1OYuy4BFo8rwRneUrHuzYZfBhp/BYIrvtB3cWRz2MOmWupoTjSv6IVAS4lPuRmsbw X-Received: by 2002:a17:902:9a92:b0:161:4e50:3b80 with SMTP id w18-20020a1709029a9200b001614e503b80mr2330266plp.149.1654135883339; Wed, 01 Jun 2022 19:11:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654135883; cv=none; d=google.com; s=arc-20160816; b=xPggo2fLCf9P0eLka+n1tAqJm+gayIfkwkggijZd0Oe1EEi7EWrWm8cxy1cHIJSxVo a6E7syQjD2T9/tZSnnkvbnK3bD+bAnfNJn7XjiIY3OMj1pIy3c8TKTLglradIYNYfn9r irXELnHSx1HO4W8+FTSExg/AvBkO7qv2E08nxILeZgYQlQzaSo4nH2biQ/FFQkLcW8p4 +2uHzjZ/zqh9Ye89p/6McPHebl2/B+vsV0Doe7n+pWpCDz4BhiNUN/Zj2FjvtqdL6DvG U5KwlbfNQcy1hsDUnE50g6l1tISzg+aPOJpWafMLUkuYO92crXmxgaXL1f21WAwmcKut PIMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=1XyspsvoSb3NtHUHpb5oeCcY1zxXsm6k93GfeTwfJEU=; b=DBSsXhmgG73VI+YXAz2vIRrGJcNmRRp/laL4Erwj1m3VoQm3+Sw1+p7TiiZG8YVFe+ UQZWVLAXqgzQUfa6C8LWX8VNiSMQ6QoEC/nIYlcLgvzEdUa8Bs8Zx7DWyyyTQ+o8XWUQ ycyXph+WV1aRQ2eI2r823EDMwhK3L0a0FGIGi6E0dC+ux1OwXRS2wBdG0owxzOZh6ugj 18+9u4G1Uw+GkaNjsw5KWGX3bh3Uk7rB2gxfY65ue+npfxj6KoE11pkld9IOfjr0wJPS wuzh7RXTu4/HW7PMrAyWdgmJQLtv66OC76jDMVgYGWn7ofGwYjnSX3i1iBB1l/ZsFBpR 13dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=frcb3Y+e; 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 e15-20020a056a0000cf00b0051897f4d5fesi3465006pfj.348.2022.06.01.19.11.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 19:11:23 -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=frcb3Y+e; 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 22DFD24E1DE; Wed, 1 Jun 2022 19:08:54 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233291AbiFBCIp (ORCPT + 99 others); Wed, 1 Jun 2022 22:08:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233288AbiFBCIn (ORCPT ); Wed, 1 Jun 2022 22:08:43 -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 A0B2C24A6B3 for ; Wed, 1 Jun 2022 19:08:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654135721; 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=1XyspsvoSb3NtHUHpb5oeCcY1zxXsm6k93GfeTwfJEU=; b=frcb3Y+epIe9IA9wdWwwKjMt/R6wfKLKWckiiR4MDVhqwlZbhUlkEk06YzZ5tq0HHeZ0sf zcsfS7gD0KyccURAfyG/xiO8rl86I4j1SeRUfPpLnX4/hKEhffAEjdUiNx8Pg/oeb0AcbH GSyfBlvz7kVyyIzx3kY0ycJbfrKPdHo= Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-340-Rq3di7ubNaW42j3vmV6-XA-1; Wed, 01 Jun 2022 22:08:31 -0400 X-MC-Unique: Rq3di7ubNaW42j3vmV6-XA-1 Received: by mail-pf1-f197.google.com with SMTP id y11-20020aa7804b000000b0051ba2c16046so1974640pfm.20 for ; Wed, 01 Jun 2022 19:08:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=1XyspsvoSb3NtHUHpb5oeCcY1zxXsm6k93GfeTwfJEU=; b=VDnMnV6qraLU9JQ4+64xj3rfZqbI8mw51gMKsKj+nPvETwBF1csUBbTDWvFa/Jv1TI QUqHKR7IADCH1b7Hbhk+IlEXhFBBT5pt/vIKiF5V6yfjrWtVni500CLjZK8BiTdpehDN 8YRUcFkX+ol0Ww6xhiRzISdlwMbTTSZyWrh8VD42B+BggwIra+VwsyJO6NJcIINGFnvQ C/kBffiE0YaPBUosyXXkB65ztr1o7uBTQo49izfjqFBiPDj3ewzi9Xadv+vup7FQ7gBo 6ShwQTYrLcnC4OnYoN0BN6piPw4o0WKaeZHaoS/Qg/nXgrPvDn3Q+DK9ZgpoUA24AHRA Qg3A== X-Gm-Message-State: AOAM53024ojm6VqmtJhh7f0T6gOTpQcyi7kWB+qFxfJxMKiZsTSVGSyc 9FGdoGhHqZTtsEbBa1e09NWajCB11OSiNs/F2QK5fnbHjjjvqeQYVlOmBGH/3Cz49FeUfFCd5oz zZBdRyAgjZPt4ioFvx9hznTdA X-Received: by 2002:a17:902:9a92:b0:161:4e50:3b80 with SMTP id w18-20020a1709029a9200b001614e503b80mr2320135plp.149.1654135710286; Wed, 01 Jun 2022 19:08:30 -0700 (PDT) X-Received: by 2002:a17:902:9a92:b0:161:4e50:3b80 with SMTP id w18-20020a1709029a9200b001614e503b80mr2320090plp.149.1654135709878; Wed, 01 Jun 2022 19:08:29 -0700 (PDT) Received: from [10.72.13.239] ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id l17-20020a170902e2d100b0015e9f45c1f4sm2167309plc.186.2022.06.01.19.08.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 01 Jun 2022 19:08:29 -0700 (PDT) Message-ID: <6a0b9961-40c6-9b22-2b79-608633f78814@redhat.com> Date: Thu, 2 Jun 2022 10:08:16 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v4 0/4] Implement vdpasim stop operation Content-Language: en-US To: =?UTF-8?Q?Eugenio_P=c3=a9rez?= , "Michael S. Tsirkin" , kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: martinh@xilinx.com, Stefano Garzarella , martinpo@xilinx.com, lvivier@redhat.com, pabloc@xilinx.com, Parav Pandit , 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 References: <20220526124338.36247-1-eperezma@redhat.com> From: Jason Wang In-Reply-To: <20220526124338.36247-1-eperezma@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,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 在 2022/5/26 20:43, Eugenio Pérez 写道: > 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. I think we probably need more accurate definition on the state as Parav suggested. Besides this, we should also clarify when stop is allowed. E.g should we allow setting stop without DRIVER_OK? Thanks > > 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. > > 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(-) >