Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1825758lqp; Mon, 15 Apr 2024 20:46:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUqVwdpTWA4h4pCWntlys7fJjQpOIZ4BQ35Xlug+SHrhLUaau1VQ8d6dpoRzmLcbark6rEuvI+LHeHutcAxi75/4wpv/SfQ4xysXjmWzQ== X-Google-Smtp-Source: AGHT+IGiNSjByrLKcJZJ8baHPJ3hby3z89Hen49zOGYDPitRmYnvi7CL1MevtvQDthoRjcGXYJ6p X-Received: by 2002:a05:6870:5486:b0:22e:bace:ed96 with SMTP id f6-20020a056870548600b0022ebaceed96mr14208528oan.15.1713239198207; Mon, 15 Apr 2024 20:46:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713239198; cv=pass; d=google.com; s=arc-20160816; b=iraMNUqiL+D2gOK0muBQetkQtdGNZVkYNwmb2vyTqECr7Puvk7B0l1zBUqPIT99LYB bqoKDPHmD+//Feibw8RGAkTkWuNH+C5PWL/TPgfFf4djMdvmq0dHtG/kIuJx3gaZf2Ve vUOoeXHYMcBw6kf74pAq1NzU0zJz1rbYrD+w7j95z7wdB+azts+yhLfkZXqh51K+mXbL JMbbfhoNvwKNoO0KJt6UhZcEWJibhrRHU0u8brpLoVtmqy+2t/lXY729IICNe6yLEk5e iNHhU0nctZnzAVoghgSjrLRWkrOjnY1ALeBccEOql0ofzxbPNdrx7kVXyiPE7t6QnFqs N4TA== ARC-Message-Signature: i=2; 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=ZZDbR0tmZA4tU6Egi/VdC3qpLsZIOkOjLEJ7+EXDz74=; fh=SA41Nme6NN6mITuIwMI8c3RMOLfvdEFhzeA0S2SD2wg=; b=Je42IP6pGCHvWgvItI5S7BkPI2gtItqUCkAOPC1EbB/RxuRf0CTyKOYvn0hogY+naf TTDvwwMAjk/K+9gqowh+Lb1BoaTf+mRGsRqQ6z1tY5it+ViLcIcjefzk4/SelXdIRN7d vKBVE0OlXBp+mpeDNa+PkHy30IYiOUhNR/TEFo6xnFxROgP15cv2autGw4ZiMKziuLaU BZYbb1w2771d9CMSGecLvQTU8CcR/nXJzgUORXHS5oXjiHuj9FUd4otIQYUqcV1/n9l+ zbVHP8zpe95J6tiHgTNENT802OJV2K0euwyoTHd7ZW3ly6mGAE5aSSrX/FUJkaDW8Bza b63Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="UH/TkX03"; 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-146186-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-146186-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id k5-20020a63ba05000000b005dc81a6b2b6si9245441pgf.782.2024.04.15.20.46.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 20:46:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-146186-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="UH/TkX03"; 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-146186-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-146186-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id C6EBD2865A3 for ; Tue, 16 Apr 2024 03:46:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9D75E1B5A4; Tue, 16 Apr 2024 03:46:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="UH/TkX03" 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 F28C515AF6 for ; Tue, 16 Apr 2024 03:46:28 +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=1713239190; cv=none; b=n67d1MuoYEpmmcbn86fFR0vbRj8x6r0DewuSW1AVFDAMluGh5E6qmyMmXJ5qnkLi8+EnDeZqoNhPA5u4YbRCvUVm7mcujPQyXynumR/oWBN8/YFqwzFeeq6q5EO3Ui67WiolWzG+0tCSZSwj7BD6WhgmlumXKeIqIt5PDWdGP2M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713239190; c=relaxed/simple; bh=5AHDPoNYz6OYyTQyPh89LCxQ98eQH/ZTlnsO1SaMREA=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=dQb/ktuoxgc4VIiboIaCtGCUsOq2VsKScTmyGwDhH//XMlbMNEUbhBXnbB7IgbxRCfPps4yHbh5DwcwMD1ONldfukxrP9cmhUiI1/YQmN7jTv7wr8i9kzlBloaN9yEk1P7QJxLdUF1Ys6NzH7Bl0bvCFnGKBbtbMNx2uysm26oI= 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=UH/TkX03; 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=1713239187; 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=ZZDbR0tmZA4tU6Egi/VdC3qpLsZIOkOjLEJ7+EXDz74=; b=UH/TkX03E7QYDcRz+oQ530VqRLQVaZWHux/9TYZKwb5CkHFlIeQX3biBvf8+uRwiKRd0c8 sOOwcCPRUGcPZVLuYXLCyTF2SLbhMQVvU529ntfo1z7ZSxS78H5yUr8zu0u6U5McZZw5nv LGydW33Z7EI+iNLqR849hMsMFoeW1to= Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-543-bY-cuf55NQSxXfO8i3kVrA-1; Mon, 15 Apr 2024 23:46:26 -0400 X-MC-Unique: bY-cuf55NQSxXfO8i3kVrA-1 Received: by mail-pf1-f199.google.com with SMTP id d2e1a72fcca58-6ed663aa4a7so2500429b3a.3 for ; Mon, 15 Apr 2024 20:46:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713239185; x=1713843985; 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=ZZDbR0tmZA4tU6Egi/VdC3qpLsZIOkOjLEJ7+EXDz74=; b=XvcnFwsiq0FD8Gd7jc7UmijaJtBvcm9uHroNqq1DAYpF8UM4cIlC/zLEXQqyBXKJeM /UQ6vRqjN0HISHIM0W6xRQePeN20y7/GkRaPJzkQa8gfmCree/fsyuNn6sDWbvo1D+dJ dy1YiuAgRz4bwIwJwFSfkroXMlM1kBkyUz6I3FouuErFQItfIWBoDaEKptaDXZ5Df/xk aURoD4440OHdWr5ZRAM4mavqXn8wRe+DW7U6RCp6kh+yAbxQLFc4UQKvPX7meCA9gWEi FuThPp2K0k/VSkdq0STj0/1VvkNCP9bRD6lv7VWKoDmMsHYSgJ6uTZokrwXXVIBNbVTg aglA== X-Forwarded-Encrypted: i=1; AJvYcCVxY1rc2fpcbRuK3Fk/ATjmIU8lC/BFpUBv61/6bF2Q89GwX9RjSJedNidQ65XXrHcOiiCVIHrsgDVLPbDKSC0ADfeeWvtMWqeKxj4I X-Gm-Message-State: AOJu0Yz1yZtqSK2Zq2uKDK/rZWk086v27Wmn7CWElG4zs7uSUSO43I3u xUt9eetNq7y+gg1iAliw3eEnM38KXCVrZdUdBHNA7RORBgoORpm9wwtqYOghcXNNgWSDr3pkTUw 3Z6DO2Rn98XmhcgM0UG6w1/2Rj/YuVOcVb+iYn+xoRCgAPmxIeOKspzufjHoZUDioT+tPSTMAXx FLjFGqSiIlR5TYustspeDlxM12hUyrbFQHCBA2 X-Received: by 2002:a05:6a20:9794:b0:1a7:bb6d:6589 with SMTP id hx20-20020a056a20979400b001a7bb6d6589mr9991417pzc.29.1713239185036; Mon, 15 Apr 2024 20:46:25 -0700 (PDT) X-Received: by 2002:a05:6a20:9794:b0:1a7:bb6d:6589 with SMTP id hx20-20020a056a20979400b001a7bb6d6589mr9991405pzc.29.1713239184690; Mon, 15 Apr 2024 20:46:24 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240412133017.483407-1-lulu@redhat.com> <20240412133017.483407-6-lulu@redhat.com> In-Reply-To: <20240412133017.483407-6-lulu@redhat.com> From: Jason Wang Date: Tue, 16 Apr 2024 11:46:13 +0800 Message-ID: Subject: Re: [PATCH v5 5/5] Documentation: Add reconnect process for VDUSE To: Cindy Lu Cc: mst@redhat.com, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Apr 12, 2024 at 9:31=E2=80=AFPM Cindy Lu wrote: > > 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/usersp= ace-api/vduse.rst > index bdb880e01132..7faa83462e78 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 reconnection works > +------------------------------------ > +1. What is reconnection? > + > + When the userspace application loads, it should establish a connectio= n > + to the vduse kernel device. Sometimes,the userspace application exist= s, I guess you meant "exists"? If yes, it should be better to say "exits unexpectedly" > + and we want to support its restart and connect to the kernel device a= gain > + > +2. How can I support reconnection in a userspace application? Better to say "How reconnection is supported"? > + > +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 st= ep 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_mum= ber. I think we need to mention that this should be part of the previous "VDUSE devices are created as follows"? > + > +2.3 Check if the information is suitable for reconnect > + If this is reconnection : > + Before attempting to reconnect, The userspace application needs to u= se the > + ioctl(VDUSE_DEV_GET_CONFIG, VDUSE_DEV_GET_STATUS, VDUSE_DEV_GET_FEAT= URES...) > + to get the information from kernel. > + Please review the information and confirm if it is suitable to recon= nect. Need to define "review" here and how to decide if it is not suitable to reconnect. > + > +2.4 Userspace application needs to mmap the memory to userspace > + The userspace application requires mapping one page for every vq. Th= ese pages > + should be used to save vq-related information during system running. Not a native speaker, but it looks better with "should be used by the userspace to store virtqueue specific information". > Additionally, > + the application must define its own structure to store information f= or 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. I think we need some link/code examples to demonstrate what needs to be sto= red. > When calling the ioctl VDUSE_VQ_GET_INFO to > + get vq information, it's necessary to check whether it's a reconnect= ion. Better with some examples of codes. > If it is > + a reconnection, the vq-related information must be get from the mapp= ed pages. > + > +2.6 When the Userspace application exits, it is necessary to unmap all t= he > + pages for reconnection This seems to be unnecessary, for example there could be an unexpected exit= . Thanks > -- > 2.43.0 >