lkml.org 
[lkml]   [2011]   [Jul]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH] perf: Extend attr check to allow also dynamically generated
    On 04.07.11 19:59:27, Robert Richter wrote:
    > (Btw, current kernel code does not support dynamically allocated pmu
    > types due to a check in perf_copy_attr():
    >
    > if (attr->type >= PERF_TYPE_MAX)
    > return -EINVAL;
    > )

    Below a fix for this.

    -Robert


    From 63e76c3d827e3d6d24ff4ee24854523c054c7179 Mon Sep 17 00:00:00 2001
    From: Robert Richter <robert.richter@amd.com>
    Date: Tue, 5 Jul 2011 11:04:39 +0200
    Subject: [PATCH] perf: Extend attr check to allow also dynamically generated
    types

    When attaching events to a pmu with generated type, the initialization
    fails. Extending the check to allow such types.

    Signed-off-by: Robert Richter <robert.richter@amd.com>
    ---
    kernel/events/core.c | 2 +-
    1 files changed, 1 insertions(+), 1 deletions(-)

    diff --git a/kernel/events/core.c b/kernel/events/core.c
    index cca3588..5900729 100644
    --- a/kernel/events/core.c
    +++ b/kernel/events/core.c
    @@ -5958,7 +5958,7 @@ static int perf_copy_attr(struct perf_event_attr __user *uattr,
    * If the type exists, the corresponding creation will verify
    * the attr->config.
    */
    - if (attr->type >= PERF_TYPE_MAX)
    + if (attr->type >= PERF_TYPE_MAX && !idr_find(&pmu_idr, attr->type))
    return -EINVAL;

    if (attr->__reserved_1)
    --
    1.7.5.3



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



    \
     
     \ /
      Last update: 2011-07-05 11:49    [W:0.024 / U:1.984 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site