From patchwork Fri Mar 31 15:14:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 13196100 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3B8DFC761A6 for ; Fri, 31 Mar 2023 15:15:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=dE1l3/PElB0Y8NiJ6RiDKhJSmyZD0xPNkp5Ec3s3ps8=; b=A1kIzA02cYOjDt 0BWv4vz/3rJ9C/MdbstnEHBoodBGib2+f+MCvnGLAsqdahMHDgfEO61i3byLPMk6mh2uRmfj5++8Y UMWHFVu4sj944hRnqTuakvSHlHfnH6kv/R+Ospo5UP5Jj1KbedsP6H8+3Qdy3hIsfWLqjq3w00s+g XGJ+qOAjWSJvv7IAn+oYsdff9RfYJxgVKLBMoCvWscMmF9ECLJYB+knxomKcRu6cQdlfPSSYsU7bM GShe5E2PUk6lIuyveEjHY3QL+HT6l7+a1obQ3A9X1RxzLXezRtrkj6oVRsmqxrAPSqlB3QHTt0+XW o3rWey8SxyoPu5rJESUQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1piGSp-007sUT-2n; Fri, 31 Mar 2023 15:14:51 +0000 Received: from mail-dbaeur03on20621.outbound.protection.outlook.com ([2a01:111:f400:fe1a::621] helo=EUR03-DBA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1piGSc-007sQN-0y for linux-arm-kernel@lists.infradead.org; Fri, 31 Mar 2023 15:14:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wTRXVlpbEuCBH9k+NARDJqadbWm40OuAkQ7QWg4d2WQ=; b=p+R1crxvH6BEL7lPRIqGYZmR5v5AbKB2znYcrdvFNwP23jCliH3DBv6miHbsj1rXm4HQ56O55J3y5GVaboCd/AtU+fEtFuD+svCyB5jSGZKR97cAxtDHw09oI0E/rdHZTe3kjy3zNkIw/etSo5zQgcn1aCXYb2uVIYsBH08u4f10T3lPfJ5Cq1kBiJR1qJHMLMmITXx07kqucWDobLsnBCekEklGPKi0Vhus3JXOq5P7QJOK0p84zsMRwT0uN9xmZqqBLmqAn4BaQ8bNlSTYd9T8GnYFRlop4KEroizjmvqHf7dXRz0tRm52LtL2GYB5RfOD9BtCZ3zTiF+ZjJkh2g== Received: from ZR0P278CA0106.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:23::21) by PA4PR03MB7071.eurprd03.prod.outlook.com (2603:10a6:102:ed::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.23; Fri, 31 Mar 2023 15:14:35 +0000 Received: from VI1EUR05FT033.eop-eur05.prod.protection.outlook.com (2603:10a6:910:23:cafe::81) by ZR0P278CA0106.outlook.office365.com (2603:10a6:910:23::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.22 via Frontend Transport; Fri, 31 Mar 2023 15:14:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 20.160.56.86) smtp.mailfrom=seco.com; dkim=pass (signature was verified) header.d=seco.com;dmarc=pass action=none header.from=seco.com; Received-SPF: Pass (protection.outlook.com: domain of seco.com designates 20.160.56.86 as permitted sender) receiver=protection.outlook.com; client-ip=20.160.56.86; helo=inpost-eu.tmcas.trendmicro.com; pr=C Received: from inpost-eu.tmcas.trendmicro.com (20.160.56.86) by VI1EUR05FT033.mail.protection.outlook.com (10.233.243.184) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.39 via Frontend Transport; Fri, 31 Mar 2023 15:14:34 +0000 Received: from outmta (unknown [192.168.82.135]) by inpost-eu.tmcas.trendmicro.com (Trend Micro CAS) with ESMTP id 11F4C2008026F; Fri, 31 Mar 2023 15:14:34 +0000 (UTC) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (unknown [104.47.2.51]) by repre.tmcas.trendmicro.com (Trend Micro CAS) with ESMTPS id 01FB02008006E; Fri, 31 Mar 2023 15:14:49 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KLeNXYhcFiAA4cfPlhIFc/XFTdwXECKysiSS/m11yfkwoikNfkRxGWdGN7YPyLUYYLOVaoxYQ4haTm4oAUFh6xIKGPiCsOUQFJrNXhoweVWeFPpxR4GMjXBNnydw+z3DQzazAfQQvlFRAzOdROplQuZ6yM58vBNp1UvEyHsjpkjLUyYx+PibKagqcIudDC0axwrkwQOGDTEKwMtuGa3dNTQYIAElYjzzI2i9uTm93huwmkwCHIscQ8FEsvAKdZiuH1M7ArgcJI3PhyvCierfmLOqycAUWwy8hL5cI3ENWXocY0L4D9J3p3t1FSbwpGsPPAjkmzpnFXI/I590CQDbAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wTRXVlpbEuCBH9k+NARDJqadbWm40OuAkQ7QWg4d2WQ=; b=FAMGoMqSqJi014cCBlRgJZxEkqXIk1Gyi/ya1ueB2AsRsLKrffV1Cvm1xEW4T1XYWV/bwe47as333Alaqi1bE4FQqLznxCGs2Bs66AlWzXtQCb5Zi3Yr9uRwa2dBkGrIRvsPf/t0R8cJf+byp0gPFY6TTKSbzyTLY8DhtM0S78yMpdPK42SZ46h5Nsln+ExNrHjXj1urX4pS/VTcectA6aXrbRrjcTpnWcq8/zmxsbnOxovULfWwRw+NS2eBqLjw1X8HDvqJXf4H3fI4CVvl7rJPn/o5ojqUYRn24vhDNMfklWKEw17IKsb16psPRM/9854FbfEQv/WqED9xf1h2Eg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wTRXVlpbEuCBH9k+NARDJqadbWm40OuAkQ7QWg4d2WQ=; b=p+R1crxvH6BEL7lPRIqGYZmR5v5AbKB2znYcrdvFNwP23jCliH3DBv6miHbsj1rXm4HQ56O55J3y5GVaboCd/AtU+fEtFuD+svCyB5jSGZKR97cAxtDHw09oI0E/rdHZTe3kjy3zNkIw/etSo5zQgcn1aCXYb2uVIYsBH08u4f10T3lPfJ5Cq1kBiJR1qJHMLMmITXx07kqucWDobLsnBCekEklGPKi0Vhus3JXOq5P7QJOK0p84zsMRwT0uN9xmZqqBLmqAn4BaQ8bNlSTYd9T8GnYFRlop4KEroizjmvqHf7dXRz0tRm52LtL2GYB5RfOD9BtCZ3zTiF+ZjJkh2g== Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) by DB9PR03MB9662.eurprd03.prod.outlook.com (2603:10a6:10:458::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.23; Fri, 31 Mar 2023 15:14:27 +0000 Received: from DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::2226:eb03:a8c:a7e5]) by DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::2226:eb03:a8c:a7e5%2]) with mapi id 15.20.6222.033; Fri, 31 Mar 2023 15:14:27 +0000 From: Sean Anderson To: Li Yang , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org Cc: Scott Wood , Camelia Groza , linux-kernel@vger.kernel.org, Roy Pledge , "David S . Miller" , Claudiu Manoil , Vladimir Oltean , Sean Anderson Subject: [PATCH v2 1/2] soc: fsl: qbman: Always disable interrupts when taking cgr_lock Date: Fri, 31 Mar 2023 11:14:12 -0400 Message-Id: <20230331151413.1684105-1-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty X-ClientProxiedBy: BL0PR05CA0016.namprd05.prod.outlook.com (2603:10b6:208:91::26) To DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: DB9PR03MB8847:EE_|DB9PR03MB9662:EE_|VI1EUR05FT033:EE_|PA4PR03MB7071:EE_ X-MS-Office365-Filtering-Correlation-Id: 7351cecb-8b40-41c2-051d-08db31faa2e6 X-TrendMicro-CAS-OUT-LOOP-IDENTIFIER: 656f966764b7fb185830381c646b41a1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: cbVSpMOOVb/NFEnKYpqZyiNznc2YR2/H81WYnu7GOumO4XcOGsHuA+oicVwSe//9Bzle+TDtT4NqaeZbDa6bCFkhBos0KRA335/NPdoaAB3zUKeIj2QPfrC7dES7PNc9u1MgsoFYhExqbw8b/f8suG12EdIW/I6pXKj699HAeYDI90cHSCocJB0UKArEEEzBF0SF6VpcHpRExNie7RBP7kbILcDdqT8U3mzvadYAEJVCmgC3oo98uBhVGDNjU8njDAmoStu5KwPdN217TqgBl/OVCUvVuvhOinpB0i01LkMJniKdVk07IQUhZuHR9Gn4d1G+H98yQfC/JOs9mWEyewKKcvO+na8UhkeSRCeXXB6GDAgl6kxlcAiGvq+vmSAYU/6oe4hNW/vIqyJsMJIXE67dp4y0Y8V3O/hge22cSm5eQMmm5JlT0tfTWhcFvzELZ/veOg7iSoqdc1UY+I0vShisd87QsnuEzadR8D1NCl8hOSu3AwQurzFSsopxSxqqKr/wmexK04PYMyZJVdzpde/1g5U+v5Lfq7cEFltSpWkF431FYKxFVlWCokstmupAjTIcNGdjWk2FFiKKz/SL6AENN15jPyNiXsRG9nbEBqStowWc17OhmiPTrBMl5JUN X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB9PR03MB8847.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(396003)(376002)(39850400004)(346002)(366004)(136003)(451199021)(478600001)(54906003)(83380400001)(2616005)(26005)(1076003)(6506007)(107886003)(6666004)(6512007)(6486002)(4326008)(66556008)(8676002)(66476007)(316002)(66946007)(52116002)(186003)(5660300002)(41300700001)(7416002)(44832011)(38350700002)(38100700002)(2906002)(8936002)(86362001)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR03MB9662 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VI1EUR05FT033.eop-eur05.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: f9cda0ad-29f9-4209-9d53-08db31fa9e48 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WdF3gUppxqV6BEILhUC5ic6IOt0bec9+aH3Lbs127+9iH12hfHesdk5kRUkztQdEpaYyj6otETe/1M2bjS5nPOz96o7PMD4n5CFfypPLCqexEMTQ3K8HREt90LrkhIx+IMJNfvj8h7cFYhGMwxObcbeMJqiNhM/MXc3ixGo+lpl8uadFj7UuABGqcoVAF5K2+7awIfZ0Taxtf2A+pRtVKbCi0mqtq71YfgreowRQhjDNPFWTZroif393PeF78chhiBkj6eOG8ojadvLdkRwNizYD2nzJ29P84QSLMyl6d4eOM6+xHTwm1BgsUg/M51UiqokwlQ6CBgC1PD34PEyHporZERqKqyvnVmnf3QVmbElVTOWf7VOQOONVoJj0hUtHX14hD26siitT+iBpVckuU+Gnpa/G6JB8P80NYXiOX6vIXsHkuannPHD7tkDQ3WNEU9iMX5OfE8YEDdK9A+7JC5+XKTanin1MfG5SK86LZE3WSCqLOBjT6ARonk/clTy/sdPG/QmhfxZ7r3yUaOk52q0cUBKpq/20Br4FgDRSVqIqdgVIN9tL4QUmZNisFhNpu0Hr1/b7rEhQN/uT9pfE1CyLfk5UtydvZDuvbMX6lAOCq+sCDLlMHPmGP8OscbK+Thkheuz+3RoMeysuaoq4ZcKPqm3soms2tuBPW8AxiZb1djbjh5p6MLQtRMSLvo/fQti6CtG4EQoUPEbRu1doaLnoKvbpn9ZRH4GW7BbN1GE= X-Forefront-Antispam-Report: CIP:20.160.56.86;CTRY:NL;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:inpost-eu.tmcas.trendmicro.com;PTR:inpost-eu.tmcas.trendmicro.com;CAT:NONE;SFS:(13230028)(376002)(39850400004)(346002)(396003)(136003)(451199021)(46966006)(40470700004)(36840700001)(2906002)(44832011)(7416002)(5660300002)(8936002)(4326008)(70586007)(8676002)(40460700003)(316002)(36756003)(478600001)(41300700001)(70206006)(6486002)(40480700001)(54906003)(186003)(7596003)(6512007)(356005)(6506007)(26005)(2616005)(107886003)(336012)(1076003)(82310400005)(7636003)(6666004)(86362001)(83380400001)(47076005)(34070700002)(36860700001)(82740400003);DIR:OUT;SFP:1101; X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Mar 2023 15:14:34.6844 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7351cecb-8b40-41c2-051d-08db31faa2e6 X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=bebe97c3-6438-442e-ade3-ff17aa50e733;Ip=[20.160.56.86];Helo=[inpost-eu.tmcas.trendmicro.com] X-MS-Exchange-CrossTenant-AuthSource: VI1EUR05FT033.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR03MB7071 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230331_081438_346068_2B66DC17 X-CRM114-Status: GOOD ( 11.49 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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: c535e923bb97 ("soc/fsl: Introduce DPAA 1.x QMan device driver") Signed-off-by: Sean Anderson Tested-by: Vladimir Oltean Reviewed-by: Camelia Groza --- 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; } From patchwork Fri Mar 31 15:14:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 13196099 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B17DAC76196 for ; Fri, 31 Mar 2023 15:15:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=W51yzCDRQKaZclEcA6c9epW3FYa1ZLB+ZqcskFqGUvI=; b=oDb2LeEJj1oijS AUR+Z9afNPWYp9zrRyt86zV/4iL5dUhY9BhgoX6WUCQiDKb1vDPnbSCagUlHTnI2WQ8Vjl+bUDXYV OjlNgHGCeCfHhOj58xA1B7/NuFIMqVMqJ8qocZ0FYWLL/DvoR94j4xnCawiEqXKYyJuEcyrMt4xAZ lrrORT2CoPy0SxAiPkXju5nnfzuQN5A7ftBoWxFJ46KumWd5z07asQ2dynSRia6A1yMotpXrcPkX+ 9PwTKfKQR4YbamkCHxp/evTfFwlyA9imzyd740saqf7XEJE9uQKrB4qyblCN8+CvX24qczqKXKLHQ 9DccVkhFE4H1ZdTEJaww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1piGSf-007sRZ-0F; Fri, 31 Mar 2023 15:14:41 +0000 Received: from mail-am7eur03on20606.outbound.protection.outlook.com ([2a01:111:f400:7eaf::606] helo=EUR03-AM7-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1piGSb-007sQB-2Z for linux-arm-kernel@lists.infradead.org; Fri, 31 Mar 2023 15:14:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Omp7V1S97FAyi73wif/zMkSpT+3MnMf5Youer7m6faE=; b=qPbVzDCEz0TLukEIJqKbzUp+GSxH8IqRUmNRy62viH38YgbtcmcbjIUWqHwC3jm0EOTsXkLo58Ebs532Mz3UumuPtKhECiDCBuv1HXYegw9Y1Gfvy5ZEQcRKCmMdU5Cs4N/RfqrkiWNTNdhuUvn4A3PnmGtvkdkFkhcFDZEc4rpuKKOQcY4MUaJLnZwrYOL2My4pbytC66SxniRoYpech6AJKLA4LwTsgzNAyCr0ed7UcsKVAPhvg8361+afsM56JAb2CwsMVVG4UMrI0Ghjcrqu5+WOn3lL7Cok9x0LGoaZg/oUwfTAdaztK3kA6AXpHvhz+PdNeIiljw3KfoKmrA== Received: from AS9PR05CA0311.eurprd05.prod.outlook.com (2603:10a6:20b:491::28) by AS2PR03MB9813.eurprd03.prod.outlook.com (2603:10a6:20b:60b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.21; Fri, 31 Mar 2023 15:14:34 +0000 Received: from AM6EUR05FT007.eop-eur05.prod.protection.outlook.com (2603:10a6:20b:491:cafe::27) by AS9PR05CA0311.outlook.office365.com (2603:10a6:20b:491::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.22 via Frontend Transport; Fri, 31 Mar 2023 15:14:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 20.160.56.81) smtp.mailfrom=seco.com; dkim=pass (signature was verified) header.d=seco.com;dmarc=pass action=none header.from=seco.com; Received-SPF: Pass (protection.outlook.com: domain of seco.com designates 20.160.56.81 as permitted sender) receiver=protection.outlook.com; client-ip=20.160.56.81; helo=inpost-eu.tmcas.trendmicro.com; pr=C Received: from inpost-eu.tmcas.trendmicro.com (20.160.56.81) by AM6EUR05FT007.mail.protection.outlook.com (10.233.240.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.37 via Frontend Transport; Fri, 31 Mar 2023 15:14:33 +0000 Received: from outmta (unknown [192.168.82.132]) by inpost-eu.tmcas.trendmicro.com (Trend Micro CAS) with ESMTP id B7BFA2008026E; Fri, 31 Mar 2023 15:14:33 +0000 (UTC) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (unknown [104.47.2.52]) by repre.tmcas.trendmicro.com (Trend Micro CAS) with ESMTPS id 62BF12008006E; Fri, 31 Mar 2023 15:14:51 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GWA4LEIXrYZ1y6UI/hH4At7U5J4TBGQCkG07W8e60EoDvLwuROKwNNvOxpjzRFlus7F8MjfLiB10EKlpJGjGWFx6UgYY+I0W2ED2V7fpFE78xQ4l9kc3b5//9/QRxoV1I1yb8dtc4LBG/PxscMdZLM0DXBliDvVCH6eXN7/L0G9Ja8GpphgEWhyprzt51Zg7vEGcl8BQMDO8d0Xjpxx4bqnhhEtfVDgNmez7Eu3g6Fy63U5BF52x/3djh6dPWTk/NZtW0O7tGROKrnPR32iy0tkeMfhgHri8reTvRh26eLU/yB62USxNj0ZtclpnrBjF8yjFJ07p3Mx9pXRrKi3/Gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Omp7V1S97FAyi73wif/zMkSpT+3MnMf5Youer7m6faE=; b=S93NRqJ7VEqr933bvRWHXOUIxj809H+ZA+Wk65CeLvNhak9umLc3d9JcqNCqdj4L7XR1uxtzkngXV3bh6FMd5BpEu/H7gokDZJcdc3DPuSydH0qx+S/ezu3QYTyE/F4RjztLlo9FoVxT9/Y7Vg7jxRNge6KYaZs5EQmwrS1b1VtK0HpXoqAWPdS95RCw+2H1STjrSl6e2jPyZsIhgUrkRLNY3cTqxQi4qKoeGBeAix5LXLKI3DUD5k7YwHkHDf6Xaa/ttKBx2544zskUMhZusNY/HtHm7SHvf8/W4V8fA5+pgCqKElxoB8PuvI4VTNnGiPK6Sw8Nv3B401tSvns49A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Omp7V1S97FAyi73wif/zMkSpT+3MnMf5Youer7m6faE=; b=qPbVzDCEz0TLukEIJqKbzUp+GSxH8IqRUmNRy62viH38YgbtcmcbjIUWqHwC3jm0EOTsXkLo58Ebs532Mz3UumuPtKhECiDCBuv1HXYegw9Y1Gfvy5ZEQcRKCmMdU5Cs4N/RfqrkiWNTNdhuUvn4A3PnmGtvkdkFkhcFDZEc4rpuKKOQcY4MUaJLnZwrYOL2My4pbytC66SxniRoYpech6AJKLA4LwTsgzNAyCr0ed7UcsKVAPhvg8361+afsM56JAb2CwsMVVG4UMrI0Ghjcrqu5+WOn3lL7Cok9x0LGoaZg/oUwfTAdaztK3kA6AXpHvhz+PdNeIiljw3KfoKmrA== Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) by DB9PR03MB9662.eurprd03.prod.outlook.com (2603:10a6:10:458::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.23; Fri, 31 Mar 2023 15:14:28 +0000 Received: from DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::2226:eb03:a8c:a7e5]) by DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::2226:eb03:a8c:a7e5%2]) with mapi id 15.20.6222.033; Fri, 31 Mar 2023 15:14:28 +0000 From: Sean Anderson To: Li Yang , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org Cc: Scott Wood , Camelia Groza , linux-kernel@vger.kernel.org, Roy Pledge , "David S . Miller" , Claudiu Manoil , Vladimir Oltean , Sean Anderson Subject: [PATCH v2 2/2] soc: fsl: qbman: Use raw spinlock for cgr_lock Date: Fri, 31 Mar 2023 11:14:13 -0400 Message-Id: <20230331151413.1684105-2-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20230331151413.1684105-1-sean.anderson@seco.com> References: <20230331151413.1684105-1-sean.anderson@seco.com> X-ClientProxiedBy: BL0PR05CA0016.namprd05.prod.outlook.com (2603:10b6:208:91::26) To DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: DB9PR03MB8847:EE_|DB9PR03MB9662:EE_|AM6EUR05FT007:EE_|AS2PR03MB9813:EE_ X-MS-Office365-Filtering-Correlation-Id: b1537ca3-d11d-42a8-7ee2-08db31faa25f X-TrendMicro-CAS-OUT-LOOP-IDENTIFIER: 656f966764b7fb185830381c646b41a1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 6LnjyGfFKFpI0J6llfF0IeX3uRIOE0BfbhIGObh5aa+OOGVd64s3aaWAfmSrlj7YpNnopQElNj59GZ7/XM6lNzFNTtzvPd8T3qEugW4tK3+bgELl69sFRQf+jBuXWa2iAUsv1xqh8HDzJzvfN2yqgFbgj3NbfgX2e71AYl66l7hfR2mspiSrPhROc5zDnRsQ8P+XqLQ5H0gQERaQp+96DdUCf7wqDw+DWMowjkY4BQcbRH9fDP7oYXcsRohg5kPC0xS3loyHGNNqwjvhh8UPj4fyOgujoeztLm2PWJ79yRc3QZoos2uebJowEMl14qslZujyhVf+dO5Y+E2zy/k/dKQXbBIFmcLQj7eqrtlfcqR5kNfqhByTSZVBARCs442N4JUByR5pOGFBn+WRCDi0UTC1c+cqZqp9Ismg9fd4dOHiIbQpn1186muB57THrnH+Gpuo5Y0Y0PlTFIfAQjIZZvzF+EYuZcDEziu1cJZtN3aVXGnoQlSvWX1xlpn5LI8Fb345ewlQvwuiGtcviakgAmf4caRCYuhjh+/bXsi16SG/giSj5q4h+f64CoYgmzkBCpqq9uNmSC1w+SIJh5XH8lzgrDOdaDdkhUQaEqRR9mk= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB9PR03MB8847.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(396003)(376002)(39850400004)(346002)(366004)(136003)(451199021)(478600001)(54906003)(83380400001)(2616005)(26005)(1076003)(6506007)(107886003)(6666004)(6512007)(6486002)(966005)(4326008)(66556008)(8676002)(66476007)(316002)(66946007)(52116002)(186003)(5660300002)(41300700001)(7416002)(44832011)(38350700002)(38100700002)(2906002)(8936002)(86362001)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR03MB9662 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM6EUR05FT007.eop-eur05.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: da2cb8e2-4ed5-4dc7-6992-08db31fa9f18 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0jWnEN+Yp7cr9ix2nY3LExjzbAsAD5EkZb2p+MB/xxB+SYBAk6Otog7qIlEy9vViYNwsFOas1YaoynlhRWamRp+dTqeRZuXXJxmQbBz0t3LHj3PjMXoWkp09CvQRa7w2qSsflnZWV09dbo2vCpDq28SkjeRWVDp4qqtUbwzaA0tz0CD++FiDsnMs1FHO8hty0ZpGoKDhxFf75q+CTmSmnJdcODSJfknlXo61U+4F8pDeujDbGelA3K1Cny7anD7nSDmGZWaDdtiFICwlF7hIsJz2S43rRJWpL5bhmtrqpAn4xhMbfrvrVuYD8oFMma6aL5jwg5bMz/gk4ze3uBwdGd9sr2QYbgh2xL1oHCtzkw6zzMRy26qe8Jn5Lcnwa5TvikLxhxrQqo170JVLrEDVtffapRKxLxnClR3nU7xRnuv+1AtOZN82FyURWIM5UtoR4f2Fq/Zbk/B2thDvJZSjXLMwPZqVSLHF4mo+BvQ9QwXgtOwHf9BUMVcAMSTXUZsXHd3w1x14/VkdXM13DtoLApRliEoYQNaCYlRIgVE5KPx8nL5G0Wcoi6fMzeR1GNaPcB5H3Egh/QzxOGzcB2QgvXGehrqY73H0p6YEWsSosLFlpVkbIuEqGxuDE4H5h7XvNi5L2lUt90dEg+zTki4JwbwTJGJ3nJl16pJfLJTb+Chsa01MMnxKGDKKh8t/BQVbRxw4gBWoAS+Sbef6uOmF3qO9EA87WXzwuv2zMyPx6I4= X-Forefront-Antispam-Report: CIP:20.160.56.81;CTRY:NL;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:inpost-eu.tmcas.trendmicro.com;PTR:inpost-eu.tmcas.trendmicro.com;CAT:NONE;SFS:(13230028)(39850400004)(346002)(396003)(136003)(376002)(451199021)(46966006)(36840700001)(40470700004)(7636003)(47076005)(82310400005)(7596003)(356005)(5660300002)(44832011)(7416002)(8936002)(70586007)(40460700003)(70206006)(36756003)(4326008)(82740400003)(8676002)(41300700001)(40480700001)(336012)(966005)(83380400001)(6486002)(2616005)(36860700001)(54906003)(34070700002)(1076003)(26005)(6666004)(6512007)(186003)(86362001)(6506007)(2906002)(107886003)(478600001)(316002);DIR:OUT;SFP:1101; X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Mar 2023 15:14:33.8340 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b1537ca3-d11d-42a8-7ee2-08db31faa25f X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=bebe97c3-6438-442e-ade3-ff17aa50e733;Ip=[20.160.56.81];Helo=[inpost-eu.tmcas.trendmicro.com] X-MS-Exchange-CrossTenant-AuthSource: AM6EUR05FT007.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR03MB9813 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230331_081437_836396_E3179400 X-CRM114-Status: GOOD ( 16.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org cgr_lock may be locked with interrupts already disabled by smp_call_function_single. As such, we must use a raw spinlock to avoid problems on PREEMPT_RT kernels. Although this bug has existed for a while, it was not apparent until commit ef2a8d5478b9 ("net: dpaa: Adjust queue depth on rate change") which invokes smp_call_function_single via qman_update_cgr_safe every time a link goes up or down. Fixes: c535e923bb97 ("soc/fsl: Introduce DPAA 1.x QMan device driver") Reported-by: Vladimir Oltean Link: https://lore.kernel.org/all/20230323153935.nofnjucqjqnz34ej@skbuf/ Signed-off-by: Sean Anderson Tested-by: Vladimir Oltean Reviewed-by: Camelia Groza --- (no changes since v1) drivers/soc/fsl/qbman/qman.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/soc/fsl/qbman/qman.c b/drivers/soc/fsl/qbman/qman.c index 1bf1f1ea67f0..7a1558aba523 100644 --- a/drivers/soc/fsl/qbman/qman.c +++ b/drivers/soc/fsl/qbman/qman.c @@ -991,7 +991,7 @@ struct qman_portal { /* linked-list of CSCN handlers. */ struct list_head cgr_cbs; /* list lock */ - spinlock_t cgr_lock; + raw_spinlock_t cgr_lock; struct work_struct congestion_work; struct work_struct mr_work; char irqname[MAX_IRQNAME]; @@ -1281,7 +1281,7 @@ static int qman_create_portal(struct qman_portal *portal, /* if the given mask is NULL, assume all CGRs can be seen */ qman_cgrs_fill(&portal->cgrs[0]); INIT_LIST_HEAD(&portal->cgr_cbs); - spin_lock_init(&portal->cgr_lock); + raw_spin_lock_init(&portal->cgr_lock); INIT_WORK(&portal->congestion_work, qm_congestion_task); INIT_WORK(&portal->mr_work, qm_mr_process_task); portal->bits = 0; @@ -1456,11 +1456,11 @@ static void qm_congestion_task(struct work_struct *work) union qm_mc_result *mcr; struct qman_cgr *cgr; - spin_lock_irq(&p->cgr_lock); + raw_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_irq(&p->cgr_lock); + raw_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_irq(&p->cgr_lock); + raw_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_irq(&p->cgr_lock); + raw_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_irq(&p->cgr_lock); + raw_spin_unlock_irq(&p->cgr_lock); put_affine_portal(); return ret; } @@ -2512,7 +2512,7 @@ int qman_delete_cgr(struct qman_cgr *cgr) return -EINVAL; memset(&local_opts, 0, sizeof(struct qm_mcc_initcgr)); - spin_lock_irqsave(&p->cgr_lock, irqflags); + raw_spin_lock_irqsave(&p->cgr_lock, irqflags); list_del(&cgr->node); /* * If there are no other CGR objects for this CGRID in the list, @@ -2537,7 +2537,7 @@ int qman_delete_cgr(struct qman_cgr *cgr) /* add back to the list */ list_add(&cgr->node, &p->cgr_cbs); release_lock: - spin_unlock_irqrestore(&p->cgr_lock, irqflags); + raw_spin_unlock_irqrestore(&p->cgr_lock, irqflags); put_affine_portal(); return ret; } @@ -2577,9 +2577,9 @@ static int qman_update_cgr(struct qman_cgr *cgr, struct qm_mcc_initcgr *opts) if (!p) return -EINVAL; - spin_lock_irqsave(&p->cgr_lock, irqflags); + raw_spin_lock_irqsave(&p->cgr_lock, irqflags); ret = qm_modify_cgr(cgr, 0, opts); - spin_unlock_irqrestore(&p->cgr_lock, irqflags); + raw_spin_unlock_irqrestore(&p->cgr_lock, irqflags); put_affine_portal(); return ret; }