From patchwork Thu Feb 22 17:07:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 204877 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp83751dyb; Thu, 22 Feb 2024 09:15:42 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX0pwwoXAI24hw+MM6W/v22KhCSmQ9VewW0+LjfyPykNrKnxd5oycbFOURoQhYEaEXXtAEjETjVftqGuWZvQFxH9Js22Q== X-Google-Smtp-Source: AGHT+IEMhz3gMD6VVCoAvXZMo4mCNKQZ/e60SQhRFreZaMdPblfPtB9c6dcNuOJNv6VP5GbiRvKx X-Received: by 2002:a17:902:ec90:b0:1db:c564:5938 with SMTP id x16-20020a170902ec9000b001dbc5645938mr21769506plg.60.1708622141990; Thu, 22 Feb 2024 09:15:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708622141; cv=pass; d=google.com; s=arc-20160816; b=WcGq785h9K6zh6K3fWZAGW0GU95+i3jXuT1RKDLXQEONtllFF9PWV5hdv6EDllm86j upL41MgPmFE+x/ciJIZi0GMyjbSR2pvVBgc39DlurAGXYBZvhI8vq2EBIxUlW07ZhzgA O41GSkcZMTwruiigI9siM9Syn/7wludFF/caTcNINVGncSc5baJuFU8zQ762UTOddSX3 rM3t+qhkL8i4e1Em0209s/aG38LeiGiJY3/WO3UExPToyVxiv7MOvB+ZEs/lwtIRoSws WjGe0VYJAH9cgqbPYIFOEAEhLsa/jMmTqFmZAUKmHBrLU8A0DS11qYs49nXUVTP+Lmgb EZ8A== 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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76921-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id t3-20020a170902e84300b001d5f009098bsi10817178plg.408.2024.02.22.09.15.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 09:15:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76921-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; 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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76921-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id EDA472890C7 for ; Thu, 22 Feb 2024 17:08:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 32098155A45; Thu, 22 Feb 2024 17:08:10 +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 X-Migadu-Flow: FLOW_OUT X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791620171494502235 X-GMAIL-MSGID: 1791620171494502235 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; }