diff mbox series

[v2,2/9] trace: fix mode change

Message ID 20221004094418.196544-3-david.marchand@redhat.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers show
Series Trace subsystem fixes | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

David Marchand Oct. 4, 2022, 9:44 a.m. UTC
The API does not state that changing mode should be refused if no trace
point is enabled. Remove this limitation.

Fixes: 84c4fae4628f ("trace: implement operation APIs")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 app/test/test_trace.c             | 3 ---
 lib/eal/common/eal_common_trace.c | 3 ---
 2 files changed, 6 deletions(-)

Comments

Jerin Jacob Oct. 11, 2022, 2:20 p.m. UTC | #1
On Tue, Oct 4, 2022 at 3:15 PM David Marchand <david.marchand@redhat.com> wrote:
>
> The API does not state that changing mode should be refused if no trace
> point is enabled. Remove this limitation.
>
> Fixes: 84c4fae4628f ("trace: implement operation APIs")
> Cc: stable@dpdk.org
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
>  app/test/test_trace.c             | 3 ---
>  lib/eal/common/eal_common_trace.c | 3 ---
>  2 files changed, 6 deletions(-)
>
> diff --git a/lib/eal/common/eal_common_trace.c b/lib/eal/common/eal_common_trace.c
> index d5dbc7d667..1b86f5d2d2 100644
> --- a/lib/eal/common/eal_common_trace.c
> +++ b/lib/eal/common/eal_common_trace.c
> @@ -127,9 +127,6 @@ rte_trace_mode_set(enum rte_trace_mode mode)
>  {
>         struct trace_point *tp;
>
> -       if (!rte_trace_is_enabled())
> -               return;

Just added pre check to avoid going through this linked list as an optimization.
Since it is in slowpath, your changes are OK.

> -
>         STAILQ_FOREACH(tp, &tp_list, next)
>                 trace_mode_set(tp->handle, mode);
>
> --
> 2.37.3
>
Sunil Kumar Kori Oct. 12, 2022, 9:07 a.m. UTC | #2
> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Tuesday, October 4, 2022 3:14 PM
> To: dev@dpdk.org
> Cc: skori@mavell.com; Jerin Jacob Kollanukkaran <jerinj@marvell.com>;
> stable@dpdk.org; Sunil Kumar Kori <skori@marvell.com>
> Subject: [EXT] [PATCH v2 2/9] trace: fix mode change
> 
> External Email
> 
> ----------------------------------------------------------------------
> The API does not state that changing mode should be refused if no trace
> point is enabled. Remove this limitation.
> 
> Fixes: 84c4fae4628f ("trace: implement operation APIs")
> Cc: stable@dpdk.org
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
>  app/test/test_trace.c             | 3 ---
>  lib/eal/common/eal_common_trace.c | 3 ---
>  2 files changed, 6 deletions(-)
> 

Acked-by: Sunil Kumar Kori <skori@marvell.com>

> diff --git a/app/test/test_trace.c b/app/test/test_trace.c index
> 76af79162b..44ac38a4fa 100644
> --- a/app/test/test_trace.c
> +++ b/app/test/test_trace.c
> @@ -126,9 +126,6 @@ test_trace_mode(void)
> 
>  	current = rte_trace_mode_get();
> 
> -	if (!rte_trace_is_enabled())
> -		return TEST_SKIPPED;
> -
>  	rte_trace_mode_set(RTE_TRACE_MODE_DISCARD);
>  	if (rte_trace_mode_get() != RTE_TRACE_MODE_DISCARD)
>  		goto failed;
> diff --git a/lib/eal/common/eal_common_trace.c
> b/lib/eal/common/eal_common_trace.c
> index d5dbc7d667..1b86f5d2d2 100644
> --- a/lib/eal/common/eal_common_trace.c
> +++ b/lib/eal/common/eal_common_trace.c
> @@ -127,9 +127,6 @@ rte_trace_mode_set(enum rte_trace_mode mode)  {
>  	struct trace_point *tp;
> 
> -	if (!rte_trace_is_enabled())
> -		return;
> -
>  	STAILQ_FOREACH(tp, &tp_list, next)
>  		trace_mode_set(tp->handle, mode);
> 
> --
> 2.37.3
diff mbox series

Patch

diff --git a/app/test/test_trace.c b/app/test/test_trace.c
index 76af79162b..44ac38a4fa 100644
--- a/app/test/test_trace.c
+++ b/app/test/test_trace.c
@@ -126,9 +126,6 @@  test_trace_mode(void)
 
 	current = rte_trace_mode_get();
 
-	if (!rte_trace_is_enabled())
-		return TEST_SKIPPED;
-
 	rte_trace_mode_set(RTE_TRACE_MODE_DISCARD);
 	if (rte_trace_mode_get() != RTE_TRACE_MODE_DISCARD)
 		goto failed;
diff --git a/lib/eal/common/eal_common_trace.c b/lib/eal/common/eal_common_trace.c
index d5dbc7d667..1b86f5d2d2 100644
--- a/lib/eal/common/eal_common_trace.c
+++ b/lib/eal/common/eal_common_trace.c
@@ -127,9 +127,6 @@  rte_trace_mode_set(enum rte_trace_mode mode)
 {
 	struct trace_point *tp;
 
-	if (!rte_trace_is_enabled())
-		return;
-
 	STAILQ_FOREACH(tp, &tp_list, next)
 		trace_mode_set(tp->handle, mode);