Skip to contentSkip to conversation

cobalt/trace: dovetail: improve xntrace_user_stop and xntrace_user_start

PATCH Applied Hongzhan Chen 2 participants 8 messages Nov 29, 2021 – Nov 30, 2021

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 cobalt/trace: dovetail: improve xntrace_user_stop and xntrace_user_start

xntrace_user_stop is widely similar to xntrace_user_freeze, call trace_cobalt_trigger to improve it and also make xntrace_user_start visible to balance them.

---
 include/cobalt/kernel/dovetail/pipeline/trace.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
include/cobalt/kernel/dovetail/pipeline/trace.h +3 -2
index 513d9b48b..479191e0e 100644
@@ -45,13 +45,14 @@ static inline int xntrace_max_reset(void)
 
 static inline int xntrace_user_start(void)
 {
-	TODO();
+	trace_cobalt_trigger("user-start");
 	return 0;
 }
 
 static inline int xntrace_user_stop(unsigned long v)
 {
-	TODO();
+	trace_cobalt_trace_longval(0, v);
+	trace_cobalt_trigger("user-stop");
 	return 0;
 }
 
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 2/2 cobalt/trace: dovetail: remove TODO and return -ENOSYS for unportable features

Some of the features are unportable because ftrace does not provide equivalent functionality to the ipipe tracer (namely double buffering so that you can continue to record in flight-recorder mode while a previous recording remains available).

We remove TODOs to pass allyesconfig make.

---
 include/cobalt/kernel/dovetail/pipeline/trace.h | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)
include/cobalt/kernel/dovetail/pipeline/trace.h +5 -10
index 479191e0e..c7df3be79 100644
@@ -27,20 +27,17 @@
 
 static inline int xntrace_max_begin(unsigned long v)
 {
-	TODO();
-	return 0;
+	return -ENOSYS;
 }
 
 static inline int xntrace_max_end(unsigned long v)
 {
-	TODO();
-	return 0;
+	return -ENOSYS;
 }
 
 static inline int xntrace_max_reset(void)
 {
-	TODO();
-	return 0;
+	return -ENOSYS;
 }
 
 static inline int xntrace_user_start(void)
@@ -96,14 +93,12 @@ static inline int xntrace_tick(unsigned long delay_ticks) /* ns */
 
 static inline int xntrace_panic_freeze(void)
 {
-	TODO();
-	return 0;
+	return -ENOSYS;
 }
 
 static inline int xntrace_panic_dump(void)
 {
-	TODO();
-	return 0;
+	return -ENOSYS;
 }
 
 static inline bool xntrace_enabled(void)
Signature · 1 line
2.17.1
#2 lore raw

Re: [PATCH v2 2/2] cobalt/trace: dovetail: remove TODO and return -ENOSYS for unportable features

Quoted 46 lines · Hongzhan Chen via Xenomai

Some of the features are unportable because ftrace does not provide equivalent functionality to the ipipe tracer (namely double buffering so that you can continue to record in flight-recorder mode while a previous recording remains available).

We remove TODOs to pass allyesconfig make.

---
 include/cobalt/kernel/dovetail/pipeline/trace.h | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)
include/cobalt/kernel/dovetail/pipeline/trace.h +3 -8
index 479191e0e..c7df3be79 100644
@@ -27,20 +27,17 @@
 
 static inline int xntrace_max_begin(unsigned long v)
 {
-	TODO();
-	return 0;
+	return -ENOSYS;
 }
 
 static inline int xntrace_max_end(unsigned long v)
 {
-	TODO();
-	return 0;
+	return -ENOSYS;
 }
 
 static inline int xntrace_max_reset(void)
 {
-	TODO();
-	return 0;
+	return -ENOSYS;
 }
 
 static inline int xntrace_user_start(void)
@@ -96,14 +93,12 @@ static inline int xntrace_tick(unsigned long delay_ticks) /* ns */
 
 static inline int xntrace_panic_freeze(void)
 {
-	TODO();
-	return 0;

include/cobalt/kernel/dovetail/pipeline/trace.h static inline int xntrace_tick(unsigned long delay_ticks) /* ns */ · line 103

Quoted 10 lines
include/cobalt/kernel/dovetail/pipeline/trace.h +2 -2
+	return -ENOSYS;
 }
 
 static inline int xntrace_panic_dump(void)
 {
-	TODO();
-	return 0;
+	return -ENOSYS;
 }
 

Looking at these two panic "abstractions": They are only called by dovetail-specific handle_oob_trap_entry. There, we should rather use kernel native tracing functions to stop and dump a trace.

And for I-pipe, we can fold the two abstractions into handle_exception() there as well.

Jan

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
#3 lore raw

RE: [PATCH v2 2/2] cobalt/trace: dovetail: remove TODO and return -ENOSYS for unportable features

Quoted 58 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Monday, November 29, 2021 3:58 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH v2 2/2] cobalt/trace: dovetail: remove TODO and return -ENOSYS for unportable features

Quoted 49 lines · Hongzhan Chen via Xenomai

Some of the features are unportable because ftrace does not provide equivalent functionality to the ipipe tracer (namely double buffering so that you can continue to record in flight-recorder mode while a previous recording remains available).

We remove TODOs to pass allyesconfig make.

---
 include/cobalt/kernel/dovetail/pipeline/trace.h | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)
include/cobalt/kernel/dovetail/pipeline/trace.h +4 -8
index 479191e0e..c7df3be79 100644
@@ -27,20 +27,17 @@
 
 static inline int xntrace_max_begin(unsigned long v)
 {
-	TODO();
-	return 0;
+	return -ENOSYS;
 }
 
 static inline int xntrace_max_end(unsigned long v)
 {
-	TODO();
-	return 0;
+	return -ENOSYS;
 }
 
 static inline int xntrace_max_reset(void)
 {
-	TODO();
-	return 0;
+	return -ENOSYS;
 }
 
 static inline int xntrace_user_start(void)
@@ -96,14 +93,12 @@ static inline int xntrace_tick(unsigned long delay_ticks) /* ns */
 
 static inline int xntrace_panic_freeze(void)
 {
-	TODO();
-	return 0;
+	return -ENOSYS;
 }
 
Quoted 11 lines

include/cobalt/kernel/dovetail/pipeline/trace.h static inline int xntrace_tick(unsigned long delay_ticks) /* ns */ · line 103

Quoted 7 lines
include/cobalt/kernel/dovetail/pipeline/trace.h +1 -2
 static inline int xntrace_panic_dump(void)
 {
-	TODO();
-	return 0;
+	return -ENOSYS;
 }
 

Looking at these two panic "abstractions": They are only called by dovetail-specific handle_oob_trap_entry. There, we should rather use kernel native tracing functions to stop and dump a trace.

I found that in EVL implementation of handle_oob_trap_entry ,especially
for note_trap implementation , it have not implemented stop and dump
a trace and just try to printk warning (please refer to kernel/evl/thread.c of evl branch). handle_oob_trap_entry would try to demote current stage and leave in-band to handle following thing. If we do native thing here, is there duplicated thing happen?

Regards

Hongzhan Chen

Quoted 13 lines

And for I-pipe, we can fold the two abstractions into handle_exception() there as well.

Jan

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
#4 lore raw

Re: [PATCH v2 2/2] cobalt/trace: dovetail: remove TODO and return -ENOSYS for unportable features

Quoted 70 lines · Hongzhan
Quoted 58 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Monday, November 29, 2021 3:58 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH v2 2/2] cobalt/trace: dovetail: remove TODO and return -ENOSYS for unportable features

Quoted 49 lines · Hongzhan Chen via Xenomai

Some of the features are unportable because ftrace does not provide equivalent functionality to the ipipe tracer (namely double buffering so that you can continue to record in flight-recorder mode while a previous recording remains available).

We remove TODOs to pass allyesconfig make.

---
 include/cobalt/kernel/dovetail/pipeline/trace.h | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)
include/cobalt/kernel/dovetail/pipeline/trace.h +4 -8
index 479191e0e..c7df3be79 100644
@@ -27,20 +27,17 @@
 
 static inline int xntrace_max_begin(unsigned long v)
 {
-	TODO();
-	return 0;
+	return -ENOSYS;
 }
 
 static inline int xntrace_max_end(unsigned long v)
 {
-	TODO();
-	return 0;
+	return -ENOSYS;
 }
 
 static inline int xntrace_max_reset(void)
 {
-	TODO();
-	return 0;
+	return -ENOSYS;
 }
 
 static inline int xntrace_user_start(void)
@@ -96,14 +93,12 @@ static inline int xntrace_tick(unsigned long delay_ticks) /* ns */
 
 static inline int xntrace_panic_freeze(void)
 {
-	TODO();
-	return 0;
+	return -ENOSYS;
 }
 
Quoted 11 lines

include/cobalt/kernel/dovetail/pipeline/trace.h static inline int xntrace_tick(unsigned long delay_ticks) /* ns */ · line 103

Quoted 7 lines
include/cobalt/kernel/dovetail/pipeline/trace.h +1 -2
 static inline int xntrace_panic_dump(void)
 {
-	TODO();
-	return 0;
+	return -ENOSYS;
 }
 

Looking at these two panic "abstractions": They are only called by dovetail-specific handle_oob_trap_entry. There, we should rather use kernel native tracing functions to stop and dump a trace.

Quoted 6 lines

I found that in EVL implementation of handle_oob_trap_entry ,especially
for note_trap implementation , it have not implemented stop and dump
a trace and just try to printk warning (please refer to kernel/evl/thread.c of evl branch). handle_oob_trap_entry would try to demote current stage and leave in-band to handle following thing. If we do native thing here, is there duplicated thing happen?

This is targeting a real error case: fault in kernel space when debugging is on. But if we really oops, ftrace_dump_on_panic may just do the job. So, yes, we could also simply drop this.

Jan

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
#5 lore raw

RE: [PATCH v2 2/2] cobalt/trace: dovetail: remove TODO and return -ENOSYS for unportable features

Quoted 86 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Tuesday, November 30, 2021 2:41 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH v2 2/2] cobalt/trace: dovetail: remove TODO and return -ENOSYS for unportable features

Quoted 70 lines · Hongzhan
Quoted 58 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Monday, November 29, 2021 3:58 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH v2 2/2] cobalt/trace: dovetail: remove TODO and return -ENOSYS for unportable features

Quoted 49 lines · Hongzhan Chen via Xenomai

Some of the features are unportable because ftrace does not provide equivalent functionality to the ipipe tracer (namely double buffering so that you can continue to record in flight-recorder mode while a previous recording remains available).

We remove TODOs to pass allyesconfig make.

---
 include/cobalt/kernel/dovetail/pipeline/trace.h | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)
include/cobalt/kernel/dovetail/pipeline/trace.h +4 -8
index 479191e0e..c7df3be79 100644
@@ -27,20 +27,17 @@
 
 static inline int xntrace_max_begin(unsigned long v)
 {
-	TODO();
-	return 0;
+	return -ENOSYS;
 }
 
 static inline int xntrace_max_end(unsigned long v)
 {
-	TODO();
-	return 0;
+	return -ENOSYS;
 }
 
 static inline int xntrace_max_reset(void)
 {
-	TODO();
-	return 0;
+	return -ENOSYS;
 }
 
 static inline int xntrace_user_start(void)
@@ -96,14 +93,12 @@ static inline int xntrace_tick(unsigned long delay_ticks) /* ns */
 
 static inline int xntrace_panic_freeze(void)
 {
-	TODO();
-	return 0;
+	return -ENOSYS;
 }
 
Quoted 11 lines

include/cobalt/kernel/dovetail/pipeline/trace.h static inline int xntrace_tick(unsigned long delay_ticks) /* ns */ · line 103

Quoted 7 lines
include/cobalt/kernel/dovetail/pipeline/trace.h +1 -2
 static inline int xntrace_panic_dump(void)
 {
-	TODO();
-	return 0;
+	return -ENOSYS;
 }
 

Looking at these two panic "abstractions": They are only called by dovetail-specific handle_oob_trap_entry. There, we should rather use kernel native tracing functions to stop and dump a trace.

Quoted 6 lines

I found that in EVL implementation of handle_oob_trap_entry ,especially
for note_trap implementation , it have not implemented stop and dump
a trace and just try to printk warning (please refer to kernel/evl/thread.c of evl branch). handle_oob_trap_entry would try to demote current stage and leave in-band to handle following thing. If we do native thing here, is there duplicated thing happen?

Quoted 3 lines

This is targeting a real error case: fault in kernel space when debugging is on. But if we really oops, ftrace_dump_on_panic may just do the job. So, yes, we could also simply drop this.

So there is no need to do further modification for xntrace_panic_freeze and xntrace_panic_dump based on this patch? Would you apply it?

Regards

Hongzhan Chen

