From: "Patel, Vedang" <vedang.patel@intel.com>
To: "tglx@linutronix.de" <tglx@linutronix.de>, "julia@ni.com" <julia@ni.com>
Cc: "ranshalit@gmail.com" <ranshalit@gmail.com>,
"linux-rt-users@vger.kernel.org" <linux-rt-users@vger.kernel.org>,
"bigeasy@linutronix.de" <bigeasy@linutronix.de>,
"tlsmith3777@gmail.com" <tlsmith3777@gmail.com>,
"Hart, Darren" <darren.hart@intel.com>
Subject: Re: Regression on rt kernel while using POSIX timers
Date: Fri, 3 Mar 2017 23:36:20 +0000 [thread overview]
Message-ID: <1488584180.29259.76.camel@intel.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1703032202240.3691@nanos>
Hi Julia, Thomas,
Thanks for all the inputs. The information is really helpful in helping
me get a better understanding of the internals. :)
On Fri, 2017-03-03 at 22:09 +0100, Thomas Gleixner wrote:
> On Fri, 3 Mar 2017, Julia Cartwright wrote:
> >
> >
> > Without PREEMPT_RT_FULL enabled, the critical section is executed
> > with
> > "raw" spinlocks, and is therefore non-preemptible. However, with
> > RT_FULL, the preemptibility of the section leads to the "bounce".
> >
> > That should make it clear why ktimersoftd would be PI boosted, as
> > well.
> >
> > Now, it isn't clear to me why the affinitized scenario appears to
> > make
> > this happen more frequently... Nor do I have a handle on what to
> > do to
> > fix this (if anything).
> The point here is:
>
> perf stat taskset 1 cyclictest -t1
>
> will make the control thread of cyclictest affine to cpu 0 and also
> the
> measuring thread. perf stat counts the context switches of both.
I believe that it is not manifested in the non-affince scenario because
the cyclictest process being migrated to another CPU every time it
goes to sleep after calling sigwait(). There are no "additional"
context switches required between ktimersoftd and cyclictest because it
is on a different CPU.
Also, I am using the '-a' argument provided by cyclictest to pin the
process to the CPU. This does not pin the main thread. I confirmed it
by using trace-cmd and kernelshark. Also, the number of context
switches for the main thread are pretty low. For example, if I run
100000 loops, there are ~300000 context switches out of which only 1000
are from the main thread. I checked in the mainline kernel and the
softirqs seem to be executing with the interrupts disabled. Which is
probably why the issue is avoided.
I now have the following concerns and comments:
1. real-time kernel vs. Mainline kernel: The real-time kernel is worse
with POSIX timers than the mainline kernel. This is odd. Is this
because the softirqs are not the same anymore(Sorry, I am still not
familiar with what they have become. I deduced the "not the same" part
from commit messages/comments in code. :))? Also, in https://git.kernel
.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit/?h=v4.4-
rt&id=4aa7cba57f73acf1e3e4998ae1650965317c2de1, it is mentioned:
"
Bring back the softirq split for now, until we fixed the signal
delivery problem for real.
"
What signal delivery problem is being referred to?
2. In the case the CPU affinity is set, The CPU is shared between
cyclictest thread and the ktimersoftd thread. So, in the end, 1 CPU
migration is cheaper than 3 context switches... Is this the right
analysis? I know this will vary from application to application.
Thanks,
Vedang Patel
Software Engineer
Intel Corporation
> CPU 0
> cyclictest-control
>
> --> Interrupt
>
> ksoftirqd
>
> cyclictest-measure
> rearm timer
> sleep
>
> cyclictest-control
>
> ....
>
> versus a non affine scenario
>
> CPU0 CPU1 CPU2
> cyclictest-control interrupt
> ksoftirqd --> cyclictest-measure
> rearm timer
> sleep
>
> interrupt
> cyclicttest <-- ksoftirqd
> -measure
>
> Thanks,
>
> tglx
next prev parent reply other threads:[~2017-03-03 23:48 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-08 18:41 Regression on rt kernel while using POSIX timers Patel, Vedang
2017-02-10 19:07 ` Sebastian Andrzej Siewior
2017-02-13 18:48 ` Patel, Vedang
2017-02-15 16:54 ` bigeasy
2017-02-16 2:05 ` Julia Cartwright
2017-02-16 2:34 ` Patel, Vedang
2017-02-22 1:43 ` Patel, Vedang
2017-03-01 15:22 ` bigeasy
2017-03-01 19:03 ` Tracy Smith
2017-03-02 3:23 ` Patel, Vedang
2017-03-03 19:41 ` Julia Cartwright
2017-03-03 20:32 ` Julia Cartwright
2017-03-03 21:09 ` Thomas Gleixner
2017-03-03 23:36 ` Patel, Vedang [this message]
2017-03-06 11:29 ` Thomas Gleixner
2017-03-07 2:01 ` Patel, Vedang
2017-03-07 17:03 ` Thomas Gleixner
2017-03-20 22:54 ` Patel, Vedang
2017-03-03 16:51 ` Thomas Gleixner
-- strict thread matches above, loose matches on Subject: below --
2017-02-13 20:32 Ran Shalit
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=1488584180.29259.76.camel@intel.com \
--to=vedang.patel@intel.com \
--cc=bigeasy@linutronix.de \
--cc=darren.hart@intel.com \
--cc=julia@ni.com \
--cc=linux-rt-users@vger.kernel.org \
--cc=ranshalit@gmail.com \
--cc=tglx@linutronix.de \
--cc=tlsmith3777@gmail.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).