From: Dave Ertman <david.m.ertman@intel.com>
To: alsa-devel@alsa-project.org
Cc: tiwai@suse.de, broonie@kernel.org, linux-rdma@vger.kernel.org,
jgg@nvidia.com, dledford@redhat.com, netdev@vger.kernel.org,
davem@davemloft.net, kuba@kernel.org, gregkh@linuxfoundation.org,
ranjani.sridharan@linux.intel.com,
pierre-louis.bossart@linux.intel.com, fred.oh@linux.intel.com,
parav@mellanox.com, shiraz.saleem@intel.com,
dan.j.williams@intel.com, kiran.patil@intel.com
Subject: [PATCH v2 6/6] ASoC: SOF: debug: Remove IPC flood test support in SOF core
Date: Mon, 5 Oct 2020 11:24:46 -0700 [thread overview]
Message-ID: <20201005182446.977325-7-david.m.ertman@intel.com> (raw)
In-Reply-To: <20201005182446.977325-1-david.m.ertman@intel.com>
From: Fred Oh <fred.oh@linux.intel.com>
Remove the IPC flood test support in the SOF core as it is
now added in the IPC flood test client.
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Fred Oh <fred.oh@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Dave Ertman <david.m.ertman@intel.com>
---
sound/soc/sof/Kconfig | 8 --
sound/soc/sof/debug.c | 230 ---------------------------------------
sound/soc/sof/sof-priv.h | 6 +-
3 files changed, 1 insertion(+), 243 deletions(-)
diff --git a/sound/soc/sof/Kconfig b/sound/soc/sof/Kconfig
index 55a2a20c3ec9..4046e96eed92 100644
--- a/sound/soc/sof/Kconfig
+++ b/sound/soc/sof/Kconfig
@@ -182,14 +182,6 @@ config SND_SOC_SOF_DEBUG_ENABLE_FIRMWARE_TRACE
module parameter (similar to dynamic debug)
If unsure, select "N".
-config SND_SOC_SOF_DEBUG_IPC_FLOOD_TEST
- bool "SOF enable IPC flood test"
- help
- This option enables the IPC flood test which can be used to flood
- the DSP with test IPCs and gather stats about response times.
- Say Y if you want to enable IPC flood test.
- If unsure, select "N".
-
config SND_SOC_SOF_DEBUG_IPC_FLOOD_TEST_CLIENT
tristate "SOF enable IPC flood test client"
depends on SND_SOC_SOF_CLIENT
diff --git a/sound/soc/sof/debug.c b/sound/soc/sof/debug.c
index 8e15f105d1d5..d224641768da 100644
--- a/sound/soc/sof/debug.c
+++ b/sound/soc/sof/debug.c
@@ -232,120 +232,10 @@ static int snd_sof_debugfs_probe_item(struct snd_sof_dev *sdev,
}
#endif
-#if IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_IPC_FLOOD_TEST)
-#define MAX_IPC_FLOOD_DURATION_MS 1000
-#define MAX_IPC_FLOOD_COUNT 10000
-#define IPC_FLOOD_TEST_RESULT_LEN 512
-
-static int sof_debug_ipc_flood_test(struct snd_sof_dev *sdev,
- struct snd_sof_dfsentry *dfse,
- bool flood_duration_test,
- unsigned long ipc_duration_ms,
- unsigned long ipc_count)
-{
- struct sof_ipc_cmd_hdr hdr;
- struct sof_ipc_reply reply;
- u64 min_response_time = U64_MAX;
- ktime_t start, end, test_end;
- u64 avg_response_time = 0;
- u64 max_response_time = 0;
- u64 ipc_response_time;
- int i = 0;
- int ret;
-
- /* configure test IPC */
- hdr.cmd = SOF_IPC_GLB_TEST_MSG | SOF_IPC_TEST_IPC_FLOOD;
- hdr.size = sizeof(hdr);
-
- /* set test end time for duration flood test */
- if (flood_duration_test)
- test_end = ktime_get_ns() + ipc_duration_ms * NSEC_PER_MSEC;
-
- /* send test IPC's */
- while (1) {
- start = ktime_get();
- ret = sof_ipc_tx_message(sdev->ipc, hdr.cmd, &hdr, hdr.size,
- &reply, sizeof(reply));
- end = ktime_get();
-
- if (ret < 0)
- break;
-
- /* compute min and max response times */
- ipc_response_time = ktime_to_ns(ktime_sub(end, start));
- min_response_time = min(min_response_time, ipc_response_time);
- max_response_time = max(max_response_time, ipc_response_time);
-
- /* sum up response times */
- avg_response_time += ipc_response_time;
- i++;
-
- /* test complete? */
- if (flood_duration_test) {
- if (ktime_to_ns(end) >= test_end)
- break;
- } else {
- if (i == ipc_count)
- break;
- }
- }
-
- if (ret < 0)
- dev_err(sdev->dev,
- "error: ipc flood test failed at %d iterations\n", i);
-
- /* return if the first IPC fails */
- if (!i)
- return ret;
-
- /* compute average response time */
- do_div(avg_response_time, i);
-
- /* clear previous test output */
- memset(dfse->cache_buf, 0, IPC_FLOOD_TEST_RESULT_LEN);
-
- if (flood_duration_test) {
- dev_dbg(sdev->dev, "IPC Flood test duration: %lums\n",
- ipc_duration_ms);
- snprintf(dfse->cache_buf, IPC_FLOOD_TEST_RESULT_LEN,
- "IPC Flood test duration: %lums\n", ipc_duration_ms);
- }
-
- dev_dbg(sdev->dev,
- "IPC Flood count: %d, Avg response time: %lluns\n",
- i, avg_response_time);
- dev_dbg(sdev->dev, "Max response time: %lluns\n",
- max_response_time);
- dev_dbg(sdev->dev, "Min response time: %lluns\n",
- min_response_time);
-
- /* format output string */
- snprintf(dfse->cache_buf + strlen(dfse->cache_buf),
- IPC_FLOOD_TEST_RESULT_LEN - strlen(dfse->cache_buf),
- "IPC Flood count: %d\nAvg response time: %lluns\n",
- i, avg_response_time);
-
- snprintf(dfse->cache_buf + strlen(dfse->cache_buf),
- IPC_FLOOD_TEST_RESULT_LEN - strlen(dfse->cache_buf),
- "Max response time: %lluns\nMin response time: %lluns\n",
- max_response_time, min_response_time);
-
- return ret;
-}
-#endif
static ssize_t sof_dfsentry_write(struct file *file, const char __user *buffer,
size_t count, loff_t *ppos)
{
-#if IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_IPC_FLOOD_TEST)
- struct snd_sof_dfsentry *dfse = file->private_data;
- struct snd_sof_dev *sdev = dfse->sdev;
- unsigned long ipc_duration_ms = 0;
- bool flood_duration_test = false;
- unsigned long ipc_count = 0;
- struct dentry *dentry;
- int err;
-#endif
size_t size;
char *string;
int ret;
@@ -357,78 +247,6 @@ static ssize_t sof_dfsentry_write(struct file *file, const char __user *buffer,
size = simple_write_to_buffer(string, count, ppos, buffer, count);
ret = size;
-#if IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_IPC_FLOOD_TEST)
- /*
- * write op is only supported for ipc_flood_count or
- * ipc_flood_duration_ms debugfs entries atm.
- * ipc_flood_count floods the DSP with the number of IPC's specified.
- * ipc_duration_ms test floods the DSP for the time specified
- * in the debugfs entry.
- */
- dentry = file->f_path.dentry;
- if (strcmp(dentry->d_name.name, "ipc_flood_count") &&
- strcmp(dentry->d_name.name, "ipc_flood_duration_ms")) {
- ret = -EINVAL;
- goto out;
- }
-
- if (!strcmp(dentry->d_name.name, "ipc_flood_duration_ms"))
- flood_duration_test = true;
-
- /* test completion criterion */
- if (flood_duration_test)
- ret = kstrtoul(string, 0, &ipc_duration_ms);
- else
- ret = kstrtoul(string, 0, &ipc_count);
- if (ret < 0)
- goto out;
-
- /* limit max duration/ipc count for flood test */
- if (flood_duration_test) {
- if (!ipc_duration_ms) {
- ret = size;
- goto out;
- }
-
- /* find the minimum. min() is not used to avoid warnings */
- if (ipc_duration_ms > MAX_IPC_FLOOD_DURATION_MS)
- ipc_duration_ms = MAX_IPC_FLOOD_DURATION_MS;
- } else {
- if (!ipc_count) {
- ret = size;
- goto out;
- }
-
- /* find the minimum. min() is not used to avoid warnings */
- if (ipc_count > MAX_IPC_FLOOD_COUNT)
- ipc_count = MAX_IPC_FLOOD_COUNT;
- }
-
- ret = pm_runtime_get_sync(sdev->dev);
- if (ret < 0) {
- dev_err_ratelimited(sdev->dev,
- "error: debugfs write failed to resume %d\n",
- ret);
- pm_runtime_put_noidle(sdev->dev);
- goto out;
- }
-
- /* flood test */
- ret = sof_debug_ipc_flood_test(sdev, dfse, flood_duration_test,
- ipc_duration_ms, ipc_count);
-
- pm_runtime_mark_last_busy(sdev->dev);
- err = pm_runtime_put_autosuspend(sdev->dev);
- if (err < 0)
- dev_err_ratelimited(sdev->dev,
- "error: debugfs write failed to idle %d\n",
- err);
-
- /* return size if test is successful */
- if (ret >= 0)
- ret = size;
-out:
-#endif
kfree(string);
return ret;
}
@@ -444,25 +262,6 @@ static ssize_t sof_dfsentry_read(struct file *file, char __user *buffer,
int size;
u8 *buf;
-#if IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_IPC_FLOOD_TEST)
- struct dentry *dentry;
-
- dentry = file->f_path.dentry;
- if ((!strcmp(dentry->d_name.name, "ipc_flood_count") ||
- !strcmp(dentry->d_name.name, "ipc_flood_duration_ms")) &&
- dfse->cache_buf) {
- if (*ppos)
- return 0;
-
- count = strlen(dfse->cache_buf);
- size_ret = copy_to_user(buffer, dfse->cache_buf, count);
- if (size_ret)
- return -EFAULT;
-
- *ppos += count;
- return count;
- }
-#endif
size = dfse->size;
/* validate position & count */
@@ -606,17 +405,6 @@ int snd_sof_debugfs_buf_item(struct snd_sof_dev *sdev,
dfse->size = size;
dfse->sdev = sdev;
-#if IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_IPC_FLOOD_TEST)
- /*
- * cache_buf is unused for SOF_DFSENTRY_TYPE_BUF debugfs entries.
- * So, use it to save the results of the last IPC flood test.
- */
- dfse->cache_buf = devm_kzalloc(sdev->dev, IPC_FLOOD_TEST_RESULT_LEN,
- GFP_KERNEL);
- if (!dfse->cache_buf)
- return -ENOMEM;
-#endif
-
debugfs_create_file(name, mode, sdev->debugfs_root, dfse,
&sof_dfs_fops);
/* add to dfsentry list */
@@ -662,24 +450,6 @@ int snd_sof_dbg_init(struct snd_sof_dev *sdev)
return err;
#endif
-#if IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_IPC_FLOOD_TEST)
- /* create read-write ipc_flood_count debugfs entry */
- err = snd_sof_debugfs_buf_item(sdev, NULL, 0,
- "ipc_flood_count", 0666);
-
- /* errors are only due to memory allocation, not debugfs */
- if (err < 0)
- return err;
-
- /* create read-write ipc_flood_duration_ms debugfs entry */
- err = snd_sof_debugfs_buf_item(sdev, NULL, 0,
- "ipc_flood_duration_ms", 0666);
-
- /* errors are only due to memory allocation, not debugfs */
- if (err < 0)
- return err;
-#endif
-
return 0;
}
EXPORT_SYMBOL_GPL(snd_sof_dbg_init);
diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h
index 1c29199132c5..a20870900a76 100644
--- a/sound/soc/sof/sof-priv.h
+++ b/sound/soc/sof/sof-priv.h
@@ -50,10 +50,6 @@ extern int sof_core_debug;
#define SOF_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE | \
SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_FLOAT)
-#define ENABLE_DEBUGFS_CACHEBUF \
- (IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_ENABLE_DEBUGFS_CACHE) || \
- IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_IPC_FLOOD_TEST))
-
/* DSP power state */
enum sof_dsp_power_states {
SOF_DSP_PM_D0,
@@ -298,7 +294,7 @@ struct snd_sof_dfsentry {
* or if it is accessible only when the DSP is in D0.
*/
enum sof_debugfs_access_type access_type;
-#if ENABLE_DEBUGFS_CACHEBUF
+#if IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_ENABLE_DEBUGFS_CACHE)
char *cache_buf; /* buffer to cache the contents of debugfs memory */
#endif
struct snd_sof_dev *sdev;
--
2.26.2
prev parent reply other threads:[~2020-10-05 19:23 UTC|newest]
Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-05 18:24 [PATCH v2 0/6] Ancillary bus implementation and SOF multi-client support Dave Ertman
2020-10-05 18:24 ` [PATCH v2 1/6] Add ancillary bus support Dave Ertman
2020-10-06 7:18 ` Leon Romanovsky
2020-10-06 15:18 ` Pierre-Louis Bossart
2020-10-06 17:02 ` Leon Romanovsky
2020-10-06 17:09 ` Parav Pandit
2020-10-06 17:26 ` Leon Romanovsky
2020-10-06 17:41 ` Saleem, Shiraz
2020-10-06 19:20 ` Leon Romanovsky
2020-10-07 2:49 ` Dan Williams
2020-10-07 13:09 ` Saleem, Shiraz
2020-10-07 13:36 ` Leon Romanovsky
2020-10-07 18:55 ` Dan Williams
2020-10-07 20:01 ` Ertman, David M
2020-10-06 18:35 ` Ranjani Sridharan
2020-10-06 17:50 ` Saleem, Shiraz
2020-10-07 18:06 ` Ertman, David M
2020-10-07 19:26 ` Leon Romanovsky
2020-10-07 19:53 ` Ertman, David M
2020-10-07 19:57 ` Ertman, David M
2020-10-07 20:17 ` Parav Pandit
2020-10-07 20:46 ` Ertman, David M
2020-10-07 20:59 ` Pierre-Louis Bossart
2020-10-07 21:22 ` Ertman, David M
2020-10-07 21:49 ` Pierre-Louis Bossart
2020-10-08 4:56 ` Parav Pandit
2020-10-08 5:26 ` Leon Romanovsky
2020-10-08 7:14 ` Parav Pandit
2020-10-08 7:45 ` Leon Romanovsky
2020-10-08 9:45 ` Parav Pandit
2020-10-08 10:17 ` Leon Romanovsky
2020-10-08 13:29 ` Pierre-Louis Bossart
2020-10-09 11:40 ` Leon Romanovsky
2020-10-08 16:54 ` Ertman, David M
2020-10-08 17:35 ` Parav Pandit
2020-10-08 18:13 ` Ertman, David M
2020-10-08 5:21 ` Leon Romanovsky
2020-10-08 6:32 ` Dan Williams
2020-10-08 7:00 ` Leon Romanovsky
2020-10-08 7:38 ` Dan Williams
2020-10-08 7:50 ` gregkh
2020-10-08 11:10 ` Parav Pandit
2020-10-08 16:39 ` Ertman, David M
2020-10-08 8:00 ` Leon Romanovsky
2020-10-08 8:09 ` Dan Williams
2020-10-08 16:42 ` Ertman, David M
2020-10-08 17:21 ` Leon Romanovsky
2020-10-08 18:25 ` Ertman, David M
2020-10-07 20:30 ` Ertman, David M
2020-10-07 20:18 ` Ertman, David M
2020-10-06 17:23 ` Leon Romanovsky
2020-10-06 17:45 ` Saleem, Shiraz
2020-10-08 22:04 ` Ertman, David M
2020-10-08 22:41 ` Dan Williams
2020-10-09 14:26 ` Pierre-Louis Bossart
2020-10-09 19:22 ` Dan Williams
2020-10-09 19:39 ` Pierre-Louis Bossart
2020-10-12 18:34 ` Ertman, David M
2020-10-08 17:20 ` Leon Romanovsky
2020-10-08 17:28 ` Ertman, David M
2020-10-05 18:24 ` [PATCH v2 2/6] ASoC: SOF: Introduce descriptors for SOF client Dave Ertman
2020-10-13 1:05 ` Randy Dunlap
2020-10-13 1:31 ` Pierre-Louis Bossart
2020-10-13 1:55 ` Randy Dunlap
2020-10-13 1:56 ` Randy Dunlap
2020-10-13 15:08 ` Pierre-Louis Bossart
2020-10-13 19:35 ` Randy Dunlap
2020-10-13 19:57 ` Pierre-Louis Bossart
2020-10-05 18:24 ` [PATCH v2 3/6] ASoC: SOF: Create client driver for IPC test Dave Ertman
2020-10-05 18:24 ` [PATCH v2 4/6] ASoC: SOF: ops: Add ops for client registration Dave Ertman
2020-10-05 18:24 ` [PATCH v2 5/6] ASoC: SOF: Intel: Define " Dave Ertman
2020-10-05 18:24 ` Dave Ertman [this message]
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=20201005182446.977325-7-david.m.ertman@intel.com \
--to=david.m.ertman@intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=dan.j.williams@intel.com \
--cc=davem@davemloft.net \
--cc=dledford@redhat.com \
--cc=fred.oh@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=jgg@nvidia.com \
--cc=kiran.patil@intel.com \
--cc=kuba@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=parav@mellanox.com \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=ranjani.sridharan@linux.intel.com \
--cc=shiraz.saleem@intel.com \
--cc=tiwai@suse.de \
/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;
as well as URLs for NNTP newsgroup(s).