Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp480256rdb; Tue, 19 Sep 2023 00:49:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFyzskVnhwYOpraOtLSfjA1fW2iOdWa1VKiPMzR+GnrlbOM+d+bVZO3ufVTLfMBfB3FhpUn X-Received: by 2002:a17:90a:2ec3:b0:268:29cf:3231 with SMTP id h3-20020a17090a2ec300b0026829cf3231mr10086818pjs.3.1695109744401; Tue, 19 Sep 2023 00:49:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695109744; cv=none; d=google.com; s=arc-20160816; b=XL9INrFc8ZwS2TM3xS1SMTnDB1sO/GOxlOccrgmWg+GXTmZ3nfMARqJkajncEexedM qVMtaZuDTQisAce+mgMxgH4ibNW4sG0cNFhszWEgKaD3eB3W8/8Vle0q0ZPerCLGKgEQ BUd8JcA6ht3q8CxaVaNFDB96s+HxVMV7VrToQlRg8fIXvPwuGs7hTXCi4aVqNspLmDCk gcsOY6p5uPWwyWhEWEw3YXH45kKT0aTMRfO2dG0jIpr+ITsntC4pPqZZsFIUMpMbZxO0 YFH6xxpOPONP0v1Np1gyFcmFr1uxmYB/WUBg1BIMdk8Telbrhk78REn+Ej20OysJQc0B b51w== 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=XjrLFNKkiROohp1YQUFUAWvCAJRc18i6LWfUqVeHSNg=; fh=KYIgaKzY60pU9WqmLGkDlcDWEU+gMoww+4hF4y9j8Zo=; b=0gpbGsTfViIE43mFXlCV90mH/qVK4z/Qs2uuIje28unC59C9Ja4cXzQILeu/OZhYEA isM8+wka0fKMiQGR6T6NTk1aO1ZYFSYzB4zFezw7D6RilS+of9K8Pxbe+FlymX/YIWuX RuWlxUTg2ixnp2DELlLET8x1wiqeyxaH2yP1dlqQ9Wbevm8+hpSTVYXrKYlfnBXZMWNZ flaXKeGR/bJBoMo5FXDNJtV4OKm4CHUgG13JEB6HThruAbxQW1bdurZWT5o/mNPeZkXz LyPPAHb6Z11DvmgmnrDnzVAPCiL91ANxCUfXI/hvKXA2JoqKSonuImJCqyWa7Sjek9Kx 1n1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bDdp5CEZ; 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 h21-20020a170902f7d500b001b9dda4e1e7si9003874plw.154.2023.09.19.00.49.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 00:49:04 -0700 (PDT) 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=bDdp5CEZ; 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 51213807FC01; Mon, 18 Sep 2023 01:50:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238919AbjIRIu3 (ORCPT + 99 others); Mon, 18 Sep 2023 04:50:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238266AbjIRIt5 (ORCPT ); Mon, 18 Sep 2023 04:49:57 -0400 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 D00DD10A for ; Mon, 18 Sep 2023 01:49:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695026945; 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=XjrLFNKkiROohp1YQUFUAWvCAJRc18i6LWfUqVeHSNg=; b=bDdp5CEZbVauUXjOX1O7JtjLZlU71hvHnnIGiPPqn0l4V/wmsNWY2AtSV9MACqZloGF3J0 Pr0GxwphfyKLnL8wDpUYA/Bfib+9skyD+2QlmnEHaPPnnbpXUxytw8GYnzj09anw9FST1r x0aXAby2yrHzg5pDRXFCaDnK4ZxQMeQ= Received: from mail-lf1-f71.google.com (mail-lf1-f71.google.com [209.85.167.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-643-BVU3v-E-Olqf2m9ZJzGQ5g-1; Mon, 18 Sep 2023 04:49:01 -0400 X-MC-Unique: BVU3v-E-Olqf2m9ZJzGQ5g-1 Received: by mail-lf1-f71.google.com with SMTP id 2adb3069b0e04-5007f3d3255so3208933e87.3 for ; Mon, 18 Sep 2023 01:49:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695026940; x=1695631740; 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=XjrLFNKkiROohp1YQUFUAWvCAJRc18i6LWfUqVeHSNg=; b=VBKw+34zkMuK5EB/AAdw1u6ymDs6K9Js1RtXfHPJoxWjB1hNMYXDgJoMAW9lnOrH8H u6GSBr04fMsYdXbOxCvWMyoEwNooG/8WqdjAWR/X8YKvpBGCyM2JNhqq0JALwkNQQrYI obgOI2F3hezFLu213NWz3Nv6EjGOZmiGoNmCjmps2CD9aFAdsvDoppNZxBaG/WYET/Ex 0PQ5LQ7lzutrzXlDvEM6Sf9HodSsq2t539isjhFr6wMICpBKH6pMtNgrgI5eB3iemixk QAz6T7F5BzGva2uRWAGWUeTsKmoRfch//J95YiKgcu9h1PtIIVptwLndEKBgz/NSQMsL Asfg== X-Gm-Message-State: AOJu0Yyp38T8kBWtq1bzBDhimcsRyJmi314FR8A8Uc8EkSZh4fpctecz zQljqr6uj+l1gOZ3TND8xgC30i/1F1bKAAL9ollOYnd/zDVctKMzzQFbKHvVT3TyCeQdk9qEikD XfUnVfvp/gXhbOAEPYvt1u0odfQL21eF7Nusv1HHi X-Received: by 2002:a05:6512:454:b0:500:9a45:63b with SMTP id y20-20020a056512045400b005009a45063bmr6257571lfk.13.1695026940424; Mon, 18 Sep 2023 01:49:00 -0700 (PDT) X-Received: by 2002:a05:6512:454:b0:500:9a45:63b with SMTP id y20-20020a056512045400b005009a45063bmr6257546lfk.13.1695026940132; Mon, 18 Sep 2023 01:49:00 -0700 (PDT) MIME-Version: 1.0 References: <20230912030008.3599514-1-lulu@redhat.com> <20230912030008.3599514-5-lulu@redhat.com> In-Reply-To: <20230912030008.3599514-5-lulu@redhat.com> From: Jason Wang Date: Mon, 18 Sep 2023 16:48:49 +0800 Message-ID: Subject: Re: [RFC v2 4/4] vduse: Add new ioctl VDUSE_GET_RECONNECT_INFO To: Cindy Lu Cc: mst@redhat.com, maxime.coquelin@redhat.com, xieyongji@bytedance.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, stable@vger.kernel.org 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 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]); Mon, 18 Sep 2023 01:50:58 -0700 (PDT) On Tue, Sep 12, 2023 at 11:01=E2=80=AFAM Cindy Lu wrote: > > In VDUSE_GET_RECONNECT_INFO, the Userspace App can get the map size > and The number of mapping memory pages from the kernel. The userspace > App can use this information to map the pages. > > Signed-off-by: Cindy Lu > --- > drivers/vdpa/vdpa_user/vduse_dev.c | 15 +++++++++++++++ > include/uapi/linux/vduse.h | 15 +++++++++++++++ > 2 files changed, 30 insertions(+) > > diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/= vduse_dev.c > index 680b23dbdde2..c99f99892b5c 100644 > --- a/drivers/vdpa/vdpa_user/vduse_dev.c > +++ b/drivers/vdpa/vdpa_user/vduse_dev.c > @@ -1368,6 +1368,21 @@ static long vduse_dev_ioctl(struct file *file, uns= igned int cmd, > ret =3D 0; > break; > } > + case VDUSE_GET_RECONNECT_INFO: { > + struct vduse_reconnect_mmap_info info; > + > + ret =3D -EFAULT; > + if (copy_from_user(&info, argp, sizeof(info))) > + break; > + > + info.size =3D PAGE_SIZE; > + info.max_index =3D dev->vq_num + 1; > + > + if (copy_to_user(argp, &info, sizeof(info))) > + break; > + ret =3D 0; > + break; > + } > default: > ret =3D -ENOIOCTLCMD; > break; > diff --git a/include/uapi/linux/vduse.h b/include/uapi/linux/vduse.h > index d585425803fd..ce55e34f63d7 100644 > --- a/include/uapi/linux/vduse.h > +++ b/include/uapi/linux/vduse.h > @@ -356,4 +356,19 @@ struct vhost_reconnect_vring { > _Bool avail_wrap_counter; > }; > > +/** > + * struct vduse_reconnect_mmap_info > + * @size: mapping memory size, always page_size here > + * @max_index: the number of pages allocated in kernel,just > + * use for check > + */ > + > +struct vduse_reconnect_mmap_info { > + __u32 size; > + __u32 max_index; > +}; One thing I didn't understand is that, aren't the things we used to store connection info belong to uAPI? If not, how can we make sure the connections work across different vendors/implementations. If yes, where? Thanks > + > +#define VDUSE_GET_RECONNECT_INFO \ > + _IOWR(VDUSE_BASE, 0x1b, struct vduse_reconnect_mmap_info) > + > #endif /* _UAPI_VDUSE_H_ */ > -- > 2.34.3 >