Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1382617rdd; Wed, 10 Jan 2024 18:56:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IG/lDE1L6aVQHpwm5G8kRA5Qt+nqYBmJJCibkn9rxp+kF5P7WnfZYTsSgG9QggGZvaEghgA X-Received: by 2002:aa7:d5cb:0:b0:556:db12:af4b with SMTP id d11-20020aa7d5cb000000b00556db12af4bmr187923eds.54.1704941782232; Wed, 10 Jan 2024 18:56:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704941782; cv=none; d=google.com; s=arc-20160816; b=Dl2/InrXGJsCodIjnLqT4nP5+OXYBAv0fVnJ2pH/8CcYIlSw7PzSfUUzLj5CxVNcp0 t1UG4E4xMGBhNeXolCEYs506nWe26ziSz+ApT3Gtn0+EMQpeeh5uq/vvlzgWNVNvT7Vq V6ERPKtoIOiL+uiXQOWonXGgQvyaUs3rLEk0nT5gBwK3jjOgwM/BNSQcz18lBvJ8zW/Z jO/0lhoYFRKi8ArdUY2CWPdkNBI74iygzJw1nmGARffRiAxchmzp6aSFevmHd8CWAqXh EH+3xX2/WVEXbaCTnXRf2dTsP2y0wc8QKUBFVupYeb8aoA5kVq8IUWqTD6ci7veBg6Vh 7VTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=j9j8eMpUTHCJ1mO7p36IGUmNwnqk3Axv6bQ9HcFkssI=; fh=hEvG+XP+VQIWjF9dz+JlOWwnAizZagG90jWEJfaeJKU=; b=kODaIfpBkBaArERYgBXbGl4mChvMN2G5ioqR6lRxWkPgEuXewFcwuzZNjwa7Jl7f6S kASSjHc6c+4ERFODyEz8Aq9FPQPX/y4x64v8SzAVfRpdjcrAXQtN9IdDpECvCMl4ZuEt WdqWN3TcrbKGRLfgN9sGwYf6LnOcb76jh5l2ZPGgNL7ldLVCgAftMGgiqdqMVz8nwD/D /qEUZ6s3n7+zQvscCiu1HySlkjlDaWHd5EVE4lMcSc+AT1hMQCSHrJpbzgyfMQ9DD0CN V5Q1DYASv+j6tZkZ8Mk2e6xyxwl6ABpDiJid+FanTlWSXw2hXp1nO/6KTeNPOQikX16/ delw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KBtrNJVD; spf=pass (google.com: domain of linux-kernel+bounces-22999-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22999-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id m12-20020a056402050c00b00557c159731dsi76328edv.547.2024.01.10.18.56.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 18:56:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-22999-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KBtrNJVD; spf=pass (google.com: domain of linux-kernel+bounces-22999-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22999-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 231B91F22501 for ; Thu, 11 Jan 2024 02:56:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A07972583; Thu, 11 Jan 2024 02:55:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="KBtrNJVD" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F02561FD2 for ; Thu, 11 Jan 2024 02:55:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704941736; 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=j9j8eMpUTHCJ1mO7p36IGUmNwnqk3Axv6bQ9HcFkssI=; b=KBtrNJVDafh3JWHORE/R2dysE20RP7sd5w9sjGkcsHfsPrteVO4Tp2U7l+TxobQNRWclFs 3FgOZPj7Kqov2uSBZZuD3bkyD/I8q93Dfk7W8q7ck8kBYbPEqIjuDkDsjHRm7p+R01naY6 AQWOCH6f9feoCsrlU6Hq5xPyOQ8wPHM= Received: from mail-oi1-f198.google.com (mail-oi1-f198.google.com [209.85.167.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-576-FfFHjeHOO6W5U_5PsFF26g-1; Wed, 10 Jan 2024 21:55:35 -0500 X-MC-Unique: FfFHjeHOO6W5U_5PsFF26g-1 Received: by mail-oi1-f198.google.com with SMTP id 5614622812f47-3bd34d3c9cbso4279046b6e.1 for ; Wed, 10 Jan 2024 18:55:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704941734; x=1705546534; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=j9j8eMpUTHCJ1mO7p36IGUmNwnqk3Axv6bQ9HcFkssI=; b=Z5RGuMaKkXTBMFI17JMa1pnBtrELEIkFrpzsAhOvHi2rPEFQ/C+5VzKGJpoU6QnTEH 0xOgyWJxNn11zlNgkRJvUok4qC2v+XkR+c8rsoIWbvZkrE3K9sUOQb4B65Lh03IRZDXC zMp4W+bogmpSpLeozbi3kWrRG9J6jGwvGyhIcyR3S61e7qVKvs/CgrnXjIAka27/OdwY knMjZVVFq1r0o5kLvH1uFjfjS0IyF0koeI7DKyjkJdbXqZRrZBvlkwxBiDddiQ+x4j/E U5kSmgmmrCMGhViTwZwHarHbwg4j5MwOsI5EG7I4Rf93jKvqyHdW5uHGJMW0vbX9JKLG +zTQ== X-Gm-Message-State: AOJu0YwW7au4+k1i+L20j4g23rAlBoUeBm8d1Ws0q/7sLfVPOqGef+OX hc7qSUdoeG3pFuJINSbZzRnRExKYvYMKrlkp1I8Hdw+r2t+7YSl4nkza0hoTT3vkIZ0OPCyJHpP DDo5J+7u+cPXl3SX1x6LYON/A3mEcK57ORBB7RDgtmzM+TAme X-Received: by 2002:aca:1917:0:b0:3bb:bc99:97ea with SMTP id l23-20020aca1917000000b003bbbc9997eamr539521oii.113.1704941734412; Wed, 10 Jan 2024 18:55:34 -0800 (PST) X-Received: by 2002:aca:1917:0:b0:3bb:bc99:97ea with SMTP id l23-20020aca1917000000b003bbbc9997eamr539508oii.113.1704941734197; Wed, 10 Jan 2024 18:55:34 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <1704919215-91319-1-git-send-email-steven.sistare@oracle.com> In-Reply-To: <1704919215-91319-1-git-send-email-steven.sistare@oracle.com> From: Jason Wang Date: Thu, 11 Jan 2024 10:55:23 +0800 Message-ID: Subject: Re: [RFC V1 00/13] vdpa live update To: Steve Sistare Cc: virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, "Michael S. Tsirkin" , Si-Wei Liu , Eugenio Perez Martin , Xuan Zhuo , Dragos Tatulea , Eli Cohen , Xie Yongji Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Jan 11, 2024 at 4:40=E2=80=AFAM Steve Sistare wrote: > > Live update is a technique wherein an application saves its state, exec's > to an updated version of itself, and restores its state. Clients of the > application experience a brief suspension of service, on the order of > 100's of milliseconds, but are otherwise unaffected. > > Define and implement interfaces that allow vdpa devices to be preserved > across fork or exec, to support live update for applications such as qemu= . > The device must be suspended during the update, but its dma mappings are > preserved, so the suspension is brief. > > The VHOST_NEW_OWNER ioctl transfers device ownership and pinned memory > accounting from one process to another. > > The VHOST_BACKEND_F_NEW_OWNER backend capability indicates that > VHOST_NEW_OWNER is supported. > > The VHOST_IOTLB_REMAP message type updates a dma mapping with its userlan= d > address in the new process. > > The VHOST_BACKEND_F_IOTLB_REMAP backend capability indicates that > VHOST_IOTLB_REMAP is supported and required. Some devices do not > require it, because the userland address of each dma mapping is discarded > after being translated to a physical address. > > Here is a pseudo-code sequence for performing live update, based on > suspend + reset because resume is not yet available. The vdpa device > descriptor, fd, remains open across the exec. > > ioctl(fd, VHOST_VDPA_SUSPEND) > ioctl(fd, VHOST_VDPA_SET_STATUS, 0) > exec Is there a userspace implementation as a reference? > > ioctl(fd, VHOST_NEW_OWNER) > > issue ioctls to re-create vrings > > if VHOST_BACKEND_F_IOTLB_REMAP > foreach dma mapping > write(fd, {VHOST_IOTLB_REMAP, new_addr}) I think I need to understand the advantages of this approach. For example, why it is better than ioctl(VHOST_RESET_OWNER) exec ioctl(VHOST_SET_OWNER) for each dma mapping ioctl(VHOST_IOTLB_UPDATE) Thanks > > ioctl(fd, VHOST_VDPA_SET_STATUS, > ACKNOWLEDGE | DRIVER | FEATURES_OK | DRIVER_OK) > > > Steve Sistare (13): > vhost-vdpa: count pinned memory > vhost-vdpa: pass mm to bind > vhost-vdpa: VHOST_NEW_OWNER > vhost-vdpa: VHOST_BACKEND_F_NEW_OWNER > vhost-vdpa: VHOST_IOTLB_REMAP > vhost-vdpa: VHOST_BACKEND_F_IOTLB_REMAP > vhost-vdpa: flush workers on suspend > vduse: flush workers on suspend > vdpa_sim: reset must not run > vdpa_sim: flush workers on suspend > vdpa/mlx5: new owner capability > vdpa_sim: new owner capability > vduse: new owner capability > > drivers/vdpa/mlx5/net/mlx5_vnet.c | 3 +- > drivers/vdpa/vdpa_sim/vdpa_sim.c | 24 ++++++- > drivers/vdpa/vdpa_user/vduse_dev.c | 32 +++++++++ > drivers/vhost/vdpa.c | 101 +++++++++++++++++++++++++++-- > drivers/vhost/vhost.c | 15 +++++ > drivers/vhost/vhost.h | 1 + > include/uapi/linux/vhost.h | 10 +++ > include/uapi/linux/vhost_types.h | 15 ++++- > 8 files changed, 191 insertions(+), 10 deletions(-) > > -- > 2.39.3 >