DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Chautru, Nicolas" <nicolas.chautru@intel.com>
To: Phil Yang <phil.yang@arm.com>, "dev@dpdk.org" <dev@dpdk.org>,
	"david.marchand@redhat.com" <david.marchand@redhat.com>,
	"Hunt, David" <david.hunt@intel.com>
Cc: "Ruifeng.Wang@arm.com" <Ruifeng.Wang@arm.com>,
	"Honnappa.Nagarahalli@arm.com" <Honnappa.Nagarahalli@arm.com>,
	"nd@arm.com" <nd@arm.com>
Subject: Re: [dpdk-dev] [PATCH v3 2/4] bbdev: use C11 atomic builtins for device processing counter
Date: Thu, 24 Sep 2020 22:01:51 +0000
Message-ID: <BY5PR11MB4451D4BEF802C005349C1941F8390@BY5PR11MB4451.namprd11.prod.outlook.com> (raw)
In-Reply-To: <1600925968-18278-3-git-send-email-phil.yang@arm.com>

Hi Phil, 
Naïve question but the deprecation document was stating that "DPDK will adopt C11 atomic operations semantics and provide wrappers using C11 atomic built-ins."
Here you are using directly the C11 atomic built-ins and not providing and using a DPDK wrapper. 
Wasn't the intent to have a new rte_... wrapper here? Ie. the same way as the __sync_fetch_and_add() were called before behind the rte_atomicNN_XX wrapper. 

Thanks
Nic


> -----Original Message-----
> From: Phil Yang <phil.yang@arm.com>
> Sent: Wednesday, September 23, 2020 10:39 PM
> To: dev@dpdk.org; david.marchand@redhat.com; Chautru, Nicolas
> <nicolas.chautru@intel.com>; Hunt, David <david.hunt@intel.com>
> Cc: Ruifeng.Wang@arm.com; Honnappa.Nagarahalli@arm.com;
> nd@arm.com
> Subject: [PATCH v3 2/4] bbdev: use C11 atomic builtins for device processing
> counter
> 
> Since rte_atomicXX APIs are not allowed to be used, use C11 atomic builtins
> for device processing counter.
> 
> Signed-off-by: Phil Yang <phil.yang@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> ---
>  lib/librte_bbdev/rte_bbdev.c | 5 +++--
>  lib/librte_bbdev/rte_bbdev.h | 4 +---
>  2 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/lib/librte_bbdev/rte_bbdev.c b/lib/librte_bbdev/rte_bbdev.c
> index a4fdb69..5ba891c 100644
> --- a/lib/librte_bbdev/rte_bbdev.c
> +++ b/lib/librte_bbdev/rte_bbdev.c
> @@ -210,7 +210,7 @@ rte_bbdev_allocate(const char *name)
>  		return NULL;
>  	}
> 
> -	rte_atomic16_inc(&bbdev->data->process_cnt);
> +	__atomic_add_fetch(&bbdev->data->process_cnt, 1,
> __ATOMIC_RELAXED);
>  	bbdev->data->dev_id = dev_id;
>  	bbdev->state = RTE_BBDEV_INITIALIZED;
> 
> @@ -252,7 +252,8 @@ rte_bbdev_release(struct rte_bbdev *bbdev)
>  	}
> 
>  	/* clear shared BBDev Data if no process is using the device anymore
> */
> -	if (rte_atomic16_dec_and_test(&bbdev->data->process_cnt))
> +	if (__atomic_sub_fetch(&bbdev->data->process_cnt, 1,
> +			      __ATOMIC_RELAXED) == 0)
>  		memset(bbdev->data, 0, sizeof(*bbdev->data));
> 
>  	memset(bbdev, 0, sizeof(*bbdev));
> diff --git a/lib/librte_bbdev/rte_bbdev.h b/lib/librte_bbdev/rte_bbdev.h
> index 5729137..7017124 100644
> --- a/lib/librte_bbdev/rte_bbdev.h
> +++ b/lib/librte_bbdev/rte_bbdev.h
> @@ -33,7 +33,6 @@ extern "C" {
>  #include <string.h>
> 
>  #include <rte_compat.h>
> -#include <rte_atomic.h>
>  #include <rte_bus.h>
>  #include <rte_cpuflags.h>
>  #include <rte_memory.h>
> @@ -426,8 +425,7 @@ struct rte_bbdev_data {
>  	uint16_t dev_id;  /**< Device ID */
>  	int socket_id;  /**< NUMA socket that device is on */
>  	bool started;  /**< Device run-time state */
> -	/** Counter of processes using the device */
> -	rte_atomic16_t process_cnt;
> +	uint16_t process_cnt;  /** Counter of processes using the device */
>  };
> 
>  /* Forward declarations */
> --
> 2.7.4


  reply	other threads:[~2020-09-24 22:02 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-11  3:29 [dpdk-dev] [PATCH 0/4] use C11 atomic builtins for libs Phil Yang
2020-09-11  3:29 ` [dpdk-dev] [PATCH 1/4] eal: use C11 atomic builtins for already initialized check Phil Yang
2020-09-11  3:29 ` [dpdk-dev] [PATCH 2/4] bbdev: use C11 atomic builtins for device processing counter Phil Yang
2020-09-11  3:29 ` [dpdk-dev] [PATCH 3/4] power: use C11 atomic builtins for power in use state update Phil Yang
2020-09-11  3:29 ` [dpdk-dev] [PATCH 4/4] ethdev: use C11 atomic builtins for link status update Phil Yang
2020-09-15 15:12 ` [dpdk-dev] [PATCH 0/4] use C11 atomic builtins for libs David Marchand
2020-09-16  7:32   ` Phil Yang
2020-09-16  8:23 ` [dpdk-dev] [PATCH v2 " Phil Yang
2020-09-16  8:23   ` [dpdk-dev] [PATCH v2 1/4] eal: use C11 atomic builtins for already initialized check Phil Yang
2020-09-23 13:06     ` David Marchand
2020-09-24  3:44       ` Phil Yang
2020-09-16  8:23   ` [dpdk-dev] [PATCH v2 2/4] bbdev: use C11 atomic builtins for device processing counter Phil Yang
2020-09-16  8:23   ` [dpdk-dev] [PATCH v2 3/4] power: use C11 atomic builtins for power in use state update Phil Yang
2020-09-16  8:23   ` [dpdk-dev] [PATCH v2 4/4] ethdev: use C11 atomic builtins for link status update Phil Yang
2020-09-17 16:08     ` Andrew Rybchenko
2020-09-23 13:18   ` [dpdk-dev] [PATCH v2 0/4] use C11 atomic builtins for libs David Marchand
2020-09-24  3:47     ` Phil Yang
2020-09-24  5:39   ` [dpdk-dev] [PATCH v3 " Phil Yang
2020-09-24  5:39     ` [dpdk-dev] [PATCH v3 1/4] eal: use C11 atomic builtins for already initialized check Phil Yang
2020-09-24  5:39     ` [dpdk-dev] [PATCH v3 2/4] bbdev: use C11 atomic builtins for device processing counter Phil Yang
2020-09-24 22:01       ` Chautru, Nicolas [this message]
2020-09-24 22:44         ` Honnappa Nagarahalli
2020-09-24 23:20           ` Chautru, Nicolas
2020-09-24  5:39     ` [dpdk-dev] [PATCH v3 3/4] power: use C11 atomic builtins for power in use state update Phil Yang
2020-09-24  8:34       ` David Hunt
2020-09-24  5:39     ` [dpdk-dev] [PATCH v3 4/4] ethdev: use C11 atomic builtins for link status update Phil Yang
2020-09-25 13:59     ` [dpdk-dev] [PATCH v3 0/4] use C11 atomic builtins for libs David Marchand

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=BY5PR11MB4451D4BEF802C005349C1941F8390@BY5PR11MB4451.namprd11.prod.outlook.com \
    --to=nicolas.chautru@intel.com \
    --cc=Honnappa.Nagarahalli@arm.com \
    --cc=Ruifeng.Wang@arm.com \
    --cc=david.hunt@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=nd@arm.com \
    --cc=phil.yang@arm.com \
    /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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git