From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11011048.outbound.protection.outlook.com [52.101.65.48]) (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 3838F3AFAE2 for ; Wed, 13 May 2026 19:03:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.65.48 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778698992; cv=fail; b=fJAd/h4oqzpzRHWfAlKzm6kQlRJG+l6TheDR5Qy3GLGZAvcUR4CdhPSCwta6HBJqssQQHMM2tUakVasRSr4JFQ5RYMK2WW25snTA2p8R7DQgWvP1GJBXMpaxH+6sTLcchisTjHgvt7lQ4cV4aVTABMVOOVxnG0/GjHi8qVC+0Vk= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778698992; c=relaxed/simple; bh=yyb1qauORgtLrqDutByYR6n0tkslr1W0l7+NjxHm3qQ=; h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type: Content-Disposition:In-Reply-To:MIME-Version; b=GoZWqNT+TDVaR5eY4wq/1YgfH8j2mvsyMJZhfypjp0opt3bJbUuO5uz1fkkZMW/HQuj/fvlQQ2HjxxJ0POa7DbXFzdWOv2u6afBxFXfy4wBVFJom2R63UDaqhDacwsQR4WJGoOzIHShWlxTxDsrhnEfxFyRdayDJ0wG6H/d1Ka4= 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=grF1nIWA; arc=fail smtp.client-ip=52.101.65.48 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="grF1nIWA" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Fb0mYXmyfsFSTu/H75Q3OKVaRLADRImNMJurOrt8DobjiTS8DwUUa+vMDUiCodxpsBTA4QqU5b2srI5e2BwhsB0zpVIM9JSzQtgLbKhCMcwUJjGTvRoGfsW5XMADoyy1oOsOYQsaEjC05xjyMWT07DuRyMnbB/CgZ+f5Yc4aNO5z3yIMWuc8MzrX/ng6mdGJkSZTpNezuBJw5C/95tHvKiwkR7MhWC6jzxSH6uevbk4oQxNTxpSVIGHwxnSRe87lO3u2lc4HSjeouv+AkSRi8nlX1cEe1J0LXijV5P/bZ5sTA7pdoOCBYIQbp2afG48WRi36Im/mK5bkYdqjOthlxQ== 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=/94UAkOPoK7W485xO1ghJLmt5oO/3eOmZ9prv4labs0=; b=JfNHAhT8Q3/nS8CMFUrOea7hXvT84PqmbRIKv0RKkezqbCt3Ev6sqTUSUJH2/gQz2yyRjlyGwSyLRBr1nulXur09bb2y3nXZHnURk6NIZSOvRykyx7pnxJam8K0UPXcILQr/gGjXOm3g03u0d+gKumFsFHnm0nJvpyJY+TxrM/VTFc0/KtCTXB3Lwp31/No2OjJTsiIx6/KiAohrby+7TeVUZ0RCkMbSulCZSfTjx18HSEsfb892gjz4yocKBqtchWcH/vqkkA22cSmtN+yRSGfrS383EkmfkCdCIbQ6XsSfO6WImo0TQ6fHkgZKT21ZCVaG2WwXtizJMQa2fl0CDw== 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=/94UAkOPoK7W485xO1ghJLmt5oO/3eOmZ9prv4labs0=; b=grF1nIWAXWgIaY8E6HqE7p4p0nAfxUQ937sRgKEkBuBNw4Sbikg2316wdHK030Q0zgdKX2lcxwKxDE6dqhfv7cGR2iM7FVaUTXTReW4QmbyFHefPcFWTxa5drRtV5W6eYPs1hdW6UpCoNkp7TlJWk/NJSKhVrXqmFFL386woa1rqT+55Ar08bM5nrS62Y2mvmBt/z5DEd5v9DTinZF93MlRFdX/DQd2zhnp/jpKZfJhYQyCYsgM1E9QspfR1qQBmhDwO12FCw9QPn+guOyueOSJ3LkhAygRb3fOvrF06GMzO8JDyUL66ieswPaJcvrWtwizSlH8Vr+0CM6pEvHzrYQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PA4PR04MB9366.eurprd04.prod.outlook.com (2603:10a6:102:2a9::8) by DU2PR04MB9180.eurprd04.prod.outlook.com (2603:10a6:10:2f7::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9913.11; Wed, 13 May 2026 19:03:06 +0000 Received: from PA4PR04MB9366.eurprd04.prod.outlook.com ([fe80::75e4:8143:ddbc:6588]) by PA4PR04MB9366.eurprd04.prod.outlook.com ([fe80::75e4:8143:ddbc:6588%3]) with mapi id 15.20.9913.009; Wed, 13 May 2026 19:03:06 +0000 Date: Wed, 13 May 2026 15:03:02 -0400 From: Frank Li To: Adrian Hunter Cc: alexandre.belloni@bootlin.com, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 6/8] i3c: master: Defer new-device registration out of DAA caller context Message-ID: References: <20260512121732.406009-1-adrian.hunter@intel.com> <20260512121732.406009-7-adrian.hunter@intel.com> <01df8e0e-9041-401b-ab73-634701c4acdc@intel.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <01df8e0e-9041-401b-ab73-634701c4acdc@intel.com> X-ClientProxiedBy: SA1P222CA0003.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:22c::31) To PA4PR04MB9366.eurprd04.prod.outlook.com (2603:10a6:102:2a9::8) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PA4PR04MB9366:EE_|DU2PR04MB9180:EE_ X-MS-Office365-Filtering-Correlation-Id: 641c15f0-b49a-4259-b519-08deb1224445 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|19092799006|376014|52116014|366016|1800799024|38350700014|56012099003|11063799003|4143699003|18002099003|22082099003; X-Microsoft-Antispam-Message-Info: gbSCirg5MaU14o31yRXlSoe/Ro/5vIrhZw1/I0FGBUB0y4r3GH7XE2FmHAkcb2bjxY1zXGuoHgh124hN/3cUw0wb7iz0Li6hHcQw/96l5x+v+7dk53j9wLzui17PecDGxG21nTVwWNByvmUR80DHbl9ps6YJprCO9VBrbaLKzcaz47nGMh4QZDtzOnLghZGEH9NjA0SVWMESTx6WDAK2ojvmAp8X4DaXSZVLQ8QcdNow3RfwJwEa9IDtkeQWKCQR1N2fgGJJHtouX4NTb/1SArZHsXmzvjehRhwOpniLb+HZjWW18KND05bZ+lztw5D+rfQBpf5uU//yZTpPr8kTlHkv3R0tMdoA/SBALOC9A22NiA+w3p3ctM9I3EtbShX/QJFQoHIt7dnq6fQrTy+OadckiGnHhBF0yO84Nd8DCMp+89z9WU0HrFeVFEPULT6EeDz/kH9F9+iyD08I4eQKXIpgNEWUYZiVJTXTU5cdJqc6yocjn7CMRKEKyFXNv/OuQWPk3uwJfNJXjuqfr41crMB2MtWdMztc83vA0i88YgSfKm1m9h8v6D5bMsLSJPJ3GjsZBvc/qRZi3W8g+lla1pYzsmsSbv56MeDWJhNgN+LbNaRaI1VCU6GBP3oulfDm1Nl1Clk/PAumwGD7VFbDyxUkRnK8lFMxMD+WppT6ZOc1zhtl2WEkoTBAUMoA+mAjQnsVsAegl1lX3HcHJeFujWRt7z6Gc4YTKrIEet/FPnmUU/lpypuBctQ383kuKG9Z X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PA4PR04MB9366.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(19092799006)(376014)(52116014)(366016)(1800799024)(38350700014)(56012099003)(11063799003)(4143699003)(18002099003)(22082099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?i41whOGwj3FxtyuMmLtpAiOL0SYks6XTD8j4L6lytPCX5Q+yXrh23pPLa9AJ?= =?us-ascii?Q?gdzEeOVNHcExfVZ3ou/qk0vC0v0z+zmFs9aGCc7/ym//nYJxIR7dGuqzbdtB?= =?us-ascii?Q?jXYH9riQZjT7i5MeTlXkdwHWCesjb4rSqqI8MBnlLeS+aDw1SjKs4r1E9jo4?= =?us-ascii?Q?gmxnVdNLeo3sj+88NWl9GqdJ0N3p/d0LIuaYxCifXmYkt5trzQ6MuF8onpGu?= =?us-ascii?Q?Q5gXrQwkEPegZ9cdx56nnGTbTTOfu/ULyiQv7XNvf1G6TVVBDdjgZzhDD1o0?= =?us-ascii?Q?0V07Xi+Vl9x7xWH5OEg+doI2SlqQJAKNJzkZ7I+PoFhQW0Dyh13bpBsjCxim?= =?us-ascii?Q?58nAqxRhD5UKNLq5FowCzuQ48tEPdmiscj8AouvpquX7p+/bF7VqF+5xE6Hv?= =?us-ascii?Q?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oj6X?= =?us-ascii?Q?1Qvi1ehqALmfH/K9IEfRLb7ZVLdS/XCj78MGa0YBTklibYO36Ggr3lN3Wzm5?= =?us-ascii?Q?lqL3Lmr+z1KkRc/9whqek7GAx/DmbGWOkpT1bT/hdvg9f+4tsDoA3rLE56Wb?= =?us-ascii?Q?VwRA4iAO4kMproEz+7dI1HaOrRAWRUXk7lmeDjJMa0Omd96NTVKqyPFn9FB+?= =?us-ascii?Q?8K95fB53IxyAY+A6JoM4sAqU9gl1oaX0p6buN9Il7OScaOk0BB4Ze9sR5axT?= =?us-ascii?Q?JKzNMdU52RkiICs2YcN/viWTdUsqKY1KByQAE4hix41bnjicQy94vyRtp8EY?= =?us-ascii?Q?bUYmYwYHAnbmmbmVixzsfHu/TB9WF6JHKwCiCp0c2iZV5chvhNu/VumLlc7g?= =?us-ascii?Q?Xemv36timGD2EsJa77w11dlNUNnjIxJhGUxTzFqJ4eFeX6k6?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 641c15f0-b49a-4259-b519-08deb1224445 X-MS-Exchange-CrossTenant-AuthSource: PA4PR04MB9366.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 May 2026 19:03:06.7150 (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: mcVVMrXltiPOrqC6OPV8E8CfzoIkihot1t5U7NjYdWkc17ndlRrxiWK5i4Z30ZR4LiE/5EQLCdH9gMgkWDRXhA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB9180 On Wed, May 13, 2026 at 08:45:55AM +0300, Adrian Hunter wrote: > On 12/05/2026 19:39, Frank Li wrote: > > On Tue, May 12, 2026 at 03:17:30PM +0300, Adrian Hunter wrote: > >> Master drivers may invoke i3c_master_do_daa_ext() during resume to > >> re-run Dynamic Address Assignment. As well as assigning addresses to > >> any newly arrived devices, this restores the dynamic address of devices > >> that lost it across system suspend, so it has to run as part of the > >> controller's resume path. > >> > >> A side effect of i3c_master_do_daa_ext() today is that it also > >> registers any newly discovered I3C devices with the driver model > >> inline, via i3c_master_register_new_i3c_devs(). Doing that from the > >> resume path is problematic: a hot-join-capable device may join the bus > >> during this same DAA, and registering it immediately would push driver > >> model work (probing, sysfs, etc.) into the controller's resume context, > >> where the rest of the system is not yet fully resumed and the > >> controller driver is still partway through its own resume sequence. > >> > >> Decouple discovery from registration: add a reg_work work item to > >> struct i3c_master_controller and have i3c_master_do_daa_ext() queue it > >> on master->wq (the freezable workqueue) instead of calling > >> i3c_master_register_new_i3c_devs() directly. The worker performs the > >> registration only when the controller is not shutting_down, and is > >> cancelled alongside hj_work in i3c_master_shutdown(). Because wq is > >> freezable, any newly observed devices end up being registered after > >> the system has finished resuming. > >> > >> i3c_master_register() also routes its initial post-bus-init registration > >> through reg_work, using flush_work() to keep probe-time behavior > >> synchronous. This keeps a single registration code path and ensures the > >> worker is the only writer of desc->dev. > > > > why not direct use hj_work? > > i3c_master_register_new_i3c_devs() use of desc->dev is racy, so > i3c_master_register_new_i3c_devs() must not be allowed to race > with itself. Having it only ever run via reg_work achieves that. Sorry, I have not understand these, Can provide some detail? Frank >