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=1796156277; b=1WbpjDZzHyfkSFtrynAfbraKgM8mN9/ZFZHsiYAuxM6RMn0X4984+xxGrxDDh2AD8yR0 yWQolls3+v4lwDxWPmD7rxkhhZ081nnRNBxnIi3n1JjFBBFpVRAASAlJUrDIbpBwXUZ2N qminCC9MkQvZVHQvYyDfEAbQY43uAdJxlc3iRmzBy6rfZYmhTo3GPou9mwdfICqN0PBXP 0aq73gmV53KQ3F7JoTKqHcrt3nZmdKczBJKYyEnvej7+ty2Q/8VLTJS9Jd04K49OQeZII f0VNgzs+S/oqD6bTJA5WxvAezeskTw4WQLfTfllOfMMOORszwhqAQ+PdoX1Fjfng9+g== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796156277; 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=Un0XJKAA530iJ1U/86eTT4ADTjpqiL2NiuLkJJJLU0U=; b=5JBByC249gorvBkMTBs3nIelzOhm7Le70qJ0jm0Z/P7RnXOForU62HBC8EJAIYlFjqzE 6JQmS5cdNq5ovhwlsaaHFzqy2xzfl74KcMH8nrqVMiLg+oL8kY4c7tJtYBP1O4qOMP8Bv JzI8Kry+raiC2IfYtIGGZ10h8sW3BvxLFVazWZm+nECd5/nc3R56aZntLcvwz487r5asC evtDgzc8eH1wyP/eXdqpmErCP7tU3eUmservKPpoQHuEymgTcmS528y0wJ8MeBM82wUSt LgoWHb06Veal5pqWH7Zi3g8cslfFSwYJt8McedP21b6k1pPQr+oLHlnWma3JQWzghng== 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=hj4rA9uh; 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 E2F28606A31A for ; Tue, 1 Dec 2026 20:17:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E2F28606A31A 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=hj4rA9uh DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796156276; x=1827692276; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=Un0XJKAA530iJ1U/86eTT4ADTjpqiL2NiuLkJJJLU0U=; b=hj4rA9uhd0Wi8WCoVrjQi/NdI4HeUhBc7qpcYLgxm1/j4RG2jYr4gqNT kfqofV5bCrDyKGSKgnQCZb5PI+kaOUJHsBHx/kNuqtQmMQqcnJj4RPDPW NazwF4Gcy/Khe07RkwVzrsIuyIfYC+oq6UUz6/2BgF6OGDLGAFiJfdR/C 0rmzbGJKGCwjHN1L0qw3B23jrXJlUknOEkFYBeJuC+DmgypLjMNla6gU8 nPwJnkboT9HAhqc8T42GrasmdQNwK2ZqNBcD3PeiLw1TyE078eWWWGnYx eByz/B0LfF8qZBuL/VwsHNNJ7cZwbBjVoFYIO5dNydlOPPva3hO41dbQ0 w==; X-CSE-ConnectionGUID: //KgmlT5RQi2WN5wEHcJJg== X-CSE-MsgGUID: wsnvtiArR2u/xscdC0ERFw== X-IronPort-AV: E=McAfee;i="6800,10657,11983"; a="4995561" X-IronPort-AV: E=Sophos;i="6.27,245,1787036400"; d="scan'208";a="4995561" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2026 12:17:55 -0800 X-CSE-ConnectionGUID: Fbc9My7dRdGpa1Rz0G/Zcw== X-CSE-MsgGUID: VRw39+z4QwKlPtebr8o+dQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,245,1787036400"; d="scan'208";a="13277535" Received: from fmsmsx903.amr.corp.intel.com ([10.18.126.92]) by fmviesa004.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2026 12:17:55 -0800 Received: from FMSMSX902.amr.corp.intel.com (10.18.126.91) by fmsmsx903.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Tue, 1 Dec 2026 12:17:54 -0800 Received: from fmsedg903.ED.cps.intel.com (10.1.192.145) by FMSMSX902.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57 via Frontend Transport; Tue, 1 Dec 2026 12:17:54 -0800 Received: from SN4PR2101CU001.outbound.protection.outlook.com (40.93.195.51) by edgegateway.intel.com (192.55.55.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Tue, 1 Dec 2026 12:17:54 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=J6dsgCOVhaa2l6x6U5k4DKqh6dzh304FXijSgi9ViBG8BUoDQMRaNFPLifbZIb9pKcP8nJGADir8nmA365QM1T4zGo13P90s87D4qXNxj5ETcIgGh+WuOhH0kv/k4z6vxC1XzMYVpHAwAJIHAR7I+CX6vP+3jC41Dokuy5Bxf5m0BvsCD8+CTeCg+Hh+vtwHlZhQO8WmiGzeIs9pM+4cgV6sqvk5pSu2USN1pVzg08wre53HMSCnAoab7u3A/r4P5Hjl4q1lgp2FukE4MBCilYQh7KzuOY/3Dw/pzDCgrAW/gPxC5zu4HeyN8vJKnv0wPRgmlXUAR69eJCc4/dldiQ== 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=Un0XJKAA530iJ1U/86eTT4ADTjpqiL2NiuLkJJJLU0U=; b=lnh0qnyOj6fDdsDfAK2CcU8e76qOgDTR/a0RZgW6h2CgjK/hZwH/GKNJIh7y+ttS7/2arYeXlhI9hODPi7fzNfDp+MFOySKsoQuXykzmHbIZKyrla4UCyrRxuwMMK4+j8OAW/sCiwCJ99BDG+GFnIl74y61Jveugj8nO4wGd4ka+4K0dVL+hIsq0jMjWU3EBcKfKHT2avlmgpaYFEohK9VaGYqdlGbXjHLpafl6y2FtMXE878ILp7a5Ctgip3iGQPMQ58Wg7QfkeCBLZcFN6NnIXly8UoxoputLM7wsSwGDg12qd2MWizj827fKXsYn/WfP2pSxDeI83tlHxqJcZfg== 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 IA4PR11MB658299.namprd11.prod.outlook.com (2603:10b6:207:112::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.662.13; Tue, 1 Dec 2026 20:17:52 +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; Tue, 1 Dec 2026 20:17:52 +0000 Date: Tue, 1 Dec 2026 12:17:49 -0800 From: Alison Schofield To: Davidlohr Bueso CC: , , , , Subject: Re: [PATCH] cxl/hdm: Account for locked decoders regardless of commit state Message-ID: References: <20261029201327.1119231-1-dave@stgolabs.net> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: MW4P223CA0019.NAMP223.PROD.OUTLOOK.COM (2603:10b6:303:80::24) To DS4PPF0BAC23327.namprd11.prod.outlook.com (2603:10b6:f:fc02::9) X-Mailing-List: linux-cxl@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_|IA4PR11MB658299:EE_ X-MS-Office365-Filtering-Correlation-Id: ec078354-b7e6-402f-1a43-08df4fe82d6a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|366016|1800799024|23010399003|11063799006|5023799004|4143699003|6133799003|261009223027099003|18002099003|22082099003|10067099003|56012099006|261028144727099003|261026121527099003|261026140227099003|261022105027099003|261021121427099003|261102123227099003|261021123027099003; X-Microsoft-Antispam-Message-Info: w2E2Li/bvyhY5jL019tRUPv/Q1VN5923lb6UKrQbGM2dwiDzMGTwyHbo1mgfTWEEvZY4b9PnrFoyxe4zu9eqTB/ofRm/FHtXTf9/Mo3ayewoLAa5nQOhE+m3dm8K+VyoduMBak26H5/u8gMAC+CLLavBAA5G1NY92C6M797brSL3UgJ9OJPWPrX02KAxOM/4XdQvqIWXeWnUUV2Mjrv32oUTRwNkU6c2AEomj2sAUa4Iw/6cDpzzH9qbffEoxoJkSdHNH+rORg/w/rKCcF2UW1w5UC/huaXDh8Zpoe02vWNpmKG/B/Y1TGQ0Nw4FFlDhwmY9KuQDvtI5rcFB1WmqG3nqjmrUf94HvG6Fr7JTTl5FL3SzN1zX2zwHxDqsZbvU82disGm9ZGKsUXndpeBvvtoTdlFz1dFrOEpYoJZv7CiF/GwnK/RCdfj7813Zr0xeYpCgenbMrk7haKyJzxarJS6xRFKjDQUGDg/0X3FFghXaKVPye/lNoq7EPX6g2YeORKkUBUiu37T8O05Ec8kIArh8ZaUFbCFqFZJo1aJuCloeeZHOeEV0iPt7hrG+SiGkk5/xrpiu4kMV/hKStO3Q/aT73GqTpZGQB41URdqKDA/IfYGx7LTebTM3p0ERaRXgKLrAS39IqVlY2Z9ymDtvJMpeCnw9iKJ7zFw2S7XEihk= 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)(376014)(366016)(1800799024)(23010399003)(11063799006)(5023799004)(4143699003)(6133799003)(261009223027099003)(18002099003)(22082099003)(10067099003)(56012099006)(261028144727099003)(261026121527099003)(261026140227099003)(261022105027099003)(261021121427099003)(261102123227099003)(261021123027099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?amWobg15paoCJv/DTVQ7GhNLMit2H02eI1k+pjJLN7Sfdp4hEPiyDZIHfdOj?= =?us-ascii?Q?6Q9PQHaEuAXnBmTxnto7th+DZm7gtZv/qW2hGeKdTwyMtCnGM5gWzG6zftYW?= =?us-ascii?Q?NLpttxc8OrKauglpg1Acgp+duL17OkTF/PBf3Kszq4o2Y6BqrN+OY/2LPm3E?= =?us-ascii?Q?eHhUDBcHutNxRYAycz6Gs3Bt/oxeR8jymUSX/4M7dYQCtZOOfScKbAGpQnvr?= =?us-ascii?Q?6sj3j0QJSgIC1CpdD2SlOwVJTShZKbJ7x2GEZDw2idbLoJ2GDisfocijBDEJ?= =?us-ascii?Q?l3DmGy8Z6YApY9ewvAZZD9BQYgdj0pPdTLT6UC0VRHYrOrtOJKiSoviFeXuw?= =?us-ascii?Q?gkNHfYycMtKhIM9wiLFZrMw0UtYyNh3Ak3aQyozZ61FQz7SejslBjg1Kepjo?= =?us-ascii?Q?qGkQX57tRsLbRw1VIlXjr1XLVmfTeG/lFEH2ZX7RJuKd7TeKYNlNFkH6Kumu?= =?us-ascii?Q?6+fA00VypuCK/nCsYrU/eFRXKK3qQ5DODgdo1Y6IinO51BlhOzkVzt4j93Ca?= =?us-ascii?Q?XUzxOCmTR3m8QHBgpTj9gYsAs+M4xCQfQFTSA+9Tj7eo5QECJV05hJQ8JNjK?= =?us-ascii?Q?26gqPHzD08UV6l9gZsC8G+Ei5txy/sgvcub5UtfecnHaII1Sr7+tckaLVRXw?= =?us-ascii?Q?+p1WBfSIxpITvtHXtRlo+fkMgtQ1zbNjhgmyuy2JyxfJRXx/EaveqcwP9i1Q?= =?us-ascii?Q?fnUMwrMDn0Xs0PCNcIn9jit3RHi82H/LFTaRToREakw68iHC6C6Nk29nWFB1?= =?us-ascii?Q?auRAyUQZhvCk8dByEigE3xMJ6UjTqaZcPSVc2mKvNZ9NbufJPX8UwALOl5/Y?= =?us-ascii?Q?aRKQOPQCuDtcPNdRiK+K6lTJxLJVk6UlYR/LPbTn/1T9Uma1opge1tfzFkaW?= =?us-ascii?Q?EkVIutCDzmCiT2WBehprR1rFdivVY432CD3ZJn21ty4NJE41HLvPK5aWC6Ik?= =?us-ascii?Q?yLqXtLWeBmk9NHE74xSCjSzgCSDO28zkx2PPkpKnZJ5rwuo4kXrrSDhBY4HU?= =?us-ascii?Q?Yh4sExm4dz1pcXcDw6nTxsohvfjKkzvenOFeLMoEhtVGVS8ICUvzDdXp+/9r?= =?us-ascii?Q?MtoGnlPiVUfzCPFXjIV5M9lxQwCbuDppxfOCYJXtRy1U6GXBYCGat4M54NFP?= =?us-ascii?Q?i20/z4fd2Qb+H4flxQ/+LKK0SOUMHetHHiYhmsYZNjjBSZ0hlBQMpD2yuoCu?= =?us-ascii?Q?x+zfzpTzbuB7ttvokGgyxkF8cPlaNRjypeCBLNzpCVDWn2SO4f6GA6I4lGIw?= =?us-ascii?Q?jFnk1i3cc7TT1kFxwWtQLP9ityOnQQQm3t1ThZPLBwmd1RiApnEJiwuVaahv?= =?us-ascii?Q?zrcP8x9caQNJhmaQsNmALHTbqJnnlf2Q2GIR30hsrJQ6o4OtbyhP+Yn4pBPr?= =?us-ascii?Q?oTjsg/rWGSHRJkTFE/F/j8WfxAvGbCBIpnbEVkbU5TD+pyNacaf/zKpvdIPp?= =?us-ascii?Q?zVb2wiXN+xng007iqyJ4HWEf2fptButwKk6lj03YQ95tf7Ie4hFG6+NwSi8Z?= =?us-ascii?Q?r939WEa7efapSbaFVkJWBJmKilCAsHpaZ3wRYiwGjU6TrHJFf4FgD//mgHrW?= =?us-ascii?Q?k57OY6pN7lTFTb7XrP1iTUgFcrVfQQXL8h9/hLjVnjREP02OYZWua1t/D+gN?= =?us-ascii?Q?X2nX8IbNnYlQP+2a3FxEBVEsKDX5G+XPyYcuJuY/EML55e1b/whxktTIpVPv?= =?us-ascii?Q?UML1apIs4WAzs6a++XCmzct4ogAfFIrLTCpqrG7ZIYhIpOrBtncFEZ7myjB2?= =?us-ascii?Q?xvFUzrAuFVfRiUvne2fBZgO+P5t+KBI=3D?= X-Exchange-RoutingPolicyChecked: GIu9cXfDahhtmtBJtSSKDvty2r+vWL3itXw0SI0xBeadShVqv//bYjxHovTR/Vo+WLYmcfjTWw0QSEgXkKQjAlcpsw9MMcnpEo2RJrkBKfi39VnUms7Av4BrvTHWeRM9puSP3+gHJos6uQvuxAjU2shf69ye8Xigoa4c/sxsjw0DjvBahXgu6YOGtM37xEI1SDS5yQKj2nKQJbNqIe69iW2m/TD7pd/xX5Qs3yZ784e2R2MBXtIH5hC4j3T9CHiPsxFs33gl50toK1GCZYqqzcA8gNTI1evv09TjaJT8YMsdlf0MJugHN8LBaMyqSkKiXDgzZCCBzZGPh8q+YsTNPg== X-MS-Exchange-CrossTenant-Network-Message-Id: ec078354-b7e6-402f-1a43-08df4fe82d6a X-MS-Exchange-CrossTenant-AuthSource: DS4PPF0BAC23327.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2026 20:17:52.4933 (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: zMjiJ9wBsW+fx59Yacsl2m9dYb3wx8gFoGCFv7xPUggYiH565Rs7q0F0LhmGuXbRYDSBN4qvO7dE3Y/vaf7c6oYZBpwGhVqprdvuvbIbkaQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA4PR11MB658299 X-OriginatorOrg: intel.com On Thu, Nov 19, 2026 at 04:16:54PM -0800, Alison Schofield wrote: > On Thu, Oct 29, 2026 at 01:13:27PM -0700, Davidlohr Bueso wrote: > > Firmware may arm a locked decoder it leaves uncommitted, a corner > > case albeit a valid one. Enumeration only records the bit for committed > > decoders, yet setup_hw_decoder() carries it through and the driver's > > own commit triggers it read-only. > > > > A later region teardown then writes a reset the hardware ignores and > > clears CXL_DECODER_F_ENABLE anyway, so the decoder looks free while it > > still decodes and releases its DPA. > > > > Record the bit regardless of the commit state, such that the decoder > > then reads locked from probe, and a region built on it is locked at > > attach. > > > > Tested on qemu modified to enforce locked, arming the bit on an > > uncommitted endpoint decoder before the endpoint probes, then > > committing and deleting a 256M region on it and creating a 512M one. > > Before, the decoder and region read unlocked, the DPA is freed and the > > second region reports committed while the hardware still decodes the > > first; after, both read locked from attach, decommit fails with > > -EPERM, the DPA release with -EBUSY, and the second region cannot > > allocate DPA. > > Hi Davidlohr, > > This does fix the stated problem. When firmware sets Lock On Commit on a > decoder but leaves it uncommitted (armed, below), the driver's own commit > locks it. Region teardown then marks the decoder free while the hardware > still decodes, and its DPA can be handed to a second region while the first > still decodes to it. Refusing that teardown is the safer way to fail. > > It calls attention to a wider cleanup of the lock tracking. Lock On Commit > doesn't lock anything until the decoder commits but the flag is now set at > probe, the region picks it up at attach, and is never cleared afterwards. > > The problem with that is the driver treats a region as locked before > anything in the hardware is, and keeps it locked even if the armed > decoder never commits. A locked region skips all decoder teardown, so - > > - If the armed decoder is detached before commit, the region stays > locked. A region then committed with only unlocked decoders can't be > decommitted even though the hardware would allow it. > - If a region commit fails partway, before the armed decoder commits, > the unwind is skipped. The decoders that did commit stay committed > after the region is deleted, and their DPA can't be freed, though > none of them is locked. > - An SBR clears the hardware bit, but if nothing was committed the > decoder keeps the lock flag. The driver then commits it unlocked, yet > the region on it can't be decommitted. > > Could we record the decoder lock when the driver's commit actually locks > it? The region handling would then need to cover both a successful region > commit and a decoder becoming locked before a later commit fails, preserving > the locked decoder's resources while unwinding decoders that can still be > reset. Locking the region only after the entire commit succeeds would miss > that partial failure. > > Your modified QEMU is the only way I know to test it, since cxl_test > doesn't go through the real enumeration or commit paths. > > I didn't prototype anything of this at all, so nothing to concrete to > share other than my words. > > -- Alison Let's get this fix merged and address the broader decoder locking issues in a future patch. Reviewed-by: Alison Schofield > > > > > > > Fixes: 2230c4bdc412 ("cxl: Add handling of locked CXL decoder") > > Signed-off-by: Davidlohr Bueso > > --- > > drivers/cxl/core/hdm.c | 5 +++-- > > 1 file changed, 3 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/cxl/core/hdm.c b/drivers/cxl/core/hdm.c > > index fdcef20e01ba..a34f3509ab1f 100644 > > --- a/drivers/cxl/core/hdm.c > > +++ b/drivers/cxl/core/hdm.c > > @@ -1064,11 +1064,12 @@ static int init_hdm_decoder(struct cxl_port *port, struct cxl_decoder *cxld, > > .end = base + size - 1, > > }; > > > > + if (ctrl & CXL_HDM_DECODER0_CTRL_LOCK) > > + cxld->flags |= CXL_DECODER_F_LOCK; > > + > > /* decoders are enabled if committed */ > > if (committed) { > > cxld->flags |= CXL_DECODER_F_ENABLE; > > - if (ctrl & CXL_HDM_DECODER0_CTRL_LOCK) > > - cxld->flags |= CXL_DECODER_F_LOCK; > > if (FIELD_GET(CXL_HDM_DECODER0_CTRL_HOSTONLY, ctrl)) > > cxld->target_type = CXL_DECODER_HOSTONLYMEM; > > else > > -- > > 2.39.5 > > >