lkml.org 
[lkml]   [2009]   [Dec]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] perf_event: mount debugfs automatically

* Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> wrote:

> Mount debugfs automatically if it's not mounted, umount it
> when programme exit
>
> Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
> ---
> tools/perf/perf.c | 10 +++++++++-
> tools/perf/util/debugfs.c | 16 +++++++---------
> tools/perf/util/debugfs.h | 2 +-
> 3 files changed, 17 insertions(+), 11 deletions(-)

I'm not sure that's a good idea. What happens if two perf tools are running in
parallel:

perf report #1 start
perf report #2 start
perf report #2 exit [umount debugfs]
perf report #2 tries to open /debug file: kaboom
perf report #2 exit

But your idea is sound if we only do the first half: we should mount it under
/sys/kernel/debug/ if it's not mounted already [and that directory is
available], and leave it mounted there.

Furthermore please not that we must not mount it under any other path -
mounting is always a dangerous operation because it changes the VFS namespace.
For example some system might have some local files under /debug for whatever
reason, we must not over-mount it and potentially destroy data because we'd
confuse an app that writes into /debug. /sys/kernel/debug/ is a fair game to
mount into OTOH.

(and even then we should just leave it mounted and never umount it.)

Thanks,

Ingo


\
 
 \ /
  Last update: 2009-12-28 08:47    [W:0.048 / U:0.720 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site