Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1062114rda; Mon, 23 Oct 2023 00:44:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG73cYjxDNk6wkxUY2PsbDLBRb4QLUUFa1NUq1OWXp7A7tUKu0t9ezPpDqaVG+jCIYmJ1to X-Received: by 2002:a05:6a21:7803:b0:15e:ab6:6e24 with SMTP id be3-20020a056a21780300b0015e0ab66e24mr9301111pzc.27.1698047067475; Mon, 23 Oct 2023 00:44:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698047067; cv=none; d=google.com; s=arc-20160816; b=b2RfXXMSuytNiH/57y/EXmGAmcxPzfqqgWNKvRoLQMrGmqZ5edmHpN49BM/CR67xaY x3V6bOKGhfyRMLwGxAUsSI7tQ1aGGExxuANmJjhQ2HpbC+XUBY5w99ThVbPGhMDR8p13 ncGzsAHDHVpFfh2+kh35dqgY5cz2XNEPg2850uQT8oMSyENQygc/P9P0TDeP8xrI9EGO 1gAFuFCcrPnyfUEiIeGEPZLmj2YhmbvDG3kS/Dlp1SWzaGrtsARmMgT/rCjWP4DoSgfP uuH27zRQKuvR9p0JY1+9SHicCA9K9YXjrj6b9iJCJbj/YT+0Hjo+BQ763UOgc5jhFMPO 2P1A== 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=n4pnr/01geKklbuZTPmDUDub+KmFboZIfKOWl4pyxfw=; fh=v77krXJ888lWbwXy4I5d3BByE4L/Rqk76j7jyrz5/IE=; b=RHbMgvNBZYywNVHMslA27YoeOcwUGNYh+XRKldn64jnhmq1fMHtdp7of/PyqvBQJqI n01Hqw+DLFisBmqktnh49jcJ4baIjtekQQ3Z9bpak9F9eCjXTtLAXaYTKJXZhBQkwooY Wglr3ZN2nABjxiOPIuY/ZgTjBJ5WfZB+rArdEHGXbPkqR3paWo+8dDjL3D33Gx90kmTb dwrXOdqMm1m71K2KySApmJQxBkgJELiJT8ILh1KSvvsX6EXZlmikL4B9rOmnUQivHutp 1nHKAn9kmpihJvmiBOd9mKkxdv+E4o5QETOVChWgjLxp+3/tRNkY6RR6KygxnKrsLx8S Nnag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="KMP/aSK8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id j187-20020a638bc4000000b00578e5228c76si6049199pge.505.2023.10.23.00.44.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 00:44:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="KMP/aSK8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (Postfix) with ESMTP id 93811808EF42; Mon, 23 Oct 2023 00:44:24 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229820AbjJWHoF (ORCPT + 99 others); Mon, 23 Oct 2023 03:44:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233427AbjJWHoC (ORCPT ); Mon, 23 Oct 2023 03:44:02 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B3E6D60 for ; Mon, 23 Oct 2023 00:43:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698047002; 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=n4pnr/01geKklbuZTPmDUDub+KmFboZIfKOWl4pyxfw=; b=KMP/aSK8CPkkQiXYhNDy+67XWFkwtbiyHCT6mSHfP9xmOGnI6rBQPDpFVYi0+RtjONdxmx 0pzWiblo+rZwWS3PkSD6GeTaBt1P9Uz3L+qqtfAVd6hwnEV21QBfA5eGhFiLBqbXHCUDma iPZMOtmWdp+8gzZsKewLmDo/J5HTUbM= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-596-13mRTdf7PIKXi3XcFY6UZQ-1; Mon, 23 Oct 2023 03:43:16 -0400 X-MC-Unique: 13mRTdf7PIKXi3XcFY6UZQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7A07A3C1043C; Mon, 23 Oct 2023 07:43:15 +0000 (UTC) Received: from [10.39.208.17] (unknown [10.39.208.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1A6651C060AE; Mon, 23 Oct 2023 07:43:11 +0000 (UTC) Message-ID: <86532026-d1bc-491e-8fae-765ce493b7c2@redhat.com> Date: Mon, 23 Oct 2023 09:43:10 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 3/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 References: <20231020155819.24000-1-maxime.coquelin@redhat.com> <20231020155819.24000-4-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 qLNTgwSo2dpTU3+mJ3y3KlsIfoaxYI7XNsPRXGnZ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LOJz4tAFDtNFtA 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.7 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 fry.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 (fry.vger.email [0.0.0.0]); Mon, 23 Oct 2023 00:44:25 -0700 (PDT) On 10/23/23 05:08, Jason Wang wrote: > On Fri, Oct 20, 2023 at 11:58 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 do this with patch 2 or before patch 2 to > unbreak the bisection? I think it would be better to keep it in a dedicated patch to ease the revert later when your work will have been accepted, so before patch 2. 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 73ad3b7efd8e..0243dee9cf0e 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; >> @@ -1778,6 +1803,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) >> { >> @@ -1793,6 +1828,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.41.0 >> >