Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1331335imm; Tue, 2 Oct 2018 06:38:52 -0700 (PDT) X-Google-Smtp-Source: ACcGV62dmM7d22P5O3uPcsC4dt3u7qsczGImg94UFT457ZlK1CULoHmlfhgprKaHdyXcpOC9byD9 X-Received: by 2002:a62:75c7:: with SMTP id q190-v6mr10144907pfc.137.1538487532523; Tue, 02 Oct 2018 06:38:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538487532; cv=none; d=google.com; s=arc-20160816; b=J1qalIU15H4/EhH9GAznu357yAtoiuwblyG5D9fpG2kYqOxC9E4eT4afdZin3AN0YA Dpli912Y2X5pIi4SszZQSvUOPP3CvBh4W4aGNTeDAF/Lx5Aa/q6dm8xT0lEo4tY/dpgu 9ykzRRaXxQUzLSK6kLoog/91C3DyYV/CFsSe3B74bh0S+sChBPSMFwhNzKCANrN9CWVk vwtrWAI9Rls9bmj/LTxR//xBTORufhRZXFuq0cngw9+f2As44jIWCy9F389xlOKh92F3 rDYCH/vyOQUNpmj34a11GY8k7AP2Tlxbaecwtr6vSf8Ba1plPc5qAALtJ76q3XUURczy rTSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=ByzamqtcQAiyyfgM1CjOhihDNkHgGoBrrk4pGfAvD4I=; b=tnJI6tB7VgW3ql24ycnurGCYa+7u6nf2Cmwk9MNsT5TnED5rQ3Xxijzq5lv3UBvIbO ZmS8T4uq+ekNG+yGfHZGITm3MpDyuAMVRTc/ke1OWA8NzuWkRqeeeOlXs1UFhtDGAp79 nSWTR0REP66pvyROqFwxBHzw0Wfq5Bkz8H0ZrZQfEfpAVNbuHOL8FQISba5EhYjOmVuW 6ghkEUyvT8+xpkIIKiITSC8Wr79iqvo220nhPlonygL70FyUY0G2vlUf4Q8O5aFCKBoo HI/PKmYBqjXZa7cNPHSGuGVsOKuOc592hKyKGZpJQjJF9rx2Q7kVkfHre93Bdi5OQUL0 Mryg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g8-v6si16760448pli.338.2018.10.02.06.38.37; Tue, 02 Oct 2018 06:38:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387458AbeJBUUO (ORCPT + 99 others); Tue, 2 Oct 2018 16:20:14 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:36440 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731764AbeJBUUN (ORCPT ); Tue, 2 Oct 2018 16:20:13 -0400 Received: from localhost (24-104-73-23-ip-static.hfc.comcastbusiness.net [24.104.73.23]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id DC33AC51; Tue, 2 Oct 2018 13:36:48 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mike Marciniszyn , Lukasz Odzioba , "Michael J. Ruhl" , Dennis Dalessandro , Jason Gunthorpe Subject: [PATCH 4.9 75/94] IB/hfi1: Fix context recovery when PBC has an UnsupportedVL Date: Tue, 2 Oct 2018 06:25:29 -0700 Message-Id: <20181002132505.690604349@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181002132500.494838053@linuxfoundation.org> References: <20181002132500.494838053@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Michael J. Ruhl commit d623500b3c4efd8d4e945ac9003c6b87b469a9ab upstream. If a packet stream uses an UnsupportedVL (virtual lane), the send engine will not send the packet, and it will not indicate that an error has occurred. This will cause the packet stream to block. HFI has 8 virtual lanes available for packet streams. Each lane can be enabled or disabled using the UnsupportedVL mask. If a lane is disabled, adding a packet to the send context must be disallowed. The current mask for determining unsupported VLs defaults to 0 (allow all). This is incorrect. Only the VLs that are defined should be allowed. Determine which VLs are disabled (mtu == 0), and set the appropriate unsupported bit in the mask. The correct mask will allow the send engine to error on the invalid VL, and error recovery will work correctly. Cc: # 4.9.x+ Fixes: 7724105686e7 ("IB/hfi1: add driver files") Reviewed-by: Mike Marciniszyn Reviewed-by: Lukasz Odzioba Signed-off-by: Michael J. Ruhl Signed-off-by: Dennis Dalessandro Signed-off-by: Jason Gunthorpe Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/hw/hfi1/pio.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) --- a/drivers/infiniband/hw/hfi1/pio.c +++ b/drivers/infiniband/hw/hfi1/pio.c @@ -88,6 +88,7 @@ void pio_send_control(struct hfi1_devdat unsigned long flags; int write = 1; /* write sendctrl back */ int flush = 0; /* re-read sendctrl to make sure it is flushed */ + int i; spin_lock_irqsave(&dd->sendctrl_lock, flags); @@ -97,9 +98,13 @@ void pio_send_control(struct hfi1_devdat reg |= SEND_CTRL_SEND_ENABLE_SMASK; /* Fall through */ case PSC_DATA_VL_ENABLE: + mask = 0; + for (i = 0; i < ARRAY_SIZE(dd->vld); i++) + if (!dd->vld[i].mtu) + mask |= BIT_ULL(i); /* Disallow sending on VLs not enabled */ - mask = (((~0ull) << num_vls) & SEND_CTRL_UNSUPPORTED_VL_MASK) << - SEND_CTRL_UNSUPPORTED_VL_SHIFT; + mask = (mask & SEND_CTRL_UNSUPPORTED_VL_MASK) << + SEND_CTRL_UNSUPPORTED_VL_SHIFT; reg = (reg & ~SEND_CTRL_UNSUPPORTED_VL_SMASK) | mask; break; case PSC_GLOBAL_DISABLE: