From patchwork Thu Feb 15 16:23:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 13558797 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 48F47C48BC4 for ; Thu, 15 Feb 2024 16:24:37 +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=S3SzKXCortVx683E+omM3K3b2XJEs3QdPL265HKwkfo=; b=jJVIOikB4n+mm4 TcYmIK775en6C3S9Tg+XbzfxCiKDWoXdHXJIlLShiitoLIUGVFQFBYzAog0XxZv85rK6QxrZb/Q0T fJI2vqnjtSQaj8bqFJSxhW45QIWsB+MGSjzYIx2rplNr2raAAZ5ub+IlXuudI360tTU5QCMc+TCav 81LU0OrKKLW6q7jLpCd/NT/OfrZqMCXHX1H5IiRKY8YI1L4vO0+uHhrEnlSI+nGSJbdw5qZtKcgGg 39koLXZsV+C1zT9hlDksCGpCO0pMYbsNV+9FhyE+nLPZMAdEs5oUeIYOEFbKlYDdCyU2c4DK2TIBn 0uMLd6noP1kFE5gjAF/A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1raeX8-0000000GxQp-0QZh; Thu, 15 Feb 2024 16:24:22 +0000 Received: from mail-db3eur04on0728.outbound.protection.outlook.com ([2a01:111:f400:fe0c::728] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1raeX5-0000000GxLM-0Jc0 for linux-arm-kernel@lists.infradead.org; Thu, 15 Feb 2024 16:24:20 +0000 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=ZEsR0AQ2/m4rodyOo/qMais56d7q469Dghg8SNbyNj9yUbsDkPIVW5D688pXC4yd9ZIfTIbQeATnZXg1Jd6jd9mj3H7vzAHYJPXKS1eCKh9CzCaHud+qM8MsXbSGtkx5G9ge8xT5cBnhf/iF/2li4/IljhKVEc2OR2p0SH21aPPD8nWCvxXapgOVrTOUerKv+rPYHaqK7nG/CdaXlKLyqZd1kMQhkrYXQdWbXBkv3OPGmm06TKcW8BzOc7lWhr6yvAZ4kobyk5aiRDYZmiIObhYs4uv/QNn90Z5h0fOxW5uZRRdslIbnnJXg6a4zfpZdyQOE/wyDYfvU/n2N6hUj7w== ARC-Message-Signature: i=2; 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=496/upkUn2GgvHeFGCm5RARjOGu0oZ8t9EtrzqYBlH4=; b=n/7YkcgGkwFFQD6p6EiqLY4x0riGfVbOz0GYzI+dOgF6oqGyQnhilH8ERdg8Z7ZGgcjetT4hiq4IMCQIgm+dQQlYlvGh2GpoQxF51svQPFfWm8mXYyJFD/IrkzwLAUJLIgjjUP1PnPks9wbKIojMwyD+XF7lSBrNWWgfcaO+LBal8e4++U9nqYPH7F45fKVQ39/fC7wA2vic7COKabqfD2XTggCBeIhUvvzP1geB24dESUUBOmnmxEoSYl8PZYdQ86clzBUc8mnI2+LSxofPHU3rQL5+U9jrmVcwKcb7kpn3Ke0JaV11hHIvAv1hkoPDIxai0H1zg+DdhepPu0++KQ== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 20.160.56.83) smtp.rcpttodomain=buserror.net smtp.mailfrom=seco.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=seco.com; dkim=pass (signature was verified) header.d=seco.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=seco.com] dkim=[1,1,header.d=seco.com] dmarc=[1,1,header.from=seco.com]) 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=496/upkUn2GgvHeFGCm5RARjOGu0oZ8t9EtrzqYBlH4=; b=A/lSDHFZo1hYpz62RvnM2XCqILKsow5b5XNP843hOQdt/CMh3Wr4CZF5nRn/fOMnfRIRpS2Sjy/VjfgzgmfI0ve+p5j/y4CJNlhmPypPRKh/rxoyJ9Z0vqcLnYIBI7B16vEia8lqPZfftdmnmvhZA9CdJS8pAHShiNpmI86S22iIJ9icaGuly6tCL1TiZ3ol4k1o1m+8nvBOtuqcHF+/ceoKn7YF/mPmM1s8soHAUo4PWjNBfjFTk1IGASrs4FtcYTgXCMrzcfurqZjbh1qFUFn6spAr1S3AW2OEKAs38RdFR4tJrzemiwocoJqtSV3I4sjx2rjMjjo5HvFosbuUBg== Received: from AM6PR04CA0063.eurprd04.prod.outlook.com (2603:10a6:20b:f0::40) by DBBPR03MB10396.eurprd03.prod.outlook.com (2603:10a6:10:53a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.26; Thu, 15 Feb 2024 16:23:47 +0000 Received: from AMS0EPF000001B5.eurprd05.prod.outlook.com (2603:10a6:20b:f0:cafe::9f) by AM6PR04CA0063.outlook.office365.com (2603:10a6:20b:f0::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.39 via Frontend Transport; Thu, 15 Feb 2024 16:23:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 20.160.56.83) 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.83 as permitted sender) receiver=protection.outlook.com; client-ip=20.160.56.83; helo=repost-eu.tmcas.trendmicro.com; pr=C Received: from repost-eu.tmcas.trendmicro.com (20.160.56.83) by AMS0EPF000001B5.mail.protection.outlook.com (10.167.16.169) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.25 via Frontend Transport; Thu, 15 Feb 2024 16:23:46 +0000 Received: from outmta (unknown [192.168.82.133]) by repost-eu.tmcas.trendmicro.com (Trend Micro CAS) with ESMTP id 5E95B2009538A; Thu, 15 Feb 2024 16:23:46 +0000 (UTC) Received: from EUR04-HE1-obe.outbound.protection.outlook.com (unknown [104.47.13.51]) by repre.tmcas.trendmicro.com (Trend Micro CAS) with ESMTPS id 9BEEE2008006E; Thu, 15 Feb 2024 16:23:44 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AeIUsF15v8OIVXrqvL50IxapdvrSzK1o99f3GPzPVjikKKETEKjAJ0in0q9DM1xKL/jHSEX3X0fJfp3HMVxRgPVKojwdpqgyRjJcjDMqmFxkOuEIGLbDz6CPDMEMcUt5BckmxeDHj0WTqhhIVoeTlSb0UjcyGNXBY+HfuITtcHEQJN7OgZYdE7ljrNChWmM9Rb1AdDZSSg3p+S/OpKiPVpXz+TgREkXvaQcDzB0kooZnWjQ/j4WEssWx61yUn4quMsBafo7fIv1P1BhRK5XwqBzHh7DYB7C49HFnHiSXcHoB5zd2Z4sHMwHqr4Ek4jbl8MKN95N6JkbmA7jf5A/HLg== 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=7Pl0muCwfJCJNxbXBOEYL0CLXTDvyuWunEPeFHQtMOE=; b=UIDe5UlrFuL8M6CnLHlW2O+clJYBl/x0WBJJX+yZPynkpEuHfrT8fCQddUM32EGGDLG3JWd4dueKI9sOZSZmVRUxDtyHgGQcEktiEjHT9YKMZk0Eno0fH1B9/RNOG0xzVUwVqWS9bEzrOsG0b/EnPxPm5cFRiQxENWYFazOvvcEzpR8VAyfimcsNvqd81qcCBWVqXr0xSYlDKdfFPo9EuqsEa68aUi4KymgIm7A4nee2pMtkeAjU4ssEJo2QiglUN9sQwiyD+VHXyL70TvAF0aOq5b2uL5lHZY/F7YYlsriIyAPpAnHSN7iLfgynnBfe2328mwrp00CIrXTEEGdAzQ== 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=7Pl0muCwfJCJNxbXBOEYL0CLXTDvyuWunEPeFHQtMOE=; b=OyrJlZgsnXzmzbht/3AdUezUgod8wNecUZVyXHwkpAYMT97hv24UnX/CPB29/cj5pniT+GiuA+RnKonwNdMn+q9Hk8eRIqYw/EfCOCyS5obiEWaK7YLeb/QgHUeEKmdn061LPiXNqU71HImyFXu3RcBk2sPGgdC7AczmM3y1WLi5GJaOFcGB4zqizxQV/WlFToCe9ZXwvVk8TcX0HidJCJf380M0s+ZifnTk4LVFfow70z6V4G8WcDF+St8H9CpFRF6LsAiz3MkBosg0nI2OcR9ny7x2GAzStupMe3ol53WfwT9U/fvCAgmb5HCNlbYW68t+gDB0yJO/9Z8eNq81Hg== 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 DBBPR03MB7449.eurprd03.prod.outlook.com (2603:10a6:10:20b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.29; Thu, 15 Feb 2024 16:23:42 +0000 Received: from DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::18b0:3c00:30cb:711c]) by DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::18b0:3c00:30cb:711c%6]) with mapi id 15.20.7292.029; Thu, 15 Feb 2024 16:23:42 +0000 From: Sean Anderson To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org, Steffen Trumtrar , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Roy Pledge , Vladimir Oltean , Li Yang , Camelia Groza , Claudiu Manoil , Scott Wood , Sean Anderson , stable@vger.kernel.org Subject: [RESEND PATCH net v4 1/2] soc: fsl: qbman: Always disable interrupts when taking cgr_lock Date: Thu, 15 Feb 2024 11:23:26 -0500 Message-Id: <20240215162327.3663092-1-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty X-ClientProxiedBy: SJ0PR03CA0169.namprd03.prod.outlook.com (2603:10b6:a03:338::24) To AS8PR03MB8832.eurprd03.prod.outlook.com (2603:10a6:20b:56e::11) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: DB9PR03MB8847:EE_|DBBPR03MB7449:EE_|AMS0EPF000001B5:EE_|DBBPR03MB10396:EE_ X-MS-Office365-Filtering-Correlation-Id: fbbf3797-9fc6-4eed-75bb-08dc2e427c2e 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: tnG668E4SNB6rQHMmgtoJPCVCeSyBHh2CxicGa3M0cClWbC/JjGno8Hs1mICWvjgfSNRXsyJ9CKDhAmIlCJCPagvcxIcEhzLYVXcIY9vNEgSi3Vy4Uw5+B7nJ7P++SSa/hHK81gFbhpqqewf6KvoRewL5A68ELWrsQELbVbPmnNNX72ynk1GvOhk3P0H66sipXXCII4HfzodKoiyTNE6iu6pz/nU/9ukh+w6aPKBRttwqoj7MZaZRHYpN31/fPLN4Yq5TmHXP8aTbaT7hl8Fz8p3ygmel6xLg0U5sDar71YfTZw0C7zGZG/bZoHU4wVokY05MbJTi/5C9N/6wWK4YA1hBpamILcTQqOTeX4OxrUTyl1S3vvoQ4xVzuID5ttlxfq3LZDSy1VSqJYLM8NAmNGn68KL3YVl9NBCN2T37Fw8uGKLpntO+L4VFxilFFA6J3ELq3vwNEA3/0VmI0+H4JdHwmtX7+k6khKMIp8ZPmatwD0agiDD3GKPKOr7I0UuauY6nrd7DRVLEhUNsCSplLcyaxBGhyWXHOZBFQYn6eEp221OihYwpipkUFDptXStLbA4ErG6w9vUMgqNllxisInlEQEpWyz//ZggQMrD0/E= 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:(13230031)(136003)(366004)(396003)(346002)(39850400004)(376002)(230922051799003)(64100799003)(451199024)(186009)(1800799012)(2616005)(41300700001)(1076003)(26005)(2906002)(8676002)(4326008)(7416002)(44832011)(66556008)(66946007)(5660300002)(66476007)(110136005)(478600001)(966005)(6486002)(38350700005)(316002)(6506007)(6512007)(6666004)(52116002)(54906003)(8936002)(86362001)(36756003)(83380400001)(38100700002);DIR:OUT;SFP:1102; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR03MB7449 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AMS0EPF000001B5.eurprd05.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 95f58879-c10c-452b-2a23-08dc2e427952 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +aISMcb8xGMjYRankcQoFNJ2NU4i2U30dk3+UlbqJ5bd+fySVWNeBzgdp1RoL5C8SK+cUoqK4BabQdcCVf1ZOH4pcI2mdfL8Ub+T5wcTCNjyhK9CTpGiokWM25oxvFeHx9GNYzzr5rWARv/HYesRT1klegPc8ndJTNfAv0vyl0w+FOUtF/FIboZT/oVZ1yReyV+QK7+6zU0JC7wRyUo6RgCuM8NOHgVoyfObTCt3/yo2vNwhUcQFQh2EBkLEgZRoiyQby5Ty2rkDgKjcf4zbD1p8k+d4qrU8C0iAoCiTlzOMYj0MeKyi4M4hfFlxYUh8nSsLOCXtD/uiduwgO2odLGPglCrG15GoBAIShISgyLFXkVXSmv4q08ebnLakSucU+BIkohyM1G3WBRGlxLnSh83Vt9WNdfvE7jWR+3+6ybhpwbV91a0hKCXOau8Faf0nDVZuc+SNBFjB7CT1MoaxDlUnbtGMoMG4LqrzamCojreYvAYhIiiP9iANS4pWZjCMRkkZgTyqDPK1ve/DV7xH0ULD+etD10lWF4YpO1k/WhI9/4vDDN2XexzXEHazvRFLDwOofraUTZFp3FIuoAolGiChVQZJB83KERbU7ArPgPJfrziyTHzERW1jfojDJFg6CJ6oUprg/AeThKl1FNbJmQ== X-Forefront-Antispam-Report: CIP:20.160.56.83;CTRY:NL;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:repost-eu.tmcas.trendmicro.com;PTR:repost-eu.tmcas.trendmicro.com;CAT:NONE;SFS:(13230031)(376002)(346002)(136003)(396003)(39850400004)(230922051799003)(82310400011)(186009)(451199024)(36860700004)(64100799003)(1800799012)(40470700004)(46966006)(1076003)(26005)(356005)(7636003)(7596003)(336012)(83380400001)(82740400003)(2616005)(41300700001)(4326008)(7416002)(8676002)(5660300002)(8936002)(70586007)(70206006)(2906002)(478600001)(44832011)(966005)(6512007)(6486002)(6506007)(316002)(110136005)(6666004)(54906003)(36756003)(86362001);DIR:OUT;SFP:1102; X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Feb 2024 16:23:46.5437 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fbbf3797-9fc6-4eed-75bb-08dc2e427c2e 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.83];Helo=[repost-eu.tmcas.trendmicro.com] X-MS-Exchange-CrossTenant-AuthSource: AMS0EPF000001B5.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR03MB10396 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240215_082419_144986_46775101 X-CRM114-Status: GOOD ( 13.87 ) 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: 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 --- I got no response the first time I sent this, so I am resending to net. This issue was introduced in a series which went through net, so I hope it makes sense to take it via net. [1] https://lore.kernel.org/linux-arm-kernel/20240108161904.2865093-1-sean.anderson@seco.com/ (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(-) -- 2.35.1.1320.gc452695387.dirty [Embedded World 2024, SECO SpA] 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 Thu Feb 15 16:23:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 13558796 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 0FF8AC48BC4 for ; Thu, 15 Feb 2024 16:24:21 +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=7uj0VCE0qTRTqLVt7TiDeBGCGJ8pf0u7X6KW7eci3xg=; b=SP3YrGEyS4G5z/ Pl0et/+9bx+X8tVsq4WdTJwIyz2oR1vvOhr2jhXpWpyaLR8sJiMabSvjojYTsgwC+2gbJSnXcXHv3 RLwlqnzWc+06f3t/bJLHCmZyE22z1Uo8vd0LY6LKvvMmeLlg2fuGwaX+eBymVfknhnEcRnD0Z2yyO pGhrgEXZkWEJN/piaOCQRvZYSZ6SjTsaH+neUtuQIASk5TaXt4WSONenjouFIPtLsc1NXrM4K+QKn KMfbaTkXsC506gjkPvBQMHzwnceq3yGGAzucoYjyXBF3AnETj9IFncuULu6T9X5bPktrCKIvsHFVj 0+OMI+wDVTi5BZy+VeSA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1raeWn-0000000GxLz-47Re; Thu, 15 Feb 2024 16:24:01 +0000 Received: from mail-am0eur02on20701.outbound.protection.outlook.com ([2a01:111:f403:2606::701] helo=EUR02-AM0-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1raeWk-0000000GxLT-2jVz for linux-arm-kernel@lists.infradead.org; Thu, 15 Feb 2024 16:24:00 +0000 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=RtKFi39By33vVyoV7/O843mJpiAIMNxpVRxJc9HaeLjVp8SzFFwcv8d2Uqf91pYc05BdQvoICUwaIgLkFJrixtlrGmZe3v8ZIKQNPUEjdLlbVgEmJYWBKwskNd9CsmCh2DFgE1YdJo7X6dOltMgrejKU+Qh8PuZccobuOCTLYaIywjYd8LXtl3We/nNVaJ5JdAsTfkTbzB7iLxTD09xc5o4LDo4KTraeIDqrZ2nkYHmk/0HQBGrnCh7bdBn5SiYfQg0KKCSJyJm1yQqeNa0kp8Ufqy5jztwXdp/vAH90pcJDbFTtPysPXsRSKuvvoVi9btjZfrRyS1bLUDGf0/xJBg== ARC-Message-Signature: i=2; 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=jlx03JhCTno9jUWLQgpIAIW8zynONyGFe9wsiSOTRDw=; b=bZlU92R7sXurEjRsLGPpGN+QPtAcMiczee2TLjXxqtdmIX1lfg3gVSiMgBSLTlJFH0cx9KUjN1xMNgnVgvSc+v2YiC/3TEHB+hzQcZIDrOdRtXItvmU+MjQccC2FNYSE9W+PPrqqaxm5H9g/07RZVgoN509ad0MMXo3Mk0uCx5o4emaQyRauSvL7aL4bS0uJ1oypV1ZGsIB5YQrGXF3ET07toMF9u1qOyVnpK/OTieQscHlpouBybeLOlNE47vWWhkGi3Zrml8U3lK/OUVImdMUJfEBZlQUW9vlnXSuVM4eS6l16d/vg6DSlguc1atGo04wdn/8g24dMl1kchLoHUw== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 20.160.56.81) smtp.rcpttodomain=buserror.net smtp.mailfrom=seco.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=seco.com; dkim=pass (signature was verified) header.d=seco.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=seco.com] dkim=[1,1,header.d=seco.com] dmarc=[1,1,header.from=seco.com]) 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=jlx03JhCTno9jUWLQgpIAIW8zynONyGFe9wsiSOTRDw=; b=VblIBaZH1t3ChZFMjrFa/TK9W2A9cQ2gB9Py/rVJBp/skSPP5Qw3VMTMF86Pcmq/DdrD6Ts1NInmMMFRNHPoM9H1pF97l7xqKddf/s6whOVbotiEQ6qfZ4z9Fv+87FZ/HrT1fc22+grI6ycU5bqKSC1v3VB3vxPn5IbPiDHHWzKVZTAPGFzayczm7BTPGgHeZE5mdOvfXIERZBz9GzZfg8cxPRa/+cvHQOOD5FaLB0vKvP3LopZc1DdQJ+nnix3pvfmCdP/3CC/linFssSBAeb4dG1V/WBXbr3duWz5eGWXBiA0HQqR+Gr2dy0jS818RawVOkIqHlAQMh3vFYHpIGQ== Received: from DUZPR01CA0174.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b3::23) by AS8PR03MB6760.eurprd03.prod.outlook.com (2603:10a6:20b:294::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.29; Thu, 15 Feb 2024 16:23:51 +0000 Received: from DB5PEPF00014B99.eurprd02.prod.outlook.com (2603:10a6:10:4b3:cafe::ab) by DUZPR01CA0174.outlook.office365.com (2603:10a6:10:4b3::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.26 via Frontend Transport; Thu, 15 Feb 2024 16:23:51 +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=repost-eu.tmcas.trendmicro.com; pr=C Received: from repost-eu.tmcas.trendmicro.com (20.160.56.81) by DB5PEPF00014B99.mail.protection.outlook.com (10.167.8.166) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.25 via Frontend Transport; Thu, 15 Feb 2024 16:23:50 +0000 Received: from outmta (unknown [192.168.82.135]) by repost-eu.tmcas.trendmicro.com (Trend Micro CAS) with ESMTP id E7B812009538B; Thu, 15 Feb 2024 16:23:49 +0000 (UTC) Received: from EUR04-HE1-obe.outbound.protection.outlook.com (unknown [104.47.13.50]) by repre.tmcas.trendmicro.com (Trend Micro CAS) with ESMTPS id A66162008006F; Thu, 15 Feb 2024 16:23:48 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Zf1ZniC9dqbvfoq/N1XHift8LMZeY6evuJfzokInEUkJ48GO5WwmivHh0uStqkM6swIzYJCs1TM2/BPrr/Yrd1zrrtdYFjqtHiNBKdei7Y+tTCyVhhUo21wOCVFLvEW1QLuKVhXnn0jJoFieyWWAtGbOPlUwDEbRzSTpC6A2iKGtWXf4ItJsO+OeQ6NzJ+mPS3++kS+40YBVKyo9hq0gxiXqkpDlxDInGMSRxXbz8hVBFeOkXnCdCpwmSMb0PqHg0YAVZyS2vK9Hbr75gyCZr2L+MWoNIuH66w5Tcf7iLwjmGMRhdBgxDOfh8kWr4yKoTAXu917Xu5fOEyr0AAgFSA== 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=8DytUrVWR95h3Q4eeZYQUgaBhB4FvzKGExtvrD5P5TU=; b=n/4xySXcZy0PdwQFn5dSJMoisf3NiKCq39DyulI11TA3SlHaI8GAkroSsCoSEwqIbUv3zp6dsUJ50bjQj95O826Wwrsv4Zik4kQgDT5FhdaxbowcHfyBZwHlWoIlvqaCS7yhz1JqRse7W66F9FZzDHOCJsrsdbiqz7DCBqSaE0Svi4fvBVUbwj9vjsbAXcqbOocvGTE+7HovmrvozhJjSzkQO399kqQNh/LTCSRV/+LFex+S9dZt2oA5hO5zNU/Nc0pQxRKGifAQGX2FTz/EWsoGzXnMR/ryw/R/yXLFhm9cZfqDTtNy8g3qnlclFX9z0UCRyZge8ub5ptGBQljWuw== 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=8DytUrVWR95h3Q4eeZYQUgaBhB4FvzKGExtvrD5P5TU=; b=qS6chMEN9wBXfgxqs51bG1bSqS0SJKsyXgNGnVwxrS9q2DsmchuW1YtBt9YQQM8TyPdQJkTk+2ZlNQ7PvW7qAbB4XgZ75aNoBFUcxmwXxFoF879oZCK/p+66iq8WYQoEPvzy148oILYr4HDEL3V1BO8Op/PtxxgTb+PE6gVe/LG8aPfIZ3T0eL/dyOx11wWrK+wQOxeCmsqT3SAc0NriXBaoUC1PxRDklQBWQ3W4I2R4eRr7djIAvq2Pz0t+DN0LRZjFDhN5/7WLllcFTTBOSKB13BatYEtMtctriMTYJgox6b3464OC28qFcLmtLj8TNvnPUv9hVPgrkv4HqoJMNQ== 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 DBBPR03MB7449.eurprd03.prod.outlook.com (2603:10a6:10:20b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.29; Thu, 15 Feb 2024 16:23:47 +0000 Received: from DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::18b0:3c00:30cb:711c]) by DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::18b0:3c00:30cb:711c%6]) with mapi id 15.20.7292.029; Thu, 15 Feb 2024 16:23:47 +0000 From: Sean Anderson To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org, Steffen Trumtrar , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Roy Pledge , Vladimir Oltean , Li Yang , Camelia Groza , Claudiu Manoil , Scott Wood , Sean Anderson , stable@vger.kernel.org Subject: [RESEND PATCH net v4 2/2] soc: fsl: qbman: Use raw spinlock for cgr_lock Date: Thu, 15 Feb 2024 11:23:27 -0500 Message-Id: <20240215162327.3663092-2-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20240215162327.3663092-1-sean.anderson@seco.com> References: <20240215162327.3663092-1-sean.anderson@seco.com> X-ClientProxiedBy: SJ0PR03CA0169.namprd03.prod.outlook.com (2603:10b6:a03:338::24) To AS8PR03MB8832.eurprd03.prod.outlook.com (2603:10a6:20b:56e::11) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: DB9PR03MB8847:EE_|DBBPR03MB7449:EE_|DB5PEPF00014B99:EE_|AS8PR03MB6760:EE_ X-MS-Office365-Filtering-Correlation-Id: d331267b-a90a-4761-37fa-08dc2e427e65 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: e/DvRgaRvJE/Pv0ZeXy/3ra+8QP1edtcpHsDzIzkTaCf5updcFw6dXcYhpWxrKyAAy5N/8hxnTwrXctBFDstqo9QUg7qP/v8uVB/fbJVQRhbeWj0S5Zw+nNlDRIs9VvRW6YHvy3O0ILJiTXjZDxk3ImA02aRZ2l3CIJgoKV3saF2EssjxS5yp5raw6xXebw21KabM2B0wMTLKPcOKfYEj4JJEt+Dleu1hDh1aaa/smFRSylOlrnL46RErQ79hcvB+46Iz6d7MNb6ok+IZs+LHu4Op+mpCuhjBVOz/VdnmnAb4jDlIMhcpCB4rSE0UoQ6MYGprFFR/EI2kQdYkPC6WA/kXKSMxgkaX2be/Wufyew1Rm1L3scLOHVbwHksNcrZkxuLcz/41jJ6QGVczSYyeLAAqi42TTpTUzR+2nGRFbc+PopMZ9zwYMP/JtTo4crfKW6JGEnMrHb63AZGK1FGYPrYJtJz/nmehCGxq5GIU7ynNK2RSe1Gxjt5VMVobm2lgafOF2tht/LaoXt5NnkxnqsowsZ3gGg1imQF5y5uOPeSQwCp1Z8pd7z2VRLAoXwmq+uZHdLVnGNKU99vQEBNHxbqsrr4hcUoHdMs+1c0Hqc= 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:(13230031)(136003)(366004)(396003)(346002)(39850400004)(376002)(230922051799003)(64100799003)(451199024)(186009)(1800799012)(2616005)(41300700001)(1076003)(26005)(2906002)(8676002)(4326008)(7416002)(44832011)(66556008)(66946007)(5660300002)(66476007)(110136005)(478600001)(966005)(6486002)(38350700005)(316002)(6506007)(6512007)(6666004)(52116002)(54906003)(8936002)(86362001)(36756003)(83380400001)(38100700002);DIR:OUT;SFP:1102; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR03MB7449 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5PEPF00014B99.eurprd02.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: a2237568-6ae9-4845-aed8-08dc2e427c81 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 87/M1JFW78Q8IOackz2bhS/dBZNGZYFaUhSaL8DBo01IoKBcOxYaWEZOyRcEEdOkWvI8Rpv0T40W20sf37l0x2NB5k7dnl8UY7tjMUK8oSXa7EM/q/SmnBtfG7GuLNEFNNh9tVjQWXulZU9wNsgSlS4WAJmn41aWaS2b+K9AHSXDUE43jH7EyLVN5wCoUGHUoN7mI5IbDw+YEtUNTCDbZT8v0k9KkcmTdxExr3kN/FBqIR/cnPAwgEi8npAcJE0ZtF0vQrXaaSen1DwNKQuXSHSrnVF3D8Nk1suKxRHLZLHtbPnHwIQ/d9rdpx90cv4mpVRg4j0El1Cnnmld59/E3d/bFYYMg1L+cNnfgzKeGTbO6UvaZumpaWO1TT04h5kA3pHvM5iZ35l5QMeDg15xMrPfKQabiQHcoDaC3VFHOGaTRJ+0DySz02VOTurqXtUa5d7MSthE5h8O6BCm6u/e+AZb6MllMHjb8HMzdL1nlfxH3MHawZEeGZyQB6YjDfYjmU52Skstk9EXDxIfyi1c2o2FG+m/CWOBUZn/lANT2ju9h3eVDJ00onLN2d0jM9nQBgaiir3qvG3uGPv4bKoastNqsE5H0dXHpM73WY7YFX2m0GsHIBqRUsGnV0fKl8Ac0ZE+P+DDXHzSbUwGVK/gSg== X-Forefront-Antispam-Report: CIP:20.160.56.81;CTRY:NL;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:repost-eu.tmcas.trendmicro.com;PTR:repost-eu.tmcas.trendmicro.com;CAT:NONE;SFS:(13230031)(376002)(396003)(136003)(346002)(39850400004)(230922051799003)(1800799012)(186009)(36860700004)(64100799003)(82310400011)(451199024)(46966006)(40470700004)(82740400003)(7636003)(356005)(7596003)(966005)(44832011)(2906002)(86362001)(5660300002)(8676002)(70206006)(8936002)(4326008)(70586007)(83380400001)(6666004)(336012)(2616005)(6512007)(6506007)(110136005)(54906003)(316002)(6486002)(478600001)(7416002)(41300700001)(36756003)(26005)(1076003);DIR:OUT;SFP:1102; X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Feb 2024 16:23:50.2424 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d331267b-a90a-4761-37fa-08dc2e427e65 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=[repost-eu.tmcas.trendmicro.com] X-MS-Exchange-CrossTenant-AuthSource: DB5PEPF00014B99.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB6760 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240215_082358_884812_79CAFB00 X-CRM114-Status: GOOD ( 14.65 ) 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: 96f413f47677 ("soc/fsl/qbman: fix issue in qman_delete_cgr_safe()") CC: stable@vger.kernel.org Reported-by: Vladimir Oltean Closes: https://lore.kernel.org/all/20230323153935.nofnjucqjqnz34ej@skbuf/ Reported-by: Steffen Trumtrar Closes: https://lore.kernel.org/linux-arm-kernel/87wmsyvclu.fsf@pengutronix.de/ Signed-off-by: Sean Anderson Reviewed-by: Camelia Groza Tested-by: Vladimir Oltean --- Changes in v4: - Add a note about how raw spinlocks aren't quite right Changes in v3: - Change blamed commit to something more appropriate drivers/soc/fsl/qbman/qman.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) -- 2.35.1.1320.gc452695387.dirty [Embedded World 2024, SECO SpA] diff --git a/drivers/soc/fsl/qbman/qman.c b/drivers/soc/fsl/qbman/qman.c index 1bf1f1ea67f0..7e9074519ad2 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,14 @@ static void qm_congestion_task(struct work_struct *work) union qm_mc_result *mcr; struct qman_cgr *cgr; - spin_lock_irq(&p->cgr_lock); + /* + * FIXME: QM_MCR_TIMEOUT is 10ms, which is too long for a raw spinlock! + */ + 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 +1479,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 +2443,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 +2480,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 +2515,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 +2540,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 +2580,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; }