From owner-svn-src-stable@freebsd.org Thu May 16 17:19:05 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DED0A15A006A; Thu, 16 May 2019 17:19:04 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 877BE8E412; Thu, 16 May 2019 17:19:04 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2EDD123DEC; Thu, 16 May 2019 17:19:04 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4GHJ4G9099397; Thu, 16 May 2019 17:19:04 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4GHJ3sE099396; Thu, 16 May 2019 17:19:03 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201905161719.x4GHJ3sE099396@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 16 May 2019 17:19:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347808 - in stable/11/sys/dev: mlx4/mlx4_ib mlx5/mlx5_ib X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys/dev: mlx4/mlx4_ib mlx5/mlx5_ib X-SVN-Commit-Revision: 347808 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 877BE8E412 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.99)[-0.986,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 17:19:05 -0000 Author: hselasky Date: Thu May 16 17:19:03 2019 New Revision: 347808 URL: https://svnweb.freebsd.org/changeset/base/347808 Log: MFC r347258: Make sure to error out when arming the CQ fails in mlx4ib and mlx5ib. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c ============================================================================== --- stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c Thu May 16 17:18:29 2019 (r347807) +++ stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib_cq.c Thu May 16 17:19:03 2019 (r347808) @@ -878,7 +878,8 @@ int mlx4_ib_poll_cq(struct ib_cq *ibcq, int num_entrie struct mlx4_ib_dev *mdev = to_mdev(cq->ibcq.device); spin_lock_irqsave(&cq->lock, flags); - if (mdev->dev->persist->state & MLX4_DEVICE_STATE_INTERNAL_ERROR) { + if (unlikely(mdev->dev->persist->state & + MLX4_DEVICE_STATE_INTERNAL_ERROR)) { mlx4_ib_poll_sw_comp(cq, num_entries, wc, &npolled); goto out; } @@ -898,11 +899,18 @@ out: int mlx4_ib_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags flags) { - mlx4_cq_arm(&to_mcq(ibcq)->mcq, + struct mlx4_ib_cq *cq = to_mcq(ibcq); + struct mlx4_ib_dev *mdev = to_mdev(cq->ibcq.device); + + if (unlikely(mdev->dev->persist->state & + MLX4_DEVICE_STATE_INTERNAL_ERROR)) + return -1; + + mlx4_cq_arm(&cq->mcq, (flags & IB_CQ_SOLICITED_MASK) == IB_CQ_SOLICITED ? MLX4_CQ_DB_REQ_NOT_SOL : MLX4_CQ_DB_REQ_NOT, - to_mdev(ibcq->device)->uar_map, - MLX4_GET_DOORBELL_LOCK(&to_mdev(ibcq->device)->uar_lock)); + mdev->uar_map, + MLX4_GET_DOORBELL_LOCK(&mdev->uar_lock)); return 0; } Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c Thu May 16 17:18:29 2019 (r347807) +++ stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c Thu May 16 17:19:03 2019 (r347808) @@ -673,7 +673,7 @@ int mlx5_ib_poll_cq(struct ib_cq *ibcq, int num_entrie int npolled; spin_lock_irqsave(&cq->lock, flags); - if (mdev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { + if (unlikely(mdev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR)) { mlx5_ib_poll_sw_comp(cq, num_entries, wc, &npolled); goto out; } @@ -702,6 +702,9 @@ int mlx5_ib_arm_cq(struct ib_cq *ibcq, enum ib_cq_noti unsigned long irq_flags; int ret = 0; + if (unlikely(mdev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR)) + return -1; + spin_lock_irqsave(&cq->lock, irq_flags); if (cq->notify_flags != IB_CQ_NEXT_COMP) cq->notify_flags = flags & IB_CQ_SOLICITED_MASK; @@ -715,7 +718,7 @@ int mlx5_ib_arm_cq(struct ib_cq *ibcq, enum ib_cq_noti MLX5_CQ_DB_REQ_NOT_SOL : MLX5_CQ_DB_REQ_NOT, uar_page, MLX5_GET_DOORBELL_LOCK(&mdev->priv.cq_uar_lock), - to_mcq(ibcq)->mcq.cons_index); + cq->mcq.cons_index); return ret; }