Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp28082734rwd; Tue, 4 Jul 2023 12:36:00 -0700 (PDT) X-Google-Smtp-Source: APBJJlGCdH24tIAPeoB0Ewx6d0cUasTzOoKbGD+S2S2dmmZyWBa4VWFyVKXdP3uHVlKHAbkxRSgx X-Received: by 2002:a05:6a00:1951:b0:666:ba76:eef5 with SMTP id s17-20020a056a00195100b00666ba76eef5mr13107807pfk.8.1688499360012; Tue, 04 Jul 2023 12:36:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688499359; cv=none; d=google.com; s=arc-20160816; b=fV1l/y8TnmpJajggPOpGHZlXvtQylcSWyyWd8ciJOiK344zeh5o/Nd9xLAaIXT/j47 /9su58PTEsDNHikNp5UflhDjDd+xy9caClfFYk/bOOpp2UhuDQluPtg6j6nOaGegTeg+ skIEvPx8PzelRlqNIcPQwS4K/GLatgDgMgbJfzin7x3p3uCLEVALIfWo0LqjWOuto8DH Iy+YJ3BLwkJB7uCgwR7it3NaIgu8mGhyzsdxFutqlLE4tZvLQI78/F91jaGlP16KMbsz dh8JtLBKOxKTnbw3zW6XLTwr5HKMdSI46+QiTpBO7OqqNDt1D3uv064IvspYy4GTmwvV B4Gg== 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:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=mFBR9aLLd+UbaMyLdyzrVxs4N2kaUNBTqCwcKCV+cF4=; fh=4uNNgRKtZQGyzBAw7ISdCnZxKjEJcilkrkQNXNk+sc4=; b=xpccDSSyWEvq1AUa1C6mtwsFMrOYvhuYd31hFSOHtmJjOtUEz/nkaD6BUhrunM8gRm 56Nktt1qJKCsUfb+QoA/0ymqTqFxz8cKTZlU0O6Q/ihTGPNrL7H9ZPGP1XAtFsZWz6vI J1DqiSDEo6GZIJShICWkY4KNkKqOjDAqTuVpOwTGo7vj6j6ODh2b6IaF15WvE2rQ9sNO YeDVrhv+7E1fX4L22L3gmF90Kpr74YqY/7jQD8N5gj4oogTIOC7nUmPhH40Tek1GINtJ 6dXeseIqdjD7fqF+LeIkI71ClXJNoD00hT0CTHO4OZXzZ8ibA9ZQS3hXODyM4vo7akU7 E16Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VeHtMiFR; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p38-20020a634f66000000b00530b2754b77si20700171pgl.71.2023.07.04.12.35.44; Tue, 04 Jul 2023 12:35:59 -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=@redhat.com header.s=mimecast20190719 header.b=VeHtMiFR; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231404AbjGDTXb (ORCPT + 99 others); Tue, 4 Jul 2023 15:23:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230383AbjGDTXa (ORCPT ); Tue, 4 Jul 2023 15:23:30 -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 6063910E0 for ; Tue, 4 Jul 2023 12:22:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1688498559; 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=mFBR9aLLd+UbaMyLdyzrVxs4N2kaUNBTqCwcKCV+cF4=; b=VeHtMiFRKcTN/DX8ybjtpYwEBqu4LSR2/xDJNwV7f2R0hL+cl7quDp6XEUlTwq6RPtOow4 GUIWh1G/dzyBmFnPLudPaYSXY8pxlXCH+EA6KT3otAepZvZ0IdmswYLsiqnOeJmhnr5ALm ujSKGZ8NDCYtzktqg+VjC16WeDd0cO8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-137-bNqzE_xcOrKocHm-YoH1Eg-1; Tue, 04 Jul 2023 15:22:38 -0400 X-MC-Unique: bNqzE_xcOrKocHm-YoH1Eg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C620D800159; Tue, 4 Jul 2023 19:22:37 +0000 (UTC) Received: from [10.39.208.32] (unknown [10.39.208.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BD7DDF641E; Tue, 4 Jul 2023 19:22:35 +0000 (UTC) Message-ID: <1f4ac369-75f8-f65d-6f31-9c4a5a2a357f@redhat.com> Date: Tue, 4 Jul 2023 21:22:34 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH v2 3/3] vduse: Temporarily disable control queue features Content-Language: en-US To: "Michael S. Tsirkin" Cc: xieyongji@bytedance.com, jasowang@redhat.com, david.marchand@redhat.com, lulu@redhat.com, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, xuanzhuo@linux.alibaba.com, eperezma@redhat.com References: <20230704164045.39119-1-maxime.coquelin@redhat.com> <20230704164045.39119-4-maxime.coquelin@redhat.com> <20230704124245-mutt-send-email-mst@kernel.org> From: Maxime Coquelin In-Reply-To: <20230704124245-mutt-send-email-mst@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 7/4/23 18:43, Michael S. Tsirkin wrote: > On Tue, Jul 04, 2023 at 06:40:45PM +0200, 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 >> --- >> drivers/vdpa/vdpa_user/vduse_dev.c | 21 +++++++++++++++++++++ >> 1 file changed, 21 insertions(+) >> >> diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c >> index 1271c9796517..04367a53802b 100644 >> --- a/drivers/vdpa/vdpa_user/vduse_dev.c >> +++ b/drivers/vdpa/vdpa_user/vduse_dev.c >> @@ -1778,6 +1778,25 @@ static struct attribute *vduse_dev_attrs[] = { >> >> ATTRIBUTE_GROUPS(vduse_dev); >> >> +static void vduse_dev_features_fixup(struct vduse_dev_config *config) >> +{ >> + if (config->device_id == VIRTIO_ID_NET) { >> + /* >> + * Temporarily disable control virtqueue and features that >> + * depend on it while CVQ is being made more robust for VDUSE. >> + */ >> + config->features &= ~((1ULL << VIRTIO_NET_F_CTRL_VQ) | >> + (1ULL << VIRTIO_NET_F_CTRL_RX) | >> + (1ULL << VIRTIO_NET_F_CTRL_VLAN) | >> + (1ULL << VIRTIO_NET_F_GUEST_ANNOUNCE) | >> + (1ULL << VIRTIO_NET_F_MQ) | >> + (1ULL << VIRTIO_NET_F_CTRL_MAC_ADDR) | >> + (1ULL << VIRTIO_NET_F_RSS) | >> + (1ULL << VIRTIO_NET_F_HASH_REPORT) | >> + (1ULL << VIRTIO_NET_F_NOTF_COAL)); >> + } >> +} >> + > > > This will never be exhaustive, we are adding new features. > Please add an allowlist with just legal ones instead. Ok, got it! I'll post a new revision. Thanks, Maxime > > >> static int vduse_create_dev(struct vduse_dev_config *config, >> void *config_buf, u64 api_version) >> { >> @@ -1793,6 +1812,8 @@ static int vduse_create_dev(struct vduse_dev_config *config, >> if (!dev) >> goto err; >> >> + vduse_dev_features_fixup(config); >> + >> dev->api_version = api_version; >> dev->device_features = config->features; >> dev->device_id = config->device_id; >> -- >> 2.41.0 >