[patch 1/4] This patch adds support for hardware based sampling on System z processors (models z10 and up)

Previous thread: [patch 3/4] This patch introduces a new oprofile sample add function (oprofile_add_ext_hw_sample) by graalfs on Monday, December 20, 2010 - 6:05 am. (2 messages)

Next thread: [patch 0/4] OProfile support for System z's hardware sampling by graalfs on Monday, December 20, 2010 - 6:05 am. (1 message)

From: graalfs@linux.vnet.ibm.com

The CPU Measurement Facility CPUMF is described in the z/Architecture Principles of Operation.

The patch introduces 
 - a new configuration option OPROFILE_HWSAMPLING_MODE
 - a new kernel module hwsampler that controls all hardware sampling related operations as
  - checking if hardware sampling feature is available
    - ie: on System z models z10 and up, in LPAR mode only, and authorised during LPAR activation
  - allocating memory for the hardware sampling feature
  - starting/stopping hardware sampling
The hwsampler module will also depend on CONFIG_OPROFILE and CONFIG_64BIT.

All functions required to start and stop hardware sampling have to be
invoked by the oprofile kernel module as provided by the other patches of this patch set.

In case hardware based sampling cannot be setup standard timer based sampling is used by OProfile.

Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Signed-off-by: Maran Pakkirisamy <maranp@linux.vnet.ibm.com>
Signed-off-by: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
---
 arch/s390/Kconfig                       |   22 
 arch/s390/include/asm/hwsampler.h       |  130 +++
 arch/s390/oprofile/Makefile             |    6 
 drivers/s390/hwsampler/hwsampler-main.c | 1155 ++++++++++++++++++++++++++++++++
 drivers/s390/hwsampler/smpctl.c         |  170 ++++
 5 files changed, 1483 insertions(+)

Index: linux-2.6/arch/s390/include/asm/hwsampler.h
===================================================================
--- /dev/null
+++ linux-2.6/arch/s390/include/asm/hwsampler.h
@@ -0,0 +1,130 @@
+/*
+ * CPUMF HW sampler structures and prototypes
+ *
+ *    Copyright IBM Corp. 2010
+ *    Author(s): Heinz Graalfs <graalfs@de.ibm.com>
+ */
+
+#ifndef HWSAMPLER_H_
+#define HWSAMPLER_H_
+
+#include <linux/workqueue.h>
+
+struct qsi_info_block          /* QUERY SAMPLING information block  */
+{ /* Bit(s) */
+	unsigned int b0_13:14;      /* 0-13: zeros                       */
+	unsigned int as:1;    ...

This should include the real name like in your Signed-off-by tag.

You can fix this by reconfiguring git and recommitting your patches

Is there a reason for splitting the code into two files? If we would
merge hwsampler-main.c and smpctl.c we could make a lot functions
static which simplifies the interface. We could also drop the
hwsampler/ directory and put all in drivers/s390/hwsampler.c.

Another thing is, wouldn't all of this better be part of cpu
initialization code? This is not really a driver, it only registers a
cpu notifier. Do you need to build this as module?  I leave this

This file should only contain definitions for the public interface.
All structs should be private, defined in something like

 drivers/s390/hwsampler.h

or so. All of them are only used in hwsampler-main.c or smpctl.c.




Many functions above are for internal use only, these should be




Have you tried building this as a module. Not really sure, but I think it should be

 hwsampler-$(CONFIG_HWSAMPLER) := ...

See also my statement above about putting this to cpu init code
instead of having a driver for it.


-- 
Advanced Micro Devices, Inc.
Operating System Research Center

--

Previous thread: [patch 3/4] This patch introduces a new oprofile sample add function (oprofile_add_ext_hw_sample) by graalfs on Monday, December 20, 2010 - 6:05 am. (2 messages)

Next thread: [patch 0/4] OProfile support for System z's hardware sampling by graalfs on Monday, December 20, 2010 - 6:05 am. (1 message)