You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "anchao (via GitHub)" <gi...@apache.org> on 2024/03/28 11:16:15 UTC
[PR] nshlib/irqaff: add irq affinity command [nuttx-apps]
anchao opened a new pull request, #2342:
URL: https://github.com/apache/nuttx-apps/pull/2342
## Summary
nshlib/irqaff: add irq affinity command
add support for set an IRQ affinity to CPUs by software
Signed-off-by: chao an <an...@lixiang.com>
## Impact
N/A
Depends on: https://github.com/apache/nuttx/pull/12020
## Testing
qemu-armv7a/bmp ostest on single core
```
nuttx$ qemu-system-arm -cpu cortex-a7 -nographic -machine virt,virtualization=off,gic-version=2 -net none -chardev stdio,id=con,mux=on -serial chardev:con -mon chardev=con,mode=readline -kernel ./nuttx -smp 4
NuttShell (N
NuttS
Nutt
NH) NutShellShetSutlltX- (NSH) NuttX-10.4.0
4t(NheSH) NuttX-ns0.h> 1ll (NSH) Nu0.4.0
nstX-1h>
nsh> ps
PID GROUP PRI POLICY TYPE NPX STATE EVENT SIGMASK STACK USED FILLED COMMAND
0 0 0 FIFO Kthread - Ready 0000000000000000 004080 000536 13.1% CPU0 IDLE
1 1 192 RR Kthread - Waiting Semaphore 0000000000000000 004032 000296 7.3% hpwork 0x4013f51c 0x4013f530
2 2 100 RR Task - Running 0000000000000000 004056 001168 28.7% nsh_main
nsh> irqaff 33 1
nsh> ps
PID GROUP PRI POLICY TYPE NPX STATE EVENT SIGMASK STACK USED FILLED COMMAND
0 0 0 FIFO Kthread - Ready 0000000000000000 004080 000736 18.0% CPU1 IDLE
1 1 192 RR Kthread - Waiting Semaphore 0000000000000000 004032 000296 7.3% hpwork 0x4013f544 0x4013f558
2 2 100 RR Task - Running 0000000000000000 004056 001288 31.7% nsh_main
nsh> irqaff 33 2
nsh> ps
PID GROUP PRI POLICY TYPE NPX STATE EVENT SIGMASK STACK USED FILLED COMMAND
0 0 0 FIFO Kthread - Ready 0000000000000000 004080 000736 18.0% CPU2 IDLE
1 1 192 RR Kthread - Waiting Semaphore 0000000000000000 004032 000296 7.3% hpwork 0x4013f56c 0x4013f580
2 2 100 RR Task - Running 0000000000000000 004056 001168 28.7% nsh_main
nsh> irqaff 33 3
nsh> ps
PID GROUP PRI POLICY TYPE NPX STATE EVENT SIGMASK STACK USED FILLED COMMAND
0 0 0 FIFO Kthread - Ready 0000000000000000 004080 000736 18.0% CPU3 IDLE
1 1 192 RR Kthread - Waiting Semaphore 0000000000000000 004032 000296 7.3% hpwork 0x4013f594 0x4013f5a8
2 2 100 RR Task - Running 0000000000000000 004056 001168 28.7% nsh_main
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nshlib/irqaff: add irq affinity command [nuttx-apps]
Posted by "anchao (via GitHub)" <gi...@apache.org>.
anchao commented on code in PR #2342:
URL: https://github.com/apache/nuttx-apps/pull/2342#discussion_r1543930381
##########
nshlib/nsh_command.c:
##########
@@ -497,6 +497,11 @@ static const struct cmdmap_s g_cmdmap[] =
CMD_MAP("resetcause", cmd_reset_cause, 1, 1, NULL),
#endif
+#if defined(CONFIG_BOARDCTL_IRQ_AFFINITY) && !defined(CONFIG_NSH_DISABLE_IRQ_AFFINITY)
+ CMD_MAP("irqaff", cmd_irq_affinity, 3, 3,
+ "irqaff [IRQ Number] [Core Number]"),
Review Comment:
Done
##########
nshlib/nsh_syscmds.c:
##########
@@ -518,6 +518,26 @@ int cmd_reset_cause(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
}
#endif
+/****************************************************************************
+ * Name: cmd_irq_affinity
+ ****************************************************************************/
+
+#if defined(CONFIG_BOARDCTL_IRQ_AFFINITY) && !defined(CONFIG_NSH_DISABLE_IRQ_AFFINITY)
+int cmd_irq_affinity(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
+{
+ int affinity[2];
+
+ if (argc == 3)
+ {
+ affinity[0] = atoi(argv[1]);
+ affinity[1] = atoi(argv[2]);
Review Comment:
Done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nshlib/irqaff: add irq affinity command [nuttx-apps]
Posted by "anchao (via GitHub)" <gi...@apache.org>.
anchao commented on code in PR #2342:
URL: https://github.com/apache/nuttx-apps/pull/2342#discussion_r1543938384
##########
nshlib/nsh_syscmds.c:
##########
@@ -518,6 +518,32 @@ int cmd_reset_cause(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
}
#endif
+/****************************************************************************
+ * Name: cmd_irq_affinity
+ ****************************************************************************/
+
+#if defined(CONFIG_BOARDCTL_IRQ_AFFINITY) && !defined(CONFIG_NSH_DISABLE_IRQ_AFFINITY)
+int cmd_irq_affinity(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
+{
+ int affinity[2];
Review Comment:
Done
##########
nshlib/nsh_syscmds.c:
##########
@@ -518,6 +518,32 @@ int cmd_reset_cause(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
}
#endif
+/****************************************************************************
+ * Name: cmd_irq_affinity
+ ****************************************************************************/
+
+#if defined(CONFIG_BOARDCTL_IRQ_AFFINITY) && !defined(CONFIG_NSH_DISABLE_IRQ_AFFINITY)
+int cmd_irq_affinity(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
+{
+ int affinity[2];
+
+ if (argc == 3)
+ {
+ affinity[0] = atoi(argv[1]);
Review Comment:
Done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nshlib/irqaff: add irq affinity command [nuttx-apps]
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #2342:
URL: https://github.com/apache/nuttx-apps/pull/2342#discussion_r1542784670
##########
nshlib/nsh_command.c:
##########
@@ -497,6 +497,11 @@ static const struct cmdmap_s g_cmdmap[] =
CMD_MAP("resetcause", cmd_reset_cause, 1, 1, NULL),
#endif
+#if defined(CONFIG_BOARDCTL_IRQ_AFFINITY) && !defined(CONFIG_NSH_DISABLE_IRQ_AFFINITY)
+ CMD_MAP("irqaff", cmd_irq_affinity, 3, 3,
+ "irqaff [IRQ Number] [Core Number]"),
Review Comment:
```suggestion
"irqaff [IRQ Number] [Core Mask]"),
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nshlib/irqaff: add irq affinity command [nuttx-apps]
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 merged PR #2342:
URL: https://github.com/apache/nuttx-apps/pull/2342
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nshlib/irqaff: add irq affinity command [nuttx-apps]
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #2342:
URL: https://github.com/apache/nuttx-apps/pull/2342#discussion_r1543931052
##########
nshlib/nsh_syscmds.c:
##########
@@ -518,6 +518,32 @@ int cmd_reset_cause(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
}
#endif
+/****************************************************************************
+ * Name: cmd_irq_affinity
+ ****************************************************************************/
+
+#if defined(CONFIG_BOARDCTL_IRQ_AFFINITY) && !defined(CONFIG_NSH_DISABLE_IRQ_AFFINITY)
+int cmd_irq_affinity(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
+{
+ int affinity[2];
Review Comment:
```suggestion
unsigned int affinity[2];
```
##########
nshlib/nsh_syscmds.c:
##########
@@ -518,6 +518,32 @@ int cmd_reset_cause(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
}
#endif
+/****************************************************************************
+ * Name: cmd_irq_affinity
+ ****************************************************************************/
+
+#if defined(CONFIG_BOARDCTL_IRQ_AFFINITY) && !defined(CONFIG_NSH_DISABLE_IRQ_AFFINITY)
+int cmd_irq_affinity(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
+{
+ int affinity[2];
+
+ if (argc == 3)
+ {
+ affinity[0] = atoi(argv[1]);
Review Comment:
```suggestion
affinity[0] = strtoul(argv[2], NULL, 0);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] nshlib/irqaff: add irq affinity command [nuttx-apps]
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #2342:
URL: https://github.com/apache/nuttx-apps/pull/2342#discussion_r1542785570
##########
nshlib/nsh_syscmds.c:
##########
@@ -518,6 +518,26 @@ int cmd_reset_cause(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
}
#endif
+/****************************************************************************
+ * Name: cmd_irq_affinity
+ ****************************************************************************/
+
+#if defined(CONFIG_BOARDCTL_IRQ_AFFINITY) && !defined(CONFIG_NSH_DISABLE_IRQ_AFFINITY)
+int cmd_irq_affinity(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
+{
+ int affinity[2];
+
+ if (argc == 3)
+ {
+ affinity[0] = atoi(argv[1]);
+ affinity[1] = atoi(argv[2]);
Review Comment:
strtoul(argv[2], NULL, 0);
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org