Skip to content

OProfile support for System z's hardware sampling

Heinz Graalfs 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 Latest3 patches 11 repliesIn review
  2. v14 patches 8 repliesSuperseded

Changes in v2 from the cover letter

- kernel module hwsampler removed, everything is now in oprofile kernel module
- functions from hwsampler-main.c and smpctl.c merged into arch/s390/oprofile/hwsampler.c
- functions made static
- arch/s390/include/asm/hwsampler.h moved to arch/s390/oprofile/hwsampler.h
- structs have now hws_ prefix
- config variables changed, HAVE_HWSAMPLER used only
- original patch 4 (handle_munmap.patch) removed

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3This patch adds support for hardware based sampling on System z processors (models z10 and up)arch/Kconfig arch/s390/Kconfig arch/s390/oprofile/hwsampler.c +1 more+1373 -03 replies
2/3This patch enhances OProfile to support System zs hardware sampling featurearch/s390/oprofile/Makefile arch/s390/oprofile/hwsampler_files.c arch/s390/oprofile/init.c +4 more+222 -54 replies
3/3This patch introduces a new oprofile sample add function (oprofile_add_ext_hw_sample)drivers/oprofile/cpu_buffer.c+20 -71 reply

Reviews trailers per patch

None of the 3 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchHeiko Carstens
SeriesA-b
1/3
2/3
3/3

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/3] OProfile support for System z's hardware sampling

Hello Robert,

I'm resending yesterday's mail because I missed to specify the correct sender information.

This is a re-posting of the patch series originally posted last month:

http://marc.info/?l=linux-s390&m=129285043619973&w=2

Heinz

Changes in

v2:
- kernel module hwsampler removed, everything is now in oprofile kernel module
- functions from hwsampler-main.c and smpctl.c merged into arch/s390/oprofile/hwsampler.c
- functions made static
- arch/s390/include/asm/hwsampler.h moved to arch/s390/oprofile/hwsampler.h
- structs have now hws_ prefix
- config variables changed, HAVE_HWSAMPLER used only
- original patch 4 (handle_munmap.patch) removed

Description:

So far, OProfile takes samples by using a software interrupt.
The purpose of this series of patches is to add support for System z hardware sampling to OProfile.

Hardware (HW) sampling is a feature provided by System z processors (z10 and follow ons). When sampling, the processor takes samples containing the instruction address, PID, and other information. The samples are taken at a programmable rate and stored into a buffer provided by the operating system. The sampling process is implemented in hardware and millicode and thus does not affect the operating system being oberved, apart from requiring buffer memory that the Linux kernel must provide.

Hardware sampling is available in LPAR mode on 64 BIT processors only.

The overall approach is to replace the software-based sample generation by hardware sampling. All required functionality to control the HW sampling mechanism is added to the oprofile kernel module. The functions provide support for
- controlling the sampling hardware,
- setting up appropriate buffer structures (HW buffers),
- retrieving sample entries from these buffers.
Multiple CPUs can be handled.

The samples contain the instruction address, a bit distinguishing between kernel and user space, and for user space samples also the PID.
Instead of taking samples from its own per-CPU buffers, OProfile would rather take samples from the HW buffers.

When hardware sampling can be enabled on the current System z processor it will be the new default. Switching back to timer based sampling can be established by using

echo 0 > /dev/oprofile/hwsampling/hwsampler

The user space drivers of OProfile also need an extension to control hw sampling by appropriate options.