Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp445859rwr; Thu, 20 Apr 2023 01:27:41 -0700 (PDT) X-Google-Smtp-Source: AKy350Y+udOggwU466Wxm2mW7gVw3L/LDYuC2v4bR1j/AUiHpD/14jiW81zqksePYCVX7XeFeQaO X-Received: by 2002:a05:6a00:22ca:b0:634:4dea:81c6 with SMTP id f10-20020a056a0022ca00b006344dea81c6mr752711pfj.0.1681979261228; Thu, 20 Apr 2023 01:27:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681979261; cv=none; d=google.com; s=arc-20160816; b=Cl1XtF9JPkGPAPELgktr+2+6FfiCYkDW7Q49eUi1Sqiuu10xcT18cJJBeBRTWipIvS 4baRuBA0cH/6KMJtDnM9yxi/I0D1XENMgIMRE4EThxitZ3Oat9GpJs0PxRsJop+s9cge UVLYKATpXILyHy5zYJYFKBSsBTwJtCN7TIaB3j1WbN4Wsa2zXz0+Z/k/erw/SwKEWU7j ONvSJ9hHvIDDAtjDtouI0B/5rpL+wmSOaOoGIpup7lbhP3f95PvlAFzdcK0U/Y/5mcC2 NG2ZG5H3ZEBrDLeIcZJ40eodswEnK3d/bGcdTzau2R1Y5cxvaH6ZFoibGnoieYczKnNo 3mBQ== 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=X9ATYIUW0VL5jv34KSuydy4tkMajLvSkNKzBXFZEi9c=; b=KFSdsSrScgmYmqvT3BT4OvkqPTgqf504nLC8b6Mx95LicNKomHR6gaBW5yaq+8sPwO R/CqOafuJUh39AfX5v7Oz8LaWiUDjXBnsDkWMKWSibXfBsYrsRPiB2/ZVOCIQpAeVFpa vXGG+3siJfI+ZZl8plkaSJzG1HY923dskbwiOmtw7mHOX3rc8LLUcJs60sV2+Yd07wHQ QRDKvCIeCgklPrjXVZninDyIBX77xtt/Fui/B09pbHmlM9H1mgs5Ci9PS8P3sKpXEoPz NCuWhG4H8BVz1HIwJc6KVgyqMz7PV/ks3onm3e7cOeoQXmaf7eIO3VPjJx0k1V25mlE5 tVZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=OGZhHQPc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s6-20020a656446000000b00517aa9db92dsi523302pgv.396.2023.04.20.01.27.29; Thu, 20 Apr 2023 01:27:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=OGZhHQPc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234127AbjDTIPI (ORCPT + 99 others); Thu, 20 Apr 2023 04:15:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234369AbjDTIOw (ORCPT ); Thu, 20 Apr 2023 04:14:52 -0400 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFEA935BB for ; Thu, 20 Apr 2023 01:13:55 -0700 (PDT) Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-63b78b344d5so644636b3a.1 for ; Thu, 20 Apr 2023 01:13:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1681978435; x=1684570435; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=X9ATYIUW0VL5jv34KSuydy4tkMajLvSkNKzBXFZEi9c=; b=OGZhHQPc5teD2uiUoyEfyzXHywP8ztNA9qiK5ulhiP9T92wt4chvkk0ixf07oPyYmW Zh0VYFR6CMFYkGmVyTCh3IGDEkGoItnpHewcBsZKTqj+vwqPw+cvgiayMGsKaxSYT95E jz4zpwrFXp3aENZV//XLVwT77yVMxWWRE66w5zUnKoBafAbNvUmFc+hn17T4+a7VDp47 i4D81ZIFmyxqFe1AUwnP8cl3sg044RN3tE3TjkVmmQJkr1Gegr60e6l9nB9EoCeYVSTP i6EtFNu+10Uy3YQudBttVWRE2aw0DhuWrqwPDvbH0/UH/uvo0aaVhF006oirARA3ZyWf tYww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681978435; x=1684570435; 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=X9ATYIUW0VL5jv34KSuydy4tkMajLvSkNKzBXFZEi9c=; b=fZV9dZiq4447aP7RnfHVwKmMhU1/PBPNkHEKwWZqNhGfgZu5lYNHnx+/C40w1ppinL 6CoUB9VISURXZCrmP4tylCFoZJVdQbE1uzZdjyE4hddzvWI1tgxSqWBv2rQIIL97+DYH p8OzkhPzfCL4irUzcrhtd5uoxxX8ygMPsOAbiL7xEvJVpeuYY6bdHBkSWzOUxzHVvAA1 ABwJEZIWhiVsq2DIea8k9ZQ3nJMWbS+Lel6abuJEeRJfq1D/6OQPQp+h3QMglxXKnrR6 WHr8iT/sCrkE+7Zom2mbTxGwOILW8SvDpgm8BUIs2tD/UrkcWrGYqw8T8mxzA3JUzXMQ aF7w== X-Gm-Message-State: AAQBX9ebblZQ1XqwAV+DquE9AUX/qfzh08PVDbVkkqxp+EdyZpDceXMr 6HL/i7w5dyP4FOenSFa62se7zwm3EqNDPfcyTJV3 X-Received: by 2002:a05:6a20:2590:b0:ef:279d:433d with SMTP id k16-20020a056a20259000b000ef279d433dmr999724pzd.61.1681978435184; Thu, 20 Apr 2023 01:13:55 -0700 (PDT) MIME-Version: 1.0 References: <20230419134329.346825-1-maxime.coquelin@redhat.com> In-Reply-To: <20230419134329.346825-1-maxime.coquelin@redhat.com> From: Yongji Xie Date: Thu, 20 Apr 2023 16:13:42 +0800 Message-ID: Subject: Re: [RFC 0/2] vduse: add support for networking devices To: Maxime Coquelin Cc: Jason Wang , "Michael S. Tsirkin" , David Marchand , linux-kernel , virtualization , Netdev , xuanzhuo@linux.alibaba.com, Eugenio Perez Martin Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 19, 2023 at 9:44=E2=80=AFPM Maxime Coquelin wrote: > > This small series enables virtio-net device type in VDUSE. > With it, basic operation have been tested, both with > virtio-vdpa and vhost-vdpa using DPDK Vhost library series > adding VDUSE support [0] using split rings layout. > > Control queue support (and so multiqueue) has also been > tested, but require a Kernel series from Jason Wang > relaxing control queue polling [1] to function reliably. > > Other than that, we have identified a few gaps: > > 1. Reconnection: > a. VDUSE_VQ_GET_INFO ioctl() returns always 0 for avail > index, even after the virtqueue has already been > processed. Is that expected? I have tried instead to > get the driver's avail index directly from the avail > ring, but it does not seem reliable as I sometimes get > "id %u is not a head!\n" warnings. Also such solution > would not be possible with packed ring, as we need to > know the wrap counters values. > I'm not sure how to handle the reconnection in the vhost-user-net case. Can we use a tmpfs file to track inflight I/O like this [1] [1] https://qemu-project.gitlab.io/qemu/interop/vhost-user.html#inflight-i-= o-tracking > b. Missing IOCTLs: it would be handy to have new IOCTLs to > query Virtio device status, and retrieve the config > space set at VDUSE_CREATE_DEV time. > VDUSE_GET_STATUS ioctl might be needed. Or can we use a tmpfs file to save/restore that info. > 2. VDUSE application as non-root: > We need to run the VDUSE application as non-root. There > is some race between the time the UDEV rule is applied > and the time the device starts being used. Discussing > with Jason, he suggested we may have a VDUSE daemon run > as root that would create the VDUSE device, manages its > rights and then pass its file descriptor to the VDUSE > app. However, with current IOCTLs, it means the VDUSE > daemon would need to know several information that > belongs to the VDUSE app implementing the device such > as supported Virtio features, config space, etc... > If we go that route, maybe we should have a control > IOCTL to create the device which would just pass the > device type. Then another device IOCTL to perform the > initialization. Would that make sense? > I think we can reuse the VDUSE_CREATE_DEV ioctl (just use name, device_id and vendor_id) for control device here, and add a new ioctl VDUSE_DEV_SETUP to do device initialization. Thanks, Yongji