Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp3937207rwe; Mon, 17 Apr 2023 05:58:16 -0700 (PDT) X-Google-Smtp-Source: AKy350a8q2WVrdspnhsXTPO5SYAwgVjXEUZtUKRVHWVC5q/cs+RXJiZwrnwCr5AfBkbbkTLljbEy X-Received: by 2002:a05:6a00:b4f:b0:63b:5f78:d6db with SMTP id p15-20020a056a000b4f00b0063b5f78d6dbmr19623215pfo.21.1681736296615; Mon, 17 Apr 2023 05:58:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1681736296; cv=pass; d=google.com; s=arc-20160816; b=N6EJeew+gyTjjmt9mIit8JbwxMlIgpw9SN3GyuQZhQganW96eYGyDBwH0Ur/B7Wby0 gK7x/3MPBm1gWtoA4WBTAVSJ4t22kTpaNSNTNSA2cuGzDnIU/MlJmxlwBLeTR+QcSWcN XwXBaK3RpMCENRMO+Tyueq+waAHvjr4lOrTkpI6T7gi7pCJfxYmxRCEN+8u9b5XXp7n9 CmCxO7SeIjXIiQeMcRa3FjDRJHWjzfuUbQoGVkqFWuXV31FpiPSguzZMlcnE4K3pirS4 AmsRIXUJRfUgjDV9xAuu0B2ZnxZy+ifPyipg5yhDmIwzsnspNq14fT+87lYWtUfovSHk rCGQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=EQcbR0shgUTbrkuAjFci0C+iBeFOYvpw/1IOvl7Dp8M=; b=ebuQpnFor9/H4uIuv74LackYlI1SdY+vc+DAIpyaJeb0vPS/+ii6L1OjfHKiZ9py/o 471vKgEd9v0Fpz56j8DeCTQwmtbhyJityuSYSJERr60TeK+Q/i/FvgALORShoB6F+Yvs imp93QP5Bx7DwkEU9ILIvv9dSlu53atSqF8b1E+vMm3/s+C4/exVTaCF41FAdhaUqaTa QwU+w9vYJ8q48/s3g/RiJSNMg11ag9K0duIFIP7b8aeCCDf/dSzzDUHiZo+WdUwOo0vb QsU395kfx8avZKZoG2wWCACilQ+0gBgn67FQR2ED0Fpo3W4QlrPUing3rKyduCHjI0Kp PjyA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@corigine.onmicrosoft.com header.s=selector2-corigine-onmicrosoft-com header.b=APTPrcLL; arc=pass (i=1 spf=pass spfdomain=corigine.com dkim=pass dkdomain=corigine.com dmarc=pass fromdomain=corigine.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=corigine.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e17-20020a056a0000d100b0063b88c406c4si4629970pfj.171.2023.04.17.05.58.05; Mon, 17 Apr 2023 05:58:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@corigine.onmicrosoft.com header.s=selector2-corigine-onmicrosoft-com header.b=APTPrcLL; arc=pass (i=1 spf=pass spfdomain=corigine.com dkim=pass dkdomain=corigine.com dmarc=pass fromdomain=corigine.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=corigine.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229727AbjDQMxo (ORCPT + 99 others); Mon, 17 Apr 2023 08:53:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231230AbjDQMxl (ORCPT ); Mon, 17 Apr 2023 08:53:41 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2119.outbound.protection.outlook.com [40.107.244.119]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA5FD3C2B; Mon, 17 Apr 2023 05:53:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OjOdseMWHIxcb6+L0ZZhMFQ2cJQT++nt0efxRJycQIWp32ElPcwAV8DlPcVb87tnH0AWlzl0kMLH/YclPt6rCK5+YJtS4/Sw/mpCn30yRcpEHSP7hF28dJIK5JbGaSfBxBXiQXl3rJJ2EX0U+pRgGe9NB2fImMyBckpJ/6h8ShnAdTwp9cH2BKp1afZ52tqMf9xNHcfd0MyovGwv/DZqrkenDygpO8kg2USDmenF5//ae8gbFC3bUNvSWXBJxmmkupJ/hB24W75UQe3a6qLNstrqSB3AJImlPsDx9Fx4e98uplFkKzkqGiPaGjYA3kluja+Gfk4BQZA6RIoPvB3Plg== 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=EQcbR0shgUTbrkuAjFci0C+iBeFOYvpw/1IOvl7Dp8M=; b=UVyiRb2SCAcJFqBJW9iOxLjphfheZAfcyiHg4g/XbkkO2RQCB3aGM51GplZ0QUMnr3csKcevWJ8DQxBRPCDPKiD1epP25098gQf6IXyiCSScQFo/wwA10+Ubvc/ezepUFRQuXNti4R4MYsy/hmTZnW0ydaLVL8SNrDWOq4jiL7NGHda5es7BbZgjc/LrtJvK6S207POIxbMIgkupJpjTsMRizJghG3X4yHVJgk4g/ZZKthmcWx8neTuLUnCHxQKqrXx84qoWyLl/hwlrauFxGyXh1kMW/qOchBsgq4p6Fc8bfR81vc6wHf1ZOQlyJ1I2xPkNBXOIOMf8W/HAvF7PZg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EQcbR0shgUTbrkuAjFci0C+iBeFOYvpw/1IOvl7Dp8M=; b=APTPrcLLLZ0XS1mzf8XVNuWiyuzMhGYyWCp5Ww+oaNL3HBo9+ESaM5jiH+oWwAR0+DEi/HGyrkAoc2sFMmFcgGUbAjCGbqtpyJXcFutjUwR0ZwnSF1MwEn7scmQfFSFlBvv+c4Z7S+176akUt2dOiD9fSee8/h2afUpukesQGJE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) by MW3PR13MB3996.namprd13.prod.outlook.com (2603:10b6:303:5f::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.45; Mon, 17 Apr 2023 12:53:37 +0000 Received: from PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::89d1:63f2:2ed4:9169]) by PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::89d1:63f2:2ed4:9169%5]) with mapi id 15.20.6298.045; Mon, 17 Apr 2023 12:53:37 +0000 Date: Mon, 17 Apr 2023 14:53:30 +0200 From: Simon Horman To: Vladimir Oltean Cc: netdev@vger.kernel.org, Andrew Lunn , Florian Fainelli , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Xiaoliang Yang , linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next 2/7] net: mscc: ocelot: remove struct ocelot_mm_state :: lock Message-ID: References: <20230415170551.3939607-1-vladimir.oltean@nxp.com> <20230415170551.3939607-3-vladimir.oltean@nxp.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230415170551.3939607-3-vladimir.oltean@nxp.com> X-ClientProxiedBy: AS4P195CA0019.EURP195.PROD.OUTLOOK.COM (2603:10a6:20b:5d6::6) To PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR13MB4842:EE_|MW3PR13MB3996:EE_ X-MS-Office365-Filtering-Correlation-Id: 4bea9f9b-e763-43b9-3687-08db3f42c2b8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ea/gNlCdvr+4zAUbpJOKyokiQvmqcuQN/DAjUjGSs4JalJG3i/LOy+TyyVIVH5wdoyJySAyucP0/PCWG9vGB6Z4A4AQe1s29rz7meWQzMy0OzRMgXIeY8zqlKYBRxWF0avX/j8NGVfFban6x/bF74KullkgASsH9r10gCE1IOO7IqThAYxXWYCbkxeMx5yUyVXhKf5fQAfqOEXAx7VCg+FnqbruwognBbq1rFlCv+4pnP/zlKCVq8JHccVix7KluTV8yO/xDN5qgi9GBi5mA0tyKCveB/mHaXJkfUc2a+IXn4+glRgOQRSLyHTg2FMs7BSxFZnMECt31eqTsjC9gI/rC15GFjL74UARBChzngzg54JJVg0T+9GSO07tWSMbey5KM2MuWgK5UU+mdl5lJnolFgxUjjicpxYPc8npvCM4dmJ0x/WDRlHzs8ud8XqBv3TPClk0u5yt8LIexFQ+cDc2DGtA0VkfwRH3imjpcJztfKeWiCHYWbV+rXlxQcNdQ2iL8ULZWbVxVZNP1eHP/ctog+E4zzYZp4B9Ug09kIymUuTg4k45FYj0nLAs4Zddc X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR13MB4842.namprd13.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(346002)(39840400004)(396003)(366004)(136003)(376002)(451199021)(36756003)(44832011)(7416002)(2906002)(5660300002)(8936002)(8676002)(41300700001)(86362001)(38100700002)(478600001)(54906003)(2616005)(6506007)(6512007)(186003)(6666004)(6486002)(6916009)(4326008)(66476007)(66556008)(66946007)(316002)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?VQRxIO017CunCg0dnLRNApcTP3O+OuNuMMy7QVFmiXqJuqSW7ohhdXboVygX?= =?us-ascii?Q?JtoBG0iUgR+V54D6MaQzXbL8AkbK9a8TiHsK2eBy1AKBJW5p5+gAwTRjAB1v?= =?us-ascii?Q?xEIqnKO94axznIrJrFEjX7zGNwqDieigIiWC1cthl+3JFnsfzlmpOZ9eFSwQ?= =?us-ascii?Q?LUrL3zW/M0rg5bSepOeMzUC8P3JRbRjhNwO8R9EBeWIvYGNUTJpwV4n/jI5b?= =?us-ascii?Q?B4NfJeSG2226Py2HoRRDTGYK/Z+W+Xs93AA5Oi22mgzh0n0daQuO/zMyrwXU?= =?us-ascii?Q?OJ3USlqf5unppvmsN1mQRkKJ067Xiug1O78XGoFXl1VVcQrGwNtQaLC82N+x?= =?us-ascii?Q?2nKNQYzxxV3faW6a8nfIm8foEm743lEWZcTa8QOVnUOX+rVziC0xA4yYQJ8y?= =?us-ascii?Q?4BsDww0FVXDbz0G1jlu/+62S1R0i9v+058I+9Y1EibwIKlzHvCDCwsXJ0yae?= =?us-ascii?Q?ddtA+XGrI2JUTCLRmX++khLoSv7yQbSvhm7bZy+AVZw5lKcLJRPENPW7suFg?= =?us-ascii?Q?adAieUhk6XsBFodJ0WIqs0oaNRM1XZH6VYQqdEzvtup1RI6Wea4tE2nZ2TjJ?= =?us-ascii?Q?IYrhYr41DHpXsR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wbV1W2Rybwi?= =?us-ascii?Q?yr8a5EUW/6yVYhKw1ggPfh3IPsFBFJ3WPhPnvI48cJ3vvX+EPhbu2bhB20fh?= =?us-ascii?Q?ho9G3F/lnFua0Z6wpEvXRO4fqrUOVuVuhzfijPSYXV80JRzk/I33N+uI3a7k?= =?us-ascii?Q?PEb7khR75s0C4c+LFKw7eCAR+XRSCu52/Ps6Rc/4zjhJYqnXg03OXHk4fyd7?= =?us-ascii?Q?Cxu97A=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4bea9f9b-e763-43b9-3687-08db3f42c2b8 X-MS-Exchange-CrossTenant-AuthSource: PH0PR13MB4842.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Apr 2023 12:53:37.1646 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: V8TOmf2utuXlxeHemq7Y1PbPw7zNUNTcFuJjKzSxOW5aqN3O0uNzH3o454FGi7R7Vv54nr9hk8jpLbsaUmBHV/ZteC3xuO7hGTjHUSv5Pp0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR13MB3996 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Apr 15, 2023 at 08:05:46PM +0300, Vladimir Oltean wrote: > Unfortunately, the workarounds for the hardware bugs make it pointless > to keep fine-grained locking for the MAC Merge state of each port. > > Our vsc9959_cut_through_fwd() implementation requires > ocelot->fwd_domain_lock to be held, in order to serialize with changes > to the bridging domains and to port speed changes (which affect which > ports can be cut-through). Simultaneously, the traffic classes which can > be cut-through cannot be preemptible at the same time, and this will > depend on the MAC Merge layer state (which changes from threaded > interrupt context). > > Since vsc9959_cut_through_fwd() would have to hold the mm->lock of all > ports for a correct and race-free implementation with respect to > ocelot_mm_irq(), in practice it means that any time a port's mm->lock is > held, it would potentially block holders of ocelot->fwd_domain_lock. > > In the interest of simple locking rules, make all MAC Merge layer state > changes (and preemptible traffic class changes) be serialized by the > ocelot->fwd_domain_lock. > > Signed-off-by: Vladimir Oltean Reviewed-by: Simon Horman