mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pierre Gondois <pierre.gondois@arm.com>
To: linux-kernel@vger.kernel.org
Cc: Ashok Raj <ashok.raj@oss.qualcomm.com>,
	James Morse <james.morse@arm.com>,
	Mark Brown <broonie@kernel.org>,
	Pierre Gondois <pierre.gondois@arm.com>,
	Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Len Brown <lenb@kernel.org>, Tony Luck <tony.luck@intel.com>,
	Hanjun Guo <guohanjun@huawei.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Shuai Xue <xueshuai@linux.alibaba.com>,
	Mahesh J Salgaonkar <mahesh@linux.ibm.com>,
	"Oliver O'Halloran" <oohall@gmail.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>,
	Pawel Chmielewski <pawel.chmielewski@intel.com>,
	Yazen Ghannam <yazen.ghannam@amd.com>,
	Qiuxu Zhuo <qiuxu.zhuo@intel.com>, Radu Rendec <radu@rendec.net>,
	Avadhut Naik <avadhut.naik@amd.com>,
	Jonathan Cameron <jic23@kernel.org>,
	Dave Jiang <dave.jiang@intel.com>,
	Kai-Heng Feng <kaihengf@nvidia.com>,
	"Fabio M. De Francesco" <fabio.m.de.francesco@linux.intel.com>,
	Breno Leitao <leitao@debian.org>, Dan Williams <djbw@kernel.org>,
	Terry Bowman <terry.bowman@amd.com>,
	linux-acpi@vger.kernel.org, linux-edac@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org, linux-pci@vger.kernel.org,
	acpica-devel@lists.linux.dev
Subject: [PATCH v1 06/19] ACPI: APEI: Remove aer allocation in ghes_handle_aer()
Date: Tue, 17 Nov 2026 12:10:16 +0100	[thread overview]
Message-ID: <20261117111444.4185512-7-pierre.gondois@arm.com> (raw)
In-Reply-To: <20261117111444.4185512-1-pierre.gondois@arm.com>

aer_recover_queue() now copies the input aer_regs instead of
storing a pointer to the struct. Use a local variable to pass
aer_regs in ghes_handle_aer() and remove the memory allocation
introduced by:
commit e2abc47a5a1a ("ACPI: APEI: Fix AER info corruption when error
status data has multiple sections")

No functional change intended.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
---
 drivers/acpi/apei/ghes.c | 25 +++----------------------
 drivers/pci/pcie/aer.c   | 17 +++++------------
 include/acpi/ghes.h      |  4 ----
 include/linux/aer.h      |  2 +-
 4 files changed, 9 insertions(+), 39 deletions(-)

diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
index 444d8e82353a7..3aecd3f828e58 100644
--- a/drivers/acpi/apei/ghes.c
+++ b/drivers/acpi/apei/ghes.c
@@ -228,20 +228,6 @@ int ghes_estatus_pool_init(unsigned int num_ghes)
 	return -ENOMEM;
 }
 
-/**
- * ghes_estatus_pool_region_free - free previously allocated memory
- *				   from the ghes_estatus_pool.
- * @addr: address of memory to free.
- * @size: size of memory to free.
- *
- * Returns none.
- */
-void ghes_estatus_pool_region_free(unsigned long addr, u32 size)
-{
-	gen_pool_free(ghes_estatus_pool, addr, size);
-}
-EXPORT_SYMBOL_GPL(ghes_estatus_pool_region_free);
-
 static int map_gen_v2(struct ghes *ghes)
 {
 	return apei_map_generic_address(&ghes->generic_v2->read_ack_register);
@@ -666,7 +652,7 @@ static void ghes_handle_aer(struct acpi_hest_generic_data *gdata)
 
 	if (pcie_err->validation_bits & CPER_PCIE_VALID_DEVICE_ID &&
 	    pcie_err->validation_bits & CPER_PCIE_VALID_AER_INFO) {
-		struct aer_capability_regs *aer_info;
+		struct aer_capability_regs aer_info;
 		unsigned int devfn;
 		int aer_severity;
 
@@ -682,16 +668,11 @@ static void ghes_handle_aer(struct acpi_hest_generic_data *gdata)
 		if (gdata->flags & CPER_SEC_RESET)
 			aer_severity = AER_FATAL;
 
-		aer_info = (void *)gen_pool_alloc(ghes_estatus_pool,
-						  sizeof(struct aer_capability_regs));
-		if (!aer_info)
-			return;
-
-		aer_cap_regs_unpack(aer_info, pcie_err->aer_info, sizeof(pcie_err->aer_info));
+		aer_cap_regs_unpack(&aer_info, pcie_err->aer_info, sizeof(pcie_err->aer_info));
 
 		aer_recover_queue(pcie_err->device_id.segment,
 				  pcie_err->device_id.bus,
-				  devfn, aer_severity, aer_info);
+				  devfn, aer_severity, &aer_info);
 	}
 #endif
 }
diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
index 57406494ec1f7..d7ef84e3b988e 100644
--- a/drivers/pci/pcie/aer.c
+++ b/drivers/pci/pcie/aer.c
@@ -32,7 +32,6 @@
 #include <linux/slab.h>
 #include <linux/vmcore_info.h>
 #include <acpi/apei.h>
-#include <acpi/ghes.h>
 #include <ras/ras_event.h>
 
 #include "../pci.h"
@@ -1413,18 +1412,15 @@ static DECLARE_WORK(aer_recover_work, aer_recover_work_func);
  * @severity: AER_CORRECTABLE, AER_NONFATAL or AER_FATAL
  * @aer_regs: snapshot of the device's AER Capability registers
  *
- * Queue an error record received from firmware through APEI GHES.  The
- * record is processed later from a workqueue, which logs the error and,
+ * Queue an error record received from firmware. The record is processed
+ * later from a workqueue, which logs the error and,
  * for uncorrectable errors, attempts recovery of the device.
  *
- * Takes ownership of @aer_regs, which must have been allocated from
- * ghes_estatus_pool with a size of sizeof(struct aer_capability_regs).
- * Copies the registers into the queue entry and frees the supplied buffer
- * before returning, including when the queue is full. The caller must not
- * access or free @aer_regs after this call.
+ * Copies @aer_regs into the recovery queue. The caller retains ownership of
+ * the supplied snapshot and may reuse it after this function returns.
  */
 void aer_recover_queue(int domain, unsigned int bus, unsigned int devfn,
-		       int severity, struct aer_capability_regs *aer_regs)
+		       int severity, const struct aer_capability_regs *aer_regs)
 {
 	struct aer_recover_entry entry = {
 		.bus		= bus,
@@ -1434,9 +1430,6 @@ void aer_recover_queue(int domain, unsigned int bus, unsigned int devfn,
 		.regs		= *aer_regs,
 	};
 
-	ghes_estatus_pool_region_free((unsigned long)aer_regs,
-				      sizeof(struct aer_capability_regs));
-
 	if (kfifo_in_spinlocked(&aer_recover_ring, &entry, 1,
 				 &aer_recover_ring_lock)) {
 		schedule_work(&aer_recover_work);
diff --git a/include/acpi/ghes.h b/include/acpi/ghes.h
index 3fdb7ea59f9cc..ef58e2251407e 100644
--- a/include/acpi/ghes.h
+++ b/include/acpi/ghes.h
@@ -84,15 +84,11 @@ int devm_ghes_register_vendor_record_notifier(struct device *dev,
 
 struct list_head *ghes_get_devices(void);
 
-void ghes_estatus_pool_region_free(unsigned long addr, u32 size);
-
 struct cxl_cper_sec_prot_err;
 void cxl_cper_post_prot_err(struct cxl_cper_sec_prot_err *prot_err,
 			    int severity, u32 len);
 #else
 static inline struct list_head *ghes_get_devices(void) { return NULL; }
-
-static inline void ghes_estatus_pool_region_free(unsigned long addr, u32 size) { return; }
 #endif
 
 int ghes_estatus_pool_init(unsigned int num_ghes);
diff --git a/include/linux/aer.h b/include/linux/aer.h
index 043ee76b6f538..0a5ec7956b487 100644
--- a/include/linux/aer.h
+++ b/include/linux/aer.h
@@ -79,6 +79,6 @@ void aer_cap_regs_unpack(struct aer_capability_regs *regs, const void *raw,
 			 size_t raw_len);
 int cper_severity_to_aer(int cper_severity);
 void aer_recover_queue(int domain, unsigned int bus, unsigned int devfn,
-		       int severity, struct aer_capability_regs *aer_regs);
+		       int severity, const struct aer_capability_regs *aer_regs);
 #endif //_AER_H_
 
-- 
2.43.0


  parent reply	other threads:[~2026-11-17 11:17 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 11:10 [PATCH v1 00/19] ACPI: APEI: Share CPER reporting between GHES and extlog Pierre Gondois
2026-11-17 11:10 ` [PATCH v1 01/19] x86/APEI: Extract common CPER memory error reporting helper Pierre Gondois
2026-11-17 11:10 ` [PATCH v1 02/19] x86/APEI: Report Memory Error Section 2 through MCE Pierre Gondois
2026-11-17 11:10 ` [PATCH v1 03/19] ras: Bound CPER FRU strings in trace events Pierre Gondois
2026-11-17 11:10 ` [PATCH v1 04/19] ACPI: APEI: Use empty FRU values if valid bit is absent Pierre Gondois
2026-11-17 11:10 ` [PATCH v1 05/19] PCI/AER: Embed aer_capability_regs copy in struct aer_recover_entry Pierre Gondois
2026-11-17 11:44   ` Lukas Wunner
2026-11-17 11:10 ` Pierre Gondois [this message]
2026-11-17 11:10 ` [PATCH v1 07/19] ACPI: extlog: Provide HEST generic data to extlog_print_pcie() Pierre Gondois
2026-11-17 11:10 ` [PATCH v1 08/19] ACPI: extlog: Align extlog_print_pcie() and ghes_handle_aer() Pierre Gondois
2026-11-17 11:10 ` [PATCH v1 09/19] ACPI: extlog: Report errors independently of RAS consumers Pierre Gondois
2026-11-17 11:10 ` [PATCH v1 10/19] ACPI: extlog: Simplify fatal record printing Pierre Gondois
2026-11-17 11:10 ` [PATCH v1 11/19] RAS: Remove unused ras_userspace_consumers() Pierre Gondois
2026-11-17 11:10 ` [PATCH v1 12/19] ACPI: extlog: Extract CPER reporting from acpi_extlog Pierre Gondois
2026-11-17 11:10 ` [PATCH v1 13/19] ACPI: APEI: Share helpers with the common CPER reporter Pierre Gondois
2026-11-17 11:10 ` [PATCH v1 14/19] ACPI: APEI: Return status from cxl_cper_post_event() Pierre Gondois
2026-11-17 11:10 ` [PATCH v1 15/19] ACPI: APEI: Extend common CPER reporting for GHES section types Pierre Gondois
2026-11-17 11:10 ` [PATCH v1 16/19] ACPI: extlog: Report error severity using GHES bindings in MCE Pierre Gondois
2026-11-17 11:10 ` [PATCH v1 17/19] ACPI: APEI: Share the extlog PCIe handler with GHES Pierre Gondois
2026-11-17 11:10 ` [PATCH v1 18/19] ACPI: APEI: Route GHES section reporting through extlog Pierre Gondois
2026-11-17 11:10 ` [PATCH v1 19/19] PCI/ERR: Avoid NULL bridge pointer Pierre Gondois
2026-11-17 11:50   ` Lukas Wunner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261117111444.4185512-7-pierre.gondois@arm.com \
    --to=pierre.gondois@arm.com \
    --cc=acpica-devel@lists.linux.dev \
    --cc=ashok.raj@oss.qualcomm.com \
    --cc=avadhut.naik@amd.com \
    --cc=bhelgaas@google.com \
    --cc=bp@alien8.de \
    --cc=broonie@kernel.org \
    --cc=dave.hansen@linux.intel.com \
    --cc=dave.jiang@intel.com \
    --cc=djbw@kernel.org \
    --cc=fabio.m.de.francesco@linux.intel.com \
    --cc=guohanjun@huawei.com \
    --cc=hpa@zytor.com \
    --cc=james.morse@arm.com \
    --cc=jic23@kernel.org \
    --cc=kaihengf@nvidia.com \
    --cc=leitao@debian.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maciej.wieczor-retman@intel.com \
    --cc=mahesh@linux.ibm.com \
    --cc=mchehab@kernel.org \
    --cc=mingo@redhat.com \
    --cc=oohall@gmail.com \
    --cc=pawel.chmielewski@intel.com \
    --cc=qiuxu.zhuo@intel.com \
    --cc=radu@rendec.net \
    --cc=rafael@kernel.org \
    --cc=terry.bowman@amd.com \
    --cc=tglx@kernel.org \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    --cc=xueshuai@linux.alibaba.com \
    --cc=yazen.ghannam@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®