lkml.org 
[lkml]   [2005]   [Aug]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [Question] arch-independent way to differentiate between user and kernel

* Steven Rostedt <rostedt@goodmis.org> wrote:

> Hi all,
>
> I'm dealing with a problem where I want to know from __do_IRQ in
> kernel/irq/handle.c if the interrupt occurred while the process was in
> user space or kernel space. But the trick here is that it must work
> on all architectures.
>
> Does anyone know of some way that that function can tell if it had
> interrupted the kernel or user space? I know of serveral
> arch-dependent ways, but that's not acceptable right now.

i dont think there's any. user_mode(regs) gets the closest - it might
make sense to generalize it over all arches.

update_process_times() gets an arch-independent 'was the tick user-space
or kernel-space' flag, so the best starting point would be to look at
the output of:

for N in `find . -name '*.c' | xargs grep update_process_times |
grep arch`; do echo $N; done | grep update_process_times |
sort | uniq -c

which gives:

2 update_process_times()
1 update_process_times(CHOOSE_MODE(user_context(UPT_SP(regs)),
6 update_process_times(user);
1 update_process_times(user_mode(fp));
33 update_process_times(user_mode(regs));
2 update_process_times(user_mode_vm(regs));

so ~33 calls use user_mode(regs), and the rest needs to be reviewed and
possibly changed. Looks doable.

Ingo
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-08-03 12:51    [W:0.119 / U:0.204 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site