All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Van Haaren, Harry" <harry.van.haaren@intel.com>
To: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	"thomas@monjalon.net" <thomas@monjalon.net>,
	"Wiles, Keith" <keith.wiles@intel.com>,
	"Richardson, Bruce" <bruce.richardson@intel.com>
Subject: Re: [PATCH v4 1/7] service cores: header and implementation
Date: Tue, 11 Jul 2017 14:10:08 +0000	[thread overview]
Message-ID: <E923DB57A917B54B9182A2E928D00FA640C3B325@IRSMSX102.ger.corp.intel.com> (raw)
In-Reply-To: <20170711082950.GB29792@jerin>

<lots of snips to make responses consumable!>

> From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com]
> To: Van Haaren, Harry <harry.van.haaren@intel.com>
> Cc: dev@dpdk.org; thomas@monjalon.net; Wiles, Keith <keith.wiles@intel.com>; Richardson,
> Bruce <bruce.richardson@intel.com>
> Subject: Re: [PATCH v4 1/7] service cores: header and implementation
> 
<snip>
> 
> Remove above info from the git commit.

Done


> Fix the below mentioned documentation warning.
> 
> +/export/dpdk.org/lib/librte_eal/common/include/rte_service.h:338:
> warning: argument 'enabled' of command @param is not found in the
> argument list of rte_service_set_stats_enable(int enable)
> +/export/dpdk.org/lib/librte_eal/common/include/rte_service.h:346:
> warning: The following parameters of rte_service_set_stats_enable(int
> enable) are not documented:
> +  parameter 'enable'
> +/export/dpdk.org/lib/librte_eal/common/include/rte_service.h:349:
> warning: argument 'The' of command @param is not found in the argument
> list of rte_service_lcore_list(uint32_t array[], uint32_t n)
> +/export/dpdk.org/lib/librte_eal/common/include/rte_service.h:367:
> warning: The following parameters of rte_service_lcore_list(uint32_t
> array[], uint32_t n) are not documented:
> +  parameter 'n'

Done


> command to reproduce:
> ./devtools/test-build.sh -j8 x86_64-native-linuxapp-gcc+shared x86_64-native-linuxapp-
> gcc+debug

Thanks - noted.


