Commit c06e9ef6 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull pstore updates from Kees Cook:
 "Improvements and refactorings:

   - Improve compression handling

   - Refactor argument handling during initialization

   - Avoid needless locking for saner EFI backend handling

   - Add more kern-doc and improve debugging output"

* tag 'pstore-v4.21-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
  pstore/ram: Avoid NULL deref in ftrace merging failure path
  pstore: Convert buf_lock to semaphore
  pstore: Fix bool initialization/comparison
  pstore/ram: Do not treat empty buffers as valid
  pstore/ram: Simplify ramoops_get_next_prz() arguments
  pstore: Map PSTORE_TYPE_* to strings
  pstore: Replace open-coded << with BIT()
  pstore: Improve and update some comments and status output
  pstore/ram: Add kern-doc for struct persistent_ram_zone
  pstore/ram: Report backend assignments with finer granularity
  pstore/ram: Standardize module name in ramoops
  pstore: Avoid duplicate call of persistent_ram_zap()
  pstore: Remove needless lock during console writes
  pstore: Do not use crash buffer for decompression
parents 8d697332 8665569e
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -563,8 +563,6 @@ static int nvram_pstore_init(void)
	nvram_pstore_info.buf = oops_data;
	nvram_pstore_info.bufsize = oops_data_sz;

	spin_lock_init(&nvram_pstore_info.buf_lock);

	rc = pstore_register(&nvram_pstore_info);
	if (rc && (rc != -EPERM))
		/* Print error only when pstore.backend == nvram */
+1 −2
Original line number Diff line number Diff line
@@ -1035,7 +1035,7 @@ static ssize_t erst_reader(struct pstore_record *record)
			     CPER_SECTION_TYPE_MCE) == 0)
		record->type = PSTORE_TYPE_MCE;
	else
		record->type = PSTORE_TYPE_UNKNOWN;
		record->type = PSTORE_TYPE_MAX;

	if (rcd->hdr.validation_bits & CPER_VALID_TIMESTAMP)
		record->time.tv_sec = rcd->hdr.timestamp;
@@ -1176,7 +1176,6 @@ static int __init erst_init(void)
	"Error Record Serialization Table (ERST) support is initialized.\n");

	buf = kmalloc(erst_erange.size, GFP_KERNEL);
	spin_lock_init(&erst_info.buf_lock);
	if (buf) {
		erst_info.buf = buf + sizeof(struct cper_pstore_record);
		erst_info.bufsize = erst_erange.size -
+1 −3
Original line number Diff line number Diff line
@@ -259,8 +259,7 @@ static int efi_pstore_write(struct pstore_record *record)
		efi_name[i] = name[i];

	ret = efivar_entry_set_safe(efi_name, vendor, PSTORE_EFI_ATTRIBUTES,
			      !pstore_cannot_block_path(record->reason),
			      record->size, record->psi->buf);
			      preemptible(), record->size, record->psi->buf);

	if (record->reason == KMSG_DUMP_OOPS)
		efivar_run_worker();
@@ -369,7 +368,6 @@ static __init int efivars_pstore_init(void)
		return -ENOMEM;

	efi_pstore_info.bufsize = 1024;
	spin_lock_init(&efi_pstore_info.buf_lock);

	if (pstore_register(&efi_pstore_info)) {
		kfree(efi_pstore_info.buf);
+1 −1
Original line number Diff line number Diff line
@@ -148,7 +148,7 @@ void pstore_unregister_ftrace(void)
	mutex_lock(&pstore_ftrace_lock);
	if (pstore_ftrace_enabled) {
		unregister_ftrace_function(&pstore_ftrace_ops);
		pstore_ftrace_enabled = 0;
		pstore_ftrace_enabled = false;
	}
	mutex_unlock(&pstore_ftrace_lock);

+4 −47
Original line number Diff line number Diff line
@@ -335,53 +335,10 @@ int pstore_mkfile(struct dentry *root, struct pstore_record *record)
		goto fail_alloc;
	private->record = record;

	switch (record->type) {
	case PSTORE_TYPE_DMESG:
		scnprintf(name, sizeof(name), "dmesg-%s-%llu%s",
	scnprintf(name, sizeof(name), "%s-%s-%llu%s",
			pstore_type_to_name(record->type),
			record->psi->name, record->id,
			record->compressed ? ".enc.z" : "");
		break;
	case PSTORE_TYPE_CONSOLE:
		scnprintf(name, sizeof(name), "console-%s-%llu",
			  record->psi->name, record->id);
		break;
	case PSTORE_TYPE_FTRACE:
		scnprintf(name, sizeof(name), "ftrace-%s-%llu",
			  record->psi->name, record->id);
		break;
	case PSTORE_TYPE_MCE:
		scnprintf(name, sizeof(name), "mce-%s-%llu",
			  record->psi->name, record->id);
		break;
	case PSTORE_TYPE_PPC_RTAS:
		scnprintf(name, sizeof(name), "rtas-%s-%llu",
			  record->psi->name, record->id);
		break;
	case PSTORE_TYPE_PPC_OF:
		scnprintf(name, sizeof(name), "powerpc-ofw-%s-%llu",
			  record->psi->name, record->id);
		break;
	case PSTORE_TYPE_PPC_COMMON:
		scnprintf(name, sizeof(name), "powerpc-common-%s-%llu",
			  record->psi->name, record->id);
		break;
	case PSTORE_TYPE_PMSG:
		scnprintf(name, sizeof(name), "pmsg-%s-%llu",
			  record->psi->name, record->id);
		break;
	case PSTORE_TYPE_PPC_OPAL:
		scnprintf(name, sizeof(name), "powerpc-opal-%s-%llu",
			  record->psi->name, record->id);
		break;
	case PSTORE_TYPE_UNKNOWN:
		scnprintf(name, sizeof(name), "unknown-%s-%llu",
			  record->psi->name, record->id);
		break;
	default:
		scnprintf(name, sizeof(name), "type%d-%s-%llu",
			  record->type, record->psi->name, record->id);
		break;
	}

	dentry = d_alloc_name(root, name);
	if (!dentry)
Loading