Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ff5be043 authored by Arun Kumar Neelakantam's avatar Arun Kumar Neelakantam
Browse files

msm: smp2p: optimize the smp2p spinlock test



smp2p spinlock test is running for higher loop count, so taking long time
to complete on Virtio setup.

Optimize the spinlock test by removing higher loop count and run the test
for configurable timeout with a default of 1 second.

Change-Id: I5673fa6d4eab9b16760fa7f4ec4439c359770699
Signed-off-by: default avatarArun Kumar Neelakantam <aneela@codeaurora.org>
parent 630418b7
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -43,6 +43,8 @@ struct rpm_spinlock_test {
	uint32_t rpm_lock_count;
};

static uint32_t ut_remote_spinlock_run_time = 1;

/**
 * smp2p_ut_remote_spinlock_core - Verify remote spinlock.
 *
@@ -64,12 +66,12 @@ static void smp2p_ut_remote_spinlock_core(struct seq_file *s, int remote_pid,
	struct mock_cb_data cb_in;
	unsigned long flags;
	unsigned n;
	unsigned test_num;
	bool have_lock;
	bool timeout;
	int failed_tmp;
	int spinlock_owner;
	remote_spinlock_t *smem_spinlock;
	unsigned long end;

	seq_printf(s, "Running %s for '%s' remote pid %d\n",
		   __func__, smp2p_pid_to_name(remote_pid), remote_pid);
@@ -149,7 +151,12 @@ static void smp2p_ut_remote_spinlock_core(struct seq_file *s, int remote_pid,
		spinlock_owner = 0;
		test_request = 0x0;
		SMP2P_SET_RMT_CMD_TYPE_REQ(test_request);
		for (test_num = 0; !failed && test_num < 10000; ++test_num) {
		end = jiffies + (ut_remote_spinlock_run_time * HZ);
		if (ut_remote_spinlock_run_time < 300)
				seq_printf(s,
					"\tRunning test for %u seconds; on physical hardware please run >= 300 seconds by doing 'echo 300 >  ut_remote_spinlock_time'\n",
					ut_remote_spinlock_run_time);
		while (time_is_after_jiffies(end)) {
			/* try to acquire spinlock */
			if (use_trylock) {
				unsigned long j_start = jiffies;
@@ -481,6 +488,8 @@ static int __init smp2p_debugfs_init(void)
		smp2p_ut_remote_spinlock_wcnss);
	smp2p_debug_create("ut_remote_spinlock_rpm",
		smp2p_ut_remote_spinlock_rpm);
	smp2p_debug_create_u32("ut_remote_spinlock_time",
		&ut_remote_spinlock_run_time);

	return 0;
}
+9 −0
Original line number Diff line number Diff line
@@ -986,6 +986,15 @@ void smp2p_debug_create(const char *name,
		pr_err("%s: unable to create file '%s'\n", __func__, name);
}

void smp2p_debug_create_u32(const char *name, uint32_t *value)
{
	struct dentry *file;

	file = debugfs_create_u32(name, S_IRUGO | S_IWUSR, dent, value);
	if (!file)
		pr_err("%s: unable to create file '%s'\n", __func__, name);
}

static int __init smp2p_debugfs_init(void)
{
	dent = debugfs_create_dir("smp2p_test", 0);
+1 −0
Original line number Diff line number Diff line
@@ -134,6 +134,7 @@ struct mock_cb_data {
};

void smp2p_debug_create(const char *name, void (*show)(struct seq_file *));
void smp2p_debug_create_u32(const char *name, uint32_t *value);
static inline int smp2p_test_notify(struct notifier_block *self,
	unsigned long event, void *data);