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=1796308120; b=Qivbpfwso4UZQ3uTbGfPyHt8pLwr5oKgVoSE6QWk4XgCWRScMZDk/P+G8tNtC6IsGsFV TrOLpC8EcknC3LMgS89OfTfq/vML5jbQ5GVXvxKpKoCZ0+J0Mf3tBR2Ubxf+jq5MBAHBh VNn9nxKipKS5ROHwvNMSEJr7UUvYYrjGB7p7AYPIKsNJ1BI+an1locajb3jDfiw6xGiC7 ycim+Q9gO2kRkDyU/epUguyr8M9w8M08/9/aXw9yejcICZQ69vLMrfDgQoObEIU9iRhcQ LxTxdtAc779SVOLFi7R6bwQFmJixiZjly7BiBYiMwSREUtHSazzOEHzwaE0efqTlntg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796308120; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=ube+qp1nhjkyaLqrrjXF7Ud6fnqS6x02gB2fDzVuBnU=; b=UzOEiMEV66RdTA9zY+7wa45/0ya1G+Wuw9hXdVa+FYq8R7kvW0sabzvzWCKm5VRWX5fn X15/r1pP/39vpkhqSE2WM6v3XgEv0Jal12LWuwZvTEYlZgq8j01ykip/55MQ/E7BKY8XN tsI5s01l0Fo44Qyq5OpQhvRKCwEcSyf6htezMd4eZwEpmIKpsX4GJcf+7M2uavFb+vQm1 hTjbDfuXExHUMJtAGTbtnUiC8BFXx2rO0vIgJRaqjKXvfeenKJjYMw/Ji0GbLLTlTtFaz 4VbjUy4zjhXSTnxIxEYDfoLnbVbF/WosHyljMGmIBNbabMtiW4tCP+JPSUSEuNisH6w== 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=FlmKse8F; 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 A88E7606A330; Thu, 3 Dec 2026 14:28:40 +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=FlmKse8F Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9FF31F00927; Thu, 3 Dec 2026 14:28:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796308120; bh=ube+qp1nhjkyaLqrrjXF7Ud6fnqS6x02gB2fDzVuBnU=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=FlmKse8F0wYK0+I0TCop6IGTj0Op6ibC8CHGlaga54GZlPLsFBs3a1+rT5dh+O7D4 n0bfYFVkaeMAtpvTPQ1mvrXSoQX6MnmkX8UbxqJKtCByuGYOpsVgcPXmAO2B7FSLll 3V9bweIZACW4SM0E3FZZkahVIFvSJ/O72Kkb9wwCVv55I7iEyi6cpL7V6jDF3RBvPy b8z40bO97rUqPVVwqsDm2gIGBS8KlG4tjOzfUCctHB5tvgDNTfF7EWrXwPJZb9/EG4 xTlWBNeL9/DHdTu7yqjvrNMFiJfwD8aZVMcEpfdUV7v0lPqrb/+2JYFIl46nKdecTD eBTn8/9xm5l7w== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v8 22/22] RAS: add firmware-first CPER provider Reply-To: sashiko-reviews@lists.linux.dev To: "Ahmed Tiba" Cc: linux-cxl@vger.kernel.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org In-Reply-To: <20261203-topics-ahmtib01-ras_ffh_arm_internal_review-v8-22-157aac88560b@arm.com> References: <20261203-topics-ahmtib01-ras_ffh_arm_internal_review-v8-0-157aac88560b@arm.com> <20261203-topics-ahmtib01-ras_ffh_arm_internal_review-v8-22-157aac88560b@arm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 14:28:39 +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 8 potential issues to consider: - [High] RAS: RAS_CPER_ESOURCE selects ACPI-only Kconfig symbols on non-ACPI arches - [Medium] ACPI: APEI: unguarded acpi/acpi_io.h include breaks non-ACPI builds - [Medium] cxl: CXL_RAS depends on ACPI_APEI_GHES, dropping RAS_CPER_ESOURCE errors - [Medium] RAS: RAS_CPER_ESOURCE lacks HAS_IOMEM dependency for devm_ioremap() - [Medium] RAS: cper_esource_probe() uses devm_kzalloc() for up to 64 KiB estatus - [Low] RAS: commit message omits cross-subsystem AER, extlog, CXL, and GHES changes - [Low] RAS: cper_esource_map_region() maps full region before length clamping - [Low] RAS: cper_esource_map_region() returns ERR_PTR() for void __iomem * -- commit d8e05a1aeeac8369e2236d27e4905ba75243e89a Author: Ahmed Tiba > RAS: add firmware-first CPER provider > > Add a firmware-first CPER provider that reuses the shared > GHES helpers, wire it into the RAS Kconfig/Makefile and > document it in the admin guide. > > Update MAINTAINERS now that the driver exists. > > Signed-off-by: Ahmed Tiba [Severity: Low] Should the commit message also describe the cross-subsystem changes in this patch, or could they be split into preparatory commits? Beyond adding drivers/ras/cper-esource.c, the diff introduces CONFIG_GHES_CPER_PCIEAER_HELPERS, moves ghes_helpers.o out of drivers/acpi/apei/Makefile, switches PCIe AER and CXL headers to the new symbol, adds recovery flags to ghes_cper_handle_status(), and guards cxl_cper_post_prot_err() in acpi_extlog.c. Explaining why those changes are needed would help reviewers and future readers of the git history. [ ... ] > diff --git a/drivers/acpi/apei/ghes_cper.c b/drivers/acpi/apei/ghes_cper.c > index bceac27ac2747..330150f43f5e3 100644 > --- a/drivers/acpi/apei/ghes_cper.c > +++ b/drivers/acpi/apei/ghes_cper.c > @@ -42,8 +42,10 @@ > #include > #include > =20 > +#ifdef CONFIG_ACPI_APEI > #include > #include > +#endif > =20 > #include "apei-internal.h" [Severity: Medium] Does leaving outside the CONFIG_ACPI_APEI guard break non-ACPI builds on RISC-V? include/acpi/acpi_io.h unconditionally includes and defines an inline acpi_os_ioremap() fallback calling ioremap_cache() when acpi_os_ioremap is not defined. On RISC-V with CONFIG_ACPI=3Dn, arch/riscv/include/asm/acpi.h does not define acpi_os_ioremap and ioremap_cache() does not exist, so compiling ghes_cper.c fails. Guarding (and apei_unmap_generic_address() in apei-internal.h, which calls acpi_os_unmap_generic_address()) with CONFIG_ACPI_APEI would avoid pulling in ACPI I/O headers on non-ACPI builds. [ ... ] > @@ -868,7 +882,7 @@ struct work_struct *cxl_cper_prot_err_work; > void cxl_cper_post_prot_err(struct cxl_cper_sec_prot_err *prot_err, > int severity, u32 len) > { > -#ifdef CONFIG_ACPI_APEI_PCIEAER > +#ifdef CONFIG_GHES_CPER_PCIEAER_HELPERS > struct cxl_cper_prot_err_work_data wd; > =20 > if (cxl_cper_sec_prot_err_valid(prot_err, len)) [Severity: Medium] Can CXL protocol errors reported through RAS_CPER_ESOURCE ever be delivered when ACPI_APEI_GHES is disabled? In drivers/cxl/Kconfig, CXL_RAS still depends on ACPI_APEI_GHES && PCIEAER && CXL_BUS. When ACPI_APEI_GHES=3Dn with RAS_CPER_ESOURCE=3Dy, cxl_ras_init() compiles to a stub, cxl_cper_register_prot_err_work() is never called, and cxl_cper_post_prot_err() returns early with cxl_cper_prot_err_work =3D=3D NULL, silently dropping every CXL protocol error. [ ... ] > diff --git a/drivers/ras/Kconfig b/drivers/ras/Kconfig > index 070e17639faa3..f416b71ea80ae 100644 > --- a/drivers/ras/Kconfig > +++ b/drivers/ras/Kconfig > @@ -56,6 +56,19 @@ config RAS_CEC_DEBUG > =20 > source "drivers/ras/amd/atl/Kconfig" > =20 > +config RAS_CPER_ESOURCE > + bool "Firmware-first CPER error source block provider" > + select GHES_CPER_HELPERS > + select GHES_CPER_PCIEAER_HELPERS if PCIEAER [Severity: High] Does selecting GHES_CPER_HELPERS and GHES_CPER_PCIEAER_HELPERS here break builds on architectures that do not source drivers/acpi/Kconfig? Both symbols are defined in drivers/acpi/Kconfig, which is only sourced by arm64, loongarch, riscv, and x86, whereas drivers/ras/Kconfig is sourced on all architectures. On any other little-endian architecture with OF_RESERVED_MEM (such as 32-bit ARM), those symbols remain undefined, ghes_cper.o and ghes_helpers.o are not built, and linking cper-esource.o fails with undefined references to the GHES and CPER helpers. Note that moving the Kconfig symbols alone is not enough while ghes_cper.c still pulls in via , since only exists on those same four architectures. > + depends on OF_RESERVED_MEM && !CPU_BIG_ENDIAN [Severity: Medium] Is a HAS_IOMEM dependency missing here? cper_esource_map_region() calls devm_ioremap(), which is only built when CONFIG_HAS_IOMEM is enabled. OF_RESERVED_MEM does not depend on HAS_IOMEM, so configurations like UML with CONFIG_OF=3Dy and CONFIG_NO_IOMEM=3Dy can enable RAS_CPER_ESOURCE and fail to link. [ ... ] > diff --git a/drivers/ras/cper-esource.c b/drivers/ras/cper-esource.c > new file mode 100644 > index 0000000000000..221b5f97e335c > --- /dev/null > +++ b/drivers/ras/cper-esource.c [ ... ] > +static void __iomem *cper_esource_map_region(struct device *dev, > + unsigned int index, size_t *size, > + resource_size_t *start) > +{ > + resource_size_t resource_len; > + struct resource res; > + void __iomem *addr; > + > + if (of_reserved_mem_region_to_resource(dev->of_node, index, &res)) > + return ERR_PTR(dev_err_probe(dev, -EINVAL, > + "unable to resolve memory-region %u\n", > + index)); [Severity: Low] Should the error returns in cper_esource_map_region() use IOMEM_ERR_PTR() instead of ERR_PTR()? The function returns void __iomem *, so returning ERR_PTR() triggers sparse address-space mismatch warnings on all four error paths. [ ... ] > + *size =3D resource_len; > + if (start) > + *start =3D res.start; > + > + addr =3D devm_ioremap(dev, res.start, *size); [Severity: Low] Could cper_esource_map_region() clamp the mapping length before calling devm_ioremap()? cper_esource_probe() clamps ctx->status_len to GHES_ESTATUS_MAX_SIZE after mapping the entire reserved-memory region, and cper_esource_init_ack() only accesses a single 32-bit word. Mapping the full unclamped region wastes ioremap virtual address space and can cause unnecessary -ENOMEM failures if DeviceTree describes a large region. [ ... ] > + ctx->status_len =3D min_t(size_t, size, GHES_ESTATUS_MAX_SIZE); [ ... ] > + ctx->estatus =3D devm_kzalloc(dev, ctx->status_len, GFP_KERNEL); [Severity: Medium] Should ctx->estatus be allocated with kvzalloc() instead of devm_kzalloc()? ctx->status_len can be up to GHES_ESTATUS_MAX_SIZE (64 KiB). Because devm_kzalloc() prepends struct devres and rounds up to a power-of-two page order, a 64 KiB status buffer turns into a 128 KiB (order-5) physically contiguous allocation on 4 KiB page kernels, wasting nearly 64 KiB per device and risking compaction stalls or -ENOMEM on fragmented systems. ctx->estatus is only accessed by the CPU, so kvzalloc() paired with a devm_add_action_or_reset() callback calling kvfree() avoids both the high-order contiguous allocation and the rounding overhead. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203-topics-ahm= tib01-ras_ffh_arm_internal_review-v8-0-157aac88560b@arm.com?part=3D22