Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp470335rdb; Thu, 22 Feb 2024 09:08:19 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUQQ7ZaqeprEk9lw5vpCncSUgwlt1jpGz1GGvYamEyQnOEMi+cI/yUVga49Emuse+nFZNlXUzzyLiSMXDWxRIDa6+RpF4Vx3AxdcFelQQ== X-Google-Smtp-Source: AGHT+IFHzTvwQYWElyB8JVVp0qHMLo0dsxDqPMJQiHH7nTHcdLHP0SAmYHYAx9hXhj55HUSSb+ZJ X-Received: by 2002:a17:907:72c1:b0:a3f:4fd7:3cef with SMTP id du1-20020a17090772c100b00a3f4fd73cefmr3446211ejc.2.1708621699665; Thu, 22 Feb 2024 09:08:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708621699; cv=pass; d=google.com; s=arc-20160816; b=Nblwgxz93/RoTwEh7n70UYpvSJ7snRuIr4o5hHklgQzVZ0iJRAnIvpKfc7c6JD5ndF n6cWsieG38qX5NEpbvQ6ghCS6liSjfdL7W6gcYX5wyIJ8ngHiiAJc+t375anerUkOlm3 C024sT1b/KnOAaXghiYHXRoY7rc6NqkU6rg9Ak/UHO0o08QH53egQb4Q92HERcJbLmve 9aa12KGilZLU+F/tPeOqMmKQYQF6/0c7BQ+5Xdzk/o3qEzTVQAGk9Co57TtYJYCD2iEB aZvdybwUwU/Zm/K4MHxDBXOR0wP84kAMk6/Vu53rldowwtoB9GyjsRC4MTNvlqh5d904 TMIw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=O7tlgS7MkdA1L6vxpIiDfXudireah7BPJ6Dyc7UeOKw=; fh=HqB+/TIc6T7UT9VpL/KHYgcd5ZuflgOi9dG8pl6GyHY=; b=zvaOkPgOoppGtG8BDNkegthCiY+8OzxlqN6GE7Ve4MXKDi3K7WGsEf1iIwd2sqRQ7a gZVdGiOkkWQ23Tv3sS8WIukvMtKkRSzX0WomHQ0A4ToUpv4FlCUmPkmtNCANMaysrdDp G/PBAslw+VzdzNAedGry/k9Ib2CPGC7d5n7qlGCuso77QrhENJ4WqEbgnJTpYU4Z0R7P Q8EsOtIlO6w14bOES9iBAtq4877InPscg3mImX6yQnXVFWuIlSDw49Ac9Rna610BUw6M hMdpdMTciTkfJQdSWoPEJ5OhcitAg3pi0dqYj13A5mYC4kB0FQSXgoiJ+FY0n6HjvgrQ 6KkA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=v2hlfZd2; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-76921-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76921-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id gx17-20020a170906f1d100b00a3faf0ef1e7si92569ejb.1030.2024.02.22.09.08.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 09:08:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76921-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=v2hlfZd2; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-76921-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76921-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 6BFF91F28DE3 for ; Thu, 22 Feb 2024 17:08:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4B7531552F3; Thu, 22 Feb 2024 17:08:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="v2hlfZd2" Received: from out-188.mta1.migadu.com (out-188.mta1.migadu.com [95.215.58.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A06D148FF2 for ; Thu, 22 Feb 2024 17:08:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.188 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708621687; cv=none; b=E8NVNm7/A8JHZpe4QRj6BFmR4Gra948uFgjVJn08k/NlJAeiWSYe3xhw651lBdHaidDJez8stgxev9ZIghC4Ca1DSAtH1BQBgwzvKEGo9V8js5M+Om+r7JX5I/HNyL8AIQnjPX/kcB/URs9OLf2ZuCErgIhn1VH6XA5+92Qj8l4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708621687; c=relaxed/simple; bh=bjbBKm61sS3OCiUiTraEzgDb0fORpdkoRq5LcJPn/Iw=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=t+Bl6Y4zA8+UCxexDvG+tigRuxwApVOm5YJdvc7IEigVjzci6d2J6gmvbWOdNyUirS0un/8reGTf3BHItZwJeXyAnPLRnS0njnAmhFNzm9ECw9JXZeSFE8LwIM/dUXOOqmsJXEYViUkegVAgsRYAztBtI8hAvIWEJnURN1UCuxI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=v2hlfZd2; arc=none smtp.client-ip=95.215.58.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1708621681; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=O7tlgS7MkdA1L6vxpIiDfXudireah7BPJ6Dyc7UeOKw=; b=v2hlfZd2C3xXw8cSD+mG/AWXt4cPww48KC+Yl2NE0ShrDnG7iKAcyA4P/30m+d3Wy1N4l7 1OvH3paUYLfUVPW1dT1KiweB4c9jOB3an6HIr+xD2LtIOzS1yXTReMa6UyBxkDxS4UOLMN Cnu4tKGVlc5mx/+HeM4pLas0mCEkWwg= From: Sean Anderson To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Claudiu Manoil , Vladimir Oltean , linuxppc-dev@lists.ozlabs.org, Steffen Trumtrar , linux-kernel@vger.kernel.org, Camelia Groza , Roy Pledge , Scott Wood , Li Yang , Sean Anderson , stable@vger.kernel.org Subject: [RESEND2 PATCH net v4 1/2] soc: fsl: qbman: Always disable interrupts when taking cgr_lock Date: Thu, 22 Feb 2024 12:07:48 -0500 Message-Id: <20240222170749.2607485-1-sean.anderson@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT smp_call_function_single disables IRQs when executing the callback. To prevent deadlocks, we must disable IRQs when taking cgr_lock elsewhere. This is already done by qman_update_cgr and qman_delete_cgr; fix the other lockers. Fixes: 96f413f47677 ("soc/fsl/qbman: fix issue in qman_delete_cgr_safe()") CC: stable@vger.kernel.org Signed-off-by: Sean Anderson Reviewed-by: Camelia Groza Tested-by: Vladimir Oltean --- Resent from a non-mangling email. (no changes since v3) Changes in v3: - Change blamed commit to something more appropriate Changes in v2: - Fix one additional call to spin_unlock drivers/soc/fsl/qbman/qman.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/soc/fsl/qbman/qman.c b/drivers/soc/fsl/qbman/qman.c index 739e4eee6b75..1bf1f1ea67f0 100644 --- a/drivers/soc/fsl/qbman/qman.c +++ b/drivers/soc/fsl/qbman/qman.c @@ -1456,11 +1456,11 @@ static void qm_congestion_task(struct work_struct *work) union qm_mc_result *mcr; struct qman_cgr *cgr; - spin_lock(&p->cgr_lock); + spin_lock_irq(&p->cgr_lock); qm_mc_start(&p->p); qm_mc_commit(&p->p, QM_MCC_VERB_QUERYCONGESTION); if (!qm_mc_result_timeout(&p->p, &mcr)) { - spin_unlock(&p->cgr_lock); + spin_unlock_irq(&p->cgr_lock); dev_crit(p->config->dev, "QUERYCONGESTION timeout\n"); qman_p_irqsource_add(p, QM_PIRQ_CSCI); return; @@ -1476,7 +1476,7 @@ static void qm_congestion_task(struct work_struct *work) list_for_each_entry(cgr, &p->cgr_cbs, node) if (cgr->cb && qman_cgrs_get(&c, cgr->cgrid)) cgr->cb(p, cgr, qman_cgrs_get(&rr, cgr->cgrid)); - spin_unlock(&p->cgr_lock); + spin_unlock_irq(&p->cgr_lock); qman_p_irqsource_add(p, QM_PIRQ_CSCI); } @@ -2440,7 +2440,7 @@ int qman_create_cgr(struct qman_cgr *cgr, u32 flags, preempt_enable(); cgr->chan = p->config->channel; - spin_lock(&p->cgr_lock); + spin_lock_irq(&p->cgr_lock); if (opts) { struct qm_mcc_initcgr local_opts = *opts; @@ -2477,7 +2477,7 @@ int qman_create_cgr(struct qman_cgr *cgr, u32 flags, qman_cgrs_get(&p->cgrs[1], cgr->cgrid)) cgr->cb(p, cgr, 1); out: - spin_unlock(&p->cgr_lock); + spin_unlock_irq(&p->cgr_lock); put_affine_portal(); return ret; } -- 2.35.1.1320.gc452695387.dirty