[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMmz+Ykdf+bpA=ARSAYd3xp7U+BDWVmf1iW3SKW=ZVDBSmUSEg@mail.gmail.com>
Date: Thu, 9 Nov 2017 10:59:49 -0800
From: Milind Chabbi <chabbi.milind@...il.com>
To: Jiri Olsa <jolsa@...hat.com>
Cc: Milind Chabbi <chabbi.milind@...il.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Namhyung Kim <namhyung@...nel.org>,
linux-kernel@...r.kernel.org,
Michael Kerrisk-manpages <mtk.manpages@...il.com>,
linux-man@...r.kernel.org, Michael Ellerman <mpe@...erman.id.au>,
Andi Kleen <ak@...ux.intel.com>,
Kan Liang <kan.liang@...el.com>,
Hari Bathini <hbathini@...ux.vnet.ibm.com>,
Sukadev Bhattiprolu <sukadev@...ux.vnet.ibm.com>,
Jin Yao <yao.jin@...ux.intel.com>
Subject: Re: [PATCH] perf/core: fast breakpoint modification via _IOC_MODIFY_BREAKPOINT
SNIP
On Thu, Nov 9, 2017 at 5:12 AM, Jiri Olsa <jolsa@...hat.com> wrote:
>
>
> how about something like below (untested)
>
> looks like there's no irq caller for modify_user_hw_breakpoint,
> so we should be fine with locking nr_bp_mutex
>
> jirka
>
>
> ---
> diff --git a/kernel/events/hw_breakpoint.c b/kernel/events/hw_breakpoint.c
> index 3f8cb1e14588..f062b68399ea 100644
> --- a/kernel/events/hw_breakpoint.c
> +++ b/kernel/events/hw_breakpoint.c
> @@ -448,6 +448,8 @@ int modify_user_hw_breakpoint(struct perf_event *bp, struct perf_event_attr *att
> else
> perf_event_disable(bp);
>
> + release_bp_slot(bp);
> +
> bp->attr.bp_addr = attr->bp_addr;
> bp->attr.bp_type = attr->bp_type;
> bp->attr.bp_len = attr->bp_len;
> @@ -455,9 +457,9 @@ int modify_user_hw_breakpoint(struct perf_event *bp, struct perf_event_attr *att
> if (attr->disabled)
> goto end;
>
> - err = validate_hw_breakpoint(bp);
> + err = reserve_bp_slot(bp);
> if (!err)
> - perf_event_enable(bp);
> + err = validate_hw_breakpoint(bp);
>
> if (err) {
> bp->attr.bp_addr = old_addr;
> @@ -469,6 +471,7 @@ int modify_user_hw_breakpoint(struct perf_event *bp, struct perf_event_attr *att
> return err;
> }
>
> + perf_event_enable(bp);
> end:
> bp->attr.disabled = attr->disabled;
>
We can do this accounting only if bp->attr.bp_type != attr->bp_type.
-Milind
Powered by blists - more mailing lists