lkml.org 
[lkml]   [2017]   [Feb]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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.

\
 
 \ /
  Last update: 2017-02-07 11:54    [W:0.078 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site