mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Pierre Gondois <pierre.gondois@arm.com>
Cc: linux-kernel@vger.kernel.org,
	Ashok Raj <ashok.raj@oss.qualcomm.com>,
	James Morse <james.morse@arm.com>,
	Mark Brown <broonie@kernel.org>,
	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>,
	Avadhut Naik <avadhut.naik@amd.com>,
	"Fabio M. De Francesco" <fabio.m.de.francesco@linux.intel.com>,
	Dave Jiang <dave.jiang@intel.com>,
	Kai-Heng Feng <kaihengf@nvidia.com>,
	Breno Leitao <leitao@debian.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: Re: [PATCH v1 12/19] ACPI: extlog: Extract CPER reporting from acpi_extlog
Date: Wed, 18 Nov 2026 20:04:17 +0000	[thread overview]
Message-ID: <20261118200417.42034547@jic23-hlaptop> (raw)
In-Reply-To: <20261117111444.4185512-13-pierre.gondois@arm.com>

On Tue, 17 Nov 2026 12:10:22 +0100
Pierre Gondois <pierre.gondois@arm.com> wrote:

> Extract the CPER reporting code to a separate file in order
> to re-use it in the GHES code in a later patch.
> 
> CONFIG_ACPI_EXTLOG selects ACPI_APEI_GHES and acpi_extlog_report()
> will be used in ghes.c, built with CONFIG_ACPI_APEI_GHES. Thus also
> build extlog.c under CONFIG_ACPI_APEI_GHES.
> 
> Relax the definition of extlog_mem[|2]_event tracepoints to
> CONFIG_ACPI_APEI_GHES. The common reporter references them even
> when CONFIG_ACPI_EXTLOG is disabled. Guard its memory trace calls
> with CONFIG_RAS because GHES can be enabled without RAS.
> 
> Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>

There is too much going on in here that isn't code movement of
Kconfig stuff related to that.  Those other changes need their
own patches were you can describe fully why they are being done.

> diff --git a/drivers/acpi/apei/extlog.c b/drivers/acpi/apei/extlog.c
> new file mode 100644
> index 0000000000000..8eef33a4326a7
> --- /dev/null
> +++ b/drivers/acpi/apei/extlog.c

> +/**
> + * acpi_extlog_mem_error - trace a validated CPER memory section
> + * @gdata: section header followed by its payload
> + * @err_seq: sequence number shared by sections in the same error record
> + *
> + * The caller must validate the payload length, including any optional fields
> + * claimed by the memory validation bits, before calling this function.
> + */
> +static void acpi_extlog_mem_error(struct acpi_hest_generic_data *gdata, u32 err_seq)
> +{
> +#ifdef CONFIG_RAS
> +	struct cper_sec_mem_err *mem = acpi_hest_get_payload(gdata);
> +	const guid_t *fru_id;
> +	const char *fru_text;
> +
> +	if (gdata->validation_bits & CPER_SEC_VALID_FRU_ID)
> +		fru_id = (guid_t *)gdata->fru_id;
> +	else
> +		fru_id = &guid_null;
> +	if (gdata->validation_bits & CPER_SEC_VALID_FRU_TEXT)
> +		fru_text = gdata->fru_text;
> +	else
> +		fru_text = "";

See below. This work is done in the caller unless I'm going crazy
and it's a different fru entry...

> +
> +	trace_extlog_mem_event(mem, err_seq, fru_id, fru_text,
> +			       (u8)gdata->error_severity);
> +#endif
> +}
> +
> +/**
> + * acpi_extlog_mem2_error - trace a validated CPER memory section 2
> + * @gdata: section header followed by its payload
> + * @err_seq: sequence number shared by sections in the same error record
> + *
> + * The caller must validate the payload length before calling this function.
> + */
> +static void acpi_extlog_mem2_error(struct acpi_hest_generic_data *gdata, u32 err_seq)
> +{
> +#ifdef CONFIG_RAS
> +	struct cper_sec_mem_err2 *mem = acpi_hest_get_payload(gdata);
> +	const guid_t *fru_id;
> +	const char *fru_text;
> +
> +	if (gdata->validation_bits & CPER_SEC_VALID_FRU_ID)
> +		fru_id = (guid_t *)gdata->fru_id;
> +	else
> +		fru_id = &guid_null;
> +	if (gdata->validation_bits & CPER_SEC_VALID_FRU_TEXT)
> +		fru_text = gdata->fru_text;
> +	else
> +		fru_text = "";
> +
> +	trace_extlog_mem2_event(mem, err_seq, fru_id, fru_text,
> +				(u8)gdata->error_severity);
> +#endif
> +}
> +
> +/**
> + * acpi_extlog_report - report sections of a validated generic error status block
> + * @estatus: caller-owned status block, already checked by cper_estatus_check()
> + *
> + * The caller handles console output and firmware acknowledgment. Section
> + * processing, including PCIe recovery, does not depend on RAS consumers.
> + */
> +void acpi_extlog_report(const struct acpi_hest_generic_status *estatus)

Given there are functional changes in here, it may make sense to do them
separately from the code move  / factor out. 

> +{
> +	static atomic_t seqno = ATOMIC_INIT(0);

Why did this become an atomic?  I don't mind that but I'd have made
the change in a separate patch so you can explain it.

> +	struct acpi_hest_generic_data *gdata;
> +	const guid_t *fru_id;
> +	const char *fru_text;
> +	guid_t *sec_type;
> +	u32 err_seq;
> +
> +	/* log event via trace */
> +	err_seq = atomic_inc_return(&seqno);
> +	apei_estatus_for_each_section(estatus, gdata) {
> +		if (gdata->validation_bits & CPER_SEC_VALID_FRU_ID)
> +			fru_id = (guid_t *)gdata->fru_id;
> +		else
> +			fru_id = &guid_null;
> +		if (gdata->validation_bits & CPER_SEC_VALID_FRU_TEXT)
> +			fru_text = gdata->fru_text;
> +		else
> +			fru_text = "";
> +		sec_type = (guid_t *)gdata->section_type;
> +		if (guid_equal(sec_type, &CPER_SEC_PLATFORM_MEM)) {
> +			struct cper_sec_mem_err *mem = acpi_hest_get_payload(gdata);
> +
> +			if (gdata->error_data_length >= sizeof(*mem))
> +				acpi_extlog_mem_error(gdata, err_seq);

I'd move them with old name then rename in a follow up patch.
Particularly as the new code duplicates the fru stuff above - that
needs explaining which can't be done in code move patch.

> +		} else if (guid_equal(sec_type, &CPER_SEC_PLATFORM_MEM2)) {
> +			struct cper_sec_mem_err2 *mem = acpi_hest_get_payload(gdata);
> +
> +			if (gdata->error_data_length >= sizeof(*mem))
> +				acpi_extlog_mem2_error(gdata, err_seq);

Same for this.

> +		} else if (guid_equal(sec_type, &CPER_SEC_CXL_PROT_ERR)) {
> +			struct cxl_cper_sec_prot_err *prot_err =
> +				acpi_hest_get_payload(gdata);
> +
> +			cxl_cper_post_prot_err(prot_err,
> +					       gdata->error_severity,
> +					       gdata->error_data_length);
> +		} else if (guid_equal(sec_type, &CPER_SEC_PCIE)) {
> +			extlog_print_pcie(gdata);
> +		} else {
> +			void *err = acpi_hest_get_payload(gdata);
> +
> +			log_non_standard_event(sec_type, fru_id, fru_text,
> +					       gdata->error_severity, err,
> +					       gdata->error_data_length);
> +		}
> +	}
> +}
> +EXPORT_SYMBOL_FOR_MODULES(acpi_extlog_report, "acpi_extlog");



  reply	other threads:[~2026-11-18 20:04 UTC|newest]

Thread overview: 41+ 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-18 18:54   ` Jonathan Cameron
2026-11-17 11:10 ` [PATCH v1 02/19] x86/APEI: Report Memory Error Section 2 through MCE Pierre Gondois
2026-11-18 18:57   ` Jonathan Cameron
2026-11-17 11:10 ` [PATCH v1 03/19] ras: Bound CPER FRU strings in trace events Pierre Gondois
2026-11-18 19:06   ` Jonathan Cameron
2026-11-17 11:10 ` [PATCH v1 04/19] ACPI: APEI: Use empty FRU values if valid bit is absent Pierre Gondois
2026-11-18 19:10   ` Jonathan Cameron
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-18 15:10     ` Pierre Gondois
2026-11-17 11:10 ` [PATCH v1 06/19] ACPI: APEI: Remove aer allocation in ghes_handle_aer() Pierre Gondois
2026-11-18 19:14   ` Jonathan Cameron
2026-11-17 11:10 ` [PATCH v1 07/19] ACPI: extlog: Provide HEST generic data to extlog_print_pcie() Pierre Gondois
2026-11-18 19:17   ` Jonathan Cameron
2026-11-17 11:10 ` [PATCH v1 08/19] ACPI: extlog: Align extlog_print_pcie() and ghes_handle_aer() Pierre Gondois
2026-11-18 19:29   ` Jonathan Cameron
2026-11-17 11:10 ` [PATCH v1 09/19] ACPI: extlog: Report errors independently of RAS consumers Pierre Gondois
2026-11-18 19:45   ` Jonathan Cameron
2026-11-17 11:10 ` [PATCH v1 10/19] ACPI: extlog: Simplify fatal record printing Pierre Gondois
2026-11-18 19:46   ` Jonathan Cameron
2026-11-17 11:10 ` [PATCH v1 11/19] RAS: Remove unused ras_userspace_consumers() Pierre Gondois
2026-11-18 19:49   ` Jonathan Cameron
2026-11-17 11:10 ` [PATCH v1 12/19] ACPI: extlog: Extract CPER reporting from acpi_extlog Pierre Gondois
2026-11-18 20:04   ` Jonathan Cameron [this message]
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-18 20:06   ` Jonathan Cameron
2026-11-17 11:10 ` [PATCH v1 15/19] ACPI: APEI: Extend common CPER reporting for GHES section types Pierre Gondois
2026-11-18 20:14   ` Jonathan Cameron
2026-11-17 11:10 ` [PATCH v1 16/19] ACPI: extlog: Report error severity using GHES bindings in MCE Pierre Gondois
2026-11-18 20:17   ` Jonathan Cameron
2026-11-17 11:10 ` [PATCH v1 17/19] ACPI: APEI: Share the extlog PCIe handler with GHES Pierre Gondois
2026-11-18 20:22   ` Jonathan Cameron
2026-11-17 11:10 ` [PATCH v1 18/19] ACPI: APEI: Route GHES section reporting through extlog Pierre Gondois
2026-11-18 20:30   ` Jonathan Cameron
2026-11-17 11:10 ` [PATCH v1 19/19] PCI/ERR: Avoid NULL bridge pointer Pierre Gondois
2026-11-17 11:50   ` Lukas Wunner
2026-11-17 18:57     ` Kuppuswamy Sathyanarayanan
2026-11-18 15:11       ` Pierre Gondois

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=20261118200417.42034547@jic23-hlaptop \
    --to=jic23@kernel.org \
    --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=fabio.m.de.francesco@linux.intel.com \
    --cc=guohanjun@huawei.com \
    --cc=hpa@zytor.com \
    --cc=james.morse@arm.com \
    --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=pierre.gondois@arm.com \
    --cc=qiuxu.zhuo@intel.com \
    --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®