Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp3320397ioo; Tue, 24 May 2022 20:09:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyif2N0B8L/Ha9q1uQGxPAC8aM6CfOTMapuuhTCYs7OHNavYpt4sCgdaEytJYz6x2TIIBGo X-Received: by 2002:aa7:c417:0:b0:42a:c3dd:4148 with SMTP id j23-20020aa7c417000000b0042ac3dd4148mr32204659edq.379.1653448185093; Tue, 24 May 2022 20:09:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653448185; cv=none; d=google.com; s=arc-20160816; b=v6z7fbyb6y8OMGSij9Dc1PHnbBUeAxH5y4fynT2tY1g/7jX9ORN+Pjd4Lzv3aTkfv7 YoDOwxWfjIOahku3RymLATT5TZ0U9QgfH/xyPpZKnZHVY1oRKpDz85plwkzodnoGb60j og5jxLSIqRFiVJBpTpNL3lpU6yC/ZoYiA0d9gfoMtlqqjDpZFBA+0+HGLLKjRO97lTm+ ys7iV0zKu4Rgm81VFJWdldKgOCBxiUV/oi7Rkzq4SSa5Es5NHp/gC6km1E8UvE/YwhdP yROP/OvABLZPOCM7Z3I8WVTBZj03yO6qrJ42O56odf8YXzXw5ojn/7aoV2DpKH7VaZ/7 FxcQ== 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=ElTuX9jWxfL0CUwfGnyHCc3cXorhj0tUDVKXC9Pq5yE=; b=UuDxs0MJrrwwn3eUZ4xHsRnVv86dGHvB4mSUJkqXP9Qb80tmUHF0pQ677Ts2L2wNNZ HEawVrVjpjmrF2PFZALxlermsD2rsqScXdXtZ5FLJz0hb6Sd1s4xfYJRbI76izwsdioH foPp2M25LmUYVpptmCMY8BR8CEhDurNHvB3sQ4SIaEqzyY3kOzhKnywfFQfOcdsQoK94 DamDCpeE+fDAPw0y/hK2cfBQXbkb5YseevBkXqAL2F56kS2NZkFAvhM3/YATHLlDNLHF N+mcLspIyUgI6UXPUooCZVgWgyPUG31EFpyi5qKNCBEFh3GqXN2vF3JlU2McXz7gn7tQ qJLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SCsFvErv; 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 n13-20020a05640205cd00b0042b253cc1d4si17361664edx.347.2022.05.24.20.09.17; Tue, 24 May 2022 20:09:45 -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=SCsFvErv; 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 S234123AbiEYCuA (ORCPT + 99 others); Tue, 24 May 2022 22:50:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243646AbiEYCt5 (ORCPT ); Tue, 24 May 2022 22:49:57 -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 215D2703CC for ; Tue, 24 May 2022 19:49:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1653446995; 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=ElTuX9jWxfL0CUwfGnyHCc3cXorhj0tUDVKXC9Pq5yE=; b=SCsFvErvjB569gHhEv8qQXK/cvYp4munxTKrceCZ4ZonnBY+omeKA1L2/IcbPlL0EodUAc H0FZf9Amkatu87aHrv8BlfZekH5SrTJSyeVQsfxd2AalOxnndN0IcpOFLNqja39HRkUMZS /X03vhEpapmdK93QSD80fPkWw5KfQwc= 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-395-Fq037DBgORCBGAx8Fq1xqw-1; Tue, 24 May 2022 22:49:53 -0400 X-MC-Unique: Fq037DBgORCBGAx8Fq1xqw-1 Received: by mail-lf1-f69.google.com with SMTP id g11-20020a05651222cb00b0047872568226so3655048lfu.3 for ; Tue, 24 May 2022 19:49:53 -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=ElTuX9jWxfL0CUwfGnyHCc3cXorhj0tUDVKXC9Pq5yE=; b=acjk1FwcUVMTXwSxN4fWuQSx50bmkYUhYKZDtUrbVxDpzYx6n2FGJZEO2qj7HfUiiN QLcAe5GuExyn+ALTPX39tQStmettFrBUiN7oUTrljzaLPLlaR+eMRAaxdH0+YeremEUf TI9oeEj0j42LC+5OcUSsvt8yKXMT1+iVjPu8ZeFhshUqeGQo5WVIJk9EtUvoEiLEltUr Tjez4qsf09nSaGcx8FT2nhUwxxOD8JADfLPqE7eMuJjyA5pUIEvsS4zzQ27Cqam8hMBh 1H1DaNhIsz6xsOPnET6JbYGBDSWTxsWkQj28MeB9jz9OO5tZ2TxyNc/gEY1cu4W48r78 PqSA== X-Gm-Message-State: AOAM530pyBG0eNx/MHl9CML6Ms7hUJCz0QCS0nNkjJ7m63x7BKYA8k/A sTZ/vtGi1eDNtiRlq3Yo8JYy1YTlTLZzjJ7nEySooOPJG5y+2hxtURZTHgOaPgUx4XTIAp4SppI sed3C2NNh765AU+lZKtRZuj4hGASHJ/5Gmja1slqb X-Received: by 2002:a2e:81c1:0:b0:24b:f44:3970 with SMTP id s1-20020a2e81c1000000b0024b0f443970mr17702600ljg.97.1653446992151; Tue, 24 May 2022 19:49:52 -0700 (PDT) X-Received: by 2002:a2e:81c1:0:b0:24b:f44:3970 with SMTP id s1-20020a2e81c1000000b0024b0f443970mr17702581ljg.97.1653446991974; Tue, 24 May 2022 19:49:51 -0700 (PDT) MIME-Version: 1.0 References: <20220524170610.2255608-1-eperezma@redhat.com> In-Reply-To: <20220524170610.2255608-1-eperezma@redhat.com> From: Jason Wang Date: Wed, 25 May 2022 10:49:40 +0800 Message-ID: Subject: Re: [PATCH v2 0/4] Implement vdpasim stop operation To: =?UTF-8?Q?Eugenio_P=C3=A9rez?= 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 1:06 AM Eugenio P=C3=A9rez wr= ote: > > 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()? 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_INFLIGH= T_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 > >