]> Pileus Git - ~andy/linux/blobdiff - arch/s390/oprofile/hwsampler.c
Merge branch 'fixefi' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6
[~andy/linux] / arch / s390 / oprofile / hwsampler.c
index 33cbd373cce4f39e1181299b9098c2334fc231ec..4552ce40c81a5086ad550e21092c78b36ad3b7c3 100644 (file)
@@ -5,6 +5,7 @@
  * Author: Heinz Graalfs <graalfs@de.ibm.com>
  */
 
+#include <linux/kernel_stat.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/smp.h>
@@ -18,7 +19,7 @@
 #include <linux/oprofile.h>
 
 #include <asm/lowcore.h>
-#include <asm/s390_ext.h>
+#include <asm/irq.h>
 
 #include "hwsampler.h"
 
@@ -579,7 +580,7 @@ static int hws_cpu_callback(struct notifier_block *nfb,
 {
        /* We do not have sampler space available for all possible CPUs.
           All CPUs should be online when hw sampling is activated. */
-       return NOTIFY_BAD;
+       return (hws_state <= HWS_DEALLOCATED) ? NOTIFY_OK : NOTIFY_BAD;
 }
 
 static struct notifier_block hws_cpu_notifier = {
@@ -674,17 +675,11 @@ int hwsampler_activate(unsigned int cpu)
 static void hws_ext_handler(unsigned int ext_int_code,
                            unsigned int param32, unsigned long param64)
 {
-       int cpu;
        struct hws_cpu_buffer *cb;
 
-       cpu = smp_processor_id();
-       cb = &per_cpu(sampler_cpu_buffer, cpu);
-
-       atomic_xchg(
-                       &cb->ext_params,
-                       atomic_read(&cb->ext_params)
-                               | S390_lowcore.ext_params);
-
+       kstat_cpu(smp_processor_id()).irqs[EXTINT_CPM]++;
+       cb = &__get_cpu_var(sampler_cpu_buffer);
+       atomic_xchg(&cb->ext_params, atomic_read(&cb->ext_params) | param32);
        if (hws_wq)
                queue_work(hws_wq, &cb->worker);
 }
@@ -764,7 +759,7 @@ static int worker_check_error(unsigned int cpu, int ext_params)
        if (!sdbt || !*sdbt)
                return -EINVAL;
 
-       if (ext_params & EI_IEA)
+       if (ext_params & EI_PRA)
                cb->req_alert++;
 
        if (ext_params & EI_LSDA)
@@ -1009,7 +1004,7 @@ int hwsampler_deallocate()
        if (hws_state != HWS_STOPPED)
                goto deallocate_exit;
 
-       smp_ctl_clear_bit(0, 5); /* set bit 58 CR0 off */
+       ctl_clear_bit(0, 5); /* set bit 58 CR0 off */
        deallocate_sdbt();
 
        hws_state = HWS_DEALLOCATED;
@@ -1123,7 +1118,7 @@ int hwsampler_shutdown()
                mutex_lock(&hws_sem);
 
                if (hws_state == HWS_STOPPED) {
-                       smp_ctl_clear_bit(0, 5); /* set bit 58 CR0 off */
+                       ctl_clear_bit(0, 5); /* set bit 58 CR0 off */
                        deallocate_sdbt();
                }
                if (hws_wq) {
@@ -1198,7 +1193,7 @@ start_all_exit:
        hws_oom = 1;
        hws_flush_all = 0;
        /* now let them in, 1407 CPUMF external interrupts */
-       smp_ctl_set_bit(0, 5); /* set CR0 bit 58 */
+       ctl_set_bit(0, 5); /* set CR0 bit 58 */
 
        return 0;
 }