Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1028759rdh; Mon, 25 Sep 2023 00:30:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFJ+oJqSiNK41njL6BZMwPS7N0kkgVKGexKJIJ3SwIWbjYV0ubsOxjoHq6NoivPpmEjHSMR X-Received: by 2002:a05:6358:91a3:b0:143:786b:3de5 with SMTP id j35-20020a05635891a300b00143786b3de5mr8002342rwa.9.1695627030188; Mon, 25 Sep 2023 00:30:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695627030; cv=none; d=google.com; s=arc-20160816; b=K4S1Y3IEWLmrmh0zQSuqTfg+K1R2IdwgrwZ85y0D925VwUwR2tPjGF3CajLvNdh0uf R8Q8ewYWpDgaK5oFrAXnriegetJqQtqOMUBcP+m2uvUwtG4a7RgZvs1ZRtXkfJnnkLyo IcZHVQ2MXuY6Yb60R23DJOeY8vywAxcGhe/7z/y3HifH56AZIzl6FgBMV+w3mMfEIQrl 2hjgXIpHc9Gq8Qwn2la9dPFu0dX6FcaI7iT8yw1Y7onhwt3bWO0gyZ6kT6b6env5Oawg XaFdkV3L03ZfxNB1tqas5PcNmRKw5YM3ky0mz+C+byXzD9J8SNVt6Hedh3shJQqeMmWe KZqw== 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=ruu6yd/F7PRRg3zU9933sMPG2y+61a3R2Ou0YGttbMk=; fh=9z4dZr983w21Pd0RQN3Hf7v6e+s/vu+D8meFPGx2CyU=; b=v7h6gV6nnKKZTlUFfO6s9NabrQV3uLFXFiQKL8TbV+Rs+M5qbhL4/mz8D43jP+ircO lmjwwZRGoml8NhfcdPg0aEqfBBAnxfhMzgr99J5XA5AJHkIe00/X7RR4zWAuvE1iyE+Q +vCh4XQuq749LbGgQCxp3DdKDxrdFx6d0qMt864X4aChBdnQRF8qwxWrNiwERBiQ8Gr/ 6vo+JOCnFiVfTwZlxTyJ69MbB0Ph6tIBFJZr2Fcimw9ZrTBIj+lagCT0ybrtE/46/vw3 GRI7nFmK54GsXBtGkT3xWw6nUTmSUbZwEekgizuf9J4xPHqAh5l+m+Ob7vg2RCocPgMx W/1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BzyL8Bnv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id e26-20020a63545a000000b00578c9144913si9238990pgm.364.2023.09.25.00.30.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 00:30:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BzyL8Bnv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (Postfix) with ESMTP id DD99380293F0; Sun, 24 Sep 2023 21:20:15 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231664AbjIYEQq (ORCPT + 99 others); Mon, 25 Sep 2023 00:16:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229907AbjIYEQm (ORCPT ); Mon, 25 Sep 2023 00:16:42 -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 67417E8 for ; Sun, 24 Sep 2023 21:15:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695615348; 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=ruu6yd/F7PRRg3zU9933sMPG2y+61a3R2Ou0YGttbMk=; b=BzyL8BnvDMZM3MwXeVufFBXbkJPyO0gztoOXDezQbU6Ots6F6fULVGojr/8Zf+ESbo+8cp 6vZiaRUmgNS0JetbRb3EBsehFp6PVRQDBCF8tIfY3ewXWXu9YRmkoFoW1FnTMXxbgkn4aQ 2CuPqgv0qcGkXNYHu9XD10YSdShoyns= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-673-_B98rVRaNU2HLEKrG1NEuA-1; Mon, 25 Sep 2023 00:15:46 -0400 X-MC-Unique: _B98rVRaNU2HLEKrG1NEuA-1 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-3231fceb811so1324838f8f.2 for ; Sun, 24 Sep 2023 21:15:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695615346; x=1696220146; 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=ruu6yd/F7PRRg3zU9933sMPG2y+61a3R2Ou0YGttbMk=; b=PzppKS0mICMU9/E9r898BnNPJVtkftcgi0UnzDBT6/j/9PbChPVb4uk5ahZgmcq0bH EbKCkVDAQJDCLEmUOJz5BeoNYMMsoqt6Gr7NJMerPK286aJyMd72y60OuNG4KbKj9fOU 71Lk0XTS5tNYu00pMXCn7/tEvI2WMmcb3DYFFMCeeyYDx7C23QBtf6mlbBKvBLwJDeCU 9oSuOJyUkTi4d3Q/ksqk3ugEot1xWPOnRTGl2cfVMDfhZ7Hy9xp6D1HCMfLIssVCY+ji 9/isiteHzvHSUrIPu4NgRIquQPemOMz6SlPsg0FmZYu/k4V4NI1r5U3/nQcC5YD6k08N mUhw== X-Gm-Message-State: AOJu0YwbgsI/dQpUHqLoMyToz+bBy1AO3d0TGd8LtqCsUYdDUqyNuHGV UKEcCjELk0ftIdi24tSIqgBxWfS9E3NNrwQ3gAK9Abx4bnlQleHLVLmUVP4WIACbntADWtk74OO 1KiJZOoTqWzm651ukyipjPXu9oy0McRKzCQOyi/Qa X-Received: by 2002:adf:e508:0:b0:321:64a6:e417 with SMTP id j8-20020adfe508000000b0032164a6e417mr5651728wrm.1.1695615345913; Sun, 24 Sep 2023 21:15:45 -0700 (PDT) X-Received: by 2002:adf:e508:0:b0:321:64a6:e417 with SMTP id j8-20020adfe508000000b0032164a6e417mr5651717wrm.1.1695615345660; Sun, 24 Sep 2023 21:15:45 -0700 (PDT) MIME-Version: 1.0 References: <20230912030008.3599514-1-lulu@redhat.com> <20230912030008.3599514-4-lulu@redhat.com> In-Reply-To: From: Cindy Lu Date: Mon, 25 Sep 2023 12:15:08 +0800 Message-ID: Subject: Re: [RFC v2 3/4] vduse: update the vq_info in ioctl To: Jason Wang 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 groat.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 (groat.vger.email [0.0.0.0]); Sun, 24 Sep 2023 21:20:16 -0700 (PDT) On Tue, Sep 12, 2023 at 3:39=E2=80=AFPM Jason Wang wr= ote: > > On Tue, Sep 12, 2023 at 11:00=E2=80=AFAM Cindy Lu wrote= : > > > > In VDUSE_VQ_GET_INFO, the driver will sync the last_avail_idx > > with reconnect info, After mapping the reconnect pages to userspace > > The userspace App will update the reconnect_time in > > struct vhost_reconnect_vring, If this is not 0 then it means this > > vq is reconnected and will update the last_avail_idx > > > > Signed-off-by: Cindy Lu > > --- > > drivers/vdpa/vdpa_user/vduse_dev.c | 13 +++++++++++++ > > include/uapi/linux/vduse.h | 6 ++++++ > > 2 files changed, 19 insertions(+) > > > > diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_use= r/vduse_dev.c > > index 2c69f4004a6e..680b23dbdde2 100644 > > --- a/drivers/vdpa/vdpa_user/vduse_dev.c > > +++ b/drivers/vdpa/vdpa_user/vduse_dev.c > > @@ -1221,6 +1221,8 @@ static long vduse_dev_ioctl(struct file *file, un= signed int cmd, > > struct vduse_vq_info vq_info; > > struct vduse_virtqueue *vq; > > u32 index; > > + struct vdpa_reconnect_info *area; > > + struct vhost_reconnect_vring *vq_reconnect; > > > > ret =3D -EFAULT; > > if (copy_from_user(&vq_info, argp, sizeof(vq_info))) > > @@ -1252,6 +1254,17 @@ static long vduse_dev_ioctl(struct file *file, u= nsigned int cmd, > > > > vq_info.ready =3D vq->ready; > > > > + area =3D &vq->reconnect_info; > > + > > + vq_reconnect =3D (struct vhost_reconnect_vring *)area->= vaddr; > > + /*check if the vq is reconnect, if yes then update the = last_avail_idx*/ > > + if ((vq_reconnect->last_avail_idx !=3D > > + vq_info.split.avail_index) && > > + (vq_reconnect->reconnect_time !=3D 0)) { > > + vq_info.split.avail_index =3D > > + vq_reconnect->last_avail_idx; > > + } > > + > > ret =3D -EFAULT; > > if (copy_to_user(argp, &vq_info, sizeof(vq_info))) > > break; > > diff --git a/include/uapi/linux/vduse.h b/include/uapi/linux/vduse.h > > index 11bd48c72c6c..d585425803fd 100644 > > --- a/include/uapi/linux/vduse.h > > +++ b/include/uapi/linux/vduse.h > > @@ -350,4 +350,10 @@ struct vduse_dev_response { > > }; > > }; > > > > +struct vhost_reconnect_vring { > > + __u16 reconnect_time; > > + __u16 last_avail_idx; > > + _Bool avail_wrap_counter; > > Please add a comment for each field. > Sure will do > And I never saw _Bool is used in uapi before, maybe it's better to > pack it with last_avail_idx into a __u32. > Thanks will fix this > Btw, do we need to track inflight descriptors as well? > I will check this Thanks cindy > Thanks > > > +}; > > + > > #endif /* _UAPI_VDUSE_H_ */ > > -- > > 2.34.3 > > >