From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-s390@vger.kernel.org, Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@elte.hu>, john stultz <johnstul@us.ibm.com>
Subject: [patch 0/3] [RFC] tick_program_event/clockevents_program_event tweaking
Date: Tue, 23 Aug 2011 15:29:41 +0200 [thread overview]
Message-ID: <20110823132941.744407154@de.ibm.com> (raw)
Greetings,
I rediscovered a couple of clockevents patches which have patiently
been sitting on my hard drive for a rather long time. After some
polishing I guess they are now ready for a review. The aim is to
improve the handling of the clockevents device for s390.
The first patch addresses an issue with the automatic adjustment of
the minimum delay of the clockevents device. We have seen situations
where this adjustment errornously increased the minimum delay on a
virtual system running under z/VM. The only way to get the delay back
to a sane value is a reboot.
To solve this problem a new config option GENERIC_CLOCKEVENTS_MIN_ADJUST
is introduced that allows to select if the automatic increase of the
minimum delay of a clockevents device should be done or not.
The patch enables GENERIC_CLOCKEVENTS_MIN_ADJUST for x86, for s390
we never want to do an adjustment.
Question to the architecture maintainers: are there any other platforms
which will need the adjustment as well?
The second issue that patches #2 and #3 are trying to solve is the fact
that the current code only supports clockevents devices which use a time
delta. The clock comparator found on s390 uses a wall-time value that is
constantly compared to the current TOD clock. If the clock comparator
value is smaller than the TOD clock value an interrupt is made pending.
The current clockevents code is needlessly complex for this clockevents
device, the function trace of a tick_program_event call looks like this:
0) | tick_program_event() {
0) | tick_dev_program_event() {
0) | ktime_get() {
0) | read_tod_clock() {
0) 0.336 us | } /* read_tod_clock */
0) 0.692 us | } /* ktime_get */
0) | clockevents_program_event() {
0) | s390_next_event() {
0) 0.190 us | } /* s390_next_event */
0) 0.701 us | } /* clockevents_program_event */
0) 1.901 us | } /* tick_dev_program_event */
0) 2.370 us | } /* tick_program_event */
The code does a ktime_get and substracts the result from the expires
value, then passes the delta to the s390_next_event function. This
function then uses get_clock and adds that value to the delta. So
basically the current ktime is first subtracted and then readded to
the expires value for no gain.
The new code implemented by the patches #2 and #3 gives this call trace:
0) | tick_program_event() {
0) | clockevents_program_event() {
0) | s390_next_ktime() {
0) | ktime_get_monotonic_offset() {
0) 0.183 us | } /* ktime_get_monotonic_offset */
0) 0.734 us | } /* s390_next_ktime */
0) 1.120 us | } /* clockevents_program_event */
0) 1.557 us | } /* tick_program_event */
The function tick_dev_program_event is gone, clockevents_program_event
passes the unmodified expires value to s390_next_ktime. This new
function only needs to subtract the wall_to_monotonic offset to get
the wall-clock value to program the clock comparator. And forcing the
minimum delay on a clockevent device with CLOCK_EVT_FEAT_KTIME is not
necessary anymore. Any ktime value can be programmed to the clock
comparator, even one that is in the past. As soon as the irqs are
open again we will simply get an interrupt.
The old code needs 151 instruction for a tick_program_event call,
the new one only 85. A nice improvement.
To: linux-arch@vger.kernel.org
To: linux-kernel@vger.kernel.org
To: linux-s390@vger.kernel.org
To: Ingo Molnar <mingo@elte.hu>
To: Thomas Gleixner <tglx@linutronix.de>
To: john stultz <johnstul@us.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
--
blue skies,
Martin.
"Reality continues to ruin my life." - Calvin.
next reply other threads:[~2011-08-23 13:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-23 13:29 Martin Schwidefsky [this message]
2011-08-23 13:29 ` [patch 1/3] clockevent event minimum delay adjustments Martin Schwidefsky
2011-08-23 13:29 ` [patch 2/3] direct ktime path for clockevent devices Martin Schwidefsky
2011-08-23 13:29 ` [patch 3/3] use direct ktime path for s390 clockevent device Martin Schwidefsky
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=20110823132941.744407154@de.ibm.com \
--to=schwidefsky@de.ibm.com \
--cc=johnstul@us.ibm.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
/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