Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1512226rdb; Thu, 7 Dec 2023 00:47:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IG8gUv0fbXmXTuyrL5U0G/rMFAHvQHIZTSpSnjmhJmT6waKYIh+y4heYWyIxn/und16CiXI X-Received: by 2002:a05:6a20:9146:b0:187:d44:59f1 with SMTP id x6-20020a056a20914600b001870d4459f1mr2154313pzc.31.1701938829630; Thu, 07 Dec 2023 00:47:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701938829; cv=none; d=google.com; s=arc-20160816; b=Yd4UI0WldPTzxkdTEwluA69sWWWbcGesvLGHLz0io71ya/ThibYHzAilW1WUmsALoN PvXs2Vob4fPjpno3326cv4ZDsI5q6UNoehNxAYJVF9hl00XaJQBLQbROqgI0+o6926cQ dpTFgcedZG8b6kLLcSmvW/DiubuA+O7lFTjHnTndM0mOvWC9xZjUlNlYHaKwHt7ONB58 BzZE6IWX5Kev06mg8ep+SGlBYrsVhTcpH5Yros6+jzOK69axEzA1xbbtONizrswxhLRR 2xcMJuSwWAF4+xgytKkkI0n62FeoBScIgoa8UF63px7XifvxEd68EpBKQNzlVG30I7JJ 6fPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=jEejCQBe0JpA/tNNsAza2pPtF0USzloo/HRlTyZ5Xy4=; fh=ir7cOO3TfsXjq7Y5DnAiuq3+k2gzyaCCb4HcXAX8/h4=; b=jvc2f2c6mVklpwKoGJ4DG5PBzrnLrIJ+D+kMiroKTqwoFym+iASdvWtvuyau5zaown tnpraNtlEctwozTpp+4PC5E/uLyq/09y900FTaUjMIu2c+k73qKeFKTeZoluRe46ClLL QX0hFMLa1a0/mGD/TK0h32AA8suv/dTJjT6HiC0pLbqXqY2Z86dfv6Oe7vu2a87aANg8 kY4hhNfBMfbuWnjxEo7JjM0qVF+AAVCKSSIkvkZng0ZgG4/0mrXq/FhuelWYwD49F3PS ExdFrbe96r2PPoSk3tGRUEPDF/WPl0S+bxMNyhF4jW6jJMxn9vajskOTqmVMP5q00OFr kY6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=aTkiVFZs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id 30-20020a17090a09a100b00286926f5b20si748858pjo.148.2023.12.07.00.47.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 00:47:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=aTkiVFZs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id 2CE6280A1DAE; Thu, 7 Dec 2023 00:47:06 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378431AbjLGIqc (ORCPT + 99 others); Thu, 7 Dec 2023 03:46:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378394AbjLGIq0 (ORCPT ); Thu, 7 Dec 2023 03:46:26 -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 3CD9019A for ; Thu, 7 Dec 2023 00:46:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701938792; 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=jEejCQBe0JpA/tNNsAza2pPtF0USzloo/HRlTyZ5Xy4=; b=aTkiVFZsHRPNZUhFFmz+heBAlELItVXLXqQwfIDE7VHESboWfzsL1q1WYTQT+uSS1H1J43 0+SEslzJ0b0Dzi2qW5Bv6gX7LgVm1JyiGE9KtZgLzosku5HkwYa+hzK9vkJwVjHTH+STOg gA1nmt+IZm4SX5koNeWGEz8iZa98sS4= Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-695-tJobi6UHONaNN0aqdf-qrw-1; Thu, 07 Dec 2023 03:46:30 -0500 X-MC-Unique: tJobi6UHONaNN0aqdf-qrw-1 Received: by mail-pj1-f72.google.com with SMTP id 98e67ed59e1d1-286d700f702so560767a91.3 for ; Thu, 07 Dec 2023 00:46:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701938790; x=1702543590; 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=jEejCQBe0JpA/tNNsAza2pPtF0USzloo/HRlTyZ5Xy4=; b=egBk64ReA2HDc5h/bWxcUV+xO8aYeQiErW/az10f86/qNGM6xcGRBFgG0BYVgsDrwR +RDZ2Z+1aITxVa/hLOMWnMJwSnARRGdRGwa30xuWySH9+26egSIwg3lCQUMBWyzkBGUc vhw8d/Iz/YSabr2gC68eVHSu2XUHyDMrCmfPCkc7PiPlYUCWJWZZeMAoxjo27fIGZDGl o3ocB2XoYHs2YNBHOJVZx0qnvMdzh3js+rUUdbxSWNpQDYOoQkuSMdRDiysBfj3baV58 UtntgAsQ49szdR18bp/vy0aYImicOAYm0cAoY7vktwys2ywt2K5IApjYNmyPPIg+z0lr rHng== X-Gm-Message-State: AOJu0YzUG6bAVXsiPRT5+5sew9bnw5Gc8X46GiG//Uk/t5U4ewivS310 soHInww9K1+ACOpUFUKIciY5lp4QXr1ez2xMU+4wX/jx5hp6kBWDsdJNhgVTa5BdUb4txuYHoCY VRHp4XizFBQHQ1C2tVBcrQ7CQgDjoO0YDGac8l0e2 X-Received: by 2002:a17:90b:4ac7:b0:286:a9a4:9622 with SMTP id mh7-20020a17090b4ac700b00286a9a49622mr1857199pjb.16.1701938789700; Thu, 07 Dec 2023 00:46:29 -0800 (PST) X-Received: by 2002:a17:90b:4ac7:b0:286:a9a4:9622 with SMTP id mh7-20020a17090b4ac700b00286a9a49622mr1857192pjb.16.1701938789421; Thu, 07 Dec 2023 00:46:29 -0800 (PST) MIME-Version: 1.0 References: <20231205083444.3029239-1-lulu@redhat.com> <20231205083444.3029239-3-lulu@redhat.com> In-Reply-To: <20231205083444.3029239-3-lulu@redhat.com> From: Jason Wang Date: Thu, 7 Dec 2023 16:46:18 +0800 Message-ID: Subject: Re: [PATCH v3 2/7] vduse: Add new uAPI for vduse reconnection To: Cindy Lu Cc: mst@redhat.com, xieyongji@bytedance.com, linux-kernel@vger.kernel.org, maxime.coquelin@redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 howler.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 (howler.vger.email [0.0.0.0]); Thu, 07 Dec 2023 00:47:06 -0800 (PST) On Tue, Dec 5, 2023 at 4:35=E2=80=AFPM Cindy Lu wrote: > > To synchronize the information for reconnection, add a new structure > struct vduse_dev_reconnect_data to save the device-related information, > Add the VDUSE_RECONNCT_MMAP_SIZE for the size of mapped memory for each v= q > and device status. > > Signed-off-by: Cindy Lu > --- > include/uapi/linux/vduse.h | 22 ++++++++++++++++++++++ > 1 file changed, 22 insertions(+) > > diff --git a/include/uapi/linux/vduse.h b/include/uapi/linux/vduse.h > index 11bd48c72c6c..c22838247814 100644 > --- a/include/uapi/linux/vduse.h > +++ b/include/uapi/linux/vduse.h > @@ -350,4 +350,26 @@ struct vduse_dev_response { > }; > }; > > +/** > + * struct vduse_dev_reconnect_data - saved the reconnect info for device > + * @version; version for userspace APP I guess it should be the version of the reconnection protocol not the userspace application. > + * @reconnected: indetify if this is reconnected.userspace APP needs set= this > + * to VDUSE_RECONNECT, while reconnecting.kernel will use= this > + * to indetify if this is reconnect Typos, I think checkpatch may help or you can tweak your editor to enable spell checkings. > + * @features; Device features negotiated in the last connect. This seems to cause confusion, let's use driver_features instead. But can't we just get driver_features via VDUSE_DEV_GET_FEATURES? > + * @status; Device status in last reconnect > + */ > + > +struct vduse_dev_reconnect_data { > + __u32 version; > +#define VDUSE_RECONNECT 1 > +#define VDUSE_NOT_RECONNECT 0 > + __u32 reconnected; > + __u64 features; > + __u8 status; > +}; For status, VDUSE currently forwards the request to the userspace: static int vduse_dev_set_status(struct vduse_dev *dev, u8 status) { struct vduse_dev_msg msg =3D { 0 }; msg.req.type =3D VDUSE_SET_STATUS; msg.req.s.status =3D status; return vduse_dev_msg_sync(dev, &msg); } Do we need to handle the case where the user space crashes when dealing with this message? For example, driver set DRIVER_OK but VDUSE application crashes when dealing with DRIVER_OK. At the uAPI level, it probably requires to fetch inflight VDUSE requests. It may help for the case where dealing with crash at feature negotiation and configuration space access. > + > +/* the reconnection mmap size for each VQ and dev status */ > +#define VDUSE_RECONNCT_MMAP_SIZE PAGE_SIZE PAGE_SIZE should not belong to uAPI. Userspace can query it via e.g sysconf= etc. Btw, what is the virtqueue part for this? I'd expect there should be at least the part of inflight descriptors? > + > #endif /* _UAPI_VDUSE_H_ */ > -- > 2.34.3 >