> > +
> > +/* the internal values of a service core */
> > +struct core_state {
> 
> Change to lcore_state.

Done.


> > +
> > +void rte_service_set_stats_enable(int enabled)
> 
> IMO, It should be per service  i.e
> rte_service_set_stats_enable(const struct rte_service_spec *spec, int enable)

Improved service library to handle statistics collection on a per service basis.


> > +			/* check if this is the only core mapped, else use
> > +			 * atomic to serialize cores mapped to this service
> > +			 */
> > +			uint32_t *lock = (uint32_t *)&s->execute_lock;
> > +			if ((s->spec.capabilities & RTE_SERVICE_CAP_MT_SAFE) ||
> > +					(s->num_mapped_cores == 1 ||
> > +					rte_atomic32_cmpset(lock, 0, 1))) {
> > +				void *userdata = s->spec.callback_userdata;
> > +
> > +				if (cs->collect_statistics) {
> > +					uint64_t start = rte_rdtsc();
> > +					s->spec.callback(userdata);
> > +					uint64_t end = rte_rdtsc();
> > +					s->cycles_spent += end - start;
> > +					cs->calls_per_service[i]++;
> > +					s->calls++;
> > +				} else
> > +					s->spec.callback(userdata);
> > +
> > +				if ((s->spec.capabilities &
> > +						RTE_SERVICE_CAP_MT_SAFE) == 0 &&
> > +						s->num_mapped_cores > 1)
> 
> How about computing the non rte_atomic32_cmpset() mode value first and
> using in both place i.e here and in the top "if" loop
> 
> 	const int need_cmpset = (s->spec.capabilities & RTE_SERVICE_CAP_MT_SAFE)...
> 	if (need_cmpset || rte_atomic32_cmpset(lock, 0, 1))
> 	..
> 	if (need_cmpset)
> 		rte_atomic32_clear()..


Yes good idea. Indeed I wasn't happy with that, this is a good fix.
The checks to detect if we need_cmpset are a little complex, but it's the only solution I see.

I've added another unit test to verify both MT safe and MT unsafe callback operations.


> > +int32_t
> > +rte_service_set_default_mapping(void)
> > +{
> > +	/* create a default mapping from cores to services, then start the
> > +	 * services to make them transparent to unaware applications.
> > +	 */
> > +	uint32_t i;
> > +	int ret;
> > +	uint32_t count = rte_service_get_count();
> > +
> > +	int32_t lcore_iter = 0;
> > +	uint32_t ids[RTE_MAX_LCORE];
> > +	int32_t lcore_count = rte_service_lcore_list(ids, RTE_MAX_LCORE);
> > +
> > +	for (i = 0; i < count; i++) {
> > +		struct rte_service_spec *s = rte_service_get_by_id(i);
> > +		if (!s)
> > +			return -EINVAL;
> > +
> > +		/* if no lcores available as services cores, don't setup map.
> > +		 * This means app logic must add cores, and setup mappings
> > +		 */
> > +		if (lcore_count > 0) {
> 
> 
> > +			/* do 1:1 core mapping here, with each service getting
> > +			 * assigned a single core by default. Adding multiple
> > +			 * services should multiplex to a single core, or 1:1
> > +			 * if services == cores
> > +			 */
> > +			ret = rte_service_enable_on_lcore(s, ids[lcore_iter]);
> > +			if (ret)
> > +				return -ENODEV;
> > +		}
> > +
> > +		lcore_iter++;
> > +		if (lcore_iter >= lcore_count)
> > +			lcore_iter = 0;
> > +
> > +		ret = rte_service_start(s);
> 
> IMO, we don't need to start the service if lcore_count == 0. How about
> moving the "if (lcore_count > 0)" check on top of for the loop and exist
> from the function if lcore_count == 0.

Good point, added   if() check for lcore_count at start of function, and return if no service cores are available.


> > +
> > +int32_t
> > +rte_service_lcore_add(uint32_t lcore)
> > +{
> > +	if (lcore >= RTE_MAX_LCORE)
> > +		return -EINVAL;
> > +	if (cores_state[lcore].is_service_core)
> > +		return -EALREADY;
> > +
> > +	set_lcore_state(lcore, ROLE_SERVICE);
> > +
> > +	/* ensure that after adding a core the mask and state are defaults */
> > +	cores_state[lcore].service_mask = 0;
> > +	cores_state[lcore].runstate = RUNSTATE_STOPPED;
> 
> If worker core can call rte_service_lcore_add() then add rte_smp_wmb()
> here. Applies to rte_service_lcore_del() as well.

Added barriers to both add() and del().

  parent reply	other threads:[~2017-07-11 14:10 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-23  9:06 [PATCH 1/6] service cores: header and implementation Harry van Haaren
2017-06-23  9:06 ` [PATCH 2/6] service cores: coremask parsing Harry van Haaren
2017-06-26 12:49   ` Jerin Jacob
2017-06-29 11:13     ` Van Haaren, Harry
2017-06-23  9:06 ` [PATCH 3/6] service cores: EAL init changes Harry van Haaren
2017-06-26 12:55   ` Jerin Jacob
2017-06-29 11:13     ` Van Haaren, Harry
2017-06-23  9:06 ` [PATCH 4/6] service cores: mark cores in lcore config as RTE Harry van Haaren
2017-06-23  9:06 ` [PATCH 5/6] service core: add unit tests Harry van Haaren
2017-06-26 13:06   ` Jerin Jacob
2017-06-29 11:14     ` Van Haaren, Harry
2017-06-23  9:06 ` [PATCH 6/6] service cores: enable event/sw with service Harry van Haaren
2017-06-26 13:46   ` Jerin Jacob
2017-06-29 11:15     ` Van Haaren, Harry
2017-06-26 11:59 ` [PATCH 1/6] service cores: header and implementation Jerin Jacob
2017-06-29 11:13   ` Van Haaren, Harry
2017-06-29 11:23 ` [PATCH v2 0/5] service cores: cover letter Harry van Haaren
2017-06-29 11:23   ` [PATCH v2 1/5] service cores: header and implementation Harry van Haaren
2017-06-29 11:23   ` [PATCH v2 2/5] service cores: EAL init changes Harry van Haaren
2017-06-29 11:23   ` [PATCH v2 3/5] service cores: coremask parsing Harry van Haaren
2017-06-29 11:23   ` [PATCH v2 4/5] service cores: add unit tests Harry van Haaren
2017-06-29 11:23   ` [PATCH v2 5/5] service cores: enable event/sw with service Harry van Haaren
2017-07-02 21:35   ` [PATCH v3 0/7] service cores: cover letter Harry van Haaren
2017-07-02 21:35     ` [PATCH v3 1/7] service cores: header and implementation Harry van Haaren
2017-07-04 17:16       ` Jerin Jacob
2017-07-02 21:35     ` [PATCH v3 2/7] service cores: EAL init changes Harry van Haaren
2017-07-04 11:35       ` Jerin Jacob
2017-07-07 16:28         ` Van Haaren, Harry
2017-07-02 21:35     ` [PATCH v3 3/7] service cores: coremask parsing Harry van Haaren
2017-07-04 12:45       ` Jerin Jacob
2017-07-06 14:47         ` Van Haaren, Harry
2017-07-07 10:45           ` Jerin Jacob
2017-07-07 10:57             ` Van Haaren, Harry
2017-07-02 21:35     ` [PATCH v3 4/7] service cores: add unit tests Harry van Haaren
2017-07-04 11:14       ` Jerin Jacob
2017-07-02 21:35     ` [PATCH v3 5/7] service cores: enable event/sw with service Harry van Haaren
2017-07-04 10:52       ` Jerin Jacob
2017-07-07 16:28         ` Van Haaren, Harry
2017-07-02 21:35     ` [PATCH v3 6/7] maintainers: claim service cores Harry van Haaren
2017-07-04 10:53       ` Jerin Jacob
2017-07-02 21:35     ` [PATCH v3 7/7] doc: add service cores to doc and release notes Harry van Haaren
2017-07-02 22:16       ` Mcnamara, John
2017-07-04 10:56       ` Jerin Jacob
2017-07-07 16:41   ` [PATCH v4 0/7] service cores: cover letter Harry van Haaren
2017-07-07 16:41     ` [PATCH v4 1/7] service cores: header and implementation Harry van Haaren
2017-07-11  8:29       ` Jerin Jacob
2017-07-11  9:54         ` Thomas Monjalon
2017-07-11 12:32           ` Van Haaren, Harry
2017-07-11 12:44             ` Jerin Jacob
2017-07-11 12:49               ` Van Haaren, Harry
2017-07-11 14:10         ` Van Haaren, Harry [this message]
2017-07-07 16:41     ` [PATCH v4 2/7] service cores: EAL init changes Harry van Haaren
2017-07-11  7:42       ` Jerin Jacob
2017-07-11 14:11         ` Van Haaren, Harry
2017-07-07 16:41     ` [PATCH v4 3/7] service cores: coremask parsing Harry van Haaren
2017-07-07 16:41     ` [PATCH v4 4/7] service cores: add unit tests Harry van Haaren
2017-07-11  8:12       ` Jerin Jacob
2017-07-07 16:41     ` [PATCH v4 5/7] event/sw: enable SW PMD with service capability Harry van Haaren
2017-07-07 16:41     ` [PATCH v4 6/7] doc: add service cores to doc and release notes Harry van Haaren
2017-07-07 16:41     ` [PATCH v4 7/7] maintainers: claim service cores Harry van Haaren
2017-07-11  7:53       ` Jerin Jacob
2017-07-09 22:08     ` [PATCH v4 0/7] service cores: cover letter Thomas Monjalon
2017-07-10  8:18       ` Van Haaren, Harry
2017-07-10 11:41         ` Jerin Jacob
2017-07-11 14:19     ` [PATCH v5 " Harry van Haaren
2017-07-11 14:19       ` [PATCH v5 1/7] service cores: header and implementation Harry van Haaren
2017-07-12 16:35         ` Jerin Jacob
2017-07-11 14:19       ` [PATCH v5 2/7] service cores: EAL init changes Harry van Haaren
2017-07-11 14:19       ` [PATCH v5 3/7] service cores: coremask parsing Harry van Haaren
2017-07-11 14:19       ` [PATCH v5 4/7] service cores: add unit tests Harry van Haaren
2017-07-11 14:19       ` [PATCH v5 5/7] event/sw: enable SW PMD with service capability Harry van Haaren
2017-07-11 14:19       ` [PATCH v5 6/7] doc: add service cores to doc and release notes Harry van Haaren
2017-07-11 14:19       ` [PATCH v5 7/7] maintainers: claim service cores Harry van Haaren
2017-07-12 16:49       ` [PATCH v5 0/7] service cores: cover letter Jerin Jacob
2017-07-16 19:25       ` Thomas Monjalon
2017-07-17  8:07         ` Van Haaren, Harry
2017-07-17 15:21         ` [PATCH] service: add corelist to EAL arguments Harry van Haaren
2017-07-17 15:53           ` Ananyev, Konstantin
2017-07-17 15:58             ` Van Haaren, Harry
2017-07-17 16:10               ` Ananyev, Konstantin
2017-07-17 16:16                 ` Van Haaren, Harry
2017-07-19  5:42           ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E923DB57A917B54B9182A2E928D00FA640C3B325@IRSMSX102.ger.corp.intel.com \
    --to=harry.van.haaren@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=jerin.jacob@caviumnetworks.com \
    --cc=keith.wiles@intel.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.