Skip to content

Arch-generic sched_clock NMI safety and optimizations for -tip

John Stultz lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5sched_clock: Match scope of read and write seqcountskernel/time/sched_clock.c+11 -140 replies
2/5sched_clock: Optimize cache line usagekernel/time/sched_clock.c+77 -360 replies
3/5sched_clock: Remove suspend from clock_read_datakernel/time/sched_clock.c+25 -150 replies
4/5sched_clock: Remove redundant notrace from update functionkernel/time/sched_clock.c+1 -10 replies
5/5sched_clock: Avoid deadlock during read from NMIkernel/time/sched_clock.c+68 -350 replies

Reviews trailers per patch

All 5 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchStephen BoydPeter Zijlstra (Intel)
SeriesA-b
1/5R-b
2/5R-b
3/5R-b
4/5R-b
5/5R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/5] Arch-generic sched_clock NMI safety and optimizations for -tip

Ingo, Peter, Thomas,

The following patches from Daniel extend the arch-generic sched_clock
implementation so that it can be safely called from NMI (or FIQ on ARM) context. They also optimize the sched_clock logic to improve cache performance. I wanted to send them along so they could be queued in -tip for 4.1.

Quoted 1 line

From Daniel's last post:

"The data cache profile of sched_clock() in both the original code and my previous patch was somewhere between 2 and 3 (64-byte) cache lines, depending on alignment of struct clock_data. After patching, the cache profile for the normal case should be a single cacheline.

NMI safety was tested on i.MX6 with perf drowning the system in FIQs and using the perf handler to check that sched_clock() returned monotonic values. At the same time I forcefully reduced kt_wrap so that update_sched_clock() is being called at >1000Hz.

Without the patches the above system is grossly unstable, surviving [9K,115K,25K] perf event cycles during three separate runs. With the patch I ran for over 9M perf event cycles before getting bored."

I'm relaying these along because in the past I've queued and submitted arch-generic sched_clock.c changes from Stephen via Thomas, but I wanted to make sure this got a look from Ingo and Peter.

In the future, I think Stephen is probably the right person to act as patch-catcher for the kernel/time/sched_clock.c file. But I think those changes should continue to be merged in via the -tip tree w/ other scheduler code.

Let me know if you have any objections or concerns.

thanks
-john

Cc Daniel Thompson <[email protected]>
Cc Russell King <[email protected]>
Cc Will Deacon <[email protected]>
Cc Catalin Marinas <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Peter Zijlstra <[email protected]>

These patches can also be pulled from the pull request below.

The following changes since commit c517d838eb7d07bbe9507871fab3931deccff539:

Linux 4.0-rc1 (2015-02-22 18:21:14 -0800)

are available in the git repository at:

https://git.linaro.org/people/john.stultz/linux.git fortglx/4.1/schedclock

for you to fetch changes up to 4bb74b85d2e74cfec9e21a6de44b232a2983bcc7:

sched_clock: Avoid deadlock during read from NMI (2015-03-10 20:28:58 -0700)

----------------------------------------------------------------

Daniel Thompson (5):
sched_clock: Match scope of read and write seqcounts
sched_clock: Optimize cache line usage
sched_clock: Remove suspend from clock_read_data
sched_clock: Remove redundant notrace from update function
sched_clock: Avoid deadlock during read from NMI

 kernel/time/sched_clock.c | 195 ++++++++++++++++++++++++++++++++--------------
 1 file changed, 138 insertions(+), 57 deletions(-)
Signature · 1 line
1.9.1