Quoted 10 lines

Jan

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
#6 lore raw

Re: [PATCH v2 2/2] cobalt/trace: dovetail: remove TODO and return -ENOSYS for unportable features

Quoted 86 lines · Hongzhan
Quoted 86 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Tuesday, November 30, 2021 2:41 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH v2 2/2] cobalt/trace: dovetail: remove TODO and return -ENOSYS for unportable features

Quoted 76 lines · Hongzhan
Quoted 58 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Monday, November 29, 2021 3:58 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH v2 2/2] cobalt/trace: dovetail: remove TODO and return -ENOSYS for unportable features

Quoted 49 lines · Hongzhan Chen via Xenomai

Some of the features are unportable because ftrace does not provide equivalent functionality to the ipipe tracer (namely double buffering so that you can continue to record in flight-recorder mode while a previous recording remains available).

We remove TODOs to pass allyesconfig make.

---
 include/cobalt/kernel/dovetail/pipeline/trace.h | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)
include/cobalt/kernel/dovetail/pipeline/trace.h +4 -8
index 479191e0e..c7df3be79 100644
@@ -27,20 +27,17 @@
 
 static inline int xntrace_max_begin(unsigned long v)
 {
-	TODO();
-	return 0;
+	return -ENOSYS;
 }
 
 static inline int xntrace_max_end(unsigned long v)
 {
-	TODO();
-	return 0;
+	return -ENOSYS;
 }
 
 static inline int xntrace_max_reset(void)
 {
-	TODO();
-	return 0;
+	return -ENOSYS;
 }
 
 static inline int xntrace_user_start(void)
@@ -96,14 +93,12 @@ static inline int xntrace_tick(unsigned long delay_ticks) /* ns */
 
 static inline int xntrace_panic_freeze(void)
 {
-	TODO();
-	return 0;
+	return -ENOSYS;
 }
 
Quoted 11 lines

include/cobalt/kernel/dovetail/pipeline/trace.h static inline int xntrace_tick(unsigned long delay_ticks) /* ns */ · line 103

Quoted 7 lines
include/cobalt/kernel/dovetail/pipeline/trace.h +1 -2
 static inline int xntrace_panic_dump(void)
 {
-	TODO();
-	return 0;
+	return -ENOSYS;
 }
 

Looking at these two panic "abstractions": They are only called by dovetail-specific handle_oob_trap_entry. There, we should rather use kernel native tracing functions to stop and dump a trace.

I found that in EVL implementation of handle_oob_trap_entry ,especially
for note_trap implementation , it have not implemented stop and dump
a trace and just try to printk warning (please refer to kernel/evl/thread.c of evl branch). handle_oob_trap_entry would try to demote current stage and leave in-band to handle following thing. If we do native thing here, is there duplicated thing happen?

Quoted 7 lines
Quoted 3 lines

This is targeting a real error case: fault in kernel space when debugging is on. But if we really oops, ftrace_dump_on_panic may just do the job. So, yes, we could also simply drop this.

So there is no need to do further modification for xntrace_panic_freeze and xntrace_panic_dump based on this patch? Would you apply it?

If you drop those calls from dovetail, yes.

Jan

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
Applied
#7 lore raw
In reply to Hongzhan Chen
Quoted 21 lines · Hongzhan Chen via Xenomai

xntrace_user_stop is widely similar to xntrace_user_freeze, call trace_cobalt_trigger to improve it and also make xntrace_user_start visible to balance them.

---
 include/cobalt/kernel/dovetail/pipeline/trace.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
include/cobalt/kernel/dovetail/pipeline/trace.h +1 -1
index 513d9b48b..479191e0e 100644
@@ -45,13 +45,14 @@ static inline int xntrace_max_reset(void)
 
 static inline int xntrace_user_start(void)
 {
-	TODO();
+	trace_cobalt_trigger("user-start");
 	return 0;

include/cobalt/kernel/dovetail/pipeline/trace.h static inline int xntrace_max_reset(void) · line 58

Quoted 10 lines
include/cobalt/kernel/dovetail/pipeline/trace.h +2 -1
 }
 
 static inline int xntrace_user_stop(unsigned long v)
 {
-	TODO();
+	trace_cobalt_trace_longval(0, v);
+	trace_cobalt_trigger("user-stop");
 	return 0;
 }
 

Thanks, applied.

Jan

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux