From nobody Sun Dec 28 23:13:31 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B841C10DC3 for ; Tue, 5 Dec 2023 08:36:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376500AbjLEIgC (ORCPT ); Tue, 5 Dec 2023 03:36:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344826AbjLEIfj (ORCPT ); Tue, 5 Dec 2023 03:35:39 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D55E111F for ; Tue, 5 Dec 2023 00:35:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701765345; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=d/3zDHOQJcTtZVsBfjBojXcizA44t39WpNjmMG4thIs=; b=UWcePgjshK04nwsr+hJFhGVvJ+waynJ/dvlcJuFPqaGAbpb9VGaF5VuxI90RW0jRogE2M+ MTQzB3ACwkt6PyfIL9WPdjqmMFkxyVykMpczKBGlcbWy5PzHTf+RP963fa4g0iAmIqqUIq imV0/zGQ/igyPQpVnuYxtV0+gzrHolw= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-597-7chujVY3OOmYGcJ8vk_svw-1; Tue, 05 Dec 2023 03:35:38 -0500 X-MC-Unique: 7chujVY3OOmYGcJ8vk_svw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0AF44879843; Tue, 5 Dec 2023 08:35:38 +0000 (UTC) Received: from server.redhat.com (unknown [10.72.112.70]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7DBE03C25; Tue, 5 Dec 2023 08:35:35 +0000 (UTC) From: Cindy Lu To: lulu@redhat.com, jasowang@redhat.com, mst@redhat.com, xieyongji@bytedance.com, linux-kernel@vger.kernel.org, maxime.coquelin@redhat.com Subject: [PATCH v3 7/7] Documentation: Add reconnect process for VDUSE Date: Tue, 5 Dec 2023 16:34:44 +0800 Message-Id: <20231205083444.3029239-8-lulu@redhat.com> In-Reply-To: <20231205083444.3029239-1-lulu@redhat.com> References: <20231205083444.3029239-1-lulu@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Add a document explaining the reconnect process, including what the Userspace App needs to do and how it works with the kernel. Signed-off-by: Cindy Lu --- Documentation/userspace-api/vduse.rst | 30 +++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/Documentation/userspace-api/vduse.rst b/Documentation/userspac= e-api/vduse.rst index bdb880e01132..ec66e573f6da 100644 --- a/Documentation/userspace-api/vduse.rst +++ b/Documentation/userspace-api/vduse.rst @@ -231,3 +231,33 @@ able to start the dataplane processing as follows: after the used ring is filled. =20 For more details on the uAPI, please see include/uapi/linux/vduse.h. + +HOW VDUSE devices reconnectoin works +---------------- +0. Userspace APP checks if the device /dev/vduse/vduse_name exists. + If it does not exist, need to create the instance. + If it does exist, it means this is a reconnect and the program proceeds= to step 3. + +1. Create a new VDUSE instance with ioctl(VDUSE_CREATE_DEV) on + /dev/vduse/control. + +2. When the ioctl(VDUSE_CREATE_DEV) function is called, the kernel allocat= es memory + to synchronize the reconnect information. + +3. Userspace App need to mmap the pages to userspace + + When connecting for the first time, the userspace app must save the rec= onnect + information (struct vhost_reconnect_data) in mapped pages + + If this is reconnect,If the purpose is to reconnect, the userspace appl= ication + must verify if the saved information is suitable for reconnection. Addi= tionally, + the userspace application is required to set the "reconnected" bit in t= he + "struct vhost_reconnect_data" to "VDUSE_RECONNECT". The kernel will use= this bit + to identify if the userspace application is reconnect. + +4. Start the userspace App. + userspace APP will call ioctl VDUSE_VQ_GET_INFO to sync the vq informat= ion. + Additionally, the APP must save the vq reconnect information (struct vd= pa_vq_state) + in mapped pages while running. + +5. When the Userspace App exits, it is necessary to unmap all the reconnec= t pages. --=20 2.34.3