Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1269683pxb; Wed, 10 Feb 2021 04:35:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJxjv8GWLZ3Bk2/TWPJZ+eP9LgefvQxkdjhpIg3OCQTydoPXOq0pRcpFADm0ZTBAyIUSwCqE X-Received: by 2002:a17:906:660b:: with SMTP id b11mr2894928ejp.458.1612960550395; Wed, 10 Feb 2021 04:35:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612960550; cv=none; d=google.com; s=arc-20160816; b=A/89ZURSpxcoxkgD9F+g4wLyZmbBEEs7gSSSTXdIaTl3bnUD41HV5fWNR+mduTiio5 h8TiW/Y3zPuG7N0DvAerEZtOwNHpI0v6aD494uIygWjf1nDeUd8Pm8UaMAzravWwQcRI K8UIMvS0WTWJcWnjV8HMWA1iFh7XKI5wtq9IHl69sfYYxn0ZDGQ+1NUnJvAenehEtpum ni1bdsbWeHvxNaezIaP+bOP7wvkFJ7vXRGWXfdkASCgViwxFjuOVKmzgTLZ82R9DZSBb UVj1R+N8ttPmowM8l/esnIwtbcGE0BM7I9iK8ttHkucjf3p+6hgO0sZ43al6+QBlQMsV 2jDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=i5wXyy1sPUgnnMqVauVL41jvRX6eG8p4VtBbB9PGUS8=; b=ochcP3+QUKNz7JN1TDdCKRCdjkdzFW1h4JzO7qNI2/zMbZaIo9g09qBs6tCTbQIDQp 23k3nj40zghLCyAwyuC0oyNZmWhxf7MH2SV2uPyh92FJzXrT/lbhwh5iaxqVNI0ZIHs8 SqhIs8bp0RbWlqVxbgtKn5yRM7OLvenjCRQtu/QFN+LluN7UC6TbRTtz8X3YZpCj0RO2 xwvNgZvRZBHoJ0oNXEi0NdqZCHR2G1YSl0bPiI7TMgs07f01TRZfGY4FSGMzUuFXYO7S u++gTyjuT63VNiFezW+68QuU+ZSvCWn1WI0D1WPVRK6eXrXKNlHZHO7bGtiPqkKRRdPn v3fA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GJN9Ms8J; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b2si1216928edr.426.2021.02.10.04.35.27; Wed, 10 Feb 2021 04:35:50 -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=@redhat.com header.s=mimecast20190719 header.b=GJN9Ms8J; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231913AbhBJMce (ORCPT + 99 others); Wed, 10 Feb 2021 07:32:34 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:34417 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231921AbhBJMaa (ORCPT ); Wed, 10 Feb 2021 07:30:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612960132; 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: in-reply-to:in-reply-to:references:references; bh=i5wXyy1sPUgnnMqVauVL41jvRX6eG8p4VtBbB9PGUS8=; b=GJN9Ms8JS3P8FihrakgZoDJ5qI+SHgzHKJv4e8Q5+mrUAhRZ1nhaqBT+80nCVTBM8+RkjM ioDpHeD5UhxpqLbmVD8QNeCpVNHP/bC+iVrHG7Dr7e2QQRpBNNIu5L5RJVMJWMjP1NeujM as+7uePvBfZS8O/EXZV3wfcxVrCJ348= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-195-Nyd8w7oZMgCP4YRrkHzZlg-1; Wed, 10 Feb 2021 07:28:51 -0500 X-MC-Unique: Nyd8w7oZMgCP4YRrkHzZlg-1 Received: by mail-wr1-f70.google.com with SMTP id c1so1716450wrx.2 for ; Wed, 10 Feb 2021 04:28:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=i5wXyy1sPUgnnMqVauVL41jvRX6eG8p4VtBbB9PGUS8=; b=TB4C1sTwhVjv7OYyDB8fZViB32BhPqGlEoBHxlVpoCfoOKEPgkYnAcad6qI17VdydT ELXENrJUD6fE/11/iuWhe6LH992kbVa6ef99hropJ2jNrRn8IWd3eVxA94oxk/zA43Hf GCGUFjCBBLkQEnFhbUycwLr8hi465qcR4cgjkPi+IpNbkDtiHJWksaUyXzn34aspBaOX ty9sxKPrEAgU9ydxcVMIeCRgBW0gcLYjLMCJzVinzN68ERC4hcx977hSP6qzAPi8Lm25 J7JwMvkOHSPBNb7i/yjpwmyWJE1u9MUOFESOPpB2Uvn3nH1VWNOJKYMRbbOOguKJbShy iTrQ== X-Gm-Message-State: AOAM5336wOs1HVqvk24ndXZZcSa6fJFI3NdV+n+RISimm0Okh+L63xco IJg0ty6k7ilE+jKdomc3smvbZrb6tHpmLSwC1bLfHQvjWmAnOG3OOtiHlwd2pgrnbroITb5EEON c4hWD2mJHK084icAIqeKwxxHB X-Received: by 2002:adf:b611:: with SMTP id f17mr3364768wre.8.1612960129953; Wed, 10 Feb 2021 04:28:49 -0800 (PST) X-Received: by 2002:adf:b611:: with SMTP id f17mr3364759wre.8.1612960129805; Wed, 10 Feb 2021 04:28:49 -0800 (PST) Received: from redhat.com (bzq-79-180-2-31.red.bezeqint.net. [79.180.2.31]) by smtp.gmail.com with ESMTPSA id i10sm3116755wrp.0.2021.02.10.04.28.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Feb 2021 04:28:49 -0800 (PST) Date: Wed, 10 Feb 2021 07:28:46 -0500 From: "Michael S. Tsirkin" To: Si-Wei Liu Cc: Eli Cohen , jasowang@redhat.com, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org Subject: Re: [PATCH 2/3] mlx5_vdpa: fix feature negotiation across device reset Message-ID: <20210210072758-mutt-send-email-mst@kernel.org> References: <1612614564-4220-1-git-send-email-si-wei.liu@oracle.com> <1612614564-4220-2-git-send-email-si-wei.liu@oracle.com> <20210208053500.GA137517@mtl-vdi-166.wap.labs.mlnx> <061486d5-6235-731b-d036-f5d5e9fac22e@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <061486d5-6235-731b-d036-f5d5e9fac22e@oracle.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 08, 2021 at 05:20:11PM -0800, Si-Wei Liu wrote: > > > On 2/7/2021 9:35 PM, Eli Cohen wrote: > > 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. > Yep, it makes sense. Will post a revised patch. So I'm waiting for v2 of this patchset. Please make sure to post a cover letter with an overall description. > If vdpa tool allows > reconfiguration post probing, the code has to be reconciled then. > > > > > Did you actually see this issue in action? If you did, can you share > > with us how you trigerred this? > Issue is indeed seen in action. The mismatched tx-checksum offload as > described in the commit message was one of such examples. You would need a > guest reboot though (triggering device reset via the .set_status ops and > zero'ed mlx_features was loaded to deduce new actual_features for creating > the h/w virtq object) for repro. > > -Siwei > > > > > -- > > > 1.8.3.1 > > >