From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F581C433E0 for ; Tue, 23 Feb 2021 09:55:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 54D9F64E02 for ; Tue, 23 Feb 2021 09:55:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232107AbhBWJya (ORCPT ); Tue, 23 Feb 2021 04:54:30 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:31385 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232086AbhBWJvE (ORCPT ); Tue, 23 Feb 2021 04:51:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614073778; 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=vKyuU9LWKwPaA0W8b7Zn/93LIBS1BDs8g8bsSMSJ0MM=; b=jLdWk5IW63z59YOK3U/qmznledXRVYkhcL+1tefES6GROVuon9msr6z7hn1X9+lG5+uwtt Uyy1wqjBjuguDtN69esqE75MzCH0n2CyjFS6YC59ZIDkzm6irwcp+B0f8yVrEHanNU/oaI kZCUD0iJmUSkEv2xNAC0ThshWOi6kQM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-147-Ft6zYw1bOe-pQyUCOJ4coQ-1; Tue, 23 Feb 2021 04:48:18 -0500 X-MC-Unique: Ft6zYw1bOe-pQyUCOJ4coQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DF58E1085927; Tue, 23 Feb 2021 09:48:16 +0000 (UTC) Received: from [10.72.13.6] (ovpn-13-6.pek2.redhat.com [10.72.13.6]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9CC8E19C45; Tue, 23 Feb 2021 09:48:11 +0000 (UTC) Subject: Re: [PATCH] vdpa/mlx5: set_features should allow reset to zero To: "Michael S. Tsirkin" , Eli Cohen Cc: Si-Wei Liu , linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org References: <1613735698-3328-1-git-send-email-si-wei.liu@oracle.com> <20210221144437.GA82010@mtl-vdi-166.wap.labs.mlnx> <20210221165047-mutt-send-email-mst@kernel.org> <20210222060526.GA110862@mtl-vdi-166.wap.labs.mlnx> <20210223042559-mutt-send-email-mst@kernel.org> From: Jason Wang Message-ID: <65494f6b-9613-1c0e-4a36-e4af2965235e@redhat.com> Date: Tue, 23 Feb 2021 17:48:10 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210223042559-mutt-send-email-mst@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/2/23 下午5:26, Michael S. Tsirkin wrote: > On Mon, Feb 22, 2021 at 08:05:26AM +0200, Eli Cohen wrote: >> On Sun, Feb 21, 2021 at 04:52:05PM -0500, Michael S. Tsirkin wrote: >>> On Sun, Feb 21, 2021 at 04:44:37PM +0200, Eli Cohen wrote: >>>> On Fri, Feb 19, 2021 at 06:54:58AM -0500, Si-Wei Liu wrote: >>>>> Commit 452639a64ad8 ("vdpa: make sure set_features is invoked >>>>> for legacy") made an exception for legacy guests to reset >>>>> features to 0, when config space is accessed before features >>>>> are set. We should relieve the verify_min_features() check >>>>> and allow features reset to 0 for this case. >>>>> >>>>> It's worth noting that not just legacy guests could access >>>>> config space before features are set. For instance, when >>>>> feature VIRTIO_NET_F_MTU is advertised some modern driver >>>>> will try to access and validate the MTU present in the config >>>>> space before virtio features are set. Rejecting reset to 0 >>>>> prematurely causes correct MTU and link status unable to load >>>>> for the very first config space access, rendering issues like >>>>> guest showing inaccurate MTU value, or failure to reject >>>>> out-of-range MTU. >>>>> >>>>> Fixes: 1a86b377aa21 ("vdpa/mlx5: Add VDPA driver for supported mlx5 devices") >>>>> Signed-off-by: Si-Wei Liu >>>>> --- >>>>> drivers/vdpa/mlx5/net/mlx5_vnet.c | 15 +-------------- >>>>> 1 file changed, 1 insertion(+), 14 deletions(-) >>>>> >>>>> diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c >>>>> index 7c1f789..540dd67 100644 >>>>> --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c >>>>> +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c >>>>> @@ -1490,14 +1490,6 @@ static u64 mlx5_vdpa_get_features(struct vdpa_device *vdev) >>>>> return mvdev->mlx_features; >>>>> } >>>>> >>>>> -static int verify_min_features(struct mlx5_vdpa_dev *mvdev, u64 features) >>>>> -{ >>>>> - if (!(features & BIT_ULL(VIRTIO_F_ACCESS_PLATFORM))) >>>>> - return -EOPNOTSUPP; >>>>> - >>>>> - return 0; >>>>> -} >>>>> - >>>> But what if VIRTIO_F_ACCESS_PLATFORM is not offerred? This does not >>>> support such cases. >>> Did you mean "catch such cases" rather than "support"? >>> >> Actually I meant this driver/device does not support such cases. > Well the removed code merely failed without VIRTIO_F_ACCESS_PLATFORM > it didn't actually try to support anything ... I think it's used to catch the driver that doesn't support ACCESS_PLATFORM? Thanks >