DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: Harry van Haaren <harry.van.haaren@intel.com>
Cc: dev@dpdk.org, "Mattias Rönnblom" <mattias.ronnblom@ericsson.com>,
	"Honnappa Nagarahalli" <Honnappa.Nagarahalli@arm.com>,
	"Morten Brørup" <mb@smartsharesystems.com>,
	"Bruce Richardson" <bruce.richardson@intel.com>
Subject: Re: [PATCH v3 2/2] service: fix potential stats race-condition on MT services
Date: Wed, 5 Oct 2022 15:06:31 +0200	[thread overview]
Message-ID: <CAJFAV8zt_yjRuUyMcVJ3qhL6uMpST3oT0S_C8fd4FTx9YCzjeQ@mail.gmail.com> (raw)
In-Reply-To: <20220711131825.3373195-2-harry.van.haaren@intel.com>

On Mon, Jul 11, 2022 at 3:18 PM Harry van Haaren
<harry.van.haaren@intel.com> wrote:
>
> This commit fixes a potential racey-add that could occur if
> multiple service-lcores were executing the same MT-safe service
> at the same time, with service statistics collection enabled.
>
> Because multiple threads can run and execute the service, the
> stats values can have multiple writer threads, resulting in the
> requirement of using atomic addition for correctness.
>
> Note that when a MT unsafe service is executed, a spinlock is
> held, so the stats increments are protected. This fact is used
> to avoid executing atomic add instructions when not required.
> Regular reads and increments are used, and only the store is
> specified as atomic, reducing perf impact on e.g. x86 arch.
>
> This patch causes a 1.25x increase in cycle-cost for polling a
> MT safe service when statistics are enabled. No change was seen
> for MT unsafe services, or when statistics are disabled.

Fixes: 21698354c832 ("service: introduce service cores concept")

I did not mark for backport since the commitlog indicates a performance impact.
You can still ask for backport by pinging LTS maintainers.

>
> Reported-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
> Suggested-by: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
> Suggested-by: Morten Brørup <mb@smartsharesystems.com>
> Suggested-by: Bruce Richardson <bruce.richardson@intel.com>
> Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>


Series applied, thanks.

-- 
David Marchand


  reply	other threads:[~2022-10-05 13:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-11 10:57 [PATCH v2 1/2] test/service: add perf measurements for with stats mode Harry van Haaren
2022-07-11 10:57 ` [PATCH v2 2/2] service: fix potential stats race-condition on MT services Harry van Haaren
2022-07-11 13:18 ` [PATCH v3 1/2] test/service: add perf measurements for with stats mode Harry van Haaren
2022-07-11 13:18   ` [PATCH v3 2/2] service: fix potential stats race-condition on MT services Harry van Haaren
2022-10-05 13:06     ` David Marchand [this message]
2022-09-02 17:17   ` [PATCH v3 1/2] test/service: add perf measurements for with stats mode 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=CAJFAV8zt_yjRuUyMcVJ3qhL6uMpST3oT0S_C8fd4FTx9YCzjeQ@mail.gmail.com \
    --to=david.marchand@redhat.com \
    --cc=Honnappa.Nagarahalli@arm.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=harry.van.haaren@intel.com \
    --cc=mattias.ronnblom@ericsson.com \
    --cc=mb@smartsharesystems.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).