]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
s390/cpum_cf: cleanup event/counter validation
authorHendrik Brueckner <brueckner@linux.vnet.ibm.com>
Mon, 13 Feb 2017 11:32:17 +0000 (12:32 +0100)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Fri, 31 Mar 2017 05:53:29 +0000 (07:53 +0200)
The validate_event() function just checked for reserved counters
in particular CPU-MF counter sets.  Because the number of counters
in counter sets vary among different hardware models, remove the
explicit check to tolerate new models.

Reserved counters are not accounted and, thus, will return zero.

Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/kernel/perf_cpum_cf.c

index 1c3f93812817ee7c079c4f5c20f32f654bd30bb7..6fe1428e9dfca31c4c84f92bfd2a97cd9db97fb8 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Performance event support for s390x - CPU-measurement Counter Facility
  *
- *  Copyright IBM Corp. 2012
+ *  Copyright IBM Corp. 2012, 2017
  *  Author(s): Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -102,26 +102,6 @@ static int get_counter_set(u64 event)
        return set;
 }
 
-static int validate_event(const struct hw_perf_event *hwc)
-{
-       switch (hwc->config_base) {
-       case CPUMF_CTR_SET_BASIC:
-       case CPUMF_CTR_SET_USER:
-       case CPUMF_CTR_SET_CRYPTO:
-       case CPUMF_CTR_SET_EXT:
-               /* check for reserved counters */
-               if ((hwc->config >=  6 && hwc->config <=  31) ||
-                   (hwc->config >= 38 && hwc->config <=  63) ||
-                   (hwc->config >= 80 && hwc->config <= 127))
-                       return -EOPNOTSUPP;
-               break;
-       default:
-               return -EINVAL;
-       }
-
-       return 0;
-}
-
 static int validate_ctr_version(const struct hw_perf_event *hwc)
 {
        struct cpu_hw_events *cpuhw;
@@ -381,15 +361,6 @@ static int __hw_perf_event_init(struct perf_event *event)
        hwc->config = ev;
        hwc->config_base = get_counter_set(ev);
 
-       /* Validate the counter that is assigned to this event.
-        * Because the counter facility can use numerous counters at the
-        * same time without constraints, it is not necessary to explicitly
-        * validate event groups (event->group_leader != event).
-        */
-       err = validate_event(hwc);
-       if (err)
-               return err;
-
        /* Initialize for using the CPU-measurement counter facility */
        if (!atomic_inc_not_zero(&num_events)) {
                mutex_lock(&pmc_reserve_mutex);