Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5508567pxb; Mon, 15 Feb 2021 23:39:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJzfV/oX9ZTS1WsJvkpGm9I0w5PVw1+WSS5Ebwlmm7sPImAf8yx8ceB9yRGXaYsI+Bt5UeNq X-Received: by 2002:a05:6402:94d:: with SMTP id h13mr12366502edz.19.1613461195170; Mon, 15 Feb 2021 23:39:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613461195; cv=none; d=google.com; s=arc-20160816; b=mkWmIHB/f92MVoARMmxs/LMXBcdlV1TOYVzrqjbogkogvzhtTxrWIvI6b5ZFeH9D+U oarn8Li0P0FD2WxtNqs5vfIb+Xb1EflSeMO0ygxcy7jUbDWJk5nmTvVQwlFBxewPPBxX iMZ03EcNEVXjVx2daFy5DDEOWAg3MAKpXD8usJtE3oAwGZ2lXbHZjLJEhNOrcJA/M/gv 7qepJVw3oNxPvZ3u5Lq9zjRdx5UuhVcGLvALbY7L4t1W3QBY4kmydVwbodCraP4w2mar lOz/L9D3moRECF4ip8afFdsch6Cl3+1Rna2LVEqanlHheBLRE6IgxWf+miToBZ/t0ebs 3+Vg== 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=yRDGDr46wqpLOpDbOqHK31wEU4SxZaUEQ2boRS3v1K4=; b=LQvV28ukhkHmHyJOMedvxqfRaaY127XDNlIH+BLIBjs9bCcHaEuQTeA5SKZhvMIiRr 7Innz3QatZJm1lKYyogEgrMf/SywnLRyV5l6guGZyM/z86/PBh+5aHtjSgweQVxh8rtE Auz8r5EAUb4bC0dgNmWE2eqJ3rJeTV6vk9wRo0fP/gTJneiHJN0yArtzynGwpatQz+2R 9eDse6DOpczFyuNm/PR5K2pN3SaAyVQVxQW249boGhNXfIRhBrTJZYyAAPygEKlvrCSr PDDXBaTt2G+5SUvkH7VwWvPUEnC6wneCuJL6QDvAMs2rJL21RN+hFM4f5uJ0ZwP0BbQy tRmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IKK96cwE; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o7si14183923eja.76.2021.02.15.23.39.32; Mon, 15 Feb 2021 23:39:55 -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=@kernel.org header.s=k20201202 header.b=IKK96cwE; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229916AbhBPHiU (ORCPT + 99 others); Tue, 16 Feb 2021 02:38:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:33448 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229676AbhBPHiS (ORCPT ); Tue, 16 Feb 2021 02:38:18 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 450FD64DC3; Tue, 16 Feb 2021 07:37:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1613461058; bh=6OLXpRjMtpO3rJat3zYX+pRYnE0UODR8E8eilUt1wlI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=IKK96cwEMia3biqOl2+yZcIHiH7NduEbANNEqBANbJ1bSnjgLtTIUftS3IH0dRw+L 0do0UHIe0A2ZgeStQjar6TBFj1a9Es5EyCByeBXYapR4+y5+KbwcUMlMZ0EonCZaXB H14tLwwaZ2GRH3XQBrOjhzSTrPSbhMahxvCJVIcgHFy3ZIR5qP9Xg1RRtmKXEhxBl4 4ZoGqJWs6prNDYBVQtRwH7ElfX4/TGZEQDXf8nlUmH8uGIp0xYbWW8ISJYW5T14KxK MGj4i3Qd/GR7WgiISn2OdeuaJtkYCgS1FeSuWnmoYY1VZDk0laA7pxokzvXIz3EQKf hS+lnGIr8gx4A== Date: Tue, 16 Feb 2021 09:37:34 +0200 From: Leon Romanovsky To: Eli Cohen Cc: mst@redhat.com, jasowang@redhat.com, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, si-wei.liu@oracle.com Subject: Re: [PATCH] vdpa/mlx5: Extract correct pointer from driver data Message-ID: References: <20210216055022.25248-1-elic@nvidia.com> <20210216055022.25248-2-elic@nvidia.com> <20210216064226.GA83717@mtl-vdi-166.wap.labs.mlnx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210216064226.GA83717@mtl-vdi-166.wap.labs.mlnx> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 16, 2021 at 08:42:26AM +0200, Eli Cohen wrote: > On Tue, Feb 16, 2021 at 08:35:51AM +0200, Leon Romanovsky wrote: > > On Tue, Feb 16, 2021 at 07:50:22AM +0200, Eli Cohen wrote: > > > struct mlx5_vdpa_net pointer was stored in drvdata. Extract it as well > > > in mlx5v_remove(). > > > > > > Fixes: 74c9729dd892 ("vdpa/mlx5: Connect mlx5_vdpa to auxiliary bus") > > > Signed-off-by: Eli Cohen > > > --- > > > drivers/vdpa/mlx5/net/mlx5_vnet.c | 4 ++-- > > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > > > diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c > > > index 6b0a42183622..4103d3b64a2a 100644 > > > --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c > > > +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c > > > @@ -2036,9 +2036,9 @@ static int mlx5v_probe(struct auxiliary_device *adev, > > > > > > static void mlx5v_remove(struct auxiliary_device *adev) > > > { > > > - struct mlx5_vdpa_dev *mvdev = dev_get_drvdata(&adev->dev); > > > + struct mlx5_vdpa_net *ndev = dev_get_drvdata(&adev->dev); > > > > > > - vdpa_unregister_device(&mvdev->vdev); > > > + vdpa_unregister_device(&ndev->mvdev.vdev); > > > } > > > > IMHO, The more correct solution is to fix dev_set_drvdata() call, > > because we are regustering/unregistering/allocating "struct mlx5_vdpa_dev". > > > > We're allocating "struct mlx5_vdpa_net". "struct mlx5_vdpa_dev" is just > a member field of "struct mlx5_vdpa_net". I referred to these lines in the mlx5v_probe(): 1986 err = mlx5_vdpa_alloc_resources(&ndev->mvdev); 1987 if (err) 1988 goto err_mtu; 1989 1990 err = alloc_resources(ndev); 1991 if (err) 1992 goto err_res; 1993 1994 err = vdpa_register_device(&mvdev->vdev); So mlx5v_remove() is better to be symmetrical. Thanks > > > diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c > > index 88dde3455bfd..079b8fe669af 100644 > > --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c > > +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c > > @@ -1995,7 +1995,7 @@ static int mlx5v_probe(struct auxiliary_device *adev, > > if (err) > > goto err_reg; > > > > - dev_set_drvdata(&adev->dev, ndev); > > + dev_set_drvdata(&adev->dev, mvdev); > > return 0; > > > > err_reg: > > > > > > > > static const struct auxiliary_device_id mlx5v_id_table[] = { > > > > > -- > > > 2.29.2 > > >