Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3744619pxb; Sun, 7 Feb 2021 21:39:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJwvkYJ1JvCKV2O20ACdCx77BxZ2zmW3gwHeHtVAgmG03eW1GL42ood2K1BSBRlx1m+onzpw X-Received: by 2002:a17:906:cc47:: with SMTP id mm7mr15251508ejb.241.1612762748269; Sun, 07 Feb 2021 21:39:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612762748; cv=none; d=google.com; s=arc-20160816; b=L0L7qP73MQ22Hk5u8S0y1SmIJreJlNuPTkCe2uXUyUnEfDq3AdgTok8nAh9AiJztUy BkEXyhK1gX6sjO5Tjc4S9n/YJmDUyqsosWvJEDwTxbHdnU2mN1+5V79FGMiieS1cvBFu md2TO6F/VCjenvAko/ozAzfmoBp0g4M/h2jgSKcQnXEP0MJGG3dyWitGQ4ozmi3RxD1T SmOqoH15tu/2If8a+mZxXuxubOXiYxv23ru+AP0pGQvuSsak4Z6mCkNWJi9MPftGr0xH P3UEt+k0k1TDLSdFbAYQ/CTeyXKXoFoSY8Kvty6QNX2j4Rd8SMCAM2VMw0/U283d4Ek5 evWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:dkim-signature:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=/bt91ojGTfU/NFiqHuMYnIol4RfQVN8e4gHDbfiF45I=; b=ijFIpoc1Tzzl9jYEG6uxOeZ3xM5WoxSqzeEpUig4y69izwfrf8IKj2vCvUfTUl9pYi t/FWBClAJ5Iwao/9CV3AkZlSpVwsz6P7qY8yRjwwC0gDLrYqtFdE2KFdon7hK6ZlwbMl iWQtkRaQ44i5fTC6akHad44HTLrTMY6U1mkeonQdNERmnYKL8YhRPHGI0ZPuS7ALLabo 9bxT3FkSAP0Q/01/2SxD58T7FHOeQAvRJ48Upc3C+TrbAxr7eWR6xjb+Ioq46hdaZTmc 4Jzp/0unrLv3541ZwNPtDBRqUkstctrJ4fUi9g2M4x8vr82u4qqluUrMiVqIyTP/Pkud 3RkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=j9ttjT1p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q17si9314370edg.401.2021.02.07.21.38.45; Sun, 07 Feb 2021 21:39:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=j9ttjT1p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229692AbhBHFft (ORCPT + 99 others); Mon, 8 Feb 2021 00:35:49 -0500 Received: from hqnvemgate26.nvidia.com ([216.228.121.65]:8714 "EHLO hqnvemgate26.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229609AbhBHFfr (ORCPT ); Mon, 8 Feb 2021 00:35:47 -0500 Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Sun, 07 Feb 2021 21:35:07 -0800 Received: from mtl-vdi-166.wap.labs.mlnx (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 8 Feb 2021 05:35:04 +0000 Date: Mon, 8 Feb 2021 07:35:00 +0200 From: Eli Cohen To: Si-Wei Liu CC: , , , , Subject: Re: [PATCH 2/3] mlx5_vdpa: fix feature negotiation across device reset Message-ID: <20210208053500.GA137517@mtl-vdi-166.wap.labs.mlnx> References: <1612614564-4220-1-git-send-email-si-wei.liu@oracle.com> <1612614564-4220-2-git-send-email-si-wei.liu@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1612614564-4220-2-git-send-email-si-wei.liu@oracle.com> User-Agent: Mutt/1.9.5 (bf161cf53efb) (2018-04-13) X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1612762507; bh=/bt91ojGTfU/NFiqHuMYnIol4RfQVN8e4gHDbfiF45I=; h=Date:From:To:CC:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To:User-Agent: X-Originating-IP:X-ClientProxiedBy; b=j9ttjT1pDapYqiN+WH++D9JM/pB7ZXbSTizJE8f6pxtYrqtBLmMz7Bqy7JXPAzBcM oKY1Czqb3BphVpwHT2uVUsbf6w+qtFdKg7Cds4dLnkx42poAJxf6UL4SYfkwlTQE2x 05iGGvmeZwqs7T/x8WpfFNCI3TV9uzkX9wBRB2KNmD7fex4EN0mg5EZO8d7rsA8Xh9 4lxhsa2vhWP/hTCq3LsVOzkdH3gW7Pj6aE5oLemTKzWrJ4Cw/aoalHxHlpYAI21uwu 1YsUHCMfb62ZLcYu/2Um76C8lccBZuDq/g41Aj89Rvh+/YSLMDcWq287ooApo0zved oLrikGbfqhbeQ== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Feb 06, 2021 at 04:29:23AM -0800, Si-Wei Liu wrote: > The mlx_features denotes the capability for which > set of virtio features is supported by device. In > principle, this field needs not be cleared during > virtio device reset, as this capability is static > and does not change across reset. > > In fact, the current code may have the assumption > that mlx_features can be reloaded from firmware > via the .get_features ops after device is reset > (via the .set_status ops), which is unfortunately > not true. The userspace VMM might save a copy > of backend capable features and won't call into > kernel again to get it on reset. This causes all > virtio features getting disabled on newly created > virtqs after device reset, while guest would hold > mismatched view of available features. For e.g., > the guest may still assume tx checksum offload > is available after reset and feature negotiation, > causing frames with bogus (incomplete) checksum > transmitted on the wire. > > Signed-off-by: Si-Wei Liu > --- > drivers/vdpa/mlx5/net/mlx5_vnet.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c > index b8416c4..aa6f8cd 100644 > --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c > +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c > @@ -1788,7 +1788,6 @@ static void mlx5_vdpa_set_status(struct vdpa_device *vdev, u8 status) > clear_virtqueues(ndev); > mlx5_vdpa_destroy_mr(&ndev->mvdev); > ndev->mvdev.status = 0; > - ndev->mvdev.mlx_features = 0; > ++mvdev->generation; > return; > } Since we assume that device capabilities don't change, I think I would get the features through a call done in mlx5v_probe after the netdev object is created and change mlx5_vdpa_get_features() to just return ndev->mvdev.mlx_features. Did you actually see this issue in action? If you did, can you share with us how you trigerred this? > -- > 1.8.3.1 >