Merge "soc: qcom: minidump: Fix the region register fail issue"

This commit is contained in:
QCTECMDR Service 2024-07-25 14:54:20 -07:00 committed by Gerrit - the friendly Code Review server
commit 8fff36db32
3 changed files with 18 additions and 15 deletions

View File

@ -35,6 +35,7 @@
extern unsigned int md_num_regions;
extern struct md_elfhdr minidump_elfheader;
extern spinlock_t mdt_lock;
extern bool md_init_done;
/**
* md_ss_region - Minidump region

View File

@ -26,7 +26,6 @@
/* Protect elfheader and smem table from deferred calls contention */
static DEFINE_RWLOCK(mdt_remove_lock);
struct workqueue_struct *minidump_rm_wq;
static bool md_init_done;
static inline int md_elf_entry_number(const struct md_region *entry)
{
@ -325,17 +324,16 @@ static int md_rm_add_md_region(const struct md_region *entry)
}
/* Ensure that init completes before register region */
if (smp_load_acquire(&md_init_done)) {
if (md_elf_entry_number(entry) >= 0) {
printk_deferred("Entry name already exist\n");
ret = -EEXIST;
goto out;
}
ret = md_rm_add_region(entry);
md_add_elf_header(entry);
if (ret)
goto out;
if (md_elf_entry_number(entry) >= 0) {
printk_deferred("Entry name already exist\n");
ret = -EEXIST;
goto out;
}
ret = md_rm_add_region(entry);
md_add_elf_header(entry);
if (ret)
goto out;
ret = md_num_regions;
md_num_regions++;

View File

@ -29,7 +29,9 @@ struct md_core {
const struct md_ops *ops;
};
static bool md_init_done;
bool md_init_done;
EXPORT_SYMBOL_GPL(md_init_done);
static struct md_core md_core;
DEFINE_SPINLOCK(mdt_lock);
@ -246,7 +248,8 @@ int msm_minidump_add_region(const struct md_region *entry)
if (validate_region(entry))
return -EINVAL;
if (md_core.ops) {
/* Region adding should after init completes */
if (md_core.ops && smp_load_acquire(&md_init_done)) {
ret = md_core.ops->add_region(entry);
} else {
/* Local table not initialized
@ -417,14 +420,15 @@ int msm_minidump_driver_probe(const struct md_init_data *data)
return ret;
}
/* All updates above should be visible, before init completes */
smp_store_release(&md_init_done, true);
ret = md_core.ops->add_pending_entry(&pending_list);
if (ret) {
pr_err("Add pending entry failed\n");
goto out;
}
/* All updates above should be visible, before init completes */
smp_store_release(&md_init_done, true);
msm_minidump_log_init();
pr_info("Enabled with max number of regions %d\n",
CONFIG_MINIDUMP_MAX_ENTRIES);