From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011070.outbound.protection.outlook.com [52.101.70.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 687C8204F8D for ; Tue, 18 Mar 2025 08:47:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.70.70 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742287671; cv=fail; b=BbfeM/VYwVU+AHWlQIl0DK0CELFlUJ4XpYsVk+L9ob/GlJxN7KWRaw9PgL0YBxvi8H0TO2+fu4dUUlVhQOMhpwQwaEo3ZkQAe8NXEXO//GvcFV2YAvDKYLzJY/9VmSJZXk4WXolStXekebpRj+LnfnOcYrtuRuXWFf9ENFQzCpw= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742287671; c=relaxed/simple; bh=0AyhmmiUQJZv/fzoOT33pYI7Lj9MSD2WXG+cU3zOh3k=; h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type: Content-Disposition:In-Reply-To:MIME-Version; b=ZFmp5YA744FYxR0KWiO97ZzhjCbr6di51gefSUNhMboZWXY82c1XGuJAWUI0wtS5Prh5uT1py/lI3Li04fLmtjChQj/2ui7UDWbAhtq9HHy0tns1ABfkosaB8ltI8mOAOvGx2MPoMXe+on/VCvgWMjrAyet14xMoKNEKAFQJok8= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=M0cia/2Z; arc=fail smtp.client-ip=52.101.70.70 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="M0cia/2Z" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vbuA4cnV/hXI5IbTt6BfEtn9cRnpE811kYgibLr95NVBc0LPawtwg5B0a9cyG4Q2W1+RgthVMz/aPtWs9uoPQs8VV5X5QSP3BozMXBJO+FQXl9OqWrJb/nuEQUAI4pi5XjkFSC0MCLV3tc8ZaacMofNJthz6khu3Pvb20/nG/zZ6CfcH0YNuYHEXHudEn3r1wUnQPUoutAc7HY/P53QpdAx/jjl6ioCiOsQGCY0NyMuFtJ2f/gLJvFiJTUNl6Pt2dXXQ1hKWZoSpVlsf3QdZcd7MH8G4Oe3ojrJ76uGwskiFVwRZ/AHBLgB0BTRj80cbjYbbomYRCrQV4jNuo3ectA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=nHv9nXWjBuoONM7wIXWOwvaYSCEo29qF+Pxs5khUqtk=; b=plBlM6iXyxfFzL9naTRcvlZbBhumNAaSXl3mUB/VulH//hoVDQHKtKnovY0zIdsn24vPFW9kKJDDOMN50gEdDCLQhcF8l0oFp4V4gETrfgaaICYXWzNbho+yNsZvK1h4Gail9sLH1Z71qgpWJENQTzVlSETWUqoUwwPlfDbggz3koy+xGCPnf4i/Ggob9SzTclpNGcmBpq3vYBahicK+w1MgRJmckfe13Pvi4ZEpQbmJE3A47BmGotlVwD4ZC7NwZKfL6r8DloX0PbF842057z6VYuY3qWcdt1p7JbfZXn3awSysFlMVm8oOcT308/BE58yC90eEY89KwRJFpGt6Hg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nHv9nXWjBuoONM7wIXWOwvaYSCEo29qF+Pxs5khUqtk=; b=M0cia/2ZBU0sH2L00x9vsYL+BBwSIwfy5CQJtoWsfbI7hJj88svqvWqRioFhn89MUhNBS8qfS2jCYZKB11m2yG56oZAajC+0GZY8QgSPZFVtBwIirIui32qi+DZVl2q6tLweS57EIgeeNqSjiSlPiiBbTEQ6Sr309mZkBrwObF9KzoKMfaYt/7lD2pMvTy3oRPly1UaLj5xy9sFU45CyqEHoC6a+Kh/rzwzYh1fi1roSzxAx0/6TbnQog11BzOmBHns1+ejOL50NG/7lpTcwy1tTcWBmmbRS802chlEgGqMiz16nmLfaTp87ATRf8CdKiYApKTomJaPO/dQcMSWHaw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM8PR04MB7779.eurprd04.prod.outlook.com (2603:10a6:20b:24b::14) by AS8PR04MB8372.eurprd04.prod.outlook.com (2603:10a6:20b:3b3::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8534.33; Tue, 18 Mar 2025 08:47:42 +0000 Received: from AM8PR04MB7779.eurprd04.prod.outlook.com ([fe80::7417:d17f:8d97:44d2]) by AM8PR04MB7779.eurprd04.prod.outlook.com ([fe80::7417:d17f:8d97:44d2%6]) with mapi id 15.20.8534.031; Tue, 18 Mar 2025 08:47:42 +0000 Date: Tue, 18 Mar 2025 10:47:37 +0200 From: Vladimir Oltean To: Claudiu Manoil Cc: Wei Fang , Clark Wang , "andrew+netdev@lunn.ch" , "davem@davemloft.net" , "edumazet@google.com" , "kuba@kernel.org" , "pabeni@redhat.com" , "christophe.leroy@csgroup.eu" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "imx@lists.linux.dev" , "linuxppc-dev@lists.ozlabs.org" , "linux-arm-kernel@lists.infradead.org" Subject: Re: [PATCH v4 net-next 04/14] net: enetc: add MAC filter for i.MX95 ENETC PF Message-ID: <20250318084737.e27y6x4mrky47ih4@skbuf> References: <20250311053830.1516523-1-wei.fang@nxp.com> <20250311053830.1516523-5-wei.fang@nxp.com> <20250317141807.2zobsefxl5vnqdet@skbuf> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: VI1PR09CA0165.eurprd09.prod.outlook.com (2603:10a6:800:120::19) To AM8PR04MB7779.eurprd04.prod.outlook.com (2603:10a6:20b:24b::14) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM8PR04MB7779:EE_|AS8PR04MB8372:EE_ X-MS-Office365-Filtering-Correlation-Id: 1c22514e-7320-4597-320d-08dd65f98b1c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?ayB2eciidm25Yv6K2nTR+SRx4CpeIcUDZUcVn+h4EhkXDJTsiCLJXNDZvU/4?= =?us-ascii?Q?ZYZ3VgtXRPwsDVIRNH8sfCUVGD5UThPf88C40Zj5zqW2Oir5GKgqHnvbi4K2?= =?us-ascii?Q?/s2BuF6fslflxfNSTL69vaNYiVwVk6TM1bQMnT9ZD8EB+z3/YfSWWHJjPOYR?= =?us-ascii?Q?lfHWOr+IqWN0q/x9oBKOIti9e1sntyPMc1NsBl5V+H0eiPcmexYcvd8blYL9?= =?us-ascii?Q?MkcU6Ln3DwsIQFk5aAF01J2qYzx6FhiWdnTw1ND3XMlzn4HpR320fz9qKEiR?= =?us-ascii?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qDHuc64ml?= =?us-ascii?Q?4BwKuT0eiCCbKHXVJpN3Fuu8K84YsHI3q4PFkh/kF2w2DXz7Klg0LYBzWe/3?= =?us-ascii?Q?BlGKIqb/nnsd1CJmWymDOQEN1nf0XnR5gkIgdqn7NS+Jw4fvO2MGEntUnzfo?= =?us-ascii?Q?prV5q++YZxLCGCzwDkEmBd4fS5cdJwiTg+Q/AmY4M3Oj8eK2CObizmucTyqu?= =?us-ascii?Q?7ot46XII02sxAuoyZLvmCtfcMnNk?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM8PR04MB7779.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(7416014)(376014)(1800799024)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?UDWXOYDSaxWrRghIpSNllvDMY1c5KXfakuQ0iX5s5mA1jChq9mJmPFHoalBM?= =?us-ascii?Q?V/0aK9UvY67GmDiaBfnrxOrb4/XGhUg9AC8vRO8ky8ioyz3AOZ5splSbNomJ?= =?us-ascii?Q?NeN3O13eG+31yQNaCjIA0WU4HLnNzfTyT9Av0bn451z8I3P9pws4OcFfXyT6?= =?us-ascii?Q?b35L9MxPo3pIM80R0WU2Eom7HJM4ipotMrBDFNpP6/aRNRRT5dJw7KFy3WI0?= =?us-ascii?Q?0lGO9oMAe4ay/fTEncwGPZDWbfNkJQYvjXNYlRtaYnRwSTYoCz1jEjUIlfH/?= =?us-ascii?Q?dU7bVlew/CV2BjA3fR3PM6fIFMs9zwbKiI3ywOiOy42Ij94eLhCbFIuUjZR+?= =?us-ascii?Q?UqmM5fko4DqPx1G6zASX6gvW0x5yPgoRcWMFISo6I5K6dHTeDFbAc8mfExJI?= =?us-ascii?Q?jzNNHSXuyTDhLdLkXrzP1RQc82hYuG7entn1MoV/F5jC5hTdl0SnhkCC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bh19+22G2zaUIZPRVsKVeqkKEKAQSUExJ1aqiR?= =?us-ascii?Q?StAihbMGMZUo/nWHGQTv+opdiK84AMoeav+Dxw/fGzKA0rHIChnwqFaK5yCG?= =?us-ascii?Q?SYPqS8tNxkZsG48dOMFCK+KUdCVuUk9jwZ7l88JpoFM7zw8neDUS7dRQV/vu?= =?us-ascii?Q?/Qy8cHepBsGAp8tp71N9qAgPJYe7eH6Gb+LHmBFZUjHrc3oFM0Q0wPFNxcDx?= =?us-ascii?Q?gZTintuB0Yqj88AmhkSHI/qDa1yLELKo4zA7tVf+6j8DMlGxWAeIOC2TNYKN?= =?us-ascii?Q?xg=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1c22514e-7320-4597-320d-08dd65f98b1c X-MS-Exchange-CrossTenant-AuthSource: AM8PR04MB7779.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Mar 2025 08:47:42.0973 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 53Ju+X9ZfKI2/DgPolhuWRL/0NOJWffPpUfifDQ73jjqniNl8eVlli0u55YlP4XCx3dIKtGqIi80Ox/nTyo0+A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8372 Hi Claudiu, On Tue, Mar 18, 2025 at 10:08:24AM +0200, Claudiu Manoil wrote: > > > -----Original Message----- > > From: Vladimir Oltean > > Sent: Monday, March 17, 2025 4:18 PM > [...] > > Subject: Re: [PATCH v4 net-next 04/14] net: enetc: add MAC filter for i.MX95 > > ENETC PF > > > > On Tue, Mar 11, 2025 at 01:38:20PM +0800, Wei Fang wrote: > [...] > > > +static void enetc4_pf_destroy_mac_list(struct enetc_pf *pf) > > > +{ > > > + struct enetc_mac_list_entry *entry; > > > + struct hlist_node *tmp; > > > + > > > + mutex_lock(&pf->mac_list_lock); > > > > The mutex_lock() usage here should raise serious questions. This is > > running right before mutex_destroy(). So if there were any concurrent > > attempt to acquire this lock, that concurrent code would have been broken > > any time it would have lost arbitration, by the fact that it would > > attempt to acquire a destroyed mutex. > > > > But there's no such concurrent thread, because we run after destroy_workqueue() > > which flushes those concurrent calls and prevents new ones. So the mutex > > usage here is not necessary. > > > > [ same thing with mutex_init() immediately followed by mutex_lock(). > > It is an incorrect pattern most of the time. ] > > > > This is not as bad as it seems. In the final version of the code, mutex 'mac_list_lock' > serializes the access btw the thread programming the filter for the PF instance, > and the threads programming the filter on behalf of underlying VFs (triggered by async > request from VF). But since VF support is not included in this patch set (as Wei > already mentioned) the lock can/should be added later, with the VF patches. We all agree that the lock is unnecessary as far as the logic presented in this patch set is concerned, and thus should not be added. When Wei will present new code that will make explicit serialization necessary, we can comment more. But, I don't see how any extra logic can change the basic fact I was pointing out in the portion that you've quoted. Before you destroy the mutex, you need to do something that ensures concurrent threads can no longer execute. Then, there's no point in locking in enetc4_pf_destroy_mac_list(). I expect not to see such locking there in future patch sets.