Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp138983rdb; Tue, 5 Dec 2023 00:36:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IGVgFezSOWoPfSazd7XYxbYTx3L+P7mMB5tim3BxGpnsxquJp4EEFfqsh6YJhgvW2cuJqkE X-Received: by 2002:a05:6a20:258f:b0:18c:64e0:4408 with SMTP id k15-20020a056a20258f00b0018c64e04408mr3001204pzd.44.1701765387938; Tue, 05 Dec 2023 00:36:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701765387; cv=none; d=google.com; s=arc-20160816; b=AkYAw+ITgPaZim+/MHHLPTdawx6csrTtqkkQuVghJrgsNI2vVWh2Rr5K0yOkhvnfDO AorkpHeq+YVTNg1A+gWE+gr1tr9M+WPbmGwjan8aVW/J3HIYqPz+qt9HYZVkqfa9gNph XqmZOX39GCLdlEUov+IyHbQFgxFFLV+pePPbnX4cLD10t7tL1wJurWVFPWH7ABYtOYFN Bj0f0dxHpG9fIiZfYZX2HcNp6PZbsnJD56AIDQiN94Nkb2WQWEELt1YUOMBmLKmvsYhf q/HTdtAxjJmbtET3VPnTN4pajELJzurs2mqc2yieJn3W0QRly2PHUVA1SGXxnc2EXdoU oErQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=d/3zDHOQJcTtZVsBfjBojXcizA44t39WpNjmMG4thIs=; fh=ARFoO5Pk7SniYIzyAg9Z8eUcw3AUCiaEHOgWusT66QQ=; b=FRRXCVKPyl1O0EKQe5SSkif5sUBfv6FR2aamBhyWWonbH/wplBq0vNw2MRfXUS+9ep rDz9K1Ff+ADipiDde48sl10j1dJ31qih2aHHyYXGscrpy/yZ15QDliW+FF9pj1lQ5imi ZYsilK8KH2qTKQSbXduaaYwFPTXTI+DbuvIZxJpgfQ2v4N/ZpcQ5ldsBHVzR+ZAd+RmP LYdryvgmDXxhAsAykpDdwtg0NsDid4Ik/XMdZR1AzjaC5+BWRgBf4CCO76xxu6sL5Lq2 8rKQul8EM8Fk4bcjFbMSYznJsWpuNj2JMGN5FSA29OKDlohv0ikc42rIICStz1KhKUVi +fxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UWcePgjs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id k60-20020a17090a3ec200b00286c80ac075si716402pjc.177.2023.12.05.00.36.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 00:36:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UWcePgjs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 0F6538077FEC; Tue, 5 Dec 2023 00:36:24 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376471AbjLEIgB (ORCPT + 99 others); Tue, 5 Dec 2023 03:36:01 -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: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,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 lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 05 Dec 2023 00:36:24 -0800 (PST) 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/userspace-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. 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 allocates 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 reconnect + information (struct vhost_reconnect_data) in mapped pages + + If this is reconnect,If the purpose is to reconnect, the userspace application + must verify if the saved information is suitable for reconnection. Additionally, + the userspace application is required to set the "reconnected" bit in the + "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 information. + Additionally, the APP must save the vq reconnect information (struct vdpa_vq_state) + in mapped pages while running. + +5. When the Userspace App exits, it is necessary to unmap all the reconnect pages. -- 2.34.3