Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp961126lqh; Fri, 29 Mar 2024 02:39:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVfDyiME+lRwEvPC4c+PAraNcaQ1r4z67MCs2kVmqPoaKNIdOv9Nndu40BSg6Mg1nVtn4lQ+cPwFas/S5ZgY1Rqq+yfmcdXx9rADFr1eg== X-Google-Smtp-Source: AGHT+IHm3dbhvpEwWsYsR9XIeZ7ZnzeANctc0ONVZi+wEK1xU0aO0IHoGbXTV5N04/DczPcHlxPl X-Received: by 2002:a05:620a:39d:b0:78a:3586:5fdb with SMTP id q29-20020a05620a039d00b0078a35865fdbmr1760443qkm.21.1711705146682; Fri, 29 Mar 2024 02:39:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711705146; cv=pass; d=google.com; s=arc-20160816; b=Hd0WIdeY3a60xW3Maxw5OSVlLdkqciogVYOtrj0ZmGV2VpSQH2zCdsxci5LqWftFHA kj1UviStnqEC+bLvbaGUprt7Ri0qw782+0OPvUJp0+mDXI151vkPaY+DGL0A6gc5QQHu iIO1mb3Ecet1Jx4HMFlbSrjYeIW6BuhHSSSLEcHt7jGne76JwME08q5/1pFB69svu4Tb djemKEMTO78DABwHPFA9T6ueufOgwuRHwVrLlcPoa9938pEw9zULQCMu51sP4BtVpbEs ENaRNRhAmwJtpV4rjRdmnw7dKNaBcNCHxkGrXQ0GbEvzxWCFuTvLjRUBU5KcpXYZZgha nmDA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:to:from :dkim-signature; bh=9TfOEZSUpizBDk/7ZlbtcyuX+Zuz/XZGsV/0/N9TVsY=; fh=kGL5/budLVOGR9T8KfIWmR8UsDEkssBaA4UA4TcpWp4=; b=ChbbfdmhEP5T+ONd2WbhFB/snDBubA5xeafeyDk+9BAstOnfRunhBgqPg1J3j5aAVg QyA7d2L+N6e4/pJM2Q48W5+c+ioxoSOPG/fj++hKhWPHO+tdDyNwbM/R9WKn/mSD/pSj kChnLZndGsJ0uzfUVH/CIBHTer6q5MWcmIUOrTG1/MAzAKXIyPfdUV9H0h1pT4vvUojT 5pNzUKJBRdbbA8lHetvn7bE7nbRookjXVcPkzUQQYC5PchII5cKQbMZuics17LwgpWOv 1DJ5EAUM4VVfCQc1zJGmrWkopj4ZOJ0YT9f/UwPFVXBZOIIftzX7ZG6v1DUH2mzCCyvI mLnQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=O8N89VFC; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-124356-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-124356-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id a28-20020a05620a16dc00b0078a0d51b9e6si3387889qkn.695.2024.03.29.02.39.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 02:39:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-124356-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=O8N89VFC; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-124356-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-124356-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 0FFEE1C231EB for ; Fri, 29 Mar 2024 09:39:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 12B7F4D9E4; Fri, 29 Mar 2024 09:38:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="O8N89VFC" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 A4B6839AE7 for ; Fri, 29 Mar 2024 09:38:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711705132; cv=none; b=L5mmJnk3T5W9KNKZo4H7bK/WE9tF8GXWIWTXD+AA/nQwZ8Mo5VLAlipxe2SH2GnIafPG1+TMKYIeZVqzszV6ehkiKPt+O3SGsjt5bzDGnLUPNm0PDrkAodY7j5r3GnYrtwNAf0fZU6SReXI5N1vt710Fr1/wzSwbRRaI4d+NcRU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711705132; c=relaxed/simple; bh=hlgRWAsqEYqPaeCmYoojJySYxpwBfhEhiWetVJsND38=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=FMmiRklaI35DCsu1jr+3E1oIlFD3mwczZAxshkvu9X4AP3vefCfYx0kAo0cRXM9NfHNFcUBU0MaZkWuQcqzYN3TJ5IWzyZbnGfEK4xpIRmML31zF3ZjYezFXqgaMs56NngU9btcGDjROtiVwo88fL3nQqBuZUmf9B4R3dw0nMr0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=O8N89VFC; arc=none smtp.client-ip=170.10.129.124 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=1711705129; 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; bh=9TfOEZSUpizBDk/7ZlbtcyuX+Zuz/XZGsV/0/N9TVsY=; b=O8N89VFCnRmh2SH3ARo7U5V7v8l3aaDb5StQxXAeRkh4PT1w2uDMFh0XiXYvkUuBfiUssf EaRpYe1s7tBOeHq+OHGbRJf0/O+00RmC8ZZGpfJOFSs7NPGpy3b2HHjD25iXmiFKIJgp8l msj5mKLXzHVjFAn5Cx54oq+NB5bkuyw= 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-455-jz36XEyxNSOsNelDtdEUBA-1; Fri, 29 Mar 2024 05:38:45 -0400 X-MC-Unique: jz36XEyxNSOsNelDtdEUBA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (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 718DD811E81; Fri, 29 Mar 2024 09:38:45 +0000 (UTC) Received: from server.redhat.com (unknown [10.72.112.204]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6484D202451F; Fri, 29 Mar 2024 09:38:42 +0000 (UTC) From: Cindy Lu To: lulu@redhat.com, mst@redhat.com, jasowang@redhat.com, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v2] Documentation: Add reconnect process for VDUSE Date: Fri, 29 Mar 2024 17:38:25 +0800 Message-ID: <20240329093832.140690-1-lulu@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 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 | 41 +++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/Documentation/userspace-api/vduse.rst b/Documentation/userspace-api/vduse.rst index bdb880e01132..f903aed714d1 100644 --- a/Documentation/userspace-api/vduse.rst +++ b/Documentation/userspace-api/vduse.rst @@ -231,3 +231,44 @@ 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 +------------------------------------ +1. What is reconnection? + + When the userspace application loads, it should establish a connection + to the vduse kernel device. Sometimes,the userspace application exists, + and we want to support its restart and connect to the kernel device again + +2. How can I support reconnection in a userspace application? + +2.1 During initialization, the userspace application should first verify the + existence of the device "/dev/vduse/vduse_name". + If it doesn't exist, it means this is the first-time for connection. goto step 2.2 + If it exists, it means this is a reconnection, and we should goto step 2.3 + +2.2 Create a new VDUSE instance with ioctl(VDUSE_CREATE_DEV) on + /dev/vduse/control. + When ioctl(VDUSE_CREATE_DEV) is called, kernel allocates memory for + the reconnect information. The total memory size is PAGE_SIZE*vq_mumber. + +2.3 Check if the information is suitable for reconnect + If this is reconnection : + Before attempting to reconnect, The userspace application needs to use the + ioctl(VDUSE_DEV_GET_CONFIG, VDUSE_DEV_GET_STATUS, VDUSE_DEV_GET_FEATURES...) + to get the information from kernel. + Please review the information and confirm if it is suitable to reconnect. + +2.4 Userspace application needs to mmap the memory to userspace + The userspace application requires mapping one page for every vq. These pages + should be used to save vq-related information during system running. Additionally, + the application must define its own structure to store information for reconnection. + +2.5 Completed the initialization and running the application. + While the application is running, it is important to store relevant information + about reconnections in mapped pages. When calling the ioctl VDUSE_VQ_GET_INFO to + get vq information, it's necessary to check whether it's a reconnection. If it is + a reconnection, the vq-related information must be get from the mapped pages. + +2.6 When the Userspace application exits, it is necessary to unmap all the + pages for reconnection -- 2.43.0