On 3/6/25 11:46, Dumitru Ceara wrote: > On 3/6/25 11:31 AM, Dumitru Ceara wrote: >> On 3/1/25 2:56 PM, Frank Wagner wrote: >>> On Windows to current definitions of thread_local are not working. >>> >>> Signed-off-by: Frank Wagner <frank.wag...@dbosoft.eu> >>> >>> --- >> >> Hi Frank, >> >> Thanks for the patch! >> >>> northd/lflow-mgr.c | 2 ++ >>> northd/northd.c | 2 ++ >>> northd/northd.h | 4 ++++ >>> 3 files changed, 8 insertions(+) >>> >>> diff --git a/northd/lflow-mgr.c b/northd/lflow-mgr.c >>> index 88ce7ce56..d29d5e7b4 100644 >>> --- a/northd/lflow-mgr.c >>> +++ b/northd/lflow-mgr.c >>> @@ -98,7 +98,9 @@ static bool sync_lflow_to_sb(struct ovn_lflow *, >>> /* TODO: Move the parallization logic to this module to avoid accessing >>> * and modifying in both northd.c and lflow-mgr.c. */ >>> extern int parallelization_state; >>> +#ifndef _WIN32 >>> extern thread_local size_t thread_lflow_counter; >>> +#endif >>> >>> struct dp_refcnt; >>> static struct dp_refcnt *dp_refcnt_find(struct hmap *dp_refcnts_map, >>> diff --git a/northd/northd.c b/northd/northd.c >>> index a1fcc64a5..a378fbea5 100644 >>> --- a/northd/northd.c >>> +++ b/northd/northd.c >>> @@ -5476,7 +5476,9 @@ int parallelization_state = STATE_NULL; >>> * threads are collected to fix the lflow hmap's size (by the function >>> * fix_flow_map_size()). >>> * */ >>> +#ifndef _WIN32 >>> thread_local size_t thread_lflow_counter = 0; >>> +#endif >>> >>> static bool >>> build_dhcpv4_action(struct ovn_port *op, ovs_be32 offer_ip, >>> diff --git a/northd/northd.h b/northd/northd.h >>> index 1fbc93c8e..190503753 100644 >>> --- a/northd/northd.h >>> +++ b/northd/northd.h >>> @@ -250,7 +250,11 @@ enum { >>> STATE_USE_PARALLELIZATION /* parallelization is on */ >>> }; >>> >>> +#ifdef _WIN32 >>> +static __declspec(thread) size_t thread_lflow_counter = 0; >>> +#else >>> extern thread_local size_t thread_lflow_counter; >>> +#endif >> >> Shouldn't this go to OVS's include/openvswitch/compiler.h instead? >> Maybe define an OVS_THREAD_LOCAL() or something here: >> >> https://github.com/openvswitch/ovs/blob/main/include/openvswitch/compiler.h >> >> Ilya, Alin, what do you think? >> > > OVS also has DEFINE_STATIC_PER_THREAD_DATA(), should we use that instead?
Yeah, this seems like a more appropriate thing to use. OVN should also be using HAVE_THREAD_LOCAL that it sets in the OVS_HAVE_LTS, but that will also not be needed if DEFINE_STATIC_PER_THREAD_DATA() will be used in the end. Best regards, Ilya Maximets. > > https://github.com/openvswitch/ovs/blob/00875941181c632e7ec6a406813c1ec5bd8b1654/lib/ovs-thread.h#L192 > >>> >>> /* >>> * Multicast snooping and querier per datapath configuration. >> >> Thanks, >> Dumitru >> > _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev