From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f195.google.com (mail-qk1-f195.google.com [209.85.222.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 89D6E273816 for ; Wed, 25 Feb 2026 01:42:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.195 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771983745; cv=none; b=NRi+aKjQJfHBE8HnoVx8fmu5d/f0DM2lQqV6+RjGRJHaqLIHn3cQF7oD/6IZaEWEpnH8TJhDVZkHKmpe0kFuwxhV61NG00bVLn0VWuYlYF7HMYrrd/h0CACNFkV/MtMKduLD3RBEIHhUdX4JplPg2lB1diNailHT3U5Xn85b3vM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771983745; c=relaxed/simple; bh=AfqOJ+f8iBpn2YeRECTiS3swxHGChpe1lX4CMkSixnA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=V+3fZogiVb/BTzKDwqVbsDVYF+sxOyOfrgRGAK98wlP1QwNv0bU1RIn1W2/MfbnBPHeoC8serJT4Y3J78tUJnRQ0yBgpDit9i3GYd2ES+oInZqc2bkQQB4e0uQZCy2KWHm+gvkrYmaRXx6gfMzSa8L+sKhHXhew1XBgXpG9KB8I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net; spf=pass smtp.mailfrom=gourry.net; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b=Lli8sPs5; arc=none smtp.client-ip=209.85.222.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gourry.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b="Lli8sPs5" Received: by mail-qk1-f195.google.com with SMTP id af79cd13be357-8cb3825b0fbso601219185a.0 for ; Tue, 24 Feb 2026 17:42:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1771983742; x=1772588542; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=3/UfaKnNpfKgE4L3AOtdGDMjVf1tkYmuqP6fF21iRas=; b=Lli8sPs5sDBKepHgZQrxbi2AzMZM1E5XOYkF0Ak3GlOB9lfpZPPKcW3OpB45GOFYWa Tw56AXqufs1CAMEZ67DF3frs6n/BwaXSRNbPzIf88j+iN9/yfOmmwJOTc9bVlmz3MYKF xSIWBr52tdLTI9W+JIAiL25cpFbBI3jlW3v2V8ufp7JTralXs/90LS9fprcSVAQbi4fb dFwsXJFuwGXBbCt5DARoLbxr3KrUzsCvJ3exPZwRFj8VIBaFi71YPX7cqfQ41SGO0DSd u+dmGaAJa+FnOpSaZtXGc4jGw7EYtmGmhrb+jOnYHkX6JRrSQtNeaLcLct1shEi3CSax XspA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771983742; x=1772588542; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3/UfaKnNpfKgE4L3AOtdGDMjVf1tkYmuqP6fF21iRas=; b=Yq1LZUwJqwgBfhEfh+pabAUaivZk+5grCEJ57X6GbGUWOqaOahuDOogzeExAjlUnTo FSarFURqONdUYMqbP0ltc07tKDdaId2K1yDLOQjIrlvRhay5zwpUZDFnDNzaVRdVinC8 u714ri3v9hS3IcDJ8S65FGfowi0BsqRdxtKJoTTN6QiliHVuIvMyMCtyBi3ZWtwEcnyU 1+2uSDAagXF//DME0zjSzNqgyPRmH7cTWHomkzvd9UNfZRyBa9/Lk0bdST5SwDUxsB2G TdAwQWQw9zCxDu5w7oDy7CZPcn25XX12DXtrve8vhlqckMsVcaXXaMG3ulZBGnrahUmg WYMg== X-Forwarded-Encrypted: i=1; AJvYcCURjctaHnFwr27MBu3POha7ohxPpAxdtxREzxK9GwlfEkguzg6Y0+5ZMIerRDULb1ymnHF1yOtKSufQm6o=@vger.kernel.org X-Gm-Message-State: AOJu0YxCtyQZzdppKcwtZYyAd38K6d6dAjavmTd7Xvd+EkY6aiAgwfID WvkdxP0uytENJq4wWdxr1H+JYb1HW7pe0QXO4+/GPJP5tg0pS32i+sAe0fAEH+pRyP0= X-Gm-Gg: ATEYQzy0e/4MWVyxUn3J/7thS2dUpyWVyuTp4PuatwO+i59VhTaOtJPUb/TxLYQm4zW FFrwraM0c82BK5jSl1aNdsmafhCM55FZOf1rM2y9fPYkszFdzz9q5uehRsRZT72YDnkRi13Fdlr 4Sr/OQqN4q5gRtZvZf2yHLT27gA2JLowoY3I/AIS8D1eiUZxI6kgPsjA8KC56wzjWhTq/Zm5X0i VAWy4ZHFgihA3NvnL9ljm9cVk56344sLpwOQIiay4643F14R2XzyR1g2E/+rm3snu7gzW1XwiWU OO4bSWCTbkNE+u0JLuVpLBGVB7iSNFxPgOUvlhufn3NE/jdSG+tX7KvT+hJmXX1ZWupIge34/Pi oC2rOoknIvcVVM4AKWGLc3+Mr1hBX0a8TJwMnEFcrj0tOFUALaxeX5q+kym66YWUdzXFrcN+ImY /30y3zAKVwn8pfilDASN4222wDLc3fuehNHDSK7hhxY/rOMs2Ehag2h2nt+V9NB91xMQcNdd4d+ C56C53wreAj7zQkcegT X-Received: by 2002:a05:620a:1a9e:b0:8c6:ed6b:5865 with SMTP id af79cd13be357-8cb8c9474f6mr1895796485a.0.1771983742404; Tue, 24 Feb 2026 17:42:22 -0800 (PST) Received: from gourry-fedora-PF4VCD3F (pool-96-255-20-138.washdc.ftas.verizon.net. [96.255.20.138]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-899ac09e78esm23847046d6.34.2026.02.24.17.42.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Feb 2026 17:42:22 -0800 (PST) Date: Tue, 24 Feb 2026 20:42:20 -0500 From: Gregory Price To: Alejandro Lucero Palau Cc: linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@meta.com, dave@stgolabs.net, jonathan.cameron@huawei.com, dave.jiang@intel.com, alison.schofield@intel.com, vishal.l.verma@intel.com, ira.weiny@intel.com, dan.j.williams@intel.com Subject: Re: [PATCH 1/2] cxl/region: fix region leak when attach_target fails in cxl_add_to_region Message-ID: References: <20260221043013.1420169-1-gourry@gourry.net> <87347db6-6838-4a60-ad1c-037f526f16b6@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87347db6-6838-4a60-ad1c-037f526f16b6@amd.com> On Tue, Feb 24, 2026 at 04:15:33PM +0000, Alejandro Lucero Palau wrote: > > On 2/21/26 05:17, Gregory Price wrote: > > On Fri, Feb 20, 2026 at 11:30:12PM -0500, Gregory Price wrote: > > > cxl_add_to_region() ignores the return value of attach_target(). When > > > attach_target() fails (e.g. cxl_port_setup_targets() returns -ENXIO), > > > the auto-discovered region remains registered with its HPA resource > > > consumed but never reaches COMMIT state. Subsequent region creation > > > attempts fail with -ENOSPC because the HPA range is already reserved. > > > > > > Track whether this call to cxl_add_to_region() created the region, and > > > call drop_region() on attach_target() failure to unregister it and > > > release the HPA resource. Pre-existing regions are left alone since > > > other endpoints may already be attached. > > > > > > Signed-off-by: Gregory Price > > BAH - disregard this patch, it uses drop_region which is introduced by > > Alejandro here: > > > > https://lore.kernel.org/linux-cxl/20260201155438.2664640-20-alejandro.lucero-palau@amd.com/ > > > Feel free to add it to this series. I have started to send individual series > as you know but the part changing the region creation will require more work > than the already sent. > > About this fix, it looks good to me, although I have to admit I'm a bit lost > after following the discussion Allison points to. If we want to keep the > state of failure for forensics, not sure if the debugging/tracing or default > error info in this case will be enough. > > In any case: > > Reviewed-by: Alejandro Lucero > Yeah i don't quite follow the want to keep the objects around, it seems to cause more issues than it solves - but then i also don't think this is going to be a particularly common problem ~Gregory