Message ID | 1676424640-11673-1-git-send-email-si-wei.liu@oracle.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3309904wrn; Tue, 14 Feb 2023 17:52:05 -0800 (PST) X-Google-Smtp-Source: AK7set/lyJDfbKAaGlq4ozrpiHdUIC+7eiMpqJ4yDWzmIoW5Wc4ssoMNGJZvlW4DZ6He1EEbK1OK X-Received: by 2002:a17:907:2cd7:b0:8b1:353a:1e28 with SMTP id hg23-20020a1709072cd700b008b1353a1e28mr456963ejc.48.1676425925044; Tue, 14 Feb 2023 17:52:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676425925; cv=none; d=google.com; s=arc-20160816; b=D//JCyO1KjNRqk0eL4MIHqPz7XABCVNH9ZcmEGxTCX69puMbnVhoL6zEs4wT4R/6ma hEv6OwtgiwErrBOPtNPLKsMfRNywNi0eBoI6k/N9UeWWUVamXMxy1sQ1ygaTrNwkgAvH 6B6y0dhBxY2N84LPThJ1U/jxjKh4SS09/3bdiL1aEdKCGcd0as8I8okNH4d3/dyJzibQ LgqnBDDVjWITuRANVzrz0YiBXRxKCfCkVH2/Z5/26uECAxZ1Fq7lK/CJXc6rzIltE7l/ GTBgg6scnqIVHskJ2kB3Wb91kWQeB8lz9n/3LNhKdye8GhvGJ7dFRA3aNjNqGDybDayc 4WpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=2YN4NPMiVZ/gada3XBxhbQ0i3hT/Rjk5A5hzVtCsjdg=; b=pawifNCXfN5Se9BqZlPS5wYin2yg5lb+SM5fJP29DmKs5yKRkkxjlKj3t/lwjFnJVQ PEGp052vjP9uvKAitDJHL3zzJpHYae15ZL7AOZjfL26I+9qk/3g6sowq3YVm/fcl62BH YIg996BMYDtjSS1W8sMqgL7IayTjhszffVKzuYEJlOMYWV/2P+5zywf76e5t6vH/ui78 dWVCC1xVg/W6eWx1J+guFXmVNRiFMRDHT5O3ePs8nlaTgMNeeUzYuP0mfDir3RknEuKe 3EL4W+Lyf0/1H5WnZkYjIfwyeV7tEU4HDmCDvWfimUUTxwd4PfiNO/TNoU5LY2sMdstJ rohw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=sPlF2buO; 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=oracle.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e22-20020a170906749600b008b128c10e7asi4906101ejl.215.2023.02.14.17.51.42; Tue, 14 Feb 2023 17:52:05 -0800 (PST) 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=@oracle.com header.s=corp-2022-7-12 header.b=sPlF2buO; 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=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232685AbjBOBbN (ORCPT <rfc822;tebrre53rla2o@gmail.com> + 99 others); Tue, 14 Feb 2023 20:31:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232342AbjBOBbL (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 14 Feb 2023 20:31:11 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 042DA3431A for <linux-kernel@vger.kernel.org>; Tue, 14 Feb 2023 17:31:10 -0800 (PST) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 31EL3sSL016207; Wed, 15 Feb 2023 01:31:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id; s=corp-2022-7-12; bh=2YN4NPMiVZ/gada3XBxhbQ0i3hT/Rjk5A5hzVtCsjdg=; b=sPlF2buO8XvUausytVmYxSYbaBi81Zle5UZCvB00wHrbKLptZG/U6DMCynb5GRXdwuBj vBfBEyHqIRaiGmpy+ILUh1Kj9h62Tva5Odjlpboo0MRzlT8QPHbJfE1AsCRwoRRFkpxP 7FMRCARGDPB1AmmwGt8zuwQZ3yTu47HyUDmVkMNpfRORYuqgkH4hEgkT8pB9b94flKIY AXtp4rqkQBjXPnczZVPbjH22+Nts/3PvXSP3C9AkOAvzx7ORgeQUJ1mRqFyZUKCWdzC3 cBI4tcm5iHQJ/liSECrcubDkn+SheKU602oXJnvIAkiyX34CmGQDA2YRY5QdyIcjT1KA JQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3np1t3f0dk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Feb 2023 01:31:05 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 31F06NYd013576; Wed, 15 Feb 2023 01:31:05 GMT Received: from ban25x6uut24.us.oracle.com (ban25x6uut24.us.oracle.com [10.153.73.24]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 3np1f64m55-1; Wed, 15 Feb 2023 01:31:04 +0000 From: Si-Wei Liu <si-wei.liu@oracle.com> To: mst@redhat.com, jasowang@redhat.com, elic@nvidia.com Cc: parav@nvidia.com, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, eperezma@redhat.com Subject: [PATCH v3] vdpa/mlx5: should not activate virtq object when suspended Date: Tue, 14 Feb 2023 17:30:40 -0800 Message-Id: <1676424640-11673-1-git-send-email-si-wei.liu@oracle.com> X-Mailer: git-send-email 1.8.3.1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.170.22 definitions=2023-02-14_17,2023-02-14_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 suspectscore=0 phishscore=0 spamscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2302150012 X-Proofpoint-GUID: X8IRcncblieIcEQ_6it949XjhE64ri01 X-Proofpoint-ORIG-GUID: X8IRcncblieIcEQ_6it949XjhE64ri01 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757514824412442894?= X-GMAIL-MSGID: =?utf-8?q?1757859990701905973?= |
Series |
[v3] vdpa/mlx5: should not activate virtq object when suspended
|
|
Commit Message
Si-Wei Liu
Feb. 15, 2023, 1:30 a.m. UTC
Otherwise the virtqueue object to instate could point to invalid address that was unmapped from the MTT: mlx5_core 0000:41:04.2: mlx5_cmd_out_err:782:(pid 8321): CREATE_GENERAL_OBJECT(0xa00) op_mod(0xd) failed, status bad parameter(0x3), syndrome (0x5fa1c), err(-22) Fixes: cae15c2ed8e6 ("vdpa/mlx5: Implement susupend virtqueue callback") Cc: Eli Cohen <elic@nvidia.com> Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com> Reviewed-by: Eli Cohen <elic@nvidia.com> --- v3: move suspended to struct mlx5_vdpa_dev v2: removed the change for improving warning message --- drivers/vdpa/mlx5/core/mlx5_vdpa.h | 1 + drivers/vdpa/mlx5/net/mlx5_vnet.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-)
Comments
On Wed, Feb 15, 2023 at 9:31 AM Si-Wei Liu <si-wei.liu@oracle.com> wrote: > > Otherwise the virtqueue object to instate could point to invalid address > that was unmapped from the MTT: > > mlx5_core 0000:41:04.2: mlx5_cmd_out_err:782:(pid 8321): > CREATE_GENERAL_OBJECT(0xa00) op_mod(0xd) failed, status > bad parameter(0x3), syndrome (0x5fa1c), err(-22) > > Fixes: cae15c2ed8e6 ("vdpa/mlx5: Implement susupend virtqueue callback") > Cc: Eli Cohen <elic@nvidia.com> > Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com> > Reviewed-by: Eli Cohen <elic@nvidia.com> > > --- > v3: move suspended to struct mlx5_vdpa_dev > v2: removed the change for improving warning message > --- > drivers/vdpa/mlx5/core/mlx5_vdpa.h | 1 + > drivers/vdpa/mlx5/net/mlx5_vnet.c | 6 +++++- > 2 files changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/vdpa/mlx5/core/mlx5_vdpa.h b/drivers/vdpa/mlx5/core/mlx5_vdpa.h > index 058fbe2..25fc412 100644 > --- a/drivers/vdpa/mlx5/core/mlx5_vdpa.h > +++ b/drivers/vdpa/mlx5/core/mlx5_vdpa.h > @@ -96,6 +96,7 @@ struct mlx5_vdpa_dev { > struct mlx5_control_vq cvq; > struct workqueue_struct *wq; > unsigned int group2asid[MLX5_VDPA_NUMVQ_GROUPS]; > + bool suspended; > }; > > int mlx5_vdpa_alloc_pd(struct mlx5_vdpa_dev *dev, u32 *pdn, u16 uid); > diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c > index 3a6dbbc6..daac3ab 100644 > --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c > +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c > @@ -2411,7 +2411,7 @@ static int mlx5_vdpa_change_map(struct mlx5_vdpa_dev *mvdev, > if (err) > goto err_mr; > > - if (!(mvdev->status & VIRTIO_CONFIG_S_DRIVER_OK)) > + if (!(mvdev->status & VIRTIO_CONFIG_S_DRIVER_OK) || mvdev->suspended) One more thought, Does this mean set_map() is forbidden during suspending? I'm not sure this is correct or at least we need restrict in in the vDPA core. Thanks > goto err_mr; > > restore_channels_info(ndev); > @@ -2579,6 +2579,7 @@ static int mlx5_vdpa_reset(struct vdpa_device *vdev) > clear_vqs_ready(ndev); > mlx5_vdpa_destroy_mr(&ndev->mvdev); > ndev->mvdev.status = 0; > + ndev->mvdev.suspended = false; > ndev->cur_num_vqs = 0; > ndev->mvdev.cvq.received_desc = 0; > ndev->mvdev.cvq.completed_desc = 0; > @@ -2815,6 +2816,8 @@ static int mlx5_vdpa_suspend(struct vdpa_device *vdev) > struct mlx5_vdpa_virtqueue *mvq; > int i; > > + mlx5_vdpa_info(mvdev, "suspending device\n"); > + > down_write(&ndev->reslock); > ndev->nb_registered = false; > mlx5_notifier_unregister(mvdev->mdev, &ndev->nb); > @@ -2824,6 +2827,7 @@ static int mlx5_vdpa_suspend(struct vdpa_device *vdev) > suspend_vq(ndev, mvq); > } > mlx5_vdpa_cvq_suspend(mvdev); > + mvdev->suspended = true; > up_write(&ndev->reslock); > return 0; > } > -- > 1.8.3.1 >
On 2/15/2023 8:48 PM, Jason Wang wrote: > On Wed, Feb 15, 2023 at 9:31 AM Si-Wei Liu <si-wei.liu@oracle.com> wrote: >> Otherwise the virtqueue object to instate could point to invalid address >> that was unmapped from the MTT: >> >> mlx5_core 0000:41:04.2: mlx5_cmd_out_err:782:(pid 8321): >> CREATE_GENERAL_OBJECT(0xa00) op_mod(0xd) failed, status >> bad parameter(0x3), syndrome (0x5fa1c), err(-22) >> >> Fixes: cae15c2ed8e6 ("vdpa/mlx5: Implement susupend virtqueue callback") >> Cc: Eli Cohen <elic@nvidia.com> >> Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com> >> Reviewed-by: Eli Cohen <elic@nvidia.com> >> >> --- >> v3: move suspended to struct mlx5_vdpa_dev >> v2: removed the change for improving warning message >> --- >> drivers/vdpa/mlx5/core/mlx5_vdpa.h | 1 + >> drivers/vdpa/mlx5/net/mlx5_vnet.c | 6 +++++- >> 2 files changed, 6 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/vdpa/mlx5/core/mlx5_vdpa.h b/drivers/vdpa/mlx5/core/mlx5_vdpa.h >> index 058fbe2..25fc412 100644 >> --- a/drivers/vdpa/mlx5/core/mlx5_vdpa.h >> +++ b/drivers/vdpa/mlx5/core/mlx5_vdpa.h >> @@ -96,6 +96,7 @@ struct mlx5_vdpa_dev { >> struct mlx5_control_vq cvq; >> struct workqueue_struct *wq; >> unsigned int group2asid[MLX5_VDPA_NUMVQ_GROUPS]; >> + bool suspended; >> }; >> >> int mlx5_vdpa_alloc_pd(struct mlx5_vdpa_dev *dev, u32 *pdn, u16 uid); >> diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c >> index 3a6dbbc6..daac3ab 100644 >> --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c >> +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c >> @@ -2411,7 +2411,7 @@ static int mlx5_vdpa_change_map(struct mlx5_vdpa_dev *mvdev, >> if (err) >> goto err_mr; >> >> - if (!(mvdev->status & VIRTIO_CONFIG_S_DRIVER_OK)) >> + if (!(mvdev->status & VIRTIO_CONFIG_S_DRIVER_OK) || mvdev->suspended) > One more thought, > > Does this mean set_map() is forbidden during suspending? No, it will not. Instead it now allows set_map() to proceed even if mapping is shrinking while device is suspended. The "goto err_mr" below actually returns 0 when it leaves mlx5_vdpa_change_map(). -Siwei > I'm not sure > this is correct or at least we need restrict in in the vDPA core. > > Thanks > >> goto err_mr; >> >> restore_channels_info(ndev); >> @@ -2579,6 +2579,7 @@ static int mlx5_vdpa_reset(struct vdpa_device *vdev) >> clear_vqs_ready(ndev); >> mlx5_vdpa_destroy_mr(&ndev->mvdev); >> ndev->mvdev.status = 0; >> + ndev->mvdev.suspended = false; >> ndev->cur_num_vqs = 0; >> ndev->mvdev.cvq.received_desc = 0; >> ndev->mvdev.cvq.completed_desc = 0; >> @@ -2815,6 +2816,8 @@ static int mlx5_vdpa_suspend(struct vdpa_device *vdev) >> struct mlx5_vdpa_virtqueue *mvq; >> int i; >> >> + mlx5_vdpa_info(mvdev, "suspending device\n"); >> + >> down_write(&ndev->reslock); >> ndev->nb_registered = false; >> mlx5_notifier_unregister(mvdev->mdev, &ndev->nb); >> @@ -2824,6 +2827,7 @@ static int mlx5_vdpa_suspend(struct vdpa_device *vdev) >> suspend_vq(ndev, mvq); >> } >> mlx5_vdpa_cvq_suspend(mvdev); >> + mvdev->suspended = true; >> up_write(&ndev->reslock); >> return 0; >> } >> -- >> 1.8.3.1 >>
On Thu, Feb 16, 2023 at 1:03 PM Si-Wei Liu <si-wei.liu@oracle.com> wrote: > > > > On 2/15/2023 8:48 PM, Jason Wang wrote: > > On Wed, Feb 15, 2023 at 9:31 AM Si-Wei Liu <si-wei.liu@oracle.com> wrote: > >> Otherwise the virtqueue object to instate could point to invalid address > >> that was unmapped from the MTT: > >> > >> mlx5_core 0000:41:04.2: mlx5_cmd_out_err:782:(pid 8321): > >> CREATE_GENERAL_OBJECT(0xa00) op_mod(0xd) failed, status > >> bad parameter(0x3), syndrome (0x5fa1c), err(-22) > >> > >> Fixes: cae15c2ed8e6 ("vdpa/mlx5: Implement susupend virtqueue callback") > >> Cc: Eli Cohen <elic@nvidia.com> > >> Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com> > >> Reviewed-by: Eli Cohen <elic@nvidia.com> > >> > >> --- > >> v3: move suspended to struct mlx5_vdpa_dev > >> v2: removed the change for improving warning message > >> --- > >> drivers/vdpa/mlx5/core/mlx5_vdpa.h | 1 + > >> drivers/vdpa/mlx5/net/mlx5_vnet.c | 6 +++++- > >> 2 files changed, 6 insertions(+), 1 deletion(-) > >> > >> diff --git a/drivers/vdpa/mlx5/core/mlx5_vdpa.h b/drivers/vdpa/mlx5/core/mlx5_vdpa.h > >> index 058fbe2..25fc412 100644 > >> --- a/drivers/vdpa/mlx5/core/mlx5_vdpa.h > >> +++ b/drivers/vdpa/mlx5/core/mlx5_vdpa.h > >> @@ -96,6 +96,7 @@ struct mlx5_vdpa_dev { > >> struct mlx5_control_vq cvq; > >> struct workqueue_struct *wq; > >> unsigned int group2asid[MLX5_VDPA_NUMVQ_GROUPS]; > >> + bool suspended; > >> }; > >> > >> int mlx5_vdpa_alloc_pd(struct mlx5_vdpa_dev *dev, u32 *pdn, u16 uid); > >> diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c > >> index 3a6dbbc6..daac3ab 100644 > >> --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c > >> +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c > >> @@ -2411,7 +2411,7 @@ static int mlx5_vdpa_change_map(struct mlx5_vdpa_dev *mvdev, > >> if (err) > >> goto err_mr; > >> > >> - if (!(mvdev->status & VIRTIO_CONFIG_S_DRIVER_OK)) > >> + if (!(mvdev->status & VIRTIO_CONFIG_S_DRIVER_OK) || mvdev->suspended) > > One more thought, > > > > Does this mean set_map() is forbidden during suspending? > No, it will not. Instead it now allows set_map() to proceed even if > mapping is shrinking while device is suspended. The "goto err_mr" below > actually returns 0 when it leaves mlx5_vdpa_change_map(). You're right. So Acked-by: Jason Wang <jasowang@redhat.com> Thanks > > -Siwei > > > I'm not sure > > this is correct or at least we need restrict in in the vDPA core. > > > > Thanks > > > >> goto err_mr; > >> > >> restore_channels_info(ndev); > >> @@ -2579,6 +2579,7 @@ static int mlx5_vdpa_reset(struct vdpa_device *vdev) > >> clear_vqs_ready(ndev); > >> mlx5_vdpa_destroy_mr(&ndev->mvdev); > >> ndev->mvdev.status = 0; > >> + ndev->mvdev.suspended = false; > >> ndev->cur_num_vqs = 0; > >> ndev->mvdev.cvq.received_desc = 0; > >> ndev->mvdev.cvq.completed_desc = 0; > >> @@ -2815,6 +2816,8 @@ static int mlx5_vdpa_suspend(struct vdpa_device *vdev) > >> struct mlx5_vdpa_virtqueue *mvq; > >> int i; > >> > >> + mlx5_vdpa_info(mvdev, "suspending device\n"); > >> + > >> down_write(&ndev->reslock); > >> ndev->nb_registered = false; > >> mlx5_notifier_unregister(mvdev->mdev, &ndev->nb); > >> @@ -2824,6 +2827,7 @@ static int mlx5_vdpa_suspend(struct vdpa_device *vdev) > >> suspend_vq(ndev, mvq); > >> } > >> mlx5_vdpa_cvq_suspend(mvdev); > >> + mvdev->suspended = true; > >> up_write(&ndev->reslock); > >> return 0; > >> } > >> -- > >> 1.8.3.1 > >> >
diff --git a/drivers/vdpa/mlx5/core/mlx5_vdpa.h b/drivers/vdpa/mlx5/core/mlx5_vdpa.h index 058fbe2..25fc412 100644 --- a/drivers/vdpa/mlx5/core/mlx5_vdpa.h +++ b/drivers/vdpa/mlx5/core/mlx5_vdpa.h @@ -96,6 +96,7 @@ struct mlx5_vdpa_dev { struct mlx5_control_vq cvq; struct workqueue_struct *wq; unsigned int group2asid[MLX5_VDPA_NUMVQ_GROUPS]; + bool suspended; }; int mlx5_vdpa_alloc_pd(struct mlx5_vdpa_dev *dev, u32 *pdn, u16 uid); diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index 3a6dbbc6..daac3ab 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -2411,7 +2411,7 @@ static int mlx5_vdpa_change_map(struct mlx5_vdpa_dev *mvdev, if (err) goto err_mr; - if (!(mvdev->status & VIRTIO_CONFIG_S_DRIVER_OK)) + if (!(mvdev->status & VIRTIO_CONFIG_S_DRIVER_OK) || mvdev->suspended) goto err_mr; restore_channels_info(ndev); @@ -2579,6 +2579,7 @@ static int mlx5_vdpa_reset(struct vdpa_device *vdev) clear_vqs_ready(ndev); mlx5_vdpa_destroy_mr(&ndev->mvdev); ndev->mvdev.status = 0; + ndev->mvdev.suspended = false; ndev->cur_num_vqs = 0; ndev->mvdev.cvq.received_desc = 0; ndev->mvdev.cvq.completed_desc = 0; @@ -2815,6 +2816,8 @@ static int mlx5_vdpa_suspend(struct vdpa_device *vdev) struct mlx5_vdpa_virtqueue *mvq; int i; + mlx5_vdpa_info(mvdev, "suspending device\n"); + down_write(&ndev->reslock); ndev->nb_registered = false; mlx5_notifier_unregister(mvdev->mdev, &ndev->nb); @@ -2824,6 +2827,7 @@ static int mlx5_vdpa_suspend(struct vdpa_device *vdev) suspend_vq(ndev, mvq); } mlx5_vdpa_cvq_suspend(mvdev); + mvdev->suspended = true; up_write(&ndev->reslock); return 0; }