[dpdk-dev] [PATCH] timer: allow first subsystem init from secondary

Carrillo, Erik G erik.g.carrillo at intel.com
Thu May 9 21:47:43 CEST 2019


<...snipped...>

> >
> > @@ -155,40 +156,41 @@ rte_timer_subsystem_init_v1905(void)
> >   	struct rte_timer_data *data;
> >   	int i, lcore_id;
> >   	static const char *mz_name = "rte_timer_mz";
> > +	const size_t data_arr_size =
> > +				RTE_MAX_DATA_ELS *
> sizeof(*rte_timer_data_arr);
> > +	bool do_full_init;
> >
> >   	if (rte_timer_subsystem_initialized)
> >   		return -EALREADY;
> >
> > -	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
> > -		mz = rte_memzone_lookup(mz_name);
> > -		if (mz == NULL)
> > -			return -EEXIST;
> > +lookup:
> > +	mz = rte_memzone_lookup(mz_name);
> 
> Wouldn't it be better to attempt to reserve outright, and then do a lookup on
> EEXIST?

It's probably the expected order;  I've made the change and submitted v2.

Thanks for the review,
Erik

> 
> > +	if (mz == NULL) {
> > +		mz = rte_memzone_reserve_aligned(mz_name,
> data_arr_size,
> > +				SOCKET_ID_ANY, 0, RTE_CACHE_LINE_SIZE);
> > +		if (mz == NULL) {
> > +			if (rte_errno == EEXIST)
> > +				goto lookup;
> >
> 
> 
> --
> Thanks,
> Anatoly


More information about the dev mailing list