From: "Guilherme G. Piccoli" <gpiccoli@igalia.com>
To: ardb@kernel.org, linux-efi@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, kernel-dev@igalia.com,
kernel@gpiccoli.net, anton@enomsg.org, ccross@android.com,
keescook@chromium.org, matt@codeblueprint.co.uk,
matthew.garrett@nebula.com, tony.luck@intel.com,
"Guilherme G. Piccoli" <gpiccoli@igalia.com>
Subject: [PATCH 0/2] UEFI panic notification mechanism
Date: Fri, 20 May 2022 16:50:26 -0300 [thread overview]
Message-ID: <20220520195028.1347426-1-gpiccoli@igalia.com> (raw)
Hi folks, this patch set is about a mechanism to notify the UEFI
firmware about a panic event in the kernel, so the firmware is
enabled to take some action. The specific use case for us is to
show an alternative splash screen if a panic happened.
The base for the idea is to explore the panic notifiers mechanism,
that allows a callback to execute in the panic path.
Patch 1 is kind of a "clean-up" in a way; just taking a helper out
of efibc and adding it on generic efi.h header, so we have common
code used by 3 modules (efibc, efi-pstore and efi-panic).
Patch 2 is the efi-panic module itself; it is *strongly* based on
efibc, and for that I'd like to hereby thank to the authors.
The efibc code is very clear!
Some design decisions to be discussed:
(1) The variable name and value - I called it PanicWarn, and the
data it holds is just a byte, set by default to 0xFF (though users
can change that via module parameter). I have no attachment to
these, we can improve naming and the size of the data for example,
suggestions are appreciated!
(2) The 3 modules (efibc, efi-pstore and efi-panic) share a lot of
ideas or code; both efi-{pstore,panic} deal with panic events, and
both efi{bc,-panic} rely on notifiers and share code.
Should we unify some of them or anything like that? It seemed to me
the proper approach would be a simple and small standalone module,
but I'm open for suggestions.
(3) I've noticed a behavior that also happens in efi-pstore, I'm not
sure if that's something to care about. In the efi-panic module, after
a fresh boot, we check if PanicWarn is there an if so, we print a
message and _delete_ that variable from the NVRAM. But...the variable
is still present in sysfs, in the list created by efivars. Same happens
with efi-pstore, if we delete the dumps generated from /sys/fs/pstore.
In my case, I've used the __efivar_entry_delete() variant, so it doesn't
delete from any list, only from the firmware area. Should this be handled?
Or we just don't care with the empty variable reference in the sysfs tree?
I appreciate feedbacks and suggestions, thanks in advance for the attention!
Cheers,
Guilherme
Guilherme G. Piccoli (2):
efi: Add a generic helper to convert strings to unicode
efi-panic: Introduce the UEFI panic notification module
drivers/firmware/efi/Kconfig | 10 ++++
drivers/firmware/efi/Makefile | 1 +
drivers/firmware/efi/efi-panic.c | 97 +++++++++++++++++++++++++++++++
drivers/firmware/efi/efi-pstore.c | 5 +-
drivers/firmware/efi/efibc.c | 16 ++---
include/linux/efi.h | 16 +++++
6 files changed, 130 insertions(+), 15 deletions(-)
create mode 100644 drivers/firmware/efi/efi-panic.c
--
2.36.0
next reply other threads:[~2022-05-20 19:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-20 19:50 Guilherme G. Piccoli [this message]
2022-05-20 19:50 ` [PATCH 1/2] efi: Add a generic helper to convert strings to unicode Guilherme G. Piccoli
2022-05-20 19:50 ` [PATCH 2/2] efi-panic: Introduce the UEFI panic notification module Guilherme G. Piccoli
2022-06-02 17:39 ` [PATCH 0/2] UEFI panic notification mechanism Guilherme G. Piccoli
2022-06-28 7:49 ` Ard Biesheuvel
2022-06-28 18:10 ` Guilherme G. Piccoli
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=20220520195028.1347426-1-gpiccoli@igalia.com \
--to=gpiccoli@igalia.com \
--cc=anton@enomsg.org \
--cc=ardb@kernel.org \
--cc=ccross@android.com \
--cc=keescook@chromium.org \
--cc=kernel-dev@igalia.com \
--cc=kernel@gpiccoli.net \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matt@codeblueprint.co.uk \
--cc=matthew.garrett@nebula.com \
--cc=tony.luck@intel.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®