From: Matt Fleming <matt-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
To: Seiji Aguchi <seiji.aguchi-7rDLJAbr9SE@public.gmane.org>
Cc: "linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Matt Fleming
<matt.fleming-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
Tom Gundersen <teg-B22kvLQNl6c@public.gmane.org>,
Matthew Garrett <mjg59-1xO5oi07KQx4cg9Nei1l7Q@public.gmane.org>,
Jeremy Kerr <jeremy.kerr-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>,
Tony Luck <tony.luck-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
Mike Waychison <mikew-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH 3/6] efivars: efivar_entry API
Date: Thu, 11 Apr 2013 14:34:51 +0100 [thread overview]
Message-ID: <5166BBFB.5030200@console-pimps.org> (raw)
In-Reply-To: <A5ED84D3BB3A384992CBB9C77DEDA4D41AF8CFEE-ohthHghroY0jroPwUH3sq+6wyyQG6/Uh@public.gmane.org>
On 10/04/13 16:25, Seiji Aguchi wrote:
>> + if (efi_guidcmp(entry->var.VendorGuid, vendor))
>> + return 0;
>> +
>> + for (i = 0; i < DUMP_NAME_LEN; i++)
>> + name[i] = entry->var.VariableName[i];
>> +
>> + if (sscanf(name, "dump-type%u-%u-%d-%lu",
>> + cb_data->type, &part, &cnt, &time) == 4) {
>> + *cb_data->id = part;
>> + *cb_data->count = cnt;
>> + cb_data->timespec->tv_sec = time;
>> + cb_data->timespec->tv_nsec = 0;
>> + } else if (sscanf(name, "dump-type%u-%u-%lu",
>> + cb_data->type, &part, &time) == 3) {
>> + /*
>> + * Check if an old format,
>> + * which doesn't support holding
>> + * multiple logs, remains.
>> + */
>> + *cb_data->id = part;
>> + *cb_data->count = 0;
>> + cb_data->timespec->tv_sec = time;
>> + cb_data->timespec->tv_nsec = 0;
>> + } else
>> + return 0;
>> +
>> + efivar_entry_size(entry, &size);
>
> Deadlocking will happen in this efivar_entry_size() because __efivars->lock is already hold
> in efivar_entry_iter_begin().
Good catch, thanks.
>> @@ -1419,81 +1229,90 @@ static int efi_pstore_write(enum pstore_type_id type,
>> for (i = 0; i < DUMP_NAME_LEN; i++)
>> efi_name[i] = name[i];
>>
>> - efivars->ops->set_variable(efi_name, &vendor, PSTORE_EFI_ATTRIBUTES,
>> - size, psi->buf);
>> + ret = efivar_entry_set_safe(efi_name, vendor, PSTORE_EFI_ATTRIBUTES,
>> + !pstore_cannot_block_path(reason),
>> + size, psi->buf);
>>
>> - spin_unlock_irqrestore(&efivars->lock, flags);
>> -
>> - if (reason == KMSG_DUMP_OOPS && efivar_wq_enabled)
>> + if (size && !ret && reason == KMSG_DUMP_OOPS && efivar_wq_enabled)
>
> Why do you add (size && !ret) checking?
> If the purpose of this patch is just adding new API, we don't need to modify the logic.
That looks like a bug that slipped in. I'll fix it. Thanks!
--
Matt Fleming, Intel Open Source Technology Center
WARNING: multiple messages have this Message-ID (diff)
From: Matt Fleming <matt@console-pimps.org>
To: Seiji Aguchi <seiji.aguchi@hds.com>
Cc: "linux-efi@vger.kernel.org" <linux-efi@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Matt Fleming <matt.fleming@intel.com>,
Tom Gundersen <teg@jklm.no>,
Matthew Garrett <mjg59@srcf.ucam.org>,
Jeremy Kerr <jeremy.kerr@canonical.com>,
Tony Luck <tony.luck@intel.com>,
Mike Waychison <mikew@google.com>
Subject: Re: [PATCH 3/6] efivars: efivar_entry API
Date: Thu, 11 Apr 2013 14:34:51 +0100 [thread overview]
Message-ID: <5166BBFB.5030200@console-pimps.org> (raw)
In-Reply-To: <A5ED84D3BB3A384992CBB9C77DEDA4D41AF8CFEE@USINDEM103.corp.hds.com>
On 10/04/13 16:25, Seiji Aguchi wrote:
>> + if (efi_guidcmp(entry->var.VendorGuid, vendor))
>> + return 0;
>> +
>> + for (i = 0; i < DUMP_NAME_LEN; i++)
>> + name[i] = entry->var.VariableName[i];
>> +
>> + if (sscanf(name, "dump-type%u-%u-%d-%lu",
>> + cb_data->type, &part, &cnt, &time) == 4) {
>> + *cb_data->id = part;
>> + *cb_data->count = cnt;
>> + cb_data->timespec->tv_sec = time;
>> + cb_data->timespec->tv_nsec = 0;
>> + } else if (sscanf(name, "dump-type%u-%u-%lu",
>> + cb_data->type, &part, &time) == 3) {
>> + /*
>> + * Check if an old format,
>> + * which doesn't support holding
>> + * multiple logs, remains.
>> + */
>> + *cb_data->id = part;
>> + *cb_data->count = 0;
>> + cb_data->timespec->tv_sec = time;
>> + cb_data->timespec->tv_nsec = 0;
>> + } else
>> + return 0;
>> +
>> + efivar_entry_size(entry, &size);
>
> Deadlocking will happen in this efivar_entry_size() because __efivars->lock is already hold
> in efivar_entry_iter_begin().
Good catch, thanks.
>> @@ -1419,81 +1229,90 @@ static int efi_pstore_write(enum pstore_type_id type,
>> for (i = 0; i < DUMP_NAME_LEN; i++)
>> efi_name[i] = name[i];
>>
>> - efivars->ops->set_variable(efi_name, &vendor, PSTORE_EFI_ATTRIBUTES,
>> - size, psi->buf);
>> + ret = efivar_entry_set_safe(efi_name, vendor, PSTORE_EFI_ATTRIBUTES,
>> + !pstore_cannot_block_path(reason),
>> + size, psi->buf);
>>
>> - spin_unlock_irqrestore(&efivars->lock, flags);
>> -
>> - if (reason == KMSG_DUMP_OOPS && efivar_wq_enabled)
>> + if (size && !ret && reason == KMSG_DUMP_OOPS && efivar_wq_enabled)
>
> Why do you add (size && !ret) checking?
> If the purpose of this patch is just adding new API, we don't need to modify the logic.
That looks like a bug that slipped in. I'll fix it. Thanks!
--
Matt Fleming, Intel Open Source Technology Center
next prev parent reply other threads:[~2013-04-11 13:34 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-04 12:18 [PATCH 0/6] Chainsaw efivars.c Matt Fleming
2013-04-04 12:18 ` Matt Fleming
[not found] ` <1365077935-6859-1-git-send-email-matt-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
2013-04-04 12:18 ` [PATCH 1/6] efi: move utf16 string functions to efi.h Matt Fleming
2013-04-04 12:18 ` Matt Fleming
[not found] ` <1365077935-6859-2-git-send-email-matt-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
2013-04-09 22:00 ` Mike Waychison
2013-04-09 22:00 ` Mike Waychison
[not found] ` <CAGTjWtCFSxJMKf=Xp+5MKLSb3qH4YpWVYYmUb6fkjwctMc1bDQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-04-10 11:18 ` David Woodhouse
2013-04-10 11:18 ` David Woodhouse
2013-04-04 12:18 ` [PATCH 2/6] efivars: Keep a private global pointer to efivars Matt Fleming
2013-04-04 12:18 ` Matt Fleming
[not found] ` <1365077935-6859-3-git-send-email-matt-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
2013-04-09 22:07 ` Mike Waychison
2013-04-09 22:07 ` Mike Waychison
[not found] ` <CAGTjWtAhLQVrpJSUWU=HgxuBkcjfPj_o4hN9o-ELK1g89eGA_Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-04-11 13:10 ` Matt Fleming
2013-04-11 13:10 ` Matt Fleming
2013-04-04 12:18 ` [PATCH 3/6] efivars: efivar_entry API Matt Fleming
2013-04-04 12:18 ` Matt Fleming
[not found] ` <1365077935-6859-4-git-send-email-matt-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
2013-04-10 15:25 ` Seiji Aguchi
2013-04-10 15:25 ` Seiji Aguchi
[not found] ` <A5ED84D3BB3A384992CBB9C77DEDA4D41AF8CFEE-ohthHghroY0jroPwUH3sq+6wyyQG6/Uh@public.gmane.org>
2013-04-11 13:34 ` Matt Fleming [this message]
2013-04-11 13:34 ` Matt Fleming
2013-04-09 16:25 ` [PATCH 0/6] Chainsaw efivars.c H. Peter Anvin
2013-04-09 16:25 ` H. Peter Anvin
[not found] ` <516440F5.7040904-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>
2013-04-09 16:50 ` Matt Fleming
2013-04-09 16:50 ` Matt Fleming
2013-04-04 12:18 ` [PATCH 4/6] efivars: Move pstore code into the new EFI directory Matt Fleming
2013-04-04 12:18 ` [PATCH 5/6] efivarfs: Move to fs/efivarfs Matt Fleming
2013-04-04 12:18 ` [PATCH 6/6] efi: split efisubsystem from efivars Matt Fleming
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=5166BBFB.5030200@console-pimps.org \
--to=matt-hnk1s37rvnbexh+ff434mdi2o/jbrioy@public.gmane.org \
--cc=jeremy.kerr-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org \
--cc=linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=matt.fleming-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=mikew-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
--cc=mjg59-1xO5oi07KQx4cg9Nei1l7Q@public.gmane.org \
--cc=seiji.aguchi-7rDLJAbr9SE@public.gmane.org \
--cc=teg-B22kvLQNl6c@public.gmane.org \
--cc=tony.luck-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.