[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Yx7k4uNTaJeAvBMs@hirez.programming.kicks-ass.net>
Date: Mon, 12 Sep 2022 09:50:58 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Dave Hansen <dave.hansen@...el.com>
Cc: lizhe.67@...edance.com, dave.hansen@...ux.intel.com,
luto@...nel.org, linux-kernel@...r.kernel.org,
lizefan.x@...edance.com, yuanzhu@...edance.com
Subject: Re: [RFC] x86/mm/dump_pagetables: Allow dumping pagetables by pid
On Sat, Sep 10, 2022 at 04:09:55PM -0700, Dave Hansen wrote:
> On 8/4/22 00:04, lizhe.67@...edance.com wrote:
> > In current kernel we can only dump a user task's pagetable
> > by task itself. Sometimes we need to inspect the page table
> > attributes of different memory maps to user space to meet
> > the relevant development and debugging requirements. This
> > patch helps us to make our works easier. It add two file
> > named 'pid' and 'pid_pgtable_show'. We can use 'pid' to
> > input the task we want to inspect and get pagetable info
> > from 'pid_pgtable_show'.
> >
> > User space can use file 'pid' and 'pid_pgtable_show' as follows.
> > ====
> > $ echo $pid > /sys/kernel/debug/page_tables/pid
> > $ cat /sys/kernel/debug/page_tables/pid_pgtable_show
>
> This seems a wee bit silly considering that we have /proc. It's also
> impossible to have an ABI like this work if multiple processes are
> trying to dump different pids.
>
> Are there any other per-process things in debugfs where folks have done
> something similar?
Not that I'm aware of; we can ofcourse duplicate the whole process tree
in /debug once again, but that would suck.
Another option that sucks is writing and reading to the same filedesc;
something like:
exec 3<> /debug/page_tables/pid_user
echo $pid >&3
cat - <&3
that way you can have multiple concurrent users.
Powered by blists - more mailing lists