Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3052687ybi; Tue, 2 Jul 2019 01:11:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqymQqQHhRBpg8A9fAHxq9sTqZVK7kda+hwJr3qEM4hEmq2vv9h2KTU6lxPj4PrPnE3Da+7U X-Received: by 2002:a63:1a03:: with SMTP id a3mr27855670pga.397.1562055116979; Tue, 02 Jul 2019 01:11:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562055116; cv=none; d=google.com; s=arc-20160816; b=dwMoyNnx/UKBheZDo3woy7MOOCHIB3P02mB8qCwFoNrUDDE7VgABqLSm140wLw6q9Q H3FbPKB1jVe+hQlcC+t3I+SGO6ZDxA1Rh4nlejEsMurog1HjPz7J0rWAP3VMPraKEiDn srr/9cOCMreKL7dz1lctCKIJT4JysfU1xdjwUzXwSsTuY1yKc0G2hyUAv/+LLHYNSU7s bdmiZ2Bj5QpRm51VcdCdTo0rxP4xOnB3csesL59yhvpCjbIjbSVWS+eykkfWb+MG7FPG ACAYjJ40pLAeMoHTCaBz0e5m4Hr1YAfILOMVMyOBXrboAEabVOpy1XtNCbJKjhD9miXt VNEw== 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=hy7T/ea3dt9Th1RyUdHqjpCX1t+W8EGc1aEtZeO+2so=; b=uo4qsHtUf8iZQviBzKI18WFJbmcXwl4oggwGVRVjIpQlCA+fHQyznXml6MuY+mWK84 NV9hdoLI5RGHPGoiBnwJxkUIqRk2ZOjf7oZktqZN4+/ZhI8kYPf6+Mu7+qDsxe2NQbjx y/bF96hCx9KiXQTReVaszJ8SjeVA3hIo24JoLbXW5a8eQuIqJrY9zrF/56sxkED1rz48 tKt7+qO/XupOZ9K5si+HTmaZXcU1mrHFtMnqFuvzM9QonbGFRBx6RL2xmBg66mkk+B9g UFsBZ1lFOfzofiHLqjJFj1V9OYz9FpAWxA+eNVfMOoIbmmpymush4bJkXQf/wLE/wEWF Ga+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IUKcAe+U; 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 d3si12366616pla.232.2019.07.02.01.11.42; Tue, 02 Jul 2019 01:11:56 -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; dkim=pass header.i=@kernel.org header.s=default header.b=IUKcAe+U; 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 S1728648AbfGBIJa (ORCPT + 99 others); Tue, 2 Jul 2019 04:09:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:57322 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728684AbfGBIJ1 (ORCPT ); Tue, 2 Jul 2019 04:09:27 -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 36DE221479; Tue, 2 Jul 2019 08:09:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562054966; bh=jxKyYLS206eyCqpUlU6qSBoV+PF/H1dACTeLISo2As8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IUKcAe+U4KQZ0o4k2n9mioikyvdW+d3XD4RgvNJC6zFAS4VGjbi6vyAgMrh/EwGcB 0+gCgtzQwgWwrKQBRH/9iO/bOf8k2B/lOL9/mBgAG1zosb73hFwEldVbT88e8lAe/2 YNF2KDWGrgVOukhKZP3N27Pm/skNsXDmcqJzpFxI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gary Leshner , Mike Marciniszyn , Dennis Dalessandro , Jason Gunthorpe , Sasha Levin Subject: [PATCH 4.14 05/43] IB/hfi1: Close PSM sdma_progress sleep window Date: Tue, 2 Jul 2019 10:01:45 +0200 Message-Id: <20190702080124.144847078@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190702080123.904399496@linuxfoundation.org> References: <20190702080123.904399496@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 commit da9de5f8527f4b9efc82f967d29a583318c034c7 upstream. The call to sdma_progress() is called outside the wait lock. In this case, there is a race condition where sdma_progress() can return false and the sdma_engine can idle. If that happens, there will be no more sdma interrupts to cause the wakeup and the user_sdma xmit will hang. Fix by moving the lock to enclose the sdma_progress() call. Also, delete busycount. The need for this was removed by: commit bcad29137a97 ("IB/hfi1: Serve the most starved iowait entry first") Ported to linux-4.14.y. Cc: Fixes: 7724105686e7 ("IB/hfi1: add driver files") Reviewed-by: Gary Leshner Signed-off-by: Mike Marciniszyn Signed-off-by: Dennis Dalessandro Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/hw/hfi1/user_sdma.c | 12 ++++-------- drivers/infiniband/hw/hfi1/user_sdma.h | 1 - 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/infiniband/hw/hfi1/user_sdma.c b/drivers/infiniband/hw/hfi1/user_sdma.c index cbe5ab26d95b..75275f9e363d 100644 --- a/drivers/infiniband/hw/hfi1/user_sdma.c +++ b/drivers/infiniband/hw/hfi1/user_sdma.c @@ -132,25 +132,22 @@ static int defer_packet_queue( struct hfi1_user_sdma_pkt_q *pq = container_of(wait, struct hfi1_user_sdma_pkt_q, busy); struct hfi1_ibdev *dev = &pq->dd->verbs_dev; - struct user_sdma_txreq *tx = - container_of(txreq, struct user_sdma_txreq, txreq); - if (sdma_progress(sde, seq, txreq)) { - if (tx->busycount++ < MAX_DEFER_RETRY_COUNT) - goto eagain; - } + write_seqlock(&dev->iowait_lock); + if (sdma_progress(sde, seq, txreq)) + goto eagain; /* * We are assuming that if the list is enqueued somewhere, it * is to the dmawait list since that is the only place where * it is supposed to be enqueued. */ xchg(&pq->state, SDMA_PKT_Q_DEFERRED); - write_seqlock(&dev->iowait_lock); if (list_empty(&pq->busy.list)) iowait_queue(pkts_sent, &pq->busy, &sde->dmawait); write_sequnlock(&dev->iowait_lock); return -EBUSY; eagain: + write_sequnlock(&dev->iowait_lock); return -EAGAIN; } @@ -803,7 +800,6 @@ static int user_sdma_send_pkts(struct user_sdma_request *req, unsigned maxpkts) tx->flags = 0; tx->req = req; - tx->busycount = 0; INIT_LIST_HEAD(&tx->list); /* diff --git a/drivers/infiniband/hw/hfi1/user_sdma.h b/drivers/infiniband/hw/hfi1/user_sdma.h index 2b5326d6db53..87b0c567f442 100644 --- a/drivers/infiniband/hw/hfi1/user_sdma.h +++ b/drivers/infiniband/hw/hfi1/user_sdma.h @@ -236,7 +236,6 @@ struct user_sdma_txreq { struct list_head list; struct user_sdma_request *req; u16 flags; - unsigned int busycount; u64 seqnum; }; -- 2.20.1