Skip to contentSkip to conversation

remoteproc: Add module parameter 'auto_boot'

PATCH In review Paul Cercueil 4 participants 8 messages Nov 15, 2020 – Nov 23, 2020 Remote processor (remoteproc)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 remoteproc: Add module parameter 'auto_boot'

Until now the remoteproc core would always default to trying to boot the remote processor at startup. The various remoteproc drivers could however override that setting.

Whether or not we want the remote processor to boot, really depends on the nature of the processor itself - a processor built into a WiFi chip will need to be booted for the WiFi hardware to be usable, for instance, but a general-purpose co-processor does not have any predeterminated function, and as such we cannot assume that the OS will want the processor to be booted - yet alone that we have a single do-it-all firmware to load.

Add a 'auto_boot' module parameter that instructs the remoteproc whether or not it should auto-boot the remote processor, which will default to "true" to respect the previous behaviour.

---
 drivers/remoteproc/remoteproc_core.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/remoteproc/remoteproc_core.c +6 -1
index dab2c0f5caf0..687b1bfd49db 100644
@@ -44,6 +44,11 @@
 
 #define HIGH_BITS_MASK 0xFFFFFFFF00000000ULL
 
+static bool auto_boot = true;
+module_param(auto_boot, bool, 0400);
+MODULE_PARM_DESC(auto_boot,
+		 "Auto-boot the remote processor [default=true]");
+
 static DEFINE_MUTEX(rproc_list_mutex);
 static LIST_HEAD(rproc_list);
 static struct notifier_block rproc_panic_nb;
