patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH v4] telemetry: fix race in telemetry control thread creation
@ 2021-07-13  6:41 Alvin Zhang
  2021-07-13 13:31 ` Power, Ciara
  0 siblings, 1 reply; 3+ messages in thread
From: Alvin Zhang @ 2021-07-13  6:41 UTC (permalink / raw)
  To: christian.ehrhardt, LingliX.Chen, YuX.Jiang, ciara.power,
	harry.van.haaren
  Cc: Alvin Zhang, stable

Before the caller returns from function "rte_ctrl_thread_create",
the newly created thread may have ran, and because the thread
control flag was not set before, the new thread may exit soon.
This is not what the developer expected.

This patch puts the setting thread control flag to the place that
before creating new thread.

Reported-at: https://bugs.dpdk.org/show_bug.cgi?id=731
Fixes: 8877ac688b52 ("telemetry: introduce infrastructure")
Cc: stable@dpdk.org

Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
---

v2, v3: update commit log
v4: update email address
---
 lib/librte_telemetry/rte_telemetry.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_telemetry/rte_telemetry.c b/lib/librte_telemetry/rte_telemetry.c
index eb20cc6..98d5f91 100644
--- a/lib/librte_telemetry/rte_telemetry.c
+++ b/lib/librte_telemetry/rte_telemetry.c
@@ -1005,10 +1005,10 @@ struct json_data {
 	}
 	TAILQ_INIT(&static_telemetry->client_list_head);
 
+	static_telemetry->thread_status = 1;
 	ret = rte_ctrl_thread_create(&static_telemetry->thread_id,
 		telemetry_ctrl_thread, &attr, rte_telemetry_run_thread_func,
 		(void *)static_telemetry);
-	static_telemetry->thread_status = 1;
 
 	if (ret < 0) {
 		ret = rte_telemetry_cleanup();
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-stable] [PATCH v4] telemetry: fix race in telemetry control thread creation
  2021-07-13  6:41 [dpdk-stable] [PATCH v4] telemetry: fix race in telemetry control thread creation Alvin Zhang
@ 2021-07-13 13:31 ` Power, Ciara
  2021-07-13 13:44   ` Kevin Traynor
  0 siblings, 1 reply; 3+ messages in thread
From: Power, Ciara @ 2021-07-13 13:31 UTC (permalink / raw)
  To: Zhang, AlvinX, christian.ehrhardt, Chen,  LingliX, Jiang, YuX,
	Van Haaren, Harry
  Cc: stable

Hi Alvin,

>-----Original Message-----
>From: Zhang, AlvinX <alvinx.zhang@intel.com>
>Sent: Tuesday 13 July 2021 07:42
>To: christian.ehrhardt@canonical.com; Chen, LingliX <linglix.chen@intel.com>;
>Jiang, YuX <yux.jiang@intel.com>; Power, Ciara <ciara.power@intel.com>; Van
>Haaren, Harry <harry.van.haaren@intel.com>
>Cc: Zhang, AlvinX <alvinx.zhang@intel.com>; stable@dpdk.org
>Subject: [PATCH v4] telemetry: fix race in telemetry control thread creation
>
>Before the caller returns from function "rte_ctrl_thread_create", the newly
>created thread may have ran, and because the thread control flag was not set
>before, the new thread may exit soon.
>This is not what the developer expected.
>
>This patch puts the setting thread control flag to the place that before creating
>new thread.
>
>Reported-at: https://bugs.dpdk.org/show_bug.cgi?id=731
>Fixes: 8877ac688b52 ("telemetry: introduce infrastructure")
>Cc: stable@dpdk.org
>
>Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
>---
>
<snip>

Thanks for this, I guess it is targeted towards both 18.11 and 19.11 stable releases?
This file was removed in 20.11 so won't be needed there.

Acked-by: Ciara Power <ciara.power@intel.com>



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-stable] [PATCH v4] telemetry: fix race in telemetry control thread creation
  2021-07-13 13:31 ` Power, Ciara
@ 2021-07-13 13:44   ` Kevin Traynor
  0 siblings, 0 replies; 3+ messages in thread
From: Kevin Traynor @ 2021-07-13 13:44 UTC (permalink / raw)
  To: Power, Ciara, Zhang, AlvinX, christian.ehrhardt, Chen, LingliX,
	Jiang, YuX, Van Haaren, Harry
  Cc: stable

On 13/07/2021 14:31, Power, Ciara wrote:
> Hi Alvin,
> 
>> -----Original Message-----
>> From: Zhang, AlvinX <alvinx.zhang@intel.com>
>> Sent: Tuesday 13 July 2021 07:42
>> To: christian.ehrhardt@canonical.com; Chen, LingliX <linglix.chen@intel.com>;
>> Jiang, YuX <yux.jiang@intel.com>; Power, Ciara <ciara.power@intel.com>; Van
>> Haaren, Harry <harry.van.haaren@intel.com>
>> Cc: Zhang, AlvinX <alvinx.zhang@intel.com>; stable@dpdk.org
>> Subject: [PATCH v4] telemetry: fix race in telemetry control thread creation
>>
>> Before the caller returns from function "rte_ctrl_thread_create", the newly
>> created thread may have ran, and because the thread control flag was not set
>> before, the new thread may exit soon.
>> This is not what the developer expected.
>>
>> This patch puts the setting thread control flag to the place that before creating
>> new thread.
>>
>> Reported-at: https://bugs.dpdk.org/show_bug.cgi?id=731
>> Fixes: 8877ac688b52 ("telemetry: introduce infrastructure")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
>> ---
>>
> <snip>
> 
> Thanks for this, I guess it is targeted towards both 18.11 and 19.11 stable releases?

18.11 LTS is no longer maintained, so it would just be a candidate for
19.11 but I guess that was the intent looking at the Bz.

> This file was removed in 20.11 so won't be needed there.
> 
> Acked-by: Ciara Power <ciara.power@intel.com>
> 
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-07-13 13:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-13  6:41 [dpdk-stable] [PATCH v4] telemetry: fix race in telemetry control thread creation Alvin Zhang
2021-07-13 13:31 ` Power, Ciara
2021-07-13 13:44   ` Kevin Traynor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).