DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: ibetts <ian.betts@intel.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v5 2/4] examples: add lthread subsystem for performance-thread
Date: Thu, 3 Dec 2015 08:31:39 -0800	[thread overview]
Message-ID: <20151203083139.32b82334@xeon-e3> (raw)
In-Reply-To: <1449134905-28261-3-git-send-email-ian.betts@intel.com>

On Thu,  3 Dec 2015 09:28:23 +0000
ibetts <ian.betts@intel.com> wrote:

> +/*
> + * Atomically set a value and return the old value
> + */
> +static inline uint64_t
> +atomic64_xchg(uint64_t *ptr, uint64_t val) __attribute__ ((always_inline));
> +static inline uint64_t
> +atomic64_xchg(uint64_t *ptr, uint64_t val)

You don't need a forward declaration for this.
Instead do:

static inline uint64_t __attribute__((always_inline))
atomic_xchg64(uint64_t *ptr, uint64_t val)

Really should be in rte_atomic.h as a primitive
and the assembly macro is missing change to ptr so Gcc might optmize it away.

Something like this mayb?

static inline uint64_t __attribute__ ((always_inline));
rte_atomic64_xchg(uint64_t *ptr, uint64_t val)
{
	asm volatile (
			MPLOCKED
			"xchgq %[ptr],%[val];"
			: [val] "=r" (val)
                          [ptr] "=m" (*ptr)
			: [ptr] "m" (*ptr),
			  "a" (val)
			: "memory");

	return val;
}

  reply	other threads:[~2015-12-03 16:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-03  9:28 [dpdk-dev] [PATCH v5 0/4] examples: add performance-thread ibetts
2015-12-03  9:28 ` [dpdk-dev] [PATCH v5 1/4] doc: add sample application guide for performance-thread ibetts
2015-12-03  9:28 ` [dpdk-dev] [PATCH v5 2/4] examples: add lthread subsystem " ibetts
2015-12-03 16:31   ` Stephen Hemminger [this message]
2015-12-03 16:46     ` Bruce Richardson
2015-12-03 17:15       ` Betts, Ian
2015-12-03  9:28 ` [dpdk-dev] [PATCH v5 3/4] examples: add l3fwd-thread example in performance-thread ibetts
2015-12-03 16:32   ` Stephen Hemminger
2015-12-03 17:18     ` Betts, Ian
2015-12-03  9:28 ` [dpdk-dev] [PATCH v5 4/4] examples: add pthread_shim example to performance thread ibetts
2015-12-03  9:48 ` [dpdk-dev] [PATCH v5 0/4] examples: add performance-thread Kulasek, TomaszX

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=20151203083139.32b82334@xeon-e3 \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=ian.betts@intel.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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).