@@ -2176,7 +2181,7 @@ struct rproc *rproc_alloc(struct device *dev, const char *name,
 		return NULL;
 
 	rproc->priv = &rproc[1];
-	rproc->auto_boot = true;
+	rproc->auto_boot = auto_boot;
 	rproc->elf_class = ELFCLASSNONE;
 	rproc->elf_machine = EM_NONE;
 
Signature · 1 line
2.29.2
maintainer
#1 lore raw

Hi Paul,

Quoted 4 lines · Paul Cercueil

Until now the remoteproc core would always default to trying to boot the remote processor at startup. The various remoteproc drivers could however override that setting.

Quoted 8 lines

Whether or not we want the remote processor to boot, really depends on the nature of the processor itself - a processor built into a WiFi chip will need to be booted for the WiFi hardware to be usable, for instance, but a general-purpose co-processor does not have any predeterminated function, and as such we cannot assume that the OS will want the processor to be booted - yet alone that we have a single do-it-all firmware to load.

If I understand correctly you have various remote processors that use the same firmware but are serving different purposes - is this correct?

Quoted 4 lines

Add a 'auto_boot' module parameter that instructs the remoteproc whether or not it should auto-boot the remote processor, which will default to "true" to respect the previous behaviour.

Given that the core can't be a module I wonder if this isn't something that would be better off in the specific platform driver or the device tree... Other people might have an opinion as well.

Thanks,
Mathieu

Quoted 33 lines
---
 drivers/remoteproc/remoteproc_core.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/remoteproc/remoteproc_core.c +6 -1
index dab2c0f5caf0..687b1bfd49db 100644
@@ -44,6 +44,11 @@
 
 #define HIGH_BITS_MASK 0xFFFFFFFF00000000ULL
 
+static bool auto_boot = true;
+module_param(auto_boot, bool, 0400);
+MODULE_PARM_DESC(auto_boot,
+		 "Auto-boot the remote processor [default=true]");
+
 static DEFINE_MUTEX(rproc_list_mutex);
 static LIST_HEAD(rproc_list);
 static struct notifier_block rproc_panic_nb;
@@ -2176,7 +2181,7 @@ struct rproc *rproc_alloc(struct device *dev, const char *name,
 		return NULL;
 
 	rproc->priv = &rproc[1];
-	rproc->auto_boot = true;
+	rproc->auto_boot = auto_boot;
 	rproc->elf_class = ELFCLASSNONE;
 	rproc->elf_machine = EM_NONE;
 
Signature · 1 line
2.29.2
#2 lore raw

Hi Paul,

Quoted 19 lines · Mathieu Poirier

Hi Paul,

Quoted 4 lines · Paul Cercueil

Until now the remoteproc core would always default to trying to boot the remote processor at startup. The various remoteproc drivers could however override that setting.

Quoted 8 lines

Whether or not we want the remote processor to boot, really depends on the nature of the processor itself - a processor built into a WiFi chip will need to be booted for the WiFi hardware to be usable, for instance, but a general-purpose co-processor does not have any predeterminated function, and as such we cannot assume that the OS will want the processor to be booted - yet alone that we have a single do-it-all firmware to load.

If I understand correctly you have various remote processors that use the same firmware but are serving different purposes - is this correct?

Quoted 8 lines
Quoted 4 lines

Add a 'auto_boot' module parameter that instructs the remoteproc whether or not it should auto-boot the remote processor, which will default to "true" to respect the previous behaviour.

Given that the core can't be a module I wonder if this isn't something that would be better off in the specific platform driver or the device tree... Other people might have an opinion as well.

I agree. Even it is a module, all it is setting up is default behavior, and doesn't buy you much. If you have one or more remoteproc drivers supporting different instances, and each one wants different behavior, you would have to customize it in the drivers anyway. ST drivers are customizing this using a DT flag.

Given that the individual platform drivers have to be modules, is there any issue in customizing this in your platform driver?

regards
Suman

Quoted 37 lines

Thanks,
Mathieu

Quoted 33 lines
---
 drivers/remoteproc/remoteproc_core.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/remoteproc/remoteproc_core.c +6 -1
index dab2c0f5caf0..687b1bfd49db 100644
@@ -44,6 +44,11 @@
 
 #define HIGH_BITS_MASK 0xFFFFFFFF00000000ULL
 
+static bool auto_boot = true;
+module_param(auto_boot, bool, 0400);
+MODULE_PARM_DESC(auto_boot,
+		 "Auto-boot the remote processor [default=true]");
+
 static DEFINE_MUTEX(rproc_list_mutex);
 static LIST_HEAD(rproc_list);
 static struct notifier_block rproc_panic_nb;
@@ -2176,7 +2181,7 @@ struct rproc *rproc_alloc(struct device *dev, const char *name,
 		return NULL;
 
 	rproc->priv = &rproc[1];
-	rproc->auto_boot = true;
+	rproc->auto_boot = auto_boot;
 	rproc->elf_class = ELFCLASSNONE;
 	rproc->elf_machine = EM_NONE;
 
Signature · 1 line
2.29.2
#3 lore raw

Hi Suman,

Quoted 41 lines · Suman Anna

Hi Paul,

Quoted 32 lines · Mathieu Poirier

Hi Paul,

Quoted 5 lines · Paul Cercueil

Until now the remoteproc core would always default to trying to
boot the
remote processor at startup. The various remoteproc drivers could however override that setting.

Quoted 12 lines

Whether or not we want the remote processor to boot, really
depends on
the nature of the processor itself - a processor built into a WiFi
chip
will need to be booted for the WiFi hardware to be usable, for
instance,
but a general-purpose co-processor does not have any
predeterminated
function, and as such we cannot assume that the OS will want the processor to be booted - yet alone that we have a single do-it-all firmware to load.

If I understand correctly you have various remote processors that
use the same firmware
but are serving different purposes - is this correct?

Quoted 6 lines

Add a 'auto_boot' module parameter that instructs the remoteproc
whether
or not it should auto-boot the remote processor, which will
default to
"true" to respect the previous behaviour.

Quoted 5 lines

Given that the core can't be a module I wonder if this isn't
something that
would be better off in the specific platform driver or the device
tree... Other
people might have an opinion as well.

Quoted 4 lines

I agree. Even it is a module, all it is setting up is default behavior, and doesn't buy you much. If you have one or more remoteproc drivers supporting different instances, and each one wants different behavior, you would have to customize it in the drivers anyway. ST drivers are customizing this using a DT flag.

Devicetree is supposed to describe the hardware, not how you're supposed to use the hardware...

Quoted 2 lines

Given that the individual platform drivers have to be modules, is there any issue in customizing this in your platform driver?

No, I can patch the platform driver instead, but to me it clearly is a core issue.

Cheers,
-Paul

Quoted 43 lines

regards
Suman

Quoted 39 lines

Thanks,
Mathieu

Quoted 35 lines

---

  drivers/remoteproc/remoteproc_core.c | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/remoteproc/remoteproc_core.c
b/drivers/remoteproc/remoteproc_core.c
index dab2c0f5caf0..687b1bfd49db 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -44,6 +44,11 @@

  #define HIGH_BITS_MASK 0xFFFFFFFF00000000ULL

+static bool auto_boot = true; +module_param(auto_boot, bool, 0400); +MODULE_PARM_DESC(auto_boot,
+ "Auto-boot the remote processor [default=true]");
+
static DEFINE_MUTEX(rproc_list_mutex);
static LIST_HEAD(rproc_list);
static struct notifier_block rproc_panic_nb;
@@ -2176,7 +2181,7 @@ struct rproc *rproc_alloc(struct device
*dev, const char *name,
return NULL;

rproc->priv = &rproc[1];
- rproc->auto_boot = true;
+ rproc->auto_boot = auto_boot;
rproc->elf_class = ELFCLASSNONE;
rproc->elf_machine = EM_NONE;

--
2.29.2

#4 lore raw

Hi Paul,

Quoted 36 lines · Paul Cercueil

Hi Suman,

Quoted 33 lines · Suman Anna

Hi Paul,

Quoted 29 lines · Mathieu Poirier

 Hi Paul,

Quoted 4 lines · Paul Cercueil

 Until now the remoteproc core would always default to trying to boot the remote processor at startup. The various remoteproc drivers could however override that setting.

Quoted 8 lines

 Whether or not we want the remote processor to boot, really depends on the nature of the processor itself - a processor built into a WiFi chip will need to be booted for the WiFi hardware to be usable, for instance, but a general-purpose co-processor does not have any predeterminated function, and as such we cannot assume that the OS will want the processor to be booted - yet alone that we have a single do-it-all firmware to load.

 If I understand correctly you have various remote processors that use the same firmware
 but are serving different purposes - is this correct?

Quoted 4 lines

 Add a 'auto_boot' module parameter that instructs the remoteproc whether or not it should auto-boot the remote processor, which will default to "true" to respect the previous behaviour.

 Given that the core can't be a module I wonder if this isn't something that would be better off in the specific platform driver or the device tree... Other
 people might have an opinion as well.

Quoted 8 lines
Quoted 5 lines

I agree. Even it is a module, all it is setting up is default behavior, and doesn't buy you much. If you have one or more remoteproc drivers supporting different instances, and each one wants different behavior, you would have to customize it in the drivers anyway. ST drivers are customizing this using a DT flag.

Devicetree is supposed to describe the hardware, not how you're supposed to use the hardware...

I agree, but it sneaked in somehow. Anyway, I am not proposing that you repeat the same approach.

Quoted 5 lines
Quoted 3 lines

Given that the individual platform drivers have to be modules, is there any issue in customizing this in your platform driver?

No, I can patch the platform driver instead, but to me it clearly is a core issue.

So, remoteproc core is just setting up a default, and it is upto the individual drivers to override it. I actually have two different rproc drivers on the same SoC wanting different behavior for example.

I do like the runtime config in general compared to a build-time Kconfig option, but let's say we do add this option, then you would also need every rproc driver to actually set this field specifically to ensure their expected behavior doesn't change if it is installed as false.

regards
Suman

Quoted 49 lines

Cheers,
-Paul

Quoted 43 lines

regards
Suman

Quoted 39 lines

 Thanks,
 Mathieu

Quoted 35 lines

 ---
  drivers/remoteproc/remoteproc_core.c | 7 ++++++-

  1 file changed, 6 insertions(+), 1 deletion(-)

 diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index dab2c0f5caf0..687b1bfd49db 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -44,6 +44,11 @@

  #define HIGH_BITS_MASK 0xFFFFFFFF00000000ULL

 +static bool auto_boot = true;
 +module_param(auto_boot, bool, 0400); +MODULE_PARM_DESC(auto_boot,
 +         "Auto-boot the remote processor [default=true]");
 +
  static DEFINE_MUTEX(rproc_list_mutex);
  static LIST_HEAD(rproc_list);
  static struct notifier_block rproc_panic_nb;
 @@ -2176,7 +2181,7 @@ struct rproc *rproc_alloc(struct device *dev, const char *name,
          return NULL;

      rproc->priv = &rproc[1];
 -    rproc->auto_boot = true;
 +    rproc->auto_boot = auto_boot;
      rproc->elf_class = ELFCLASSNONE;
      rproc->elf_machine = EM_NONE;

 --
 2.29.2

#5 lore raw
In reply to Mathieu Poirier

Hi Mathieu,

Quoted 20 lines · Mathieu Poirier

Hi Paul,

Quoted 5 lines · Paul Cercueil

Until now the remoteproc core would always default to trying to
boot the
remote processor at startup. The various remoteproc drivers could however override that setting.

Quoted 11 lines

Whether or not we want the remote processor to boot, really depends
on
the nature of the processor itself - a processor built into a WiFi
chip
will need to be booted for the WiFi hardware to be usable, for
instance,
but a general-purpose co-processor does not have any predeterminated function, and as such we cannot assume that the OS will want the processor to be booted - yet alone that we have a single do-it-all firmware to load.

Quoted 2 lines

If I understand correctly you have various remote processors that use the same firmware but are serving different purposes - is this correct?

That's the opposite actually. I have one remote processor which is general-purpose, and as such userspace may or may not want it started at boot time - depending on what it wants to do with it. The kernel shouldn't decide itself whether or not the remote processor should be started, because that's policy.

Quoted 11 lines
Quoted 7 lines

Add a 'auto_boot' module parameter that instructs the remoteproc
whether
or not it should auto-boot the remote processor, which will default
to
"true" to respect the previous behaviour.

Given that the core can't be a module I wonder if this isn't something that would be better off in the specific platform driver or the device tree... Other people might have an opinion as well.

Hardcoded in the platform driver or flagged in the device tree, doesn't change the fundamental problem - it should be up to the userspace to decide whether or not the remote processor should boot.

Cheers,
-Paul

Quoted 36 lines
Quoted 36 lines

---

  drivers/remoteproc/remoteproc_core.c | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/remoteproc/remoteproc_core.c
b/drivers/remoteproc/remoteproc_core.c
index dab2c0f5caf0..687b1bfd49db 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -44,6 +44,11 @@

  #define HIGH_BITS_MASK 0xFFFFFFFF00000000ULL

+static bool auto_boot = true;
+module_param(auto_boot, bool, 0400); +MODULE_PARM_DESC(auto_boot,
+ "Auto-boot the remote processor [default=true]");
+
static DEFINE_MUTEX(rproc_list_mutex);
static LIST_HEAD(rproc_list);
static struct notifier_block rproc_panic_nb;
@@ -2176,7 +2181,7 @@ struct rproc *rproc_alloc(struct device *dev,
const char *name,
return NULL;

rproc->priv = &rproc[1];
- rproc->auto_boot = true;
+ rproc->auto_boot = auto_boot;
rproc->elf_class = ELFCLASSNONE;
rproc->elf_machine = EM_NONE;

--
2.29.2

#6 lore raw
Quoted 48 lines · Paul Cercueil

Hi Mathieu,

Le ven. 20 nov. 2020 à 15:37, Mathieu Poirier <[email protected]> a écrit :

Quoted 20 lines

Hi Paul,

Quoted 5 lines · Paul Cercueil

Until now the remoteproc core would always default to trying to
boot the
remote processor at startup. The various remoteproc drivers could however override that setting.

Quoted 11 lines

Whether or not we want the remote processor to boot, really depends
on
the nature of the processor itself - a processor built into a WiFi
chip
will need to be booted for the WiFi hardware to be usable, for
instance,
but a general-purpose co-processor does not have any predeterminated function, and as such we cannot assume that the OS will want the processor to be booted - yet alone that we have a single do-it-all firmware to load.

Quoted 3 lines

If I understand correctly you have various remote processors that use the same firmware
but are serving different purposes - is this correct?

That's the opposite actually. I have one remote processor which is general-purpose, and as such userspace may or may not want it started at boot time - depending on what it wants to do with it. The kernel shouldn't decide itself whether or not the remote processor should be started, because that's policy.

Quoted 8 lines
Quoted 7 lines

Add a 'auto_boot' module parameter that instructs the remoteproc
whether
or not it should auto-boot the remote processor, which will default
to
"true" to respect the previous behaviour.

Quoted 5 lines

Given that the core can't be a module I wonder if this isn't something that
would be better off in the specific platform driver or the device tree... Other
people might have an opinion as well.

Quoted 4 lines

Hardcoded in the platform driver or flagged in the device tree, doesn't change the fundamental problem - it should be up to the userspace to decide whether or not the remote processor should boot.

Unfortunately it depends on what you're using your remoteprocs for. And in a system with multiple remoteproc instances I don't think a single global parameter is sufficient - not even a per-driver setting is.

I do agree with you that there are types of systems where the decision to auto boot things would happen after the kernel and/or DT has been written.

Regards,
Bjorn

Quoted 41 lines

Cheers,
-Paul

Quoted 36 lines
Quoted 36 lines

---

  drivers/remoteproc/remoteproc_core.c | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/remoteproc/remoteproc_core.c
b/drivers/remoteproc/remoteproc_core.c
index dab2c0f5caf0..687b1bfd49db 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -44,6 +44,11 @@

  #define HIGH_BITS_MASK 0xFFFFFFFF00000000ULL

+static bool auto_boot = true;
+module_param(auto_boot, bool, 0400); +MODULE_PARM_DESC(auto_boot,
+ "Auto-boot the remote processor [default=true]");
+
static DEFINE_MUTEX(rproc_list_mutex);
static LIST_HEAD(rproc_list);
static struct notifier_block rproc_panic_nb;
@@ -2176,7 +2181,7 @@ struct rproc *rproc_alloc(struct device *dev,
const char *name,
return NULL;

rproc->priv = &rproc[1];
- rproc->auto_boot = true;
+ rproc->auto_boot = auto_boot;
rproc->elf_class = ELFCLASSNONE;
rproc->elf_machine = EM_NONE;

--
2.29.2

maintainer
#7 lore raw
In reply to Paul Cercueil
Quoted 48 lines · Paul Cercueil

Hi Mathieu,

Le ven. 20 nov. 2020 à 15:37, Mathieu Poirier <[email protected]> a écrit :

Quoted 20 lines

Hi Paul,

Quoted 5 lines · Paul Cercueil

Until now the remoteproc core would always default to trying to
boot the
remote processor at startup. The various remoteproc drivers could however override that setting.

Quoted 11 lines

Whether or not we want the remote processor to boot, really depends
on
the nature of the processor itself - a processor built into a WiFi
chip
will need to be booted for the WiFi hardware to be usable, for
instance,
but a general-purpose co-processor does not have any predeterminated function, and as such we cannot assume that the OS will want the processor to be booted - yet alone that we have a single do-it-all firmware to load.

Quoted 3 lines

If I understand correctly you have various remote processors that use the same firmware
but are serving different purposes - is this correct?

That's the opposite actually. I have one remote processor which is general-purpose, and as such userspace may or may not want it started at boot time - depending on what it wants to do with it. The kernel shouldn't decide itself whether or not the remote processor should be started, because that's policy.

Quoted 8 lines
Quoted 7 lines

Add a 'auto_boot' module parameter that instructs the remoteproc
whether
or not it should auto-boot the remote processor, which will default
to
"true" to respect the previous behaviour.

Quoted 5 lines

Given that the core can't be a module I wonder if this isn't something that
would be better off in the specific platform driver or the device tree... Other
people might have an opinion as well.

Quoted 3 lines

Hardcoded in the platform driver or flagged in the device tree, doesn't change the fundamental problem - it should be up to the userspace to decide whether or not the remote processor should boot.

That is why I suggested to add the module parameter to the platform driver(s) that needs it. That way user space may decide to do whatever it wants based on the scenario to enact.

I see your point of view about putting the setting in the core but that is introducing drawbacks when dealing with more than one remote processor on the same system.

Thanks,
Mathieu

Quoted 42 lines

Cheers,
-Paul

Quoted 36 lines
Quoted 36 lines

---

  drivers/remoteproc/remoteproc_core.c | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/remoteproc/remoteproc_core.c
b/drivers/remoteproc/remoteproc_core.c
index dab2c0f5caf0..687b1bfd49db 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -44,6 +44,11 @@

  #define HIGH_BITS_MASK 0xFFFFFFFF00000000ULL

+static bool auto_boot = true;
+module_param(auto_boot, bool, 0400); +MODULE_PARM_DESC(auto_boot,
+ "Auto-boot the remote processor [default=true]");
+
static DEFINE_MUTEX(rproc_list_mutex);
static LIST_HEAD(rproc_list);
static struct notifier_block rproc_panic_nb;
@@ -2176,7 +2181,7 @@ struct rproc *rproc_alloc(struct device *dev,
const char *name,
return NULL;

rproc->priv = &rproc[1];
- rproc->auto_boot = true;
+ rproc->auto_boot = auto_boot;
rproc->elf_class = ELFCLASSNONE;
rproc->elf_machine = EM_NONE;

--
2.29.2