Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp4381rdb; Fri, 5 Jan 2024 00:12:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IGYOUrtgYFgUK4bDy0Ka5oNOxhiKjVDEmT9Yg32lAJn8Mo83akywRSsiACfR1oiWFF1CPne X-Received: by 2002:a17:902:c10c:b0:1d4:4fa3:2120 with SMTP id 12-20020a170902c10c00b001d44fa32120mr1876506pli.114.1704442370865; Fri, 05 Jan 2024 00:12:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704442370; cv=none; d=google.com; s=arc-20160816; b=BJhrCfCSVDd7gEuZPwAjSu/ICoFPRigS+MmP95UYxzyUU6OtqqEL5K0aAFUQlbfU2/ QAGd5VINqIZD9MjrEU1BRLgRdk5gpVHp0hY+rx5k/IgPIcZlT3h1b06wt7Wi22rJw0ix yR6BdL+h2QOaqkWsEqgN2HTnE34RRsKe+rHDJ+xUh5lIpRTMrefORrSm9zSv4Gjf8+wV 7aTc05xS9RHkXz0mdZonh/lhOLwT1RVWX/hqdvNhpuaI6+cnUsSXQLepf9MLPeJhIAr+ +LOdH0eSkaDW6XCzY/wsU+MgEJd7QEvT4RzVDK4ESOt2+vFp+bqtuCPu9AAiumPkCI1N dF6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=7YkEKbbO8nP6b5SviC5PFVb5K+BMjmcz+gCKF0Kupek=; fh=vle1xQcMQieOjLNKOZRHQ7ZAwaN/IUoqO4IPOc07N4w=; b=NG+AEcCqVuxCO1UP4eB2MrM1RfW2QKPyV4uEYba/uUDdg3TZu5urafztNXQXmhAx5p 7ijUIhPXnnILJbGOkpt9/XimKnnbivujYNEe/pneIM+Lkol0cV0hTBxuPpLryhDxBqFo SXMYY+q0FFFtp/eXot9ohnb3mzQX1y4ZFbwp5Qc2Q4b4PPpPwAzECjwpUusz2F9ZHvq3 +hDgNbhZDW2O2IrNoeIRo2NL/qul6M06smHL7R5wHe9DV6UR8FdUO2JfVJxyMBiEQQhY 3xzDNOOOxn3gYghQg/QPPMTcasq1cu3pvofqHKzmzvAcR5JOm7sYU396Kf4R0dwti4Yn qbgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=H5s9vNQ5; spf=pass (google.com: domain of linux-kernel+bounces-17572-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17572-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id b1-20020a170902d50100b001d4575c45d8si844404plg.266.2024.01.05.00.12.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 00:12:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-17572-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=H5s9vNQ5; spf=pass (google.com: domain of linux-kernel+bounces-17572-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17572-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 4CF58B23C7F for ; Fri, 5 Jan 2024 08:12:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4773421A1E; Fri, 5 Jan 2024 08:11:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="H5s9vNQ5" X-Original-To: linux-kernel@vger.kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 644BA21A10 for ; Fri, 5 Jan 2024 08:11:03 +0000 (UTC) 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=1704442262; 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:autocrypt:autocrypt; bh=7YkEKbbO8nP6b5SviC5PFVb5K+BMjmcz+gCKF0Kupek=; b=H5s9vNQ5Syabm4e0xczwcmRIBtAi/G4bu7C8BNE/5oPYAVolvbb5WsNl351U1i+eNtN8gk 3B3lUmSDzg37R4f2+yio5EZVIgQsfyg6GHxVXoYqTPGYNCm9CJt3IPGFKRHqB3doyxEc7i F3kF/qdCXhdT7+1YZz8f6/5GB3WpnTo= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-480-6yu2_erbP2GDJa0AT-4rVA-1; Fri, 05 Jan 2024 03:10:59 -0500 X-MC-Unique: 6yu2_erbP2GDJa0AT-4rVA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 835023C1E9D0; Fri, 5 Jan 2024 08:10:58 +0000 (UTC) Received: from [10.39.208.29] (unknown [10.39.208.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C885851D5; Fri, 5 Jan 2024 08:10:56 +0000 (UTC) Message-ID: <888255d7-e45b-44db-8561-5e9f386603c3@redhat.com> Date: Fri, 5 Jan 2024 09:10:55 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 2/3] vduse: Temporarily fail if control queue features requested Content-Language: en-US To: Jason Wang Cc: mst@redhat.com, xuanzhuo@linux.alibaba.com, xieyongji@bytedance.com, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, david.marchand@redhat.com, lulu@redhat.com References: <20240104153753.2931026-1-maxime.coquelin@redhat.com> <20240104153753.2931026-3-maxime.coquelin@redhat.com> From: Maxime Coquelin Autocrypt: addr=maxime.coquelin@redhat.com; keydata= xsFNBFOEQQIBEADjNLYZZqghYuWv1nlLisptPJp+TSxE/KuP7x47e1Gr5/oMDJ1OKNG8rlNg kLgBQUki3voWhUbMb69ybqdMUHOl21DGCj0BTU3lXwapYXOAnsh8q6RRM+deUpasyT+Jvf3a gU35dgZcomRh5HPmKMU4KfeA38cVUebsFec1HuJAWzOb/UdtQkYyZR4rbzw8SbsOemtMtwOx YdXodneQD7KuRU9IhJKiEfipwqk2pufm2VSGl570l5ANyWMA/XADNhcEXhpkZ1Iwj3TWO7XR uH4xfvPl8nBsLo/EbEI7fbuUULcAnHfowQslPUm6/yaGv6cT5160SPXT1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8ueB iYOcZcIGTcs9CssVwQjYaXRoeT65LJnTxYZif2pfNxfINFzCGw42s3EtZFteczClKcVSJ1+L +QUY/J24x0/ocQX/M1PwtZbB4c/2Pg/t5FS+s6UB1Ce08xsJDcwyOPIH6O3tccZuriHgvqKP yKz/Ble76+NFlTK1mpUlfM7PVhD5XzrDUEHWRTeTJSvJ8TIPL4uyfzhjHhlkCU0mw7Pscyxn DE8G0UYMEaNgaZap8dcGMYH/96EfE5s/nTX0M6MXV0yots7U2BDb4soLCxLOJz4tAFDtNFtA wLBhXRSvWhdBJZiig/9CG3dXmKfi2H+wdUCSvEFHRpgo7GK8/Kh3vGhgKmnnxhl8ACBaGy9n fxjSxjSO6rj4/MeenmlJw1yebzkX8ZmaSi8BHe+n6jTGEFNrbiOdWpJgc5yHIZZnwXaW54QT UhhSjDL1rV2B4F28w30jYmlRmm2RdN7iCZfbyP3dvFQTzQ4ySquuPkIGcOOHrvZzxbRjzMx1 Mwqu3GQ= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 On 1/5/24 03:45, Jason Wang wrote: > On Thu, Jan 4, 2024 at 11:38 PM Maxime Coquelin > wrote: >> >> Virtio-net driver control queue implementation is not safe >> when used with VDUSE. If the VDUSE application does not >> reply to control queue messages, it currently ends up >> hanging the kernel thread sending this command. >> >> Some work is on-going to make the control queue >> implementation robust with VDUSE. Until it is completed, >> let's fail features check if any control-queue related >> feature is requested. >> >> Signed-off-by: Maxime Coquelin >> --- >> drivers/vdpa/vdpa_user/vduse_dev.c | 13 +++++++++++++ >> 1 file changed, 13 insertions(+) >> >> diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c >> index 0486ff672408..94f54ea2eb06 100644 >> --- a/drivers/vdpa/vdpa_user/vduse_dev.c >> +++ b/drivers/vdpa/vdpa_user/vduse_dev.c >> @@ -28,6 +28,7 @@ >> #include >> #include >> #include >> +#include >> #include >> >> #include "iova_domain.h" >> @@ -46,6 +47,15 @@ >> >> #define IRQ_UNBOUND -1 >> >> +#define VDUSE_NET_INVALID_FEATURES_MASK \ >> + (BIT_ULL(VIRTIO_NET_F_CTRL_VQ) | \ >> + BIT_ULL(VIRTIO_NET_F_CTRL_RX) | \ >> + BIT_ULL(VIRTIO_NET_F_CTRL_VLAN) | \ >> + BIT_ULL(VIRTIO_NET_F_GUEST_ANNOUNCE) | \ >> + BIT_ULL(VIRTIO_NET_F_MQ) | \ >> + BIT_ULL(VIRTIO_NET_F_CTRL_MAC_ADDR) | \ >> + BIT_ULL(VIRTIO_NET_F_RSS)) > > We need to make this as well: > > VIRTIO_NET_F_CTRL_GUEST_OFFLOADS I missed it, and see others have been added in the Virtio spec repository (BTW, I see this specific one is missing in the dependency list [0], I will submit a patch). I wonder if it is not just simpler to just check for VIRTIO_NET_F_CTRL_VQ is requested. As we fail instead of masking out, the VDUSE driver won't be the one violating the spec so it should be good? It will avoid having to update the mask if new features depending on it are added (or forgetting to update it). WDYT? Thanks, Maxime [0]: https://github.com/oasis-tcs/virtio-spec/blob/5fc35a7efb903fc352da81a6d2be5c01810b68d3/device-types/net/description.tex#L129 > Other than this, > > Acked-by: Jason Wang > > Thanks > >> + >> struct vduse_virtqueue { >> u16 index; >> u16 num_max; >> @@ -1680,6 +1690,9 @@ static bool features_is_valid(struct vduse_dev_config *config) >> if ((config->device_id == VIRTIO_ID_BLOCK) && >> (config->features & (1ULL << VIRTIO_BLK_F_CONFIG_WCE))) >> return false; >> + else if ((config->device_id == VIRTIO_ID_NET) && >> + (config->features & VDUSE_NET_INVALID_FEATURES_MASK)) >> + return false; >> >> return true; >> } >> -- >> 2.43.0 >> >