Skip to contentSkip to conversation

samples/rpmsg: Introduce a module parameter for message count

PATCH In review Suman Anna 4 participants 6 messages Sep 11, 2018 – Oct 8, 2018 Remote processor messaging (rpmsg)

lore
Share & tools
lore

Suman Anna

author
#0 lore raw

PATCH 1/1 samples/rpmsg: Introduce a module parameter for message count

The current rpmsg_client_sample uses a fixed number of messages to be sent to each instance. This is currently set at 100. Introduce an optional module parameter 'count' so that the number of messages to be exchanged can be made flexible.

---
 samples/rpmsg/rpmsg_client_sample.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
samples/rpmsg/rpmsg_client_sample.c +4 -2
index f161dfd3e70a..9b6b27ea504f 100644
@@ -22,7 +22,9 @@
 #include <linux/rpmsg.h>
 
 #define MSG		"hello world!"
-#define MSG_LIMIT	100
+
+static int count = 100;
+module_param(count, int, 0644);
 
 struct instance_data {
 	int rx_count;
@@ -41,7 +43,7 @@ static int rpmsg_sample_cb(struct rpmsg_device *rpdev, void *data, int len,
 		       data, len,  true);
 
 	/* samples should not live forever */
-	if (idata->rx_count >= MSG_LIMIT) {
+	if (idata->rx_count >= count) {
 		dev_info(&rpdev->dev, "goodbye!\n");
 		return 0;
 	}
Signature · 1 line
2.18.0
#1 lore raw

Bjorn,

samples/rpmsg/rpmsg_client_sample.c line 27

Quoted 6 lines
  
  #define MSG		"hello world!"
samples/rpmsg/rpmsg_client_sample.c +3 -1
-#define MSG_LIMIT	100
+
+static int count = 100;
+module_param(count, int, 0644);

I thought Greg KH doesn't want any new code to have module_param call, right? Are we Ok here or I am missing something here.

Signature · 3 lines
---Trilok Soni
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a 
Linux Foundation Collaborative Project
author
#2 lore raw

Hi Trilok,

Quoted 10 lines · Trilok Soni

Bjorn,

samples/rpmsg/rpmsg_client_sample.c line 27

Quoted 5 lines

? ? #define MSG??????? "hello world!"

samples/rpmsg/rpmsg_client_sample.c +3 -1
-#define MSG_LIMIT??? 100
+
+static int count = 100;
+module_param(count, int, 0644);

I thought Greg KH doesn't want any new code to have module_param call, right? Are we Ok here or I am missing something here.

Can you point me to the thread where this was discussed/decided?

regards
Suman

#3 lore raw
In reply to Suman Anna
Quoted 5 lines · Suman Anna

The current rpmsg_client_sample uses a fixed number of messages to be sent to each instance. This is currently set at 100. Introduce an optional module parameter 'count' so that the number of messages to be exchanged can be made flexible.

Rather than sending N messages as fast as possible to any sample channel that comes up, how about making the sample create a debugfs entry that we can write messages to from user space?

That would make it possible to improve the handling of multiple remoteprocs and would allow for a variation in message lengths etc.

Regards,
Bjorn

Quoted 32 lines
---
 samples/rpmsg/rpmsg_client_sample.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
samples/rpmsg/rpmsg_client_sample.c +4 -2
index f161dfd3e70a..9b6b27ea504f 100644
@@ -22,7 +22,9 @@
 #include <linux/rpmsg.h>
 
 #define MSG		"hello world!"
-#define MSG_LIMIT	100
+
+static int count = 100;
+module_param(count, int, 0644);
 
 struct instance_data {
 	int rx_count;
@@ -41,7 +43,7 @@ static int rpmsg_sample_cb(struct rpmsg_device *rpdev, void *data, int len,
 		       data, len,  true);
 
 	/* samples should not live forever */
-	if (idata->rx_count >= MSG_LIMIT) {
+	if (idata->rx_count >= count) {
 		dev_info(&rpdev->dev, "goodbye!\n");
 		return 0;
 	}
Signature · 1 line
2.18.0
#4 lore raw
Quoted 11 lines · Bjorn Andersson
Quoted 5 lines · Suman Anna

The current rpmsg_client_sample uses a fixed number of messages to be sent to each instance. This is currently set at 100. Introduce an optional module parameter 'count' so that the number of messages to be exchanged can be made flexible.

Rather than sending N messages as fast as possible to any sample channel that comes up, how about making the sample create a debugfs entry that we can write messages to from user space?

Wouldn't it be better to make it sysfs rather than debugfs knob?

Signature · 1 line
~Vinod
author
#5 lore raw
In reply to Bjorn Andersson

Hi Bjorn,

Quoted 11 lines · Bjorn Andersson
Quoted 5 lines · Suman Anna

The current rpmsg_client_sample uses a fixed number of messages to be sent to each instance. This is currently set at 100. Introduce an optional module parameter 'count' so that the number of messages to be exchanged can be made flexible.

Rather than sending N messages as fast as possible to any sample channel that comes up, how about making the sample create a debugfs entry that we can write messages to from user space?

This sample demonstrates a kernel-level rpmsg usage, and I would prefer to maintain the current simplicity, and not add in any userspace interaction. That perhaps can be done as a different sample. I use this sample to serve as the basic test for checking the rpmsg transport functionality with multiple remoteprocs and/or multiple instances per remoteproc at the same time. The count parameter helps me with both early Silicon development, as well as exercising increased message exchanges so that the vring buffers are cycled.

Quoted 3 lines

That would make it possible to improve the handling of multiple remoteprocs and would allow for a variation in message lengths etc.

FWIW, this already support multiple instances from the same remoteproc or different remoteproc.

regards
Suman

Quoted 36 lines

Regards,
Bjorn

Quoted 32 lines
---
 samples/rpmsg/rpmsg_client_sample.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
samples/rpmsg/rpmsg_client_sample.c +4 -2
index f161dfd3e70a..9b6b27ea504f 100644
@@ -22,7 +22,9 @@
 #include <linux/rpmsg.h>
 
 #define MSG		"hello world!"
-#define MSG_LIMIT	100
+
+static int count = 100;
+module_param(count, int, 0644);
 
 struct instance_data {
 	int rx_count;
@@ -41,7 +43,7 @@ static int rpmsg_sample_cb(struct rpmsg_device *rpdev, void *data, int len,
 		       data, len,  true);
 
 	/* samples should not live forever */
-	if (idata->rx_count >= MSG_LIMIT) {
+	if (idata->rx_count >= count) {
 		dev_info(&rpdev->dev, "goodbye!\n");
 		return 0;
 	}
Signature · 1 line
2.18.0