From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796393703; b=v6GXO1Mj5nhazAKJjAi0/uuHnz2CE7Il/FTSoX2R4CeWIw9VAIK/a+4Sl2Stq5rGs07Q yy0CW+i6cHKmFk2B4gz+ZLxDqD78Gj54mU4tFrdxIi1tMVjyI4w5eKUDzroRF2tOSO3LJ FLr6VkzEh3lfNa0tnI8hBEZszHjr9y/QCG9PFvFo4gzihxv+aZ8j5QjYq0KyhYkCbzTj5 51IwwboeP/3rwWnB5+bQ7DirmiqEh60X3Ot+dgN4JhaGZ4D/UiUMfyru9CPMuhTxqd9J1 psXVrsB1Ql9uJWCoETl4FmA8ympExdpOkKwUpGfGBkbE0TtK5BdY+Lj+o17H7BcO99A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796393703; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=U8FCU5WzAIk7AifW3voGqQA009yzifllMeO6KpyjFxQ=; b=E4QwgJEAgHy6g0AeR0QLmf0TXkteqrweDNAq6jt945HhHfFC9OKvg119PcZMPDMFwL5Q v4sBE2BRPru4NoTzpI5EDEct9+LOnNjElhOg9QacokhWR2+sB+D+zYqEpUOEfnQ9IQrTL I0kcEg1S2QhqcsNhI41f+P0xLrybJRYTJoqwFRy98/qn6Oyj3BKga4oK0iXCHxaBDJZmN +jaIGdusPszMVtI8/+wnbFGmkZTQhtK5mCoQkF5t6nXBHdEbFMG1hfJQ6psQBhVvdj5/g XZHaO+hjDlkLvMcdJxd5oACjdSllDrbS6OiZ5qxwh2hFeAQEfIl+M+gNUSyKrlheDYA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=oxDdK9sM; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C0B8E606A332 for ; Fri, 4 Dec 2026 14:15:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=oxDdK9sM Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5652C1F000C2; Fri, 4 Dec 2026 14:15:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796393703; bh=U8FCU5WzAIk7AifW3voGqQA009yzifllMeO6KpyjFxQ=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=oxDdK9sMVA9l6vWjlBYcEXy+BRNzkmbtbWLd4s6pbOijp8O+vosBhEcfnmObfM5qn 8NxQFwXcyYiG/jAHbOUeY+KENvhZmqUo2l0RWndg1scaIZDaGfVjaGj0nChy6JEwX2 bNZY9lVAlM7d+K0ZXIalJYDyDu3uKSpIZP5AhPuogSEK5I79xbkUDIL3kAoYdMqxpG vAIw/iiqRC/Z0s5S11MU2WlK5B4jvBBWGnKCPFkIsO0eVCN0SPjwNRUVUi9RZNjjVI 2otdYRVS2sSH55HUjQyYtbgkOAOInN+DLrunZ9zVO/cGbgAxyLJQtFn37nSS6TG9Za UypiQXAon4zSw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2 1/2] cxl/region: Fail region creation for a root decoder without a CXL window Reply-To: sashiko-reviews@lists.linux.dev To: "Unsung Lee" , linux-cxl@vger.kernel.org In-Reply-To: <20261204135754.639574-2-unsung0317@gmail.com> References: <20261204135754.639574-1-unsung0317@gmail.com> <20261204135754.639574-2-unsung0317@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 14:15:02 +0000 X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] cxl: data race on cxlrd->res between pair_cxl_resource() and __create_region() -- commit f8ca0af34d0d599d4141c4a1d8c9733e462badf1 Author: Unsung Lee cxl/region: Fail region creation for a root decoder without a CXL window This commit rejects region creation in __create_region() with -ENXIO when cxlrd->res is NULL and logs unpaired root decoders in pair_cxl_resource(). > diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c > index 7573cd115e57d..4a1386ffa43ed 100644 > --- a/drivers/cxl/core/region.c > +++ b/drivers/cxl/core/region.c > @@ -3106,7 +3106,7 @@ static struct cxl_region *__create_region(struct cx= l_root_decoder *cxlrd, > { > int rc; > =20 > - if (cxlrd->dead) > + if (cxlrd->dead || !cxlrd->res) > return ERR_PTR(-ENXIO); > =20 > switch (mode) { [Severity: Medium] Can this read of cxlrd->res race with pair_cxl_resource() during cxl_acpi_probe()? CPU0 CPU1 cxl_acpi_probe() acpi_table_parse_cedt() __cxl_parse_cfmws() cxl_decoder_add(cxld) create_region_store() lock(&cxlrd->regions_lock) ... __create_region() pair_cxl_resource() if (cxlrd->dead || !cxlrd->res) cxlrd->res =3D ... <-- data race / spurious -ENXIO __cxl_parse_cfmws() exposes the root decoder in sysfs via cxl_decoder_add() before pair_cxl_resource() populates cxlrd->res. create_region_store() holds only cxlrd->regions_lock, while pair_cxl_resource() writes cxlrd->res with a plain store without taking cxlrd->regions_lock. This introduces a data race on cxlrd->res and can cause valid root decoders to transiently fail region creation with -ENXIO during probe. Taking cxlrd->regions_lock around the cxlrd->res store in pair_cxl_resource() would fix the data race, and deferring cxl_decoder_add() until after resource pairing would close the probe window. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204135754.6395= 74-1-unsung0317@gmail.com?part=3D1