public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
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

  reply	other threads:[~2013-04-11 13:34 UTC|newest]

Thread overview: 15+ 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 ` [PATCH 1/6] efi: move utf16 string functions to efi.h Matt Fleming
2013-04-09 22:00   ` Mike Waychison
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-09 22:07   ` Mike Waychison
2013-04-11 13:10     ` Matt Fleming
2013-04-04 12:18 ` [PATCH 3/6] efivars: efivar_entry API Matt Fleming
2013-04-10 15:25   ` Seiji Aguchi
2013-04-11 13:34     ` Matt Fleming [this message]
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
2013-04-09 16:25 ` [PATCH 0/6] Chainsaw efivars.c H. Peter Anvin
2013-04-09 16:50   ` 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@console-pimps.org \
    --cc=jeremy.kerr@canonical.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt.fleming@intel.com \
    --cc=mikew@google.com \
    --cc=mjg59@srcf.ucam.org \
    --cc=seiji.aguchi@hds.com \
    --cc=teg@jklm.no \
    --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