Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5246093rdb; Wed, 13 Dec 2023 03:25:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IH3UO3YqT35bgc9/HUUaAEYugG8ny9ta1EIcf40FiDB3qYzqDWhLW5L+Qj3BMcbWG1E7FM8 X-Received: by 2002:a17:903:32ca:b0:1d3:410b:5356 with SMTP id i10-20020a17090332ca00b001d3410b5356mr2891112plr.25.1702466722557; Wed, 13 Dec 2023 03:25:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702466722; cv=none; d=google.com; s=arc-20160816; b=gDjO0XJk/OfiQ3mOQKCSq4dPaMt3rurGG4nsWMrEWDmGBLMuqJ3F35VC0jYXtHw6/M jndmwkdai+XNXvfUhgJLsMUxEOCKPTJF4+T3TvfI4uGrzz7By9DwW9tZHmFhjU/Q4byQ hjrQdMgGC66CQU8QrdhD8gZwbaaMfAhu3aHky1ZpDvqCsYnHybTyzx6+NTBUjDtZ4LMG zJl7ID0kFDIbqA6FFCBtub2lzkMzaSj34KKyoLGUVkBCSarkG5WP5lDkVpTh9fM7mic2 WfWcgH72fGdct3XeiT3K1sKDQISgcoAae877AX5/rmdw+HkNCcXtWSyQRdezv3N9PgWE Z11w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:autocrypt :from:references:cc:to:content-language:subject:user-agent :mime-version:date:message-id:dkim-signature; bh=7Y+yhg2kzKRracDkULVJwjSDml4IjcPt6n8GLCXMB3I=; fh=wb9xQ/MCsRA4FIiJgcoVHTVfnHOHyyUtiidhE98lxXU=; b=LvLBSYZ1vaGuG4EJPiqHn457axidXw9sD5SiZoRgAWbFSYk4xatkYp9x2HKpTefHSN ul23kZ19DGLt5W1rDM4U76DqYQKJppCpiU7aJq/1aHAhl/hiYcXg+bBFThImgVO8U5ej 8HLTkjOWoqe1Bc1aKuRAjkGDKxpDusT/4Iwea8vTBun8kG0nM4GFiQsMvvnVFt9zm//r yDcJnT4rescJ67/DwwZRDD56OtL+gk/s8cS/wV3hznqGNcSO/F4e0Wrl6zGwEythZN3H 1xSCsPSscmcAHMzW0RexDJrrI6MgYCuBZxfGB7yDVAHQ1WFpD/gKkqeJpKo6TVD6LvlT tvkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RBgeEDhn; 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 y13-20020a17090322cd00b001d32f70461fsi3551622plg.579.2023.12.13.03.25.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 03:25:22 -0800 (PST) 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=RBgeEDhn; 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 F3342803C97A; Wed, 13 Dec 2023 03:24:11 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377664AbjLMLX4 (ORCPT + 99 others); Wed, 13 Dec 2023 06:23:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235211AbjLMLXt (ORCPT ); Wed, 13 Dec 2023 06:23:49 -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 F1BD31B2 for ; Wed, 13 Dec 2023 03:23:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702466624; 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=7Y+yhg2kzKRracDkULVJwjSDml4IjcPt6n8GLCXMB3I=; b=RBgeEDhnPC06C1OvwEhHoDNBZmAw+IhwbemxyS1X2wS+krq7JGlSqkCN8fkuXwf1AE1Wq/ SsaMRwLdjWiD35tAbo77Obk3qi5lCC4P4QhImHfWeAPnknURP5tDWkrSEpjSywHyDqATGV LoZI6COY7sypFTSRvVh71yrHw8QFpXA= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-411-k2g5QuaDMYKUw_v-lTjg7Q-1; Wed, 13 Dec 2023 06:23:41 -0500 X-MC-Unique: k2g5QuaDMYKUw_v-lTjg7Q-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (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 657DE837187; Wed, 13 Dec 2023 11:23:40 +0000 (UTC) Received: from [10.39.208.4] (unknown [10.39.208.4]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3D316492BC6; Wed, 13 Dec 2023 11:23:37 +0000 (UTC) Message-ID: <8afc44f7-cef5-4b4a-afac-85a4eb967d3e@redhat.com> Date: Wed, 13 Dec 2023 12:23:35 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 2/4] vduse: Temporarily disable control queue features Content-Language: en-US To: Jason Wang Cc: mst@redhat.com, xuanzhuo@linux.alibaba.com, paul@paul-moore.com, jmorris@namei.org, serge@hallyn.com, stephen.smalley.work@gmail.com, eparis@parisplace.org, xieyongji@bytedance.com, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, selinux@vger.kernel.org, david.marchand@redhat.com, lulu@redhat.com, casey@schaufler-ca.com References: <20231212131712.1816324-1-maxime.coquelin@redhat.com> <20231212131712.1816324-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/yaGv6cT5160SPXT1t8U9QDO6aTSo59N jH519JS8oeKZB1n1eLDslCfBpIpWkW8ZElGkOGWAN0vmpLfdyiqBNNyS3eGAfMkJ6b1A24un /TKc6j2QxM0QK4yZGfAxDxtvDv9LFXec8ENJYsbiR6WHRHq7wXl/n8guyh5AuBNQ3LIK44x0 KjGXP1FJkUhUuruGyZsMrDLBRHYi+hhDAgRjqHgoXi5XGETA1PAiNBNnQwMf5aubt+mE2Q5r qL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ap8dcGMYH/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.9 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 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]); Wed, 13 Dec 2023 03:24:12 -0800 (PST) Hi Jason, On 12/13/23 05:52, Jason Wang wrote: > On Tue, Dec 12, 2023 at 9:17 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 disable control virtqueue and features that depend on >> it. >> >> Signed-off-by: Maxime Coquelin > > I wonder if it's better to fail instead of a mask as a start. I think it is better to use a mask and not fail, so that we can in the future use a recent VDUSE application with an older kernel. Why would it be better to fail than negotiating? Thanks, Maxime > Thanks > >> --- >> drivers/vdpa/vdpa_user/vduse_dev.c | 37 ++++++++++++++++++++++++++++++ >> 1 file changed, 37 insertions(+) >> >> diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c >> index 0486ff672408..fe4b5c8203fd 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,30 @@ >> >> #define IRQ_UNBOUND -1 >> >> +#define VDUSE_NET_VALID_FEATURES_MASK \ >> + (BIT_ULL(VIRTIO_NET_F_CSUM) | \ >> + BIT_ULL(VIRTIO_NET_F_GUEST_CSUM) | \ >> + BIT_ULL(VIRTIO_NET_F_MTU) | \ >> + BIT_ULL(VIRTIO_NET_F_MAC) | \ >> + BIT_ULL(VIRTIO_NET_F_GUEST_TSO4) | \ >> + BIT_ULL(VIRTIO_NET_F_GUEST_TSO6) | \ >> + BIT_ULL(VIRTIO_NET_F_GUEST_ECN) | \ >> + BIT_ULL(VIRTIO_NET_F_GUEST_UFO) | \ >> + BIT_ULL(VIRTIO_NET_F_HOST_TSO4) | \ >> + BIT_ULL(VIRTIO_NET_F_HOST_TSO6) | \ >> + BIT_ULL(VIRTIO_NET_F_HOST_ECN) | \ >> + BIT_ULL(VIRTIO_NET_F_HOST_UFO) | \ >> + BIT_ULL(VIRTIO_NET_F_MRG_RXBUF) | \ >> + BIT_ULL(VIRTIO_NET_F_STATUS) | \ >> + BIT_ULL(VIRTIO_NET_F_HOST_USO) | \ >> + BIT_ULL(VIRTIO_F_ANY_LAYOUT) | \ >> + BIT_ULL(VIRTIO_RING_F_INDIRECT_DESC) | \ >> + BIT_ULL(VIRTIO_RING_F_EVENT_IDX) | \ >> + BIT_ULL(VIRTIO_F_VERSION_1) | \ >> + BIT_ULL(VIRTIO_F_ACCESS_PLATFORM) | \ >> + BIT_ULL(VIRTIO_F_RING_PACKED) | \ >> + BIT_ULL(VIRTIO_F_IN_ORDER)) >> + >> struct vduse_virtqueue { >> u16 index; >> u16 num_max; >> @@ -1782,6 +1807,16 @@ static struct attribute *vduse_dev_attrs[] = { >> >> ATTRIBUTE_GROUPS(vduse_dev); >> >> +static void vduse_dev_features_filter(struct vduse_dev_config *config) >> +{ >> + /* >> + * Temporarily filter out virtio-net's control virtqueue and features >> + * that depend on it while CVQ is being made more robust for VDUSE. >> + */ >> + if (config->device_id == VIRTIO_ID_NET) >> + config->features &= VDUSE_NET_VALID_FEATURES_MASK; >> +} >> + >> static int vduse_create_dev(struct vduse_dev_config *config, >> void *config_buf, u64 api_version) >> { >> @@ -1797,6 +1832,8 @@ static int vduse_create_dev(struct vduse_dev_config *config, >> if (!dev) >> goto err; >> >> + vduse_dev_features_filter(config); >> + >> dev->api_version = api_version; >> dev->device_features = config->features; >> dev->device_id = config->device_id; >> -- >> 2.43.0 >> >