Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3483042imu; Sun, 11 Nov 2018 16:07:28 -0800 (PST) X-Google-Smtp-Source: AJdET5dYQSgpjv5waH176hTjkMEZqSCQaRXqRAVyUo+U3kyS5Oy8oH3Ohx9cax/V0vMutmvmmmV5 X-Received: by 2002:a17:902:4025:: with SMTP id b34-v6mr18064162pld.318.1541981248343; Sun, 11 Nov 2018 16:07:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541981248; cv=none; d=google.com; s=arc-20160816; b=ojM87FmKpkmnYZOxs22XiO46ypap/RXRyZJPzWgkzZT1B/oE0eUBaWYzrZHoMXT7rm VOG6zMPIUT0AH9bDhgQq6lyLi2DChwtxxcHcBNnFuDGmtuzkzuMCasM8Xy7x4cj2kNjf PHS3K12EayVHecNJpLcRpjLRcoN8KGm90ir2trwXgxSIElCpylFMg6mE1Fq9skqza4Vx b282gqBqHzMDo7xTaN93pZbqWB5X878532gOxmE4Dyq+xP2FkQ0XxsV9/dTEFIeaWWjj cPCCk7EvvtXBFIF0XQswQX9vHpYQSLM/m2iULKwWVepzf64Uxws82n2rPzBginU/8vz1 dLKw== 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=MVlcBREF+q17+LHCquYNB0h6G8zx2AKYdi1Rh2qZqJ4=; b=ck9O974OljL7bAEwhPpgIaM8hzOHkiZqjlD8bhu6PRlO6KTedS423G6Vp1BIXO2HzI 31kwBMekS5Clk3IIKuHzrTAE00snjjEOKnfTzvcrX/fApqA8azE52CuyJdty9HxpASYc XcMT/G5bPl0rgdWvz7xCc4/TRAHyfD66g5ngvDyudD01dplJl9luPv1GDhry0xSrT6eH MJa4UkPLZNMCdonR+KYjtR3C7FUFo3QWh9aeXHipKxaQwGFFFmTX0Fbh2RCOO33/2vnh Qxf/EuySks+6mzAdzpSZ2C789MPCa2yNFhgnHLZLjEhpGvun6Z/dqnm8q4dqRrJR6wt5 QUdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=u2Ds8Ijo; 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 m63-v6si16205982pld.161.2018.11.11.16.07.13; Sun, 11 Nov 2018 16:07:28 -0800 (PST) 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=u2Ds8Ijo; 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 S1732058AbeKLJ5S (ORCPT + 99 others); Mon, 12 Nov 2018 04:57:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:33910 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731741AbeKLIRh (ORCPT ); Mon, 12 Nov 2018 03:17:37 -0500 Received: from localhost (unknown [206.108.79.134]) (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 7B956223C8; Sun, 11 Nov 2018 22:27:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975261; bh=nwyNGhuzpkIfhdQFZ66TduVOrS7LUGgVhaTN9Gs7md0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u2Ds8IjoDV800rGX+zd0HTPoeWh7ljzJiCazM5avEJqw3GliSpIxY7gt2+QLySf1i g8RbW9m5Qv+sMM70xSxwWW185+K446Eyvq24PuI5fn3iW3cNSJYZNni/egYVdjhF/z VY+eDrdsuK3r4St+G3iNz7X5Fyp0bJdUmZEKU1Y4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Selvin Xavier , Jason Gunthorpe , Sasha Levin Subject: [PATCH 4.19 146/361] RDMA/bnxt_re: Fix recursive lock warning in debug kernel Date: Sun, 11 Nov 2018 14:18:13 -0800 Message-Id: <20181111221640.920706860@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@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.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Selvin Xavier [ Upstream commit d455f29f6d76a5f94881ca1289aaa1e90617ff5d ] Fix possible recursive lock warning. Its a false warning as the locks are part of two differnt HW Queue data structure - cmdq and creq. Debug kernel is throwing the following warning and stack trace. [ 783.914967] ============================================ [ 783.914970] WARNING: possible recursive locking detected [ 783.914973] 4.19.0-rc2+ #33 Not tainted [ 783.914976] -------------------------------------------- [ 783.914979] swapper/2/0 is trying to acquire lock: [ 783.914982] 000000002aa3949d (&(&hwq->lock)->rlock){..-.}, at: bnxt_qplib_service_creq+0x232/0x350 [bnxt_re] [ 783.914999] but task is already holding lock: [ 783.915002] 00000000be73920d (&(&hwq->lock)->rlock){..-.}, at: bnxt_qplib_service_creq+0x2a/0x350 [bnxt_re] [ 783.915013] other info that might help us debug this: [ 783.915016] Possible unsafe locking scenario: [ 783.915019] CPU0 [ 783.915021] ---- [ 783.915034] lock(&(&hwq->lock)->rlock); [ 783.915035] lock(&(&hwq->lock)->rlock); [ 783.915037] *** DEADLOCK *** [ 783.915038] May be due to missing lock nesting notation [ 783.915039] 1 lock held by swapper/2/0: [ 783.915040] #0: 00000000be73920d (&(&hwq->lock)->rlock){..-.}, at: bnxt_qplib_service_creq+0x2a/0x350 [bnxt_re] [ 783.915044] stack backtrace: [ 783.915046] CPU: 2 PID: 0 Comm: swapper/2 Not tainted 4.19.0-rc2+ #33 [ 783.915047] Hardware name: Dell Inc. PowerEdge R730/0599V5, BIOS 1.0.4 08/28/2014 [ 783.915048] Call Trace: [ 783.915049] [ 783.915054] dump_stack+0x90/0xe3 [ 783.915058] __lock_acquire+0x106c/0x1080 [ 783.915061] ? sched_clock+0x5/0x10 [ 783.915063] lock_acquire+0xbd/0x1a0 [ 783.915065] ? bnxt_qplib_service_creq+0x232/0x350 [bnxt_re] [ 783.915069] _raw_spin_lock_irqsave+0x4a/0x90 [ 783.915071] ? bnxt_qplib_service_creq+0x232/0x350 [bnxt_re] [ 783.915073] bnxt_qplib_service_creq+0x232/0x350 [bnxt_re] [ 783.915078] tasklet_action_common.isra.17+0x197/0x1b0 [ 783.915081] __do_softirq+0xcb/0x3a6 [ 783.915084] irq_exit+0xe9/0x100 [ 783.915085] do_IRQ+0x6a/0x120 [ 783.915087] common_interrupt+0xf/0xf [ 783.915088] Use nested notation for the spin_lock to avoid this warning. Signed-off-by: Selvin Xavier Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) --- a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +++ b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c @@ -309,8 +309,17 @@ static int bnxt_qplib_process_qp_event(s rcfw->aeq_handler(rcfw, qp_event, qp); break; default: - /* Command Response */ - spin_lock_irqsave(&cmdq->lock, flags); + /* + * Command Response + * cmdq->lock needs to be acquired to synchronie + * the command send and completion reaping. This function + * is always called with creq->lock held. Using + * the nested variant of spin_lock. + * + */ + + spin_lock_irqsave_nested(&cmdq->lock, flags, + SINGLE_DEPTH_NESTING); cookie = le16_to_cpu(qp_event->cookie); mcookie = qp_event->cookie; blocked = cookie & RCFW_CMD_IS_BLOCKING;