Merge tag 'please-pull-pstore' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux
Pull pstore patches from Tony Luck: "A few fixes to reduce places where pstore might hang a system in the crash path. Plus a new mountpoint (/sys/fs/pstore ... makes more sense then /dev/pstore)." Fix up trivial conflict in drivers/firmware/efivars.c * tag 'please-pull-pstore' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux: pstore: Create a convenient mount point for pstore efi_pstore: Introducing workqueue updating sysfs efivars: Disable external interrupt while holding efivars->lock efi_pstore: Avoid deadlock in non-blocking paths pstore: Avoid deadlock in panic and emergency-restart path
This commit is contained in:
@@ -418,9 +418,25 @@ static struct file_system_type pstore_fs_type = {
|
||||
.kill_sb = pstore_kill_sb,
|
||||
};
|
||||
|
||||
static struct kobject *pstore_kobj;
|
||||
|
||||
static int __init init_pstore_fs(void)
|
||||
{
|
||||
return register_filesystem(&pstore_fs_type);
|
||||
int err = 0;
|
||||
|
||||
/* Create a convenient mount point for people to access pstore */
|
||||
pstore_kobj = kobject_create_and_add("pstore", fs_kobj);
|
||||
if (!pstore_kobj) {
|
||||
err = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
|
||||
err = register_filesystem(&pstore_fs_type);
|
||||
if (err < 0)
|
||||
kobject_put(pstore_kobj);
|
||||
|
||||
out:
|
||||
return err;
|
||||
}
|
||||
module_init(init_pstore_fs)
|
||||
|
||||
|
@@ -96,6 +96,27 @@ static const char *get_reason_str(enum kmsg_dump_reason reason)
|
||||
}
|
||||
}
|
||||
|
||||
bool pstore_cannot_block_path(enum kmsg_dump_reason reason)
|
||||
{
|
||||
/*
|
||||
* In case of NMI path, pstore shouldn't be blocked
|
||||
* regardless of reason.
|
||||
*/
|
||||
if (in_nmi())
|
||||
return true;
|
||||
|
||||
switch (reason) {
|
||||
/* In panic case, other cpus are stopped by smp_send_stop(). */
|
||||
case KMSG_DUMP_PANIC:
|
||||
/* Emergency restart shouldn't be blocked by spin lock. */
|
||||
case KMSG_DUMP_EMERG:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pstore_cannot_block_path);
|
||||
|
||||
/*
|
||||
* callback from kmsg_dump. (s2,l2) has the most recently
|
||||
* written bytes, older bytes are in (s1,l1). Save as much
|
||||
@@ -114,10 +135,12 @@ static void pstore_dump(struct kmsg_dumper *dumper,
|
||||
|
||||
why = get_reason_str(reason);
|
||||
|
||||
if (in_nmi()) {
|
||||
is_locked = spin_trylock(&psinfo->buf_lock);
|
||||
if (!is_locked)
|
||||
pr_err("pstore dump routine blocked in NMI, may corrupt error record\n");
|
||||
if (pstore_cannot_block_path(reason)) {
|
||||
is_locked = spin_trylock_irqsave(&psinfo->buf_lock, flags);
|
||||
if (!is_locked) {
|
||||
pr_err("pstore dump routine blocked in %s path, may corrupt error record\n"
|
||||
, in_nmi() ? "NMI" : why);
|
||||
}
|
||||
} else
|
||||
spin_lock_irqsave(&psinfo->buf_lock, flags);
|
||||
oopscount++;
|
||||
@@ -143,9 +166,9 @@ static void pstore_dump(struct kmsg_dumper *dumper,
|
||||
total += hsize + len;
|
||||
part++;
|
||||
}
|
||||
if (in_nmi()) {
|
||||
if (pstore_cannot_block_path(reason)) {
|
||||
if (is_locked)
|
||||
spin_unlock(&psinfo->buf_lock);
|
||||
spin_unlock_irqrestore(&psinfo->buf_lock, flags);
|
||||
} else
|
||||
spin_unlock_irqrestore(&psinfo->buf_lock, flags);
|
||||
}
|
||||
|
Reference in New Issue
Block a user