Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2971059ybk; Mon, 18 May 2020 12:26:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw92r4Xl39F/0/GchhTb9spNu0Y2+qZiZy1C3nlxd/vEzLJGzv9DVv7ScKfb8BAO+MH6JjL X-Received: by 2002:a50:c889:: with SMTP id d9mr15207082edh.81.1589829968243; Mon, 18 May 2020 12:26:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589829968; cv=none; d=google.com; s=arc-20160816; b=iz+jJubYJdR4S7ml32wzq/SGNQMmVFW2Sn2lY01F48gZ8ztFR/z9zSua1qT4cC7Vxa H0ep0aaeDm6AWLeCGI61fTg2T6GxnPHVs6VHzO4bOqy2QPT55xlI3sY1EceSxeB9ljjm T7Tpl8tk+NgY0JKtem/DMwNp2QbxAuOQeR1dEV0vujERmKcrt5wC6Xqtqw4Ity+avtnC l3RJxOYv4IDTLaJNwJ4FK4aT+pb0NpI+IsYX6t6VVoHGQoU+3Ef/2O2o41AZnqTF3yl9 RAOMTSI94GJ2EpdC8aDjNUo2GlbdJjVv7og1eQQ3QVvVJf6MWHBVIoaIggXQqwJKla0X /glA== 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:dkim-signature; bh=0LnPAAAYQBtGba1twUY45CC9fboI7McL4CN+iNR+zjs=; b=rtyJwaa+pfmJHxaHQ9NZpgQs6/GWHQSoxa7aVvi2B6VwjRZ6PsfYaVSIM644ff688S eiPN/9jKKyMe+KVWcaxCq8533WDW2YcDxHoshGJ+Q+CBJYY6pVqdww0MuWW9Qn9J8tGG oU6vDqOXW/FThBlLgHy066FvyqNMUhSioDwB5nLfuySZJ16s3424Xm84VYnhWSCOTrY2 YdIY/k62i0TQBIb4vNZCC4yku1R01EVNc2i3fMZgcyMhErO/uQJAfeNBJLYM9fUL3p5j YpYWH4EPmIJ2gU4T6J95Gi/j9qbEhhjENncYtuJf6yOPbFCJcfpjH23vnKFLZpjzi4K4 2j2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2ZrylI9r; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k26si1879238edf.497.2020.05.18.12.25.45; Mon, 18 May 2020 12:26:08 -0700 (PDT) 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=default header.b=2ZrylI9r; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731481AbgERRzo (ORCPT + 99 others); Mon, 18 May 2020 13:55:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:33110 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731550AbgERRzn (ORCPT ); Mon, 18 May 2020 13:55:43 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 64E9520674; Mon, 18 May 2020 17:55:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589824542; bh=qm2ebLQpPuB5UzhypP58ZpTegmhnDmthwg66hFvVqtM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2ZrylI9rmm0LfuLOAoT6Vt7yL5vnti1hlsBdIv8rTVIixUUdiQjarKTUiYobA/2xD cA7Gt++zDzMKMYiNqL0Y9DiTxaGLl24amhpV9Bf7rJYBuZan5ILYRIYqMsXQgsAFje g67WV4TrT5Lx1a4vNYGTdh9cPqj/W+7FTypRuKck= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kaike Wan , Mike Marciniszyn , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.4 054/147] IB/hfi1: Fix another case where pq is left on waitlist Date: Mon, 18 May 2020 19:36:17 +0200 Message-Id: <20200518173520.713628898@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200518173513.009514388@linuxfoundation.org> References: <20200518173513.009514388@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Mike Marciniszyn [ Upstream commit fa8dac3968635dec8518a13ac78d662f2aa88e4d ] The commit noted below fixed a case where a pq is left on the sdma wait list. It however missed another case. user_sdma_send_pkts() has two calls from hfi1_user_sdma_process_request(). If the first one fails as indicated by -EBUSY, the pq will be placed on the waitlist as by design. If the second call then succeeds, the pq is still on the waitlist setting up a race with the interrupt handler if a subsequent request uses a different SDMA engine Fix by deleting the first call. The use of pcount and the intent to send a short burst of packets followed by the larger balance of packets was never correctly implemented, because the two calls always send pcount packets no matter what. A subsequent patch will correct that issue. Fixes: 9a293d1e21a6 ("IB/hfi1: Ensure pq is not left on waitlist") Link: https://lore.kernel.org/r/20200504130917.175613.43231.stgit@awfm-01.aw.intel.com Cc: Reviewed-by: Kaike Wan Signed-off-by: Mike Marciniszyn Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/hw/hfi1/user_sdma.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/infiniband/hw/hfi1/user_sdma.c b/drivers/infiniband/hw/hfi1/user_sdma.c index 13e4203497b33..a92346e88628b 100644 --- a/drivers/infiniband/hw/hfi1/user_sdma.c +++ b/drivers/infiniband/hw/hfi1/user_sdma.c @@ -589,10 +589,6 @@ int hfi1_user_sdma_process_request(struct hfi1_filedata *fd, set_comp_state(pq, cq, info.comp_idx, QUEUED, 0); pq->state = SDMA_PKT_Q_ACTIVE; - /* Send the first N packets in the request to buy us some time */ - ret = user_sdma_send_pkts(req, pcount); - if (unlikely(ret < 0 && ret != -EBUSY)) - goto free_req; /* * This is a somewhat blocking send implementation. -- 2.20.1