From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=198.175.65.10 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796076473; b=tb+GysBjTS9++AqbxXYkTKE4/S9o25TTYGLY9tJ/yDzt6XzGbrQagtPGP09zEOVKZyEk t3hhpJm5VT5N+qUo5ElCMGhP2ysWoiNHt/4Z+jAN74d0w+APaOSpfLr6Mh/meXdBTNPVA YQendV8M9Bcxmhvyjywpc4rW9CYUqUaOYlGcZut8t+upD6If5TvECBk+yKC18EJOYTzxY Fit3kXmbgBvMyVammAMytf6/nTgmnFIrVprVmdO74f10hEtm8Ucy+Gs3LQeTZ1a53ZjTy PlL4Wt63zd941wDEZ5C6cpGqdImlTpH4IR1e3QcoQlnaSQKQhRvleDk3L0pAUMYPTFQ== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796076473; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:Received:Received: Received:Received:Received:Date:From:To:CC:Subject:Message-ID: References:Content-Type:Content-Disposition:In-Reply-To: X-ClientProxiedBy:MIME-Version:X-MS-PublicTrafficType: X-MS-TrafficTypeDiagnostic:X-MS-Office365-Filtering-Correlation-Id: X-MS-Exchange-SenderADCheck:X-MS-Exchange-AntiSpam-Relay: X-Microsoft-Antispam:X-Microsoft-Antispam-Message-Info: X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-Exchange-RoutingPolicyChecked: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-CrossTenant-Id:X-MS-Exchange-CrossTenant-MailboxType: X-MS-Exchange-CrossTenant-UserPrincipalName: X-MS-Exchange-Transport-CrossTenantHeadersStamped:X-OriginatorOrg; bh=CO8rRCVqoxk1GPOZ6bbvlmFGNfe/VCbbkOWc4Udn0rk=; b=bXmFaumgtK2DcklP6AW7LzXp35ktKdu1ZCH2YqOJ+4jmHUZpd3tB9bisPp2Zi1ZO7/ae 9LavdFIMZOJvf/H7RJESurJu5N002Iuf3phhrlGpTHSNKLIJzol+EbFt9AzEc+19kAgNI AKIBERxpBnIc7p5VMMzvn1308fjD/1rtVj3o6UfG+4bxQXp0Guokp7MyT6KCNoVvpDyjS IGrW0FpMwC1tfy0VTVBa0fCC3bbo4sdj0L+ecxfPZjs5aiom1EqLHo2kW6wH8QYfP26Ne yrotzT56/OLgLeTjWFr4DzMYdkntmjnHztLRIA9a9is6fTaOwtKt81FJwB0GexZzG4A== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=iAbi49LN; arc=pass header.oldest-pass=0 smtp.remote-ip=198.175.65.10 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 60FDD606A320; Mon, 30 Nov 2026 22:07:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 60FDD606A320 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=iAbi49LN DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796076472; x=1827612472; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=CO8rRCVqoxk1GPOZ6bbvlmFGNfe/VCbbkOWc4Udn0rk=; b=iAbi49LNsAq+laOTQKTHMuWLfcwPaEModJTkZyhTaK+khQyqEFzs78EB TCAqSkD0ypSlIuO8TBjfRenYqe84vcPAx/LBASgJDRb3At7nZGUyegr40 ph5c+nHIc3ZkD8uCLQ0dnnkrD1z9FSHy+Ltp5rhXIUXLC9Mj/YdsFap+I qoFiEzJFHj94ziCWjwXc1+lJGdEdnW+A8Lqhxomutg4hcpTUV9fDow7q+ 1Hy+P16HOai605iF1fYPBCXgMKYsLozzVePVtRopINdLcxfb5MUFfBjI+ Ps0B7EWGPEBhHti8BXWcHLjMMSHIyQ9sQSq1n0i7BJamTPBxZhQZwQNlX A==; X-CSE-ConnectionGUID: 6bIbJk79SVWmzem2W7zbuA== X-CSE-MsgGUID: JkEWglqTQgmnMpMuQpDrDA== X-IronPort-AV: E=McAfee;i="6800,10657,11982"; a="4867271" X-IronPort-AV: E=Sophos;i="6.27,243,1787036400"; d="scan'208";a="4867271" Received: from fmviesa011.fm.intel.com ([10.60.135.151]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2026 14:07:51 -0800 X-CSE-ConnectionGUID: YAgldKj2R3qSIM+KUsx12A== X-CSE-MsgGUID: RrbF/WQpTjqU5nPExis0Yw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,243,1787036400"; d="scan'208";a="14816577" Received: from orsmsx901.amr.corp.intel.com ([10.22.229.23]) by fmviesa011.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2026 14:07:51 -0800 Received: from ORSMSX902.amr.corp.intel.com (10.22.229.24) by ORSMSX901.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Mon, 30 Nov 2026 14:07:50 -0800 Received: from ORSEDG903.ED.cps.intel.com (10.7.248.13) by ORSMSX902.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57 via Frontend Transport; Mon, 30 Nov 2026 14:07:50 -0800 Received: from SA9PR02CU001.outbound.protection.outlook.com (40.93.196.64) by edgegateway.intel.com (134.134.137.113) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Mon, 30 Nov 2026 14:07:50 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WPBsI5wngggangbzh2gsEZLALRhUxGV4oWAUsBKbJWomhLxILhtcfdKlGqvrqPhqzcY84/GnqtwktdU0x9cpdrznCLj6Mzzzp7OkXZ1xnHB63nplUIcROV1qzlpS+jg4zf6+kPdaKbF/hw8ScCh3NJqoUy37YO4Kr61DBh1TRmLbupVhFmAzpMM/L9+jQtCtNpThhTQpKfiMXx2R31PejILMKOPrzT+saclaXdCNCO27SbkiL0RrqHM3VJ4zOnxk+XcIUQyxy8kaXFOUIT16J5Gz9VfWdXxEAdisiEOJwfhmX2kt02uRoH/o44MZywMIpwFCTfQZ8LdjrLzehysWFQ== 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=CO8rRCVqoxk1GPOZ6bbvlmFGNfe/VCbbkOWc4Udn0rk=; b=RCR8xAFIJv/be/VcOXJpgW8/jHGKi9KigcpAiXIL0cXBKa4JxzHCBHj7SJ3QZP8VkJWGVrpGMh2EQsfpdc5HgTxgXfDZl64frhiI50OhMcAfd4QRRvgDkV87PSIvJnsAb1tSNjWK53SNhBOLFRJRDm4aoyis9gi1WX297X4UVKwNFsf2acmakgJrM8mCubb9Vgd4uGgGI9YoxeCyIolRJeM7NYSGXntvIZLm8jqS6mufP2KsVAKXIYKP5mmoraBmPSlaWbTN1YSL9DrseFCmaBAp4TPjR4ruojYTZFXCk8mJHzPanMqbJ+DyE7ENMyYymLWyFPELBF9c9oCjleboNA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DS4PPF0BAC23327.namprd11.prod.outlook.com (2603:10b6:f:fc02::9) by DS0PR11MB8136.namprd11.prod.outlook.com (2603:10b6:8:159::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.662.13; Mon, 30 Nov 2026 22:07:46 +0000 Received: from DS4PPF0BAC23327.namprd11.prod.outlook.com ([fe80::a1fc:97e0:329a:4aa7]) by DS4PPF0BAC23327.namprd11.prod.outlook.com ([fe80::a1fc:97e0:329a:4aa7%6]) with mapi id 15.21.0662.012; Mon, 30 Nov 2026 22:07:44 +0000 Date: Mon, 30 Nov 2026 14:07:35 -0800 From: Alison Schofield To: Anisa Su CC: , , , Dave Jiang , "Jonathan Cameron" , Davidlohr Bueso , Ira Weiny , Vishal Verma , Fan Ni , Li Ming , Benjamin Cheatham , Gregory Price , Richard Cheng , Anisa Su Subject: Re: [PATCH v1 12/14] cxl/region: Read existing extents on region creation Message-ID: References: <20261104230445.66625-1-anisa.su@samsung.com> <20261104230445.66625-13-anisa.su@samsung.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261104230445.66625-13-anisa.su@samsung.com> X-ClientProxiedBy: MW4PR03CA0195.namprd03.prod.outlook.com (2603:10b6:303:b8::20) To DS4PPF0BAC23327.namprd11.prod.outlook.com (2603:10b6:f:fc02::9) X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS4PPF0BAC23327:EE_|DS0PR11MB8136:EE_ X-MS-Office365-Filtering-Correlation-Id: e7b94a43-185d-479e-58a6-08df4f2e5c26 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|7416014|376014|23010399003|10067099003|56012099006|11063799006|261021121427099003|261022075727099003|261028144727099003|261026140227099003|261022105027099003|261026121527099003|261102123227099003|261009223027099003|18002099003|22082099003|4143699003|6133799003|3023799007; X-Microsoft-Antispam-Message-Info: YXOeUKSRaCJuemC5Mr8wTtl6grAYzKP5fV6kVZU+vo+3S89n+ZGuk7tfTsCpcJ/pSwzdIpOoGCcLlv+qZUFuVmirkh/NB7Ao8vCllFpv6vLFQWjkS198bxzWdiIf9Mg/w2ZRJ8kz5UPvAkuwVKdGLlUKE6jhU77QQ98qdjymb55iX7ZHXVjTaLAwaGWRnuEE/lEwoXEtk6nTvIRNKMDMExWSg+02Nj1hl0yDqYs0HzujKmoTUTn6rBkDG/fm2OJ0sR36vXuMP7HszOUR9UTG9DQu4EaD3o2Kru9wdyknIpDSUYyOIo6WDBT1sv5qz5PI0pB7uQObVIEG5SnPd+uCMFLzGMxujabo7bEANQ7KNU8p2rmVZRlWHO5D/sSOBIbjk4mnNFMox2sEcEc0lIl9f+q/GRXx8xZPPZRKk8BcknzGra76F2IdArD3tQljMWaYprrflnOd/ifwNi6JQiDVpHUNx8/e3y3ro7p7zecxFjjVpD/Ya74asBSWggkEriscKblDGYOqVTzOoR0rfudlPYKGERbIWY0JQbz4ADzqyn6BJA4y5xypKERGCq+Z1hsruEZd625c9ln0A8RY9r/aeuQ+mwcWqCED4sZ3vxwtGAzWs6XnbihWMXsJfP5cpYNyIRQt5yLwaCsGsI4kr/KyCoTfusXNObUbHTar9jxvn/I= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS4PPF0BAC23327.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(7416014)(376014)(23010399003)(10067099003)(56012099006)(11063799006)(261021121427099003)(261022075727099003)(261028144727099003)(261026140227099003)(261022105027099003)(261026121527099003)(261102123227099003)(261009223027099003)(18002099003)(22082099003)(4143699003)(6133799003)(3023799007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?F2Zp6CRf7+PLYuDWSb1N8LNfZgFfmaZlThiqL57Fwx5ytYzY8DH72SZLTEJv?= =?us-ascii?Q?MOxizuedfzxNWtU6M8NaEUrzMLtFf2LA5iWt3aKOkpsqgplIeb+I4J47T6Uv?= =?us-ascii?Q?xvA0yLorbcbXlm1yUY2Ii/mQykHFl9G8qQgQOKaOxH0ke7lR6w9qnnWD8F2T?= =?us-ascii?Q?71pIwF0R2dJI4AKQFZZHOfw1PTRxsQrqM41toaJ0Wm+WNH3nmFxnQhJdxGse?= =?us-ascii?Q?GEU3mYTTCzUShg3VG3CQFx59FOlAdQbUaNMpqJN+tUF7mzduY+q7uRtH45JQ?= =?us-ascii?Q?aN86KWE90xVNA38DZXtcEVkrLoSMS+lv3Bo+sGtTKVu1o+9g2sUU/7QYm+5m?= =?us-ascii?Q?n1mcahat9pohlorpdZxfqzDtc3E2XbWnQ67UU+rVhPimtHuB/hhXsb8nXZLY?= =?us-ascii?Q?/soLRxC+MODJn8CASiJsT0t5VXSykICnKzAAppjG1EbiOyGCj+wpnsE+zImx?= =?us-ascii?Q?0gZjzmDUSTFRvXNxvKQ6srIrfLNSnJM1sVMQZbZLAWBC058Bp12QYUpMkHgl?= =?us-ascii?Q?KJHxXLNpj6legRSRCX6Jb/KDT/c7F2a/uKW61VygfzGvYPauOgRS3m45/Kid?= =?us-ascii?Q?GO1Tr3gnst1xSeEamGCaeqv8pAXU3z2RXBjNDcRnPbQYeDyAoZgm/KHP+k2T?= =?us-ascii?Q?rHPZddLGG4Rd+0Ys1HmK8nPs9SkDVw59kIR20vIBDJnBZ+jH2iejJWeQV1Ee?= =?us-ascii?Q?OFcA688LUHAyrxY3Es6SbIvyejj546JTevFkC5uU3GQuCz2fM1BhlNG0xYcZ?= =?us-ascii?Q?oKkIFR+1F4Ptto/RQ7a3nDo3gM4hKae4PvVhhSip2MnrmoC64Xm6iomeeC6F?= =?us-ascii?Q?s2shUbnBYHWjYH1WgJvC7A8rxTjDQSwDQEBx4AjXK4jgs5yWYf6FMpVozLKh?= =?us-ascii?Q?WcveJibg9cxew0+qDOtxb2ydGmazYZO0h+y7IdqMLmbfTgy9Ks2VStNOHGIS?= =?us-ascii?Q?2BgRGrUOZ6ItI69uNrD+LyRNmhRBcdj7fgBk7s3h1THAIDrGpnggM7ZHtkg6?= =?us-ascii?Q?S+IzIrAHkNHr4dq+CeIKG5dq4iWndwd9yAPbPFP+3yP3Ftmk6Ue4QAQ13Lqt?= =?us-ascii?Q?LOG9NbmW6VaK0gMI3nR9CxEU4XqtyVDT+H1bF8rfP3B1U/vS+TWT6B/wl/pe?= =?us-ascii?Q?DGmRtg46P7zH4lotu94tXhjZphFlAgLtqGlGT4tyHhGcARw3/IvCTqqYZqwB?= =?us-ascii?Q?lHRgquw7iR8gdzK73boy2QQqNJ6UvAMuMJW2V81+IrJmPcCsDcLd53PexIth?= =?us-ascii?Q?3MbNQceF8jIRkjHs4RYqp/KxJH+p9nHC6TiiAcKJd92llmE5liM8mZ3daSyt?= =?us-ascii?Q?IclLipYOTUknDl7ZN8SbeWdBZkdPt+W47W2Iagb40X5pUERJ0YCz0Of43pvj?= =?us-ascii?Q?i4rIFsQBTGDDNBcx4ZP9fJiCSFZwF2mZCot1GHpVD+0nvV4iQnXZ4D1dpNMy?= =?us-ascii?Q?+0G5Y31x8l/CO2YSfJtA8Cy5U449hPkB6JtaARuEGNc3xrUG6OX9vXBe0eJi?= =?us-ascii?Q?Oq0bY6CQXH+BBu6JjpvzYjkj/J37QJo22UtdQP7FXk4pGfmybfGCwrpZfHZM?= =?us-ascii?Q?VkZ7ZDgGGlPLYhG/+b1h2LQTkvPxAulNRSlj6YJmHILDOcQXaLEfO2ikFmWX?= =?us-ascii?Q?MkCKj1YyJ6gYLPypwekDaUUiZuQN78Ul5jO4EGGiEyf59CGxz/9Gt+YNZA4a?= =?us-ascii?Q?BxdxBg7sTGbdkfeCf23pY4WGwwgvgAvgrxSMnCG9ZP39sPaUufEVDcYmufdx?= =?us-ascii?Q?8T/mO9glbRO7KNe6GIXcjHwgD7hiE1I=3D?= X-Exchange-RoutingPolicyChecked: JdwhGBhs7FgopQnONj+TylKWjx7ok3MoA5xZpipYmQRTBVMGY2XrS8ysGuZ7ImVQabFkkvDFv1C71takLKM1IaOUJRm+mXtc2InnWR7CSJJL0sT5TGlL1RLDwnXJWZWiuq4Yo0gOGT/bqCwNEvrtE//Pt6D1X9/Kag9irTwrx2HRtty3zrxVyUKyiFIAZFHKinZtEQjSYWztQnVLBJnFUpsmSCsI68tUBzWFS7ViPm6xXiwK65mVKg/eOQ7s7GkrvQFmbIbkI4hTYB8K4NcmwIjTdLwmfaDweuzQ1eg3EN/R1KFgRLsXk2Z6mXqR5PVw/7qbTPZuuNiB81NNNPrxJQ== X-MS-Exchange-CrossTenant-Network-Message-Id: e7b94a43-185d-479e-58a6-08df4f2e5c26 X-MS-Exchange-CrossTenant-AuthSource: DS4PPF0BAC23327.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2026 22:07:44.5425 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: dliZVK2Eaf0vKSdmJSRqAwynYDG6EJugAIEERcy3IaSAURxKGfG9xUtyH65qzhiD3xTlZGjZkBHNCHabamhI7T7qP574dkxCTrDCbzkEqrs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR11MB8136 X-OriginatorOrg: intel.com On Thu, Nov 05, 2026 at 08:02:36AM +0900, Anisa Su wrote: > From: Ira Weiny > > Dynamic capacity device extents may be left in an accepted state on a > device due to an unexpected host crash. In this case it is expected > that the creation of a new region on top of a DC partition can read > those extents and surface them for continued use. > > Once all endpoint decoders are part of a region and the region is being > created, a read of the device's extent list can reveal these > previously accepted extents. The subject and this paragraph say the read happens at region creation, while a later paragraph says it is "not at region creation" but at the cxl_dax_region probe, which also runs again on every dax_cxl bind. Could the subject and this paragraph match that (which is the correct statement because dax_cxl driver probes later and async) > > CXL r4.0 Section 8.2.10.9.9.2 specifies the mailbox call Get Dynamic > Capacity Extent List for this purpose. The call returns all the extents > for all dynamic capacity partitions, so only the extents inside the > region's decoder DPA range are accepted. The rest belong to other > regions, or to partitions Linux does not map, so are not tracked on the > current region. If the fabric manager is adding extents to any DCD > partition, the extent list for the recovered region may change; the > generation number changing between queries is detected and the read is > retried. > > The dax_region device probes asynchronously, so the extent list is > read from the cxl_dax_region probe, not at region creation. Onlining > a recovered group attaches its devres teardown to the dax_region > device, and devres present before a probe starts makes the driver > core refuse to bind ("Resources present before probing"). > > The same asynchrony means the region can detach its decoder before or > while the probe runs, and the scan needs that decoder throughout: its > DPA range filters the extent list, and every recovered extent is > resolved through it back to the region. So cxl_dax_region_alloc() > records the decoder in cxlr_dax->cxled with a reference, which keeps > it valid until the dax_region is released. A detach mid-scan then > just makes the remaining extents resolve to no region, and the group > is released back to the device. wrt a detach mid-scan...I don't think that is true if the decoder is attached to another region while the scan runs. The extents then resolve to that region instead. snip > diff --git a/drivers/cxl/core/extent.c b/drivers/cxl/core/extent.c snip > @@ -230,7 +230,7 @@ static int cxl_validate_extent(struct cxl_memdev_state *mds, > struct cxl_extent *extent, > struct cxl_endpoint_decoder **out_cxled, > struct cxl_dax_region **out_cxlr_dax, > - struct range *out_ext_range) > + struct range *out_ext_range, bool existing) > { > u64 start_dpa = le64_to_cpu(extent->start_dpa); > struct cxl_memdev *cxlmd = mds->cxlds.cxlmd; > @@ -271,6 +271,17 @@ static int cxl_validate_extent(struct cxl_memdev_state *mds, > if (!cxlr || !cxlr->cxlr_dax) > return -ENXIO; > > + /* > + * New adds wait for a bound dax driver that has read the device's > + * pre-existing extents, so a tag already in use is never added twice. > + */ Same as Sashiko here wrt a decoder re-attached to another region while this scan runs. snip > diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c snip > @@ -1627,6 +1641,10 @@ static int cxl_realize_group(struct cxl_memdev_state *mds, const uuid_t *tag, > mds->dc_chain.group = NULL; > if (tag_group) > discard_tag_group(tag_group); > +err_release: > + /* A fresh group is simply left out of the Add response */ > + if (existing) > + cxl_release_recovered(mds, tag, group); > return rc; > } Same as Sashiko here, on releasing DPA the host has just onlined. On the Add path the same group would only be left out of the response. Should recovery drop such a group not just release it? snip > +static int cxl_read_extent_list(struct cxl_memdev_state *mds, > + const struct range *dpa_range, > + struct list_head *existing) > +{ snip > + dev_dbg(dev, "Got extent list %d-%d of %d generation Num:%d\n", > + current_index, total_read ? total_read - 1 : 0, > + current_total, current_gen_num); Use %u for these u32's to be consistent w other msgs in this func. > + > + if (current_gen_num != initial_gen_num || total_expected != current_total) { > + dev_warn(dev, "Extent list change detected; gen %u != %u : cnt %u != %u\n", > + current_gen_num, initial_gen_num, > + total_expected, current_total); > + return -EAGAIN; > + } > + > + /* No progress with more expected: a buggy device would loop forever. */ > + if (!nr_returned && total_expected > total_read) { > + dev_warn(dev, "Device returned 0 of %u remaining extents\n", > + total_expected - total_read); > + return -EIO; > + } > + > + for (int i = 0; i < nr_returned ; i++) { stray space before ; > + struct cxl_extent *extent = &extents->extent[i]; > + struct range ext_range; > + > + ext_range.start = le64_to_cpu(extent->start_dpa); > + ext_range.end = ext_range.start + > + le64_to_cpu(extent->length) - 1; > + dev_dbg(dev, "Processing extent %d/%d %pra (%pUb) seq %u\n", > + current_index + i, total_expected, &ext_range, > + extent->uuid, > + le16_to_cpu(extent->shared_extn_seq)); > + /* Another region's, or an unmapped partition's: not ours */ > + if (!range_contains(dpa_range, &ext_range)) > + continue; > + rc = stage_pending_extent(existing, extent); Same as Sashiko here wrt a tag group split by the per-extent filter. There look to be 2 more beyond what Sashiko notes: - an extent that only partly overlaps this decoder is not recovered nor released - a failed partial release is logged only with dev_dbg(), so those extents stay accepted on the device with no host tracking > + if (rc) > + return rc; > + } > + > + current_index += nr_returned; > + } while (total_expected > total_read); > + > + return 0; > +} > + > +static int __cxl_process_extent_list(struct cxl_endpoint_decoder *cxled) > +{ > + struct cxl_memdev_state *mds = cxled_to_mds(cxled); > + struct range dpa_range; > + LIST_HEAD(existing); How about making this less confusing w some renaming - Here "existing" is the list, but in cxl_add_pending() and the functions it calls the same name is the bool flag, so the call below reads as cxl_add_pending(mds, &existing, true), with "existing" meaning two things. How about LIST_HEAD(recovered) instead ? snip > +/** > + * cxl_process_extent_list() - Read existing extents > + * @cxled: Endpoint decoder which is part of a region > + * > + * Issue the Get Dynamic Capacity Extent List command to the device > + * and add existing extents if found. > + * > + * A retry of 10 is somewhat arbitrary, however, extent changes should be > + * relatively rare while bringing up a region. So 10 should be plenty. > + */ > +int cxl_process_extent_list(struct cxl_endpoint_decoder *cxled) I believe noted also in Patch 4. Spec says reread the extent list on overflow, but we don't yet. Is that planned? snip > diff --git a/drivers/cxl/core/region_dax.c b/drivers/cxl/core/region_dax.c snip > index 790176a8aadd..816386301b80 100644 > --- a/drivers/cxl/core/region_dax.c > +++ b/drivers/cxl/core/region_dax.c > @@ -13,6 +13,8 @@ static void cxl_dax_region_release(struct device *dev) > { > struct cxl_dax_region *cxlr_dax = to_cxl_dax_region(dev); > > + if (cxlr_dax->cxled) > + put_device(&cxlr_dax->cxled->cxld.dev); > xa_destroy(&cxlr_dax->dc_extents); > ida_destroy(&cxlr_dax->tag_group_ida); > kfree(cxlr_dax); > @@ -79,6 +81,15 @@ static struct cxl_dax_region *cxl_dax_region_alloc(struct cxl_region *cxlr) > cxlr_dax->hpa_range.start = p->res->start; > cxlr_dax->hpa_range.end = p->res->end; > > + /* > + * DC regions are not interleaved; the probe-time scan uses this decoder > + * and may outlive its attachment to the region, so hold a reference. > + */ > + if (cxlr->mode == CXL_PARTMODE_DYNAMIC_RAM) > + cxlr_dax->cxled = p->targets[0]; > + if (cxlr_dax->cxled) > + get_device(&cxlr_dax->cxled->cxld.dev); cxled cannot be null if first test passes. How about: if (cxlr->mode == CXL_PARTMODE_DYNAMIC_RAM) { cxlr_dax->cxled = p->targets[0]; get_device(&cxlr_dax->cxled->cxld.dev); } snip > diff --git a/drivers/dax/cxl.c b/drivers/dax/cxl.c snip > static int cxl_dax_region_probe(struct device *dev) > { > struct cxl_dax_region *cxlr_dax = to_cxl_dax_region(dev); > @@ -15,6 +21,7 @@ static int cxl_dax_region_probe(struct device *dev) > struct dev_dax_data data; > resource_size_t dev_size; > unsigned long flags; > + int rc; > > if (nid == NUMA_NO_NODE) > nid = memory_add_physaddr_to_nid(cxlr_dax->hpa_range.start); > @@ -29,11 +36,17 @@ static int cxl_dax_region_probe(struct device *dev) > if (!dax_region) > return -ENOMEM; > > - if (cxlr->mode == CXL_PARTMODE_DYNAMIC_RAM) > + if (cxlr->mode == CXL_PARTMODE_DYNAMIC_RAM) { > + /* Recover extents the device still holds for this region */ > + rc = cxl_region_add_existing_extents(cxlr_dax); > + if (rc) > + goto err_remove; > + Should a failed scan fail the whole probe? > /* Add empty seed dax device */ > dev_size = 0; > - else > + } else { > dev_size = range_len(&cxlr_dax->hpa_range); > + } > > data = (struct dev_dax_data) { > .dax_region = dax_region, > @@ -42,12 +55,20 @@ static int cxl_dax_region_probe(struct device *dev) > .memmap_on_memory = true, > }; > > - return PTR_ERR_OR_ZERO(devm_create_dev_dax(&data)); > + rc = PTR_ERR_OR_ZERO(devm_create_dev_dax(&data)); > + if (rc) > + goto err_remove; > + return 0; > + > +err_remove: > + cxl_dax_region_remove(dev); > + return rc; Is a probe failure meant to give the recovered extents back? snip to end