From: Matthew Garrett <mjg59@srcf.ucam.org>
To: Mike Waychison <mikew@google.com>
Cc: tony.luck@intel.com, linux-kernel@vger.kernel.org, Matt_Domsch@dell.com
Subject: Re: [PATCH 3/3] efi: Add support for using efivars as a pstore backend
Date: Tue, 21 Jun 2011 16:10:40 +0100 [thread overview]
Message-ID: <20110621151040.GB7476@srcf.ucam.org> (raw)
In-Reply-To: <4DFFEC3B.90001@google.com>
On Mon, Jun 20, 2011 at 05:56:27PM -0700, Mike Waychison wrote:
> On 06/06/11 12:38, Matthew Garrett wrote:
> >EFI provides an area of nonvolatile storage managed by the firmware. We
> >can use this as a pstore backend to maintain copies of oopses, aiding
> >diagnosis.
>
> How do I configure this thing?
You don't. I'll be posting a patch for pstore that lets you choose the
backend - that can be used to disable this functionality at boot time.
> >@@ -387,12 +400,145 @@ static struct kobj_type efivar_ktype = {
> > .default_attrs = def_attrs,
> > };
> >
> >+static struct efivar_entry *walk_entry;
> >+
> >+static struct pstore_info efi_pstore_info;
>
> Can you move these into struct efivars in efi.h?
In theory, but I don't really understand the benefit. You can't have
more than one efivars implementation on a system.
> >+static u64 efi_pstore_write(enum pstore_type_id type, int part, size_t size,
> >+ struct pstore_info *psi)
> >+{
> >+ char name[DUMP_NAME_LEN];
> >+ char stub_name[DUMP_NAME_LEN];
> >+ efi_char16_t efi_name[DUMP_NAME_LEN];
> >+ efi_guid_t vendor = LINUX_EFI_CRASH_GUID;
> >+ struct efivars *efivars = psi->data;
> >+ struct efivar_entry *entry, *found = NULL;
> >+ int i;
> >+
> >+ sprintf(stub_name, "dump-type%u-%u-", type, part);
>
> The format specifier here uses an unsigned, but your series passes
> part around as a signed int. If part is truely non-negative,
> consider changing it to unsigned?
The variable name is fundamentally meaningless. Just think of it as a
binary representation of the data. Formatting it as a signed integer
would break the parsing. But you're right that there's probably no
reason for it to be signed in the first place - Tony?
> >+ list_for_each_entry(entry,&efivars->list, list) {
> >+ get_var_data_locked(efivars,&entry->var);
> >+
> >+ for (i = 0; i< DUMP_NAME_LEN; i++) {
> >+ if (efi_name[i] == 0) {
>
> Test for entry->var.VariableName[i] == 0 too. Actually, could we
> just turn this string comparing loop into a strncmp test?
The idea is to check for prefixes. If efi_name[i] is non-zero but
VariableName[i] is zero then we'll break due to them not matching, which
is the desired behaviour.
> >+ found = entry;
> >+ efi.set_variable(entry->var.VariableName,&entry->var.VendorGuid,
>
> space after comma
Oops.
> >+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
> >+ 0, NULL);
>
> We shouldn't be calling the global efi ops structure here. Instead,
> we should be using efivars->ops->set_variable(...)
Ok.
> > static ssize_t efivar_create(struct file *filp, struct kobject *kobj,
> > struct bin_attribute *bin_attr,
> >@@ -763,6 +909,14 @@ int register_efivars(struct efivars *efivars,
> > if (error)
> > unregister_efivars(efivars);
> >
> >+ efi_pstore_info.buf = kmalloc(4096, GFP_KERNEL);
> >+ if (efi_pstore_info.buf) {
> >+ efi_pstore_info.bufsize = 1024;
> >+ efi_pstore_info.data = efivars;
> >+ mutex_init(&efi_pstore_info.buf_mutex);
> >+ pstore_register(&efi_pstore_info);
> >+ }
> >+
>
> Hmm. pstore doesn't have a pstore_unregister? This is unfortunate
> because this breaks efivars module unloading :(
Userspace really ought to depend on efivars being available on EFI
systems. I don't think losing the ability to unload it is a big loss.
--
Matthew Garrett | mjg59@srcf.ucam.org
next prev parent reply other threads:[~2011-06-21 15:10 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-06 19:38 [PATCH 1/3] pstore: Extend API Matthew Garrett
2011-06-06 19:38 ` [PATCH 2/3] pstore: Add extra context for writes and erases Matthew Garrett
[not found] ` <BANLkTinHYQ14A7vzTxA1c2frxUVE6HWNQg@mail.gmail.com>
2011-06-06 21:43 ` Tony Luck
2011-06-06 21:47 ` Matthew Garrett
2011-06-10 4:00 ` Matt Domsch
2011-06-10 7:12 ` Mike Waychison
2011-06-20 22:27 ` Tony Luck
2011-06-20 22:29 ` Mike Waychison
2011-06-06 19:38 ` [PATCH 3/3] efi: Add support for using efivars as a pstore backend Matthew Garrett
2011-06-06 23:11 ` Tony Luck
2011-06-07 15:47 ` Seiji Aguchi
2011-06-07 15:58 ` Matthew Garrett
2011-06-07 18:04 ` Randy Dunlap
2011-06-21 0:56 ` Mike Waychison
2011-06-21 15:10 ` Matthew Garrett [this message]
2011-06-21 17:12 ` Tony Luck
2011-06-21 20:16 ` Mike Waychison
2011-06-21 20:18 ` [PATCH 1/4] efivars: String functions Mike Waychison
2011-06-21 20:18 ` [PATCH 2/4] efivars: introduce utf16_strncmp Mike Waychison
2011-06-21 20:18 ` [PATCH 3/4] efivars: Use string functions in pstore_write Mike Waychison
2011-06-21 20:18 ` [PATCH 4/4] efivars: Introduce PSTORE_EFI_ATTRIBUTES Mike Waychison
2011-06-21 20:22 ` [PATCH 3/3] efi: Add support for using efivars as a pstore backend Matthew Garrett
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=20110621151040.GB7476@srcf.ucam.org \
--to=mjg59@srcf.ucam.org \
--cc=Matt_Domsch@dell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mikew@google.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
Powered by JetHome