mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: Igor Mammedov <imammedo@redhat.com>,
	"Michael S . Tsirkin" <mst@redhat.com>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	Shiju Jose <shiju.jose@huawei.com>,
	qemu-arm@nongnu.org, qemu-devel@nongnu.org,
	Gavin Shan <gshan@redhat.com>, Cleber Rosa <crosa@redhat.com>,
	John Snow <jsnow@redhat.com>,
	linux-kernel@vger.kernel.org, Thomas Huth <thuth@redhat.com>
Subject: Re: [PATCH v8 20/20] scripts/ghes_inject: add a script to generate GHES error inject
Date: Sat, 8 Mar 2025 10:22:28 +0100	[thread overview]
Message-ID: <20250308102228.389e2537@foz.lan> (raw)
In-Reply-To: <3f777e6a-01bc-44eb-8eac-7ff685a3fbee@linaro.org>

Hi Phillipe,

Em Fri, 7 Mar 2025 22:05:27 +0100
Philippe Mathieu-Daudé <philmd@linaro.org> escreveu:

> Hi Mauro,
> 
> On 7/3/25 20:14, Mauro Carvalho Chehab wrote:
> > Using the QMP GHESv2 API requires preparing a raw data array
> > containing a CPER record.
> > 
> > Add a helper script with subcommands to prepare such data.
> > 
> > Currently, only ARM Processor error CPER record is supported, by
> > using:
> > 	$ ghes_inject.py arm
> > 
> > which produces those warnings on Linux:
> > 
> > [  705.032426] [Firmware Warn]: GHES: Unhandled processor error type 0x02: cache error
> > [  774.866308] {4}[Hardware Error]: Hardware error from APEI Generic Hardware Error Source: 1
> > [  774.866583] {4}[Hardware Error]: event severity: recoverable
> > [  774.866738] {4}[Hardware Error]:  Error 0, type: recoverable
> > [  774.866889] {4}[Hardware Error]:   section_type: ARM processor error
> > [  774.867048] {4}[Hardware Error]:   MIDR: 0x00000000000f0510
> > [  774.867189] {4}[Hardware Error]:   running state: 0x0
> > [  774.867321] {4}[Hardware Error]:   Power State Coordination Interface state: 0
> > [  774.867511] {4}[Hardware Error]:   Error info structure 0:
> > [  774.867679] {4}[Hardware Error]:   num errors: 2
> > [  774.867801] {4}[Hardware Error]:    error_type: 0x02: cache error
> > [  774.867962] {4}[Hardware Error]:    error_info: 0x000000000091000f
> > [  774.868124] {4}[Hardware Error]:     transaction type: Data Access
> > [  774.868280] {4}[Hardware Error]:     cache error, operation type: Data write
> > [  774.868465] {4}[Hardware Error]:     cache level: 2
> > [  774.868592] {4}[Hardware Error]:     processor context not corrupted
> > [  774.868774] [Firmware Warn]: GHES: Unhandled processor error type 0x02: cache error

Thanks for your review!

> > Such script allows customizing the error data, allowing to change
> > all fields at the record. Please use:
> > 
> > 	$ ghes_inject.py arm -h  
> 
> It should be easy enough to add a functional test covering this,
> do you mind having a look?

It is on my TODO plan to add some tests to check it, but instead of
a functional test, I'm aiming to test the full stack.

See, I'm one of the reviewers of the RAS subsystem at the Linux Kernel, 
and the author/maintainer of the userspace tool used to report and take
actions in case of troubles [1]. So, I'm targeting a solution that
will have rasdaemon installed on a Linux VM, testing all three
components altogether.

This will require to implement something at rasdaemon that will have
an interface at the rasdaemon to report errors to the host OS. It
currently have ABRT support, but it will likely need something
different to output error report in a way that the same error will
report the same over newer versions of the components inside the
stack.

For such purpose, I'm planning to implement a new feature on rasdaemon 
to allow reading the errors eithe via a TCP/IP socket with some
simple text output interface, or maybe add a SQL interface[3].

[1] https://github.com/mchehab/rasdaemon
[2] https://docs.kernel.org/dev-tools/ktap.html
[3] internally, rasdaemon has already a SQL interface, used with
    SQLite. It shouldn't be hard to add PostgreSQL and/or
    mariaDB/Mysql support on it.

Before implementing it, we need to have this series merged.

So, in summary, my plan to add tests for firmware-first error
report is:

1. Have this patch series merged;
2. Add a new report mechanism on rasdaemon to report errors via
   a TCP/IP socket;
3. Setup a runner that would periodically test the full stack and
   report regressions. Such runner would need to fetch from 3 different
   sources (QEMU, Kernel, rasdaemon), so it would likely be triggered
   by some scheduler.

Btw, for the first version of the script, only ARM Processor Error is
there, but my long term plan is to be able to test other type of
GHESv2 errors, like this one [4]:

	https://gitlab.com/mchehab_kernel/qemu/-/commit/8a774121750def2723ea59ce2343a774a3f01ca6

[3] I implemented PCIe bus error without checking first if the Kernel
    supported it (when I tested, it didn't). I opted to add this one
    to ensure that adding new subcommands to the ghes_inject.py script
    would be trivial. It helped me to organize the code in a way that a
    new error injection code means just a two lines change at the main
    script. In this specific case, it is:

	+ from pcie_bus_error import PcieBusError
	...
	+    PcieBusError(subparsers)

    With the actual implementation handled on a separate .py module.

    This way, we can add multiple handlers there, each one with its
    own separate Python file.

    After having this series merged, my TODO plan for GHES type support is
    to add error injection code for the errors that are already implemented
    inside the Kernel and rasdaemon, after checking that the support for
    they are OK. Then, add support for it at the runner that will be
    checking for potential regressions at the full stack.

Regards,
Mauro

  reply	other threads:[~2025-03-08  9:22 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-07 19:14 [PATCH v8 00/20] Change ghes to use HEST-based offsets and add support for " Mauro Carvalho Chehab
2025-03-07 19:14 ` [PATCH v8 01/20] tests/acpi: virt: add an empty HEST file Mauro Carvalho Chehab
2025-03-07 19:14 ` [PATCH v8 02/20] tests/qtest/bios-tables-test: extend to also check HEST table Mauro Carvalho Chehab
2025-03-07 19:14 ` [PATCH v8 03/20] tests/acpi: virt: update HEST file with its current data Mauro Carvalho Chehab
2025-03-07 19:14 ` [PATCH v8 04/20] Revert "hw/acpi/ghes: Make ghes_record_cper_errors() static" Mauro Carvalho Chehab
2025-03-07 21:02   ` Philippe Mathieu-Daudé
2025-03-07 19:14 ` [PATCH v8 05/20] acpi/ghes: Cleanup the code which gets ghes ged state Mauro Carvalho Chehab
2025-03-07 19:14 ` [PATCH v8 06/20] acpi/ghes: prepare to change the way HEST offsets are calculated Mauro Carvalho Chehab
2025-03-07 19:14 ` [PATCH v8 07/20] acpi/ghes: add a firmware file with HEST address Mauro Carvalho Chehab
2025-03-07 19:14 ` [PATCH v8 08/20] acpi/ghes: Use HEST table offsets when preparing GHES records Mauro Carvalho Chehab
2025-03-07 19:14 ` [PATCH v8 09/20] acpi/ghes: don't hard-code the number of sources for HEST table Mauro Carvalho Chehab
2025-05-12 19:42   ` Michael S. Tsirkin
2025-05-20  6:47     ` Mauro Carvalho Chehab
2025-03-07 19:14 ` [PATCH v8 10/20] acpi/ghes: add a notifier to notify when error data is ready Mauro Carvalho Chehab
2025-03-07 19:14 ` [PATCH v8 11/20] acpi/generic_event_device: Update GHES migration to cover hest addr Mauro Carvalho Chehab
2025-03-07 19:14 ` [PATCH v8 12/20] acpi/generic_event_device: add logic to detect if HEST addr is available Mauro Carvalho Chehab
2025-03-07 19:14 ` [PATCH v8 13/20] acpi/generic_event_device: add an APEI error device Mauro Carvalho Chehab
2025-03-07 19:14 ` [PATCH v8 14/20] tests/acpi: virt: allow acpi table changes at DSDT and HEST tables Mauro Carvalho Chehab
2025-03-07 19:14 ` [PATCH v8 15/20] arm/virt: Wire up a GED error device for ACPI / GHES Mauro Carvalho Chehab
2025-03-07 19:14 ` [PATCH v8 16/20] qapi/acpi-hest: add an interface to do generic CPER error injection Mauro Carvalho Chehab
2025-03-07 19:14 ` [PATCH v8 17/20] acpi/generic_event_device.c: enable use_hest_addr for QEMU 10.x Mauro Carvalho Chehab
2025-03-07 19:14 ` [PATCH v8 18/20] tests/acpi: virt: update HEST and DSDT tables Mauro Carvalho Chehab
2025-03-07 21:04   ` Philippe Mathieu-Daudé
2025-03-07 19:14 ` [PATCH v8 19/20] docs: hest: add new "etc/acpi_table_hest_addr" and update workflow Mauro Carvalho Chehab
2025-03-07 19:14 ` [PATCH v8 20/20] scripts/ghes_inject: add a script to generate GHES error inject Mauro Carvalho Chehab
2025-03-07 21:05   ` Philippe Mathieu-Daudé
2025-03-08  9:22     ` Mauro Carvalho Chehab [this message]
2025-03-25  1:55 ` [PATCH v8 00/20] Change ghes to use HEST-based offsets and add support for " Mauro Carvalho Chehab
2025-05-11 13:44 ` Michael S. Tsirkin
2025-05-11 13:45   ` Michael S. Tsirkin
2025-05-20  6:48     ` Mauro Carvalho Chehab

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=20250308102228.389e2537@foz.lan \
    --to=mchehab+huawei@kernel.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=crosa@redhat.com \
    --cc=gshan@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=shiju.jose@huawei.com \
    --cc=thuth@redhat.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®