[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170207105412.yrvnd3ks42jjtrtg@pd.tnic>
Date: Tue, 7 Feb 2017 11:54:12 +0100
From: Borislav Petkov <bp@...en8.de>
To: Ingo Molnar <mingo@...nel.org>
Cc: Robert Richter <rric@...nel.org>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Vince Weaver <vince@...ter.net>,
lkml <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH] perf/stat: Add --disable-hwdt
On Tue, Feb 07, 2017 at 08:25:12AM +0100, Ingo Molnar wrote:
> But there's only so much we can do about that, the /proc/sys API is fundamentally
> lossy in that regard. We'd have to add much more involved kernel support to
> guarantee that the watchdog state is restored.
So I think doing all this is meh but I guess I probably should do it
just so that we're thorough.
> A way to do it would be create a new /proc/sys/kernel/watchdog_disable_file that
> disables that watchdog while it's _open_. When a task exits and the kernel
> automatically closes the file, the watchdog is re-enabled again. (Or the process
> itself can close the file too.)
>
> This method would also nest properly and would handle multi-processes races
> correctly: for example if a script runs perf as root, and root uses 'perf top',
> the two should not race and the hardware watchdog should not end up being
> disabled...
Hmm, so I don't like the aspect of adding a /proc file just for that.
Can we do something with sys_perf_event_open(..., flags) instead and
pass in a new flag that says:
PERF_FLAG_SHOO_COUNTER_USERS
or so which would go and turn off HW WDT (and possibly future things
using counters) while we're running a session?
The name should be generic enough so that we can use it for future
temporary disabling of things while a perf session runs.
Then on perf's exit path - I see there are a bunch of _destroy() things
being called when events are disappearing - we'd reenable stuff again
based on that flag.
This way we're clean in userspace and have the maximum control over
everything since we're in the kernel.
>From a quick staring, there's PERF_FLAG_FD_CLOEXEC which is a good
example for something like that. It doesn't do what I'd like to do but I
think I should model this in a similar fashion.
Thoughts?
--
Regards/Gruss,
Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.
Powered by blists - more mailing lists