DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Mattias Rönnblom" <hofors@lysator.liu.se>
To: "Morten Brørup" <mb@smartsharesystems.com>,
	"Mattias Rönnblom" <mattias.ronnblom@ericsson.com>,
	dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>,
	David Marchand <david.marchand@redhat.com>,
	Jerin Jacob <jerinj@marvell.com>
Subject: Re: [PATCH v3 3/7] eal: add lcore variable performance test
Date: Thu, 12 Sep 2024 15:01:20 +0200	[thread overview]
Message-ID: <a6233a94-b626-4cfc-a298-29116a39031a@lysator.liu.se> (raw)
In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35E9F6D4@smartserver.smartshare.dk>

On 2024-09-12 11:39, Morten Brørup wrote:
>> +struct lcore_state {
>> +	uint64_t a;
>> +	uint64_t b;
>> +	uint64_t sum;
>> +};
>> +
>> +static __rte_always_inline void
>> +update(struct lcore_state *state)
>> +{
>> +	state->sum += state->a * state->b;
>> +}
>> +
>> +static RTE_DEFINE_PER_LCORE(struct lcore_state, tls_lcore_state);
>> +
>> +static __rte_noinline void
>> +tls_update(void)
>> +{
>> +	update(&RTE_PER_LCORE(tls_lcore_state));
> 
> I would normally access TLS variables directly, not through a pointer, i.e.:
> 
> RTE_PER_LCORE(tls_lcore_state.sum) += RTE_PER_LCORE(tls_lcore_state.a) * RTE_PER_LCORE(tls_lcore_state.b);
> 
> On the other hand, then it wouldn't be 1:1 comparable to the two other test cases.
> 
> Besides, I expect the compiler to optimize away the indirect access, and produce the same output (as for the alternative implementation) anyway.
> 
> No change requested. Just noticing.
> 
>> +}
>> +
>> +struct __rte_cache_aligned lcore_state_aligned {
>> +	uint64_t a;
>> +	uint64_t b;
>> +	uint64_t sum;
> 
> Please add RTE_CACHE_GUARD here, for 100 % matching the common design pattern.
> 

Will do.

>> +};
>> +
>> +static struct lcore_state_aligned sarray_lcore_state[RTE_MAX_LCORE];
> 
> 
>> +	printf("Latencies [ns/update]\n");
>> +	printf("Thread-local storage  Static array  Lcore variables\n");
>> +	printf("%20.1f %13.1f %16.1f\n", tls_latency * 1e9,
>> +	       sarray_latency * 1e9, lvar_latency * 1e9);
> 
> I prefer cycles over ns. Perhaps you could show both?
> 

That's makes you an x86 guy. :) Since only on x86 those cycles makes any 
sense.

I didn't want to use cycles since it would be a very small value on 
certain (e.g., old ARM) platforms.

But, elsewhere in the perf tests TSC cycles are used, so maybe I should 
switch to using such nevertheless.

> 
> With RTE_CACHE_GUARD added where mentioned,
> 
> Acked-by: Morten Brørup <mb@smartsharesystems.com>
> 

  reply	other threads:[~2024-09-12 13:01 UTC|newest]

Thread overview: 184+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-08 18:16 [RFC 0/5] Lcore variables Mattias Rönnblom
2024-02-08 18:16 ` [RFC 1/5] eal: add static per-lcore memory allocation facility Mattias Rönnblom
2024-02-09  8:25   ` Morten Brørup
2024-02-09 11:46     ` Mattias Rönnblom
2024-02-09 13:04       ` Morten Brørup
2024-02-19  7:49         ` Mattias Rönnblom
2024-02-19 11:10           ` Morten Brørup
2024-02-19 14:31             ` Mattias Rönnblom
2024-02-19 15:04               ` Morten Brørup
2024-02-19  9:40   ` [RFC v2 0/5] Lcore variables Mattias Rönnblom
2024-02-19  9:40     ` [RFC v2 1/5] eal: add static per-lcore memory allocation facility Mattias Rönnblom
2024-02-20  8:49       ` [RFC v3 0/6] Lcore variables Mattias Rönnblom
2024-02-20  8:49         ` [RFC v3 1/6] eal: add static per-lcore memory allocation facility Mattias Rönnblom
2024-02-20  9:11           ` Bruce Richardson
2024-02-20 10:47             ` Mattias Rönnblom
2024-02-20 11:39               ` Bruce Richardson
2024-02-20 13:37                 ` Morten Brørup
2024-02-20 16:26                 ` Mattias Rönnblom
2024-02-21  9:43           ` Jerin Jacob
2024-02-21 10:31             ` Morten Brørup
2024-02-21 14:26             ` Mattias Rönnblom
2024-02-22  9:22           ` Morten Brørup
2024-02-23 10:12             ` Mattias Rönnblom
2024-02-25 15:03           ` [RFC v4 0/6] Lcore variables Mattias Rönnblom
2024-02-25 15:03             ` [RFC v4 1/6] eal: add static per-lcore memory allocation facility Mattias Rönnblom
2024-02-27  9:58               ` Morten Brørup
2024-02-27 13:44                 ` Mattias Rönnblom
2024-02-27 15:05                   ` Morten Brørup
2024-02-27 16:27                     ` Mattias Rönnblom
2024-02-27 16:51                       ` Morten Brørup
2024-02-28 10:09               ` [RFC v5 0/6] Lcore variables Mattias Rönnblom
2024-02-28 10:09                 ` [RFC v5 1/6] eal: add static per-lcore memory allocation facility Mattias Rönnblom
2024-03-19 12:52                   ` Konstantin Ananyev
2024-03-20 10:24                     ` Mattias Rönnblom
2024-03-20 14:18                       ` Konstantin Ananyev
2024-05-06  8:27                   ` [RFC v6 0/6] Lcore variables Mattias Rönnblom
2024-05-06  8:27                     ` [RFC v6 1/6] eal: add static per-lcore memory allocation facility Mattias Rönnblom
2024-09-10  7:03                       ` [PATCH 0/6] Lcore variables Mattias Rönnblom
2024-09-10  7:03                         ` [PATCH 1/6] eal: add static per-lcore memory allocation facility Mattias Rönnblom
2024-09-10  9:32                           ` Morten Brørup
2024-09-10 10:44                             ` Mattias Rönnblom
2024-09-10 13:07                               ` Morten Brørup
2024-09-10 15:55                               ` Stephen Hemminger
2024-09-11 10:32                           ` Morten Brørup
2024-09-11 15:05                             ` Mattias Rönnblom
2024-09-11 15:07                               ` Morten Brørup
2024-09-11 17:04                           ` [PATCH v2 0/6] Lcore variables Mattias Rönnblom
2024-09-11 17:04                             ` [PATCH v2 1/6] eal: add static per-lcore memory allocation facility Mattias Rönnblom
2024-09-12  2:33                               ` fengchengwen
2024-09-12  5:35                                 ` Mattias Rönnblom
2024-09-12  7:05                                   ` fengchengwen
2024-09-12  7:28                                   ` Jerin Jacob
2024-09-12  8:44                               ` [PATCH v3 0/7] Lcore variables Mattias Rönnblom
2024-09-12  8:44                                 ` [PATCH v3 1/7] eal: add static per-lcore memory allocation facility Mattias Rönnblom
2024-09-16 10:52                                   ` [PATCH v4 0/7] Lcore variables Mattias Rönnblom
2024-09-16 10:52                                     ` [PATCH v4 1/7] eal: add static per-lcore memory allocation facility Mattias Rönnblom
2024-09-16 14:02                                       ` Konstantin Ananyev
2024-09-16 17:39                                         ` Morten Brørup
2024-09-16 23:19                                           ` Konstantin Ananyev
2024-09-17  7:12                                             ` Morten Brørup
2024-09-17  8:09                                               ` Konstantin Ananyev
2024-09-17 14:28                                         ` Mattias Rönnblom
2024-09-17 16:11                                           ` Konstantin Ananyev
2024-09-18  7:00                                             ` Mattias Rönnblom
2024-09-17 16:29                                           ` Konstantin Ananyev
2024-09-18  7:50                                             ` Mattias Rönnblom
2024-09-17 14:32                                       ` [PATCH v5 0/7] Lcore variables Mattias Rönnblom
2024-09-17 14:32                                         ` [PATCH v5 1/7] eal: add static per-lcore memory allocation facility Mattias Rönnblom
2024-09-18  8:00                                           ` [PATCH v6 0/7] Lcore variables Mattias Rönnblom
2024-09-18  8:00                                             ` [PATCH v6 1/7] eal: add static per-lcore memory allocation facility Mattias Rönnblom
2024-09-18  8:24                                               ` Konstantin Ananyev
2024-09-18  8:25                                                 ` Mattias Rönnblom
2024-09-18  8:26                                               ` [PATCH v7 0/7] Lcore variables Mattias Rönnblom
2024-09-18  8:26                                                 ` [PATCH v7 1/7] eal: add static per-lcore memory allocation facility Mattias Rönnblom
2024-09-18  9:23                                                   ` Konstantin Ananyev
2024-09-18  8:26                                                 ` [PATCH v7 2/7] eal: add lcore variable functional tests Mattias Rönnblom
2024-09-18  8:26                                                 ` [PATCH v7 3/7] eal: add lcore variable performance test Mattias Rönnblom
2024-09-18  8:26                                                 ` [PATCH v7 4/7] random: keep PRNG state in lcore variable Mattias Rönnblom
2024-09-18  8:26                                                 ` [PATCH v7 5/7] power: keep per-lcore " Mattias Rönnblom
2024-09-18  8:26                                                 ` [PATCH v7 6/7] service: " Mattias Rönnblom
2024-09-18  8:26                                                 ` [PATCH v7 7/7] eal: keep per-lcore power intrinsics " Mattias Rönnblom
2024-09-18  9:30                                                 ` [PATCH v7 0/7] Lcore variables fengchengwen
2024-09-18  8:00                                             ` [PATCH v6 2/7] eal: add lcore variable functional tests Mattias Rönnblom
2024-09-18  8:25                                               ` Konstantin Ananyev
2024-09-18  8:00                                             ` [PATCH v6 3/7] eal: add lcore variable performance test Mattias Rönnblom
2024-09-18  8:00                                             ` [PATCH v6 4/7] random: keep PRNG state in lcore variable Mattias Rönnblom
2024-09-18  8:00                                             ` [PATCH v6 5/7] power: keep per-lcore " Mattias Rönnblom
2024-09-18  8:00                                             ` [PATCH v6 6/7] service: " Mattias Rönnblom
2024-09-18  8:00                                             ` [PATCH v6 7/7] eal: keep per-lcore power intrinsics " Mattias Rönnblom
2024-09-17 14:32                                         ` [PATCH v5 2/7] eal: add lcore variable functional tests Mattias Rönnblom
2024-09-17 14:32                                         ` [PATCH v5 3/7] eal: add lcore variable performance test Mattias Rönnblom
2024-09-17 15:40                                           ` Morten Brørup
2024-09-18  6:05                                             ` Mattias Rönnblom
2024-09-17 14:32                                         ` [PATCH v5 4/7] random: keep PRNG state in lcore variable Mattias Rönnblom
2024-09-17 14:32                                         ` [PATCH v5 5/7] power: keep per-lcore " Mattias Rönnblom
2024-09-17 14:32                                         ` [PATCH v5 6/7] service: " Mattias Rönnblom
2024-09-17 14:32                                         ` [PATCH v5 7/7] eal: keep per-lcore power intrinsics " Mattias Rönnblom
2024-09-16 10:52                                     ` [PATCH v4 2/7] eal: add lcore variable functional tests Mattias Rönnblom
2024-09-16 10:52                                     ` [PATCH v4 3/7] eal: add lcore variable performance test Mattias Rönnblom
2024-09-16 11:13                                       ` Mattias Rönnblom
2024-09-16 11:54                                         ` Morten Brørup
2024-09-16 16:12                                           ` Mattias Rönnblom
2024-09-16 17:19                                             ` Morten Brørup
2024-09-16 10:52                                     ` [PATCH v4 4/7] random: keep PRNG state in lcore variable Mattias Rönnblom
2024-09-16 16:11                                       ` Konstantin Ananyev
2024-09-16 10:52                                     ` [PATCH v4 5/7] power: keep per-lcore " Mattias Rönnblom
2024-09-16 16:12                                       ` Konstantin Ananyev
2024-09-16 10:52                                     ` [PATCH v4 6/7] service: " Mattias Rönnblom
2024-09-16 16:13                                       ` Konstantin Ananyev
2024-09-16 10:52                                     ` [PATCH v4 7/7] eal: keep per-lcore power intrinsics " Mattias Rönnblom
2024-09-16 16:14                                       ` Konstantin Ananyev
2024-09-12  8:44                                 ` [PATCH v3 2/7] eal: add lcore variable functional tests Mattias Rönnblom
2024-09-12  8:44                                 ` [PATCH v3 3/7] eal: add lcore variable performance test Mattias Rönnblom
2024-09-12  9:39                                   ` Morten Brørup
2024-09-12 13:01                                     ` Mattias Rönnblom [this message]
2024-09-12 13:09                                   ` Jerin Jacob
2024-09-12 13:20                                     ` Mattias Rönnblom
2024-09-12 15:11                                       ` Jerin Jacob
2024-09-13  6:47                                         ` Mattias Rönnblom
2024-09-13 11:23                                           ` Jerin Jacob
2024-09-13 14:40                                             ` Morten Brørup
2024-09-16  8:12                                               ` Jerin Jacob
2024-09-16  9:51                                                 ` Morten Brørup
2024-09-16 10:50                                             ` Mattias Rönnblom
2024-09-18 10:04                                               ` Jerin Jacob
2024-09-12  8:44                                 ` [PATCH v3 4/7] random: keep PRNG state in lcore variable Mattias Rönnblom
2024-09-12  8:44                                 ` [PATCH v3 5/7] power: keep per-lcore " Mattias Rönnblom
2024-09-12  8:44                                 ` [PATCH v3 6/7] service: " Mattias Rönnblom
2024-09-12  8:44                                 ` [PATCH v3 7/7] eal: keep per-lcore power intrinsics " Mattias Rönnblom
2024-09-12  9:10                               ` [PATCH v2 1/6] eal: add static per-lcore memory allocation facility Morten Brørup
2024-09-12 13:16                                 ` Jerin Jacob
2024-09-12 13:41                                   ` Morten Brørup
2024-09-12 15:22                                     ` Jerin Jacob
2024-09-18 10:11                                       ` Jerin Jacob
2024-09-11 17:04                             ` [PATCH v2 2/6] eal: add lcore variable test suite Mattias Rönnblom
2024-09-12  7:35                               ` Jerin Jacob
2024-09-12  8:56                                 ` Mattias Rönnblom
2024-09-11 17:04                             ` [PATCH v2 3/6] random: keep PRNG state in lcore variable Mattias Rönnblom
2024-09-11 17:04                             ` [PATCH v2 4/6] power: keep per-lcore " Mattias Rönnblom
2024-09-11 17:04                             ` [PATCH v2 5/6] service: " Mattias Rönnblom
2024-09-11 17:04                             ` [PATCH v2 6/6] eal: keep per-lcore power intrinsics " Mattias Rönnblom
2024-09-10  7:03                         ` [PATCH 2/6] eal: add lcore variable test suite Mattias Rönnblom
2024-09-10  7:03                         ` [PATCH 3/6] random: keep PRNG state in lcore variable Mattias Rönnblom
2024-09-10  7:03                         ` [PATCH 4/6] power: keep per-lcore " Mattias Rönnblom
2024-09-10  7:03                         ` [PATCH 5/6] service: " Mattias Rönnblom
2024-09-10  7:03                         ` [PATCH 6/6] eal: keep per-lcore power intrinsics " Mattias Rönnblom
2024-05-06  8:27                     ` [RFC v6 2/6] eal: add lcore variable test suite Mattias Rönnblom
2024-05-06  8:27                     ` [RFC v6 3/6] random: keep PRNG state in lcore variable Mattias Rönnblom
2024-05-06  8:27                     ` [RFC v6 4/6] power: keep per-lcore " Mattias Rönnblom
2024-05-06  8:27                     ` [RFC v6 5/6] service: " Mattias Rönnblom
2024-05-06  8:27                     ` [RFC v6 6/6] eal: keep per-lcore power intrinsics " Mattias Rönnblom
2024-09-02 14:42                     ` [RFC v6 0/6] Lcore variables Morten Brørup
2024-09-10  6:41                       ` Mattias Rönnblom
2024-09-10 15:41                         ` Stephen Hemminger
2024-02-28 10:09                 ` [RFC v5 2/6] eal: add lcore variable test suite Mattias Rönnblom
2024-02-28 10:09                 ` [RFC v5 3/6] random: keep PRNG state in lcore variable Mattias Rönnblom
2024-02-28 10:09                 ` [RFC v5 4/6] power: keep per-lcore " Mattias Rönnblom
2024-02-28 10:09                 ` [RFC v5 5/6] service: " Mattias Rönnblom
2024-02-28 10:09                 ` [RFC v5 6/6] eal: keep per-lcore power intrinsics " Mattias Rönnblom
2024-02-25 15:03             ` [RFC v4 2/6] eal: add lcore variable test suite Mattias Rönnblom
2024-02-25 15:03             ` [RFC v4 3/6] random: keep PRNG state in lcore variable Mattias Rönnblom
2024-02-25 15:03             ` [RFC v4 4/6] power: keep per-lcore " Mattias Rönnblom
2024-02-25 15:03             ` [RFC v4 5/6] service: " Mattias Rönnblom
2024-02-25 16:28               ` Mattias Rönnblom
2024-02-25 15:03             ` [RFC v4 6/6] eal: keep per-lcore power intrinsics " Mattias Rönnblom
2024-02-20  8:49         ` [RFC v3 2/6] eal: add lcore variable test suite Mattias Rönnblom
2024-02-20  8:49         ` [RFC v3 3/6] random: keep PRNG state in lcore variable Mattias Rönnblom
2024-02-20 15:31           ` Morten Brørup
2024-02-20  8:49         ` [RFC v3 4/6] power: keep per-lcore " Mattias Rönnblom
2024-02-20  8:49         ` [RFC v3 5/6] service: " Mattias Rönnblom
2024-02-22  9:42           ` Morten Brørup
2024-02-23 10:19             ` Mattias Rönnblom
2024-02-20  8:49         ` [RFC v3 6/6] eal: keep per-lcore power intrinsics " Mattias Rönnblom
2024-02-19  9:40     ` [RFC v2 2/5] eal: add lcore variable test suite Mattias Rönnblom
2024-02-19  9:40     ` [RFC v2 3/5] random: keep PRNG state in lcore variable Mattias Rönnblom
2024-02-19 11:22       ` Morten Brørup
2024-02-19 14:04         ` Mattias Rönnblom
2024-02-19 15:10           ` Morten Brørup
2024-02-19  9:40     ` [RFC v2 4/5] power: keep per-lcore " Mattias Rönnblom
2024-02-19  9:40     ` [RFC v2 5/5] service: " Mattias Rönnblom
2024-02-08 18:16 ` [RFC 2/5] eal: add lcore variable test suite Mattias Rönnblom
2024-02-08 18:16 ` [RFC 3/5] random: keep PRNG state in lcore variable Mattias Rönnblom
2024-02-08 18:16 ` [RFC 4/5] power: keep per-lcore " Mattias Rönnblom
2024-02-08 18:16 ` [RFC 5/5] service: " Mattias Rönnblom

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=a6233a94-b626-4cfc-a298-29116a39031a@lysator.liu.se \
    --to=hofors@lysator.liu.se \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=konstantin.v.ananyev@yandex.ru \
    --cc=mattias.ronnblom@ericsson.com \
    --cc=mb@smartsharesystems.com \
    --cc=stephen@networkplumber.org \
    /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).