From patchwork Tue Apr 4 14:55:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 13200407 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 D15B2C6FD1D for ; Tue, 4 Apr 2023 14:57:19 +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=0aa+YiYUH2h294kim/Ye6zt96SB+PfKzi2K7feKxzmA=; b=E3hs7Vw2+bXYWn pSoeuYOuw1pTrcHxzS+otvbmgk2URawMhcw1UMPMt7fVYoRSotDhtpu/qz5Uc/ni5cSWfSLoV1Kjf Am39F1o62cpPGGOJID+C8qriXLRcMnOKMrnDk+8CAxcxFXW/m1zzInPO810hyc2KGCWcXQgvphF+c MZGVbddTsgnH3BDJSBM24Qjj93VKY1bwoR22xbu0krAVCJIktRXYML50KMns6Nv8d5oUqNK5X9WEU tHnvtfnfJQn1eJvjN2QNa6qu1SE/NvC3y3IEViw8/0fAqu/5Ku2a8uVOHcw6d9W29DO8jDWxLP64q ewL3HsBha5eZ2S9YPByA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pji5C-001tke-1X; Tue, 04 Apr 2023 14:56:26 +0000 Received: from mail-vi1eur04on060a.outbound.protection.outlook.com ([2a01:111:f400:fe0e::60a] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pji57-001tjV-1e for linux-arm-kernel@lists.infradead.org; Tue, 04 Apr 2023 14:56:24 +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=C6fXCbHRRVft0iNX+9haj0XnVGCo0rNodsR7gxZbNqA=; b=h6VTEWYXkhYUEIVVGwqlL4r8mbnmtBAlGu8jqPJ+wwF136kQa4l0wZ5YL3CH6X8C0yxQhygS8nuPTLq04e+9Q6/9yV0UjY0B+QSzw5JmI496nMyCoNwX7eUeI8fHtHH/2/9TlnytjYYfVAAEDEJF8xsB/89PgwOuXeNKOlKoL7nXkn22pXgSnjd2O9vRcEt39YhITJyAdFG+reYy+qf5NRd+tVw00IDsqCETOuW3YcIcC3lUh1+GN+kkZfx476V9RkrHoOMthxDNFaO4j6pV2KqiEzMrVRfGZUyOqO/TrdTevN/sCeOrB35XhoRatZdbm84tQ0uD2HUFu5sZ7hpcYg== Received: from FR3P281CA0106.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a3::16) by PAVPR03MB10141.eurprd03.prod.outlook.com (2603:10a6:102:32e::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.33; Tue, 4 Apr 2023 14:56:16 +0000 Received: from VI1EUR05FT040.eop-eur05.prod.protection.outlook.com (2603:10a6:d10:a3:cafe::9e) by FR3P281CA0106.outlook.office365.com (2603:10a6:d10:a3::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.28 via Frontend Transport; Tue, 4 Apr 2023 14:56:16 +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 VI1EUR05FT040.mail.protection.outlook.com (10.233.243.186) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.45 via Frontend Transport; Tue, 4 Apr 2023 14:56:15 +0000 Received: from outmta (unknown [192.168.82.135]) by inpost-eu.tmcas.trendmicro.com (Trend Micro CAS) with ESMTP id 6F40B2008026E; Tue, 4 Apr 2023 14:56:15 +0000 (UTC) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (unknown [104.47.17.104]) by repre.tmcas.trendmicro.com (Trend Micro CAS) with ESMTPS id 5117820080073; Tue, 4 Apr 2023 14:56:53 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Nb1hd/f46N944eMjMaw2gsRIALgbOOAxwYld7aO7TGXlR78q40E8fcJ9Q0OrJEI/Z5yCDsShuSSmj/GgU/xLj9QuCQHHUjg2TLY7PrtrA7MalvYcesRFsMbsyAIdjD6cKGTTxRhQWDYfMeeDTykqpZ6fxy1ZU7BPJwm/XxjRVpA0DLYK6DVqeUatyjAHW4RXLp0Srj3w7t0Mf9ZV5uZrTjgl4HjWDO6L1gv1KPqax71U9FBlmSLhXIop5Jk5VafCuabwjLBL2kZ3qnMNALOZTOL6Yryh/KDMolgEDwznzu12Widhqb8rQn0LJdC3qsHZRZ49RoEy+7QlgiA01xDEKQ== 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=C6fXCbHRRVft0iNX+9haj0XnVGCo0rNodsR7gxZbNqA=; b=KPCZ9JepjTpuCNzN4fgMQSf1ZU+SODHYGoo+8ibqu0cvLo8usGO9Xa+8BlhZrYSaYWQWycsvFICthLKqfc2wScxkbUmvJQGNrWH889WHsBmbe4UyhkGmLol9eLBBsPoO2WB5ZGuH9IXd0IVrdtpm8gm+glty+zUq0iB0zYul8rgeJD9zKAxDKpjjR9PgpBky94WQR+8ZRxVurQyQBsplRElfDGl+66MY7V7VwLFyLlJvOBRtUvdcn66o1OZ7tTnAGlFuVfw8GBktKWElZ8njvp4a1q9XJsMUVsd1TXapQaVtL+O4Ju3jDIZ3qaIza5vyBStxWLVak7aj61sy8a67Tw== 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=C6fXCbHRRVft0iNX+9haj0XnVGCo0rNodsR7gxZbNqA=; b=h6VTEWYXkhYUEIVVGwqlL4r8mbnmtBAlGu8jqPJ+wwF136kQa4l0wZ5YL3CH6X8C0yxQhygS8nuPTLq04e+9Q6/9yV0UjY0B+QSzw5JmI496nMyCoNwX7eUeI8fHtHH/2/9TlnytjYYfVAAEDEJF8xsB/89PgwOuXeNKOlKoL7nXkn22pXgSnjd2O9vRcEt39YhITJyAdFG+reYy+qf5NRd+tVw00IDsqCETOuW3YcIcC3lUh1+GN+kkZfx476V9RkrHoOMthxDNFaO4j6pV2KqiEzMrVRfGZUyOqO/TrdTevN/sCeOrB35XhoRatZdbm84tQ0uD2HUFu5sZ7hpcYg== 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 PAVPR03MB10144.eurprd03.prod.outlook.com (2603:10a6:102:327::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.33; Tue, 4 Apr 2023 14:56:10 +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.6254.033; Tue, 4 Apr 2023 14:56:10 +0000 From: Sean Anderson To: Li Yang , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org Cc: Vladimir Oltean , Claudiu Manoil , Camelia Groza , linux-kernel@vger.kernel.org, Roy Pledge , Scott Wood , "David S . Miller" , Sean Anderson Subject: [PATCH v3 1/2] soc: fsl: qbman: Always disable interrupts when taking cgr_lock Date: Tue, 4 Apr 2023 10:55:56 -0400 Message-Id: <20230404145557.2356894-1-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty X-ClientProxiedBy: BL1PR13CA0285.namprd13.prod.outlook.com (2603:10b6:208:2bc::20) To DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: DB9PR03MB8847:EE_|PAVPR03MB10144:EE_|VI1EUR05FT040:EE_|PAVPR03MB10141:EE_ X-MS-Office365-Filtering-Correlation-Id: 0f8ee172-4b6b-4aab-8033-08db351cbd85 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: XIYxLFeGKfeHXbMKnvJKAIddwtGFCPYfTyS2HPdRBMWc48cYloLTvrlMtdwjfzXJF3yrEFtq7S6+f6PmEdj1PNV3jLfCDAdzAJ2LG2RGpY127NRTFfHiP7B5S5lKWak7Ej/NHnCrvW8yzAedZq52KW5n2KVAgeK2qvr6bFOCBnAgYVRCDGnjSdrV1xo3wlX01ZmB0duyGpo4HgmmZljitwP+AJpA2BLzB6NHnjlsGo2bZEompELO/2tyr9jmuYrN6SVgoCod0V5QZfZPXU6ZGHwwSj2cOQjtNRDMqh/JfOtnshHIILEdhKjRV28DUZ4iqEw4u/tRHYvCa3ZLbbMVqxDX1W4gjfuh2qBUNbNM0fBSfAbiaxDlelDXsE8lNiZCqqxUJfucc5KACW020vNpf929jkH3R8bRTuNjLhwCirWu6/2bDfyX6Uv4rWSlF8FObOt6kUG3hjd0OoGV91cUc+et2RM0oD+ciuS5Nv4Y4X0SGfRb3weGiyHpcZR0ApfRSZwHk3aMiiNL0YOK81/lrdH8SW3FUi2NoVaVAXe6mCBcJzf1yt8n7zi8/SW+idSCuz8H09CqkMbnvl4TukXILKIGhfQynhpXoqUZmcRrZ3mu5BiraCpIOlhO8hD+XdqU 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)(366004)(346002)(39850400004)(396003)(376002)(136003)(451199021)(38350700002)(36756003)(86362001)(316002)(66946007)(41300700001)(66476007)(66556008)(6486002)(6666004)(52116002)(4326008)(54906003)(8676002)(478600001)(44832011)(8936002)(7416002)(5660300002)(38100700002)(2906002)(186003)(6512007)(1076003)(26005)(107886003)(83380400001)(6506007)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAVPR03MB10144 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VI1EUR05FT040.eop-eur05.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: f492a7c3-9130-41ab-2390-08db351cba83 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: m2RXXwxkjrw4Stf+j1XWVQWdzhFJTNXS5QhdXJ7T1CbIv4P0gEi1v9bt56AI7hhoF+jADdPhypYeIry6qQZ2lPGS8EHU1tMAxPvb1Wf6M0+TCl0XlAljxBcQoiw/UbBhpY+d12bbIFRXitmzbts8oRs3FOYVw7k7M+uLR0HE0SxyxRXLBmscr7BQqMreijfNAm87wye83ECjqANMPEJH5KnVQiIxq5wGUvH/QPQYvKPnCNF1V/NH1iH/Fypr47Ub+B72A64q/95XHNBm8tUlIF1fUJDjQ1jHuGB87Usprt2zZUZemCpALFH7uFtAbowMDW6b5LV4A1WVl27EtvGOVV5dgUQl8Q/c8kOvGMayaa8Ygd0jGURX9krDEATTYV2Oo9lIPHgskKO5wPtHbPL7mtxkpvirtD6FG3cVk1g5Bl3jd0LzHtt8HtU8kW+RnCkBFfIf8t0lgwdW3aDrHDvyM+5w+w5VcXrnZunEez36hurdgRG/JSRWtR+jzgGN587OkD/7IOau/aIiB40INyq4X0sDOduVQU3pt2i0Ssmrd8NIZc9ZbBK6wlE8inY4qBSlpEwAuytJXdBKEwgD8Y9Zim3iDSjEJEp6FK+Sc28W3mDCZqYN7mAsLXiEWC2TX7vWSZTHbytEZR8WeunnaxIRL/K4B0bUeYhxjLfTReYpoJ33yWwlRTdA0ucjdT8wAA5im1LQDqw1NOw6CF/r7tqP26URHIqLgVsjYsfiXl2+Ec8= 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)(346002)(39850400004)(376002)(136003)(396003)(451199021)(46966006)(36840700001)(40470700004)(47076005)(2616005)(336012)(83380400001)(34070700002)(36860700001)(8676002)(6486002)(478600001)(316002)(186003)(6666004)(1076003)(2906002)(6506007)(107886003)(26005)(54906003)(6512007)(41300700001)(44832011)(5660300002)(7596003)(82310400005)(7416002)(7636003)(40460700003)(356005)(36756003)(70586007)(82740400003)(8936002)(86362001)(70206006)(4326008)(40480700001);DIR:OUT;SFP:1101; X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Apr 2023 14:56:15.7119 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0f8ee172-4b6b-4aab-8033-08db351cbd85 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: VI1EUR05FT040.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAVPR03MB10141 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230404_075622_057967_38851A92 X-CRM114-Status: GOOD ( 12.71 ) 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()") Signed-off-by: Sean Anderson Reviewed-by: Camelia Groza Tested-by: Vladimir Oltean --- 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; } From patchwork Tue Apr 4 14:55:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 13200408 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 5D375C77B60 for ; Tue, 4 Apr 2023 14:57: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=cfTF/E/qBq4mSyky3iO9wtyUMHpOOjTfyPGvjSZC1CU=; b=0l30EhNVI3DGZD nKQmYC4ccoRpvrXUgvAV0/ZmsTibhsJNbzxV5b0c2LAAua9Jw5B2Y06JNHvopbTqvfaDYBDIe7Epu PuaRQtn3XjC3Q/MY5icUw/wI3jq8MjRxZmXdqRCoBSoDt5hhazlGIWtNIZz1EbJdM6rSPT4YOQ37J RolpV4J2muLEIXztOIvp0ufI3BPBZUnPK6iLbLmqwJqHXKoKvu+PEzUs7VmUZDrN2aTApfLPHXrD+ mhE6S6q7kM74k+hIW2HIzu9PZtW0L1KpmyFL+fWyVWM0wOdR/GTqNgikUcMyMOF6xQ68GM11pzTCU R1LOPGFWkkkB1xjPP6Lg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pji5F-001tlg-0I; Tue, 04 Apr 2023 14:56:29 +0000 Received: from mail-db3eur04on060d.outbound.protection.outlook.com ([2a01:111:f400:fe0c::60d] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pji5B-001tjv-2O for linux-arm-kernel@lists.infradead.org; Tue, 04 Apr 2023 14:56:27 +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=Q8yvtBCZD9P8Se9ALiAo9HFkUAu77SHsj3CkpFvRPm0=; b=g3Nn+7ataJpPtcrZaP/A0dmhgRyMKdROSHMAUcjptQ9vvm6acD71vgtY0NxL1Yf2Lff95QVo39X5Y8Bbf56kp9lwPCqyUQJQF1JIHoL0W3yoeLZzPVO9IPXlcw2wCC972yHROcru+q0n1mv2IpwlxK3cvdQ0ACRbMIwAkO1ySTHVkU/LKWF+9z5LpmFmEqpLjfa0DG28uoZuiU2J/yX7COTHxU3ZV4un12ec2X05iMJxcti4nZo4V6h6ZuPB6jhCz20sdAGM3qf172JLXJ/wNmGXlj7ptxarFTW68B0OvfqYQC/+CpQUwqnoZbBNZT0VwNAF3pD362i9ESgb8okReg== Received: from FR3P281CA0125.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:94::7) by PAXPR03MB8273.eurprd03.prod.outlook.com (2603:10a6:102:23c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.30; Tue, 4 Apr 2023 14:56:21 +0000 Received: from VI1EUR05FT058.eop-eur05.prod.protection.outlook.com (2603:10a6:d10:94:cafe::5b) by FR3P281CA0125.outlook.office365.com (2603:10a6:d10:94::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.28 via Frontend Transport; Tue, 4 Apr 2023 14:56:21 +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 VI1EUR05FT058.mail.protection.outlook.com (10.233.243.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.45 via Frontend Transport; Tue, 4 Apr 2023 14:56:20 +0000 Received: from outmta (unknown [192.168.82.135]) by inpost-eu.tmcas.trendmicro.com (Trend Micro CAS) with ESMTP id 8EA132008026E; Tue, 4 Apr 2023 14:56:20 +0000 (UTC) Received: from EUR02-VI1-obe.outbound.protection.outlook.com (unknown [104.47.11.46]) by repre.tmcas.trendmicro.com (Trend Micro CAS) with ESMTPS id 3F0F22008006F; Tue, 4 Apr 2023 14:56:52 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CNGCFtcXs872mkyhxeyrvloxZso53+PPjYb8PC66rjw27L4HPZF6DIo9cIsqrf6sjCJOooTfncXD3b6Qe9+F/+lCyzE2O8dkXJfqgrGZsV1tqKQGrrDDGDZdpj9lLuEA4qCVEAxcEEf4DqMtJ9oYm3QeCOZp4atlyV+uR6YHxidre+i89R8A8+IHJ3AQoA/bqdsCGzq1rQ4XVtmetWCBgFqyVAadTfVaFPrdwl12KaLYlhhm9sbqnfReZnNPMr4S+zLgWVm2gLZ/XY6+pXER6XLbWypBlPVM1U3QtgmCMuqzBuE1wyCa+Pid/5Pw0k/rF/vB7xqUmcbT1qhlf0WJQA== 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=Q8yvtBCZD9P8Se9ALiAo9HFkUAu77SHsj3CkpFvRPm0=; b=dydAC3boNHiFNlsncKJ6+65Sziy559ismg8umftUyn2Hb6dfjAVlqRWAqIgN44M+H3ceg73fxgIGRS3m+Gkvxa1BmmBffWHG5rysjjrbpTh3WdVC5UoGhSOXlK2frZS6Kmxg1wzyDR3BhnsWXquUacM7+6b3/UvE4MPjPV5RwSUa2oUB4cVWE2P7m3V+r7v4hD1pMgA31Px7NFAM5p+JOrxS7earUnZGz2nN/pt/8VWp1StiqfY7lyehYFfiQsR58VFDoWjPCYocFqD3QLTfR7ZuUiKoYpOLgjywaEKdqCaaIu/hlXyK8Pfigy+hUTSvJsbb3zE/4ywocpuMtw+2Og== 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=Q8yvtBCZD9P8Se9ALiAo9HFkUAu77SHsj3CkpFvRPm0=; b=g3Nn+7ataJpPtcrZaP/A0dmhgRyMKdROSHMAUcjptQ9vvm6acD71vgtY0NxL1Yf2Lff95QVo39X5Y8Bbf56kp9lwPCqyUQJQF1JIHoL0W3yoeLZzPVO9IPXlcw2wCC972yHROcru+q0n1mv2IpwlxK3cvdQ0ACRbMIwAkO1ySTHVkU/LKWF+9z5LpmFmEqpLjfa0DG28uoZuiU2J/yX7COTHxU3ZV4un12ec2X05iMJxcti4nZo4V6h6ZuPB6jhCz20sdAGM3qf172JLXJ/wNmGXlj7ptxarFTW68B0OvfqYQC/+CpQUwqnoZbBNZT0VwNAF3pD362i9ESgb8okReg== 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 DB9PR03MB8824.eurprd03.prod.outlook.com (2603:10a6:10:3df::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.41; Tue, 4 Apr 2023 14:56:15 +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.6254.033; Tue, 4 Apr 2023 14:56:12 +0000 From: Sean Anderson To: Li Yang , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org Cc: Vladimir Oltean , Claudiu Manoil , Camelia Groza , linux-kernel@vger.kernel.org, Roy Pledge , Scott Wood , "David S . Miller" , Sean Anderson Subject: [PATCH v3 2/2] soc: fsl: qbman: Use raw spinlock for cgr_lock Date: Tue, 4 Apr 2023 10:55:57 -0400 Message-Id: <20230404145557.2356894-2-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20230404145557.2356894-1-sean.anderson@seco.com> References: <20230404145557.2356894-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1PR13CA0285.namprd13.prod.outlook.com (2603:10b6:208:2bc::20) To DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: DB9PR03MB8847:EE_|DB9PR03MB8824:EE_|VI1EUR05FT058:EE_|PAXPR03MB8273:EE_ X-MS-Office365-Filtering-Correlation-Id: 1a593f6e-3733-428f-d2aa-08db351cc09b 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: xUW4ja8IG8w4JmzXu2S+ZHnhwUhVc5gGpM99x/KK/RkTc0JDsSaeb9ujUUdUX5LE8xMUsKEDcAFulBJEFqtnUVSlgwn8X5sofSj05HJu6lZB7vNl67aXtr9G/0crbVPO7cj31grEv9PhXouiL+CsgejgAD2ktIo0vUQUQQZtQzc9OSrg42oCHoCf9lkXqV5V3xB5gkD29se1Kk6u10jxLPl3dYq4H41Gq8oZ6L+pv3ak3L6IuOHb28WpNSTV6+iC7uHUdiFPbeB5LqKY5gQ2PAu0ypz1zD70P56+lvn6tZZ88lqr6er1Dea5TcQbLeQnCWDBRhm2SP10vxv3wmMrqwAQdQX2JmIo9izZKQKC2m2z77+ujNPHq7bfGVXqs5zgPqeYm0swWrKOaofBbUR0zwBZC7IUL4AT6WRiR9FyoG6HvYxTyQTKMnp8AS3poICEFt3uitwg68Uuidus/Aqry/hBAXkwYtuWlz3wuOb6RZ+S4wkVBaOwX6LHd+XurMO/isM3AfDg3KAxbJtSpnRhAg4av2ZDWPh9nfv/Z3Qb7cbSMi30HYlb05LrqcubUGGxBDJoSHwxsGd0l8Ltx/EY8DzRoYHD7xN7hXW95c9KG2g= 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)(346002)(366004)(39850400004)(396003)(376002)(136003)(451199021)(66476007)(966005)(2906002)(86362001)(44832011)(36756003)(6666004)(107886003)(83380400001)(66556008)(4326008)(26005)(6486002)(52116002)(1076003)(2616005)(8676002)(186003)(316002)(6512007)(7416002)(38100700002)(66946007)(38350700002)(6506007)(8936002)(54906003)(41300700001)(478600001)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR03MB8824 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VI1EUR05FT058.eop-eur05.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 1fb96465-5a10-426c-5540-08db351cbb5e X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1UCPZgnayjAjBJT2XTGjx9Fii3PXzSZa64HvO4q6zZo4vRRw8XnAMHdZHCksdK/HfoT79Qu60Tn5UdSk4EUX/sVMxg066tXWCGj1nW+EXfwncv6Zt/Wzz2htFaLAUHGkK/OBnXJgkQlfrM+7J/8l5Erlq4KdGEj0OZj994CJYBGx8PgwtvMLJxKYfKtsm9L1w8BfznQ/ZsdPk+fDxRyRDQfNibrfGYmSvGRtvepkLK/1ksS5KYK0oNyd50gmATQmxDE3rgkYyxbiY2YDfBhXHfh7aOeq7QDhRAAH+DLv39X1Ok8PvJdWVwqfs82bnn4rm48qJOyJK5pY57+h1WU/T+zE9ezKC58zc1lY9u9chb29Lqv53z2eDJdHjC04EVV+HB1vwiGk0JzUuVOd+rW8lHK02qrn7JNHgOPQj3IpwNvasGUim1quxN35WOHvzNNwDXI3dy8B/FPi14afplrn2HSIB1I+RrI10kqbWGLTDamdsTgrwo6rKhNJJLt3K+Hox/Ykr5nDHhiLEilULeyhoTvnyB/jkJNnYeXkjXK2AT1UIGbACJVPnG95mDZa67XkvGsNtdjFbqkO53GFB53dqvkVsuG01H7XEriAR03te1jPBbxFjj69J8avRZUfGUzgFq3VKnPAasQUYs5zk1UMTB9xKI15DD+h+FJWuQNiL+L+N0xrH2hlgfdPmTw+pl6OzTBvVuAgl33vzJdn8nkwvY1vyF+gxV+/TnmZyKt/ZEU= 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)(39850400004)(396003)(346002)(136003)(376002)(451199021)(46966006)(40470700004)(36840700001)(40460700003)(8676002)(26005)(6506007)(1076003)(6512007)(107886003)(966005)(186003)(36860700001)(47076005)(83380400001)(8936002)(5660300002)(2616005)(336012)(70586007)(6486002)(4326008)(70206006)(2906002)(7416002)(54906003)(478600001)(6666004)(41300700001)(44832011)(36756003)(40480700001)(316002)(82740400003)(82310400005)(86362001)(356005)(7596003)(7636003)(34070700002);DIR:OUT;SFP:1101; X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Apr 2023 14:56:20.8913 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1a593f6e-3733-428f-d2aa-08db351cc09b 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: VI1EUR05FT058.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR03MB8273 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230404_075625_784489_DD294D29 X-CRM114-Status: GOOD ( 17.64 ) 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()") Reported-by: Vladimir Oltean Link: https://lore.kernel.org/all/20230323153935.nofnjucqjqnz34ej@skbuf/ Signed-off-by: Sean Anderson Reviewed-by: Camelia Groza Tested-by: Vladimir Oltean --- Changes in v3: - Change blamed commit to something more appropriate 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; }