Skip to content

s390: Remove vtimer infrastructure

Heiko Carstens linux-s390 lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 2 repliesIn review
  2. v1 RFC2 patches 0 repliesSuperseded

Changes in v2 from the cover letter

- Use for_each_possible_cpu() instead of for_each_online_cpu() in appldata_total_cpu_time_ns() to make sure the reported cpu time is monotonic increasing [Sashiko]

- Rework locking in __appldata_timer_setup() to make sure appldata_timer_active always reflects if a work is still active or not [Sashiko]

- Use mod_delayed_work() [Sashiko]

- Add cpu hotplug handler to recalculate interval if a new CPU is added, avoiding potential long delays between an expired timer and when the callback is run

- Avoid using scoped_guard(), etc. - keep coding style consistent within the file

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2s390/appldata: Emulate virtual timer with delayed workarch/s390/appldata/appldata_base.c+107 -642 replies
2/2s390/vtime: Remove vtimer infrastructurearch/s390/include/asm/vtime.h arch/s390/include/asm/vtimer.h arch/s390/kernel/process.c +3 more+12 -2370 replies

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchGerald Schaefer
1/2R-b T-b
2/2

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

Read the v2 thread

Cover letter [PATCH v2 0/2] s390: Remove vtimer infrastructure

v2:
- Use for_each_possible_cpu() instead of for_each_online_cpu() in appldata_total_cpu_time_ns() to make sure the reported cpu time is monotonic increasing [Sashiko]

- Rework locking in __appldata_timer_setup() to make sure appldata_timer_active always reflects if a work is still active or not [Sashiko]

- Use mod_delayed_work() [Sashiko]

- Add cpu hotplug handler to recalculate interval if a new CPU is added, avoiding potential long delays between an expired timer and when the callback is run

- Avoid using scoped_guard(), etc. - keep coding style consistent within the file

v1:
s390's virtual timer infrastructure has only a single user and the semantics of the interface are not straightforward: a virtual timer fires if the sum of elapsed CPU time over all CPUs exceeds a specified value.

This is suboptimal since the number of active CPUs defines how frequently the timer fires. With many CPUs and short intervals this can be very frequent. Furthermore the required accounting in the vtime code uses a single 64-bit value to accumulate elapsed CPU time. In busy systems this can lead to cache line bouncing when the value is updated concurrently on several CPUs; which is the reason why other accounting mechanisms use per-CPU data structures for this purpose.

In practice this is not a problem with the appldata default interval of 10 seconds, however the interval is configurable via sysctl with a minimum value of 1ms.

Given that there is only a single user, emulate the virtual timer in appldata using delayed work: the work is scheduled for the minimum possible wall-clock time until the configured CPU-time interval elapses (remaining CPU time / number of online CPUs), with a minimum delay of 100ms. The work then reads per-CPU statistics of all online CPUs to check whether enough CPU time has elapsed, and if so runs the registered callbacks.

The calculation is more expensive, but avoids potential cache line bouncing problem. In addition it allows to remove the entire vtimer infrastructure code with a subsequent patch.

Thanks,
Heiko

Heiko Carstens (2):
s390/appldata: Emulate virtual timer with delayed work s390/vtime: Remove vtimer infrastructure

 arch/s390/appldata/appldata_base.c | 171 ++++++++++++++---------
 arch/s390/include/asm/vtime.h      |   2 +
 arch/s390/include/asm/vtimer.h     |  30 ----
 arch/s390/kernel/process.c         |   1 -
 arch/s390/kernel/smp.c             |   2 +-
 arch/s390/kernel/time.c            |   2 +-
 arch/s390/kernel/vtime.c           | 212 ++---------------------------
 7 files changed, 119 insertions(+), 301 deletions(-)
 delete mode 100644 arch/s390/include/asm/vtimer.h
Signature · 1 line
2.53.0