[RFC patch] use thread.on_ustack to determine if on user stack

Luming Yu
2007-09-29T07:53:43Z

[-- Attachment #1: Type: text/plain, Size: 454 bytes --]

Hello list,

The PSR.lp bit of kernel thread kondemand sometimes would be set, then
causes set_pstate PAL call fails with invalid argument. I tracked down
to the place that the PSR.lp was set in do_notify_resume_user. I don't
understand why not use task->thread.on_ustack to
check if on user stack.in the first place. For optimization?

Signed-off-by: Yu Luming <luming.yu@intel.com>

ptrace.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: user_stack.patch --]
[-- Type: text/x-patch; name="user_stack.patch", Size: 670 bytes --]

--- linux-2.6.18.ia64/include/asm-ia64/ptrace.h.0 2007-09-28 21:41:19.000000000 +0800
+++ linux-2.6.18.ia64/include/asm-ia64/ptrace.h 2007-09-28 21:41:40.000000000 +0800
@@ -257,7 +257,7 @@
# define task_pt_regs(t) (((struct pt_regs *) ((char *) (t) + IA64_STK_OFFSET)) - 1)
# define ia64_psr(regs) ((struct ia64_psr *) &(regs)->cr_ipsr)
# define user_mode(regs) (((struct ia64_psr *) &(regs)->cr_ipsr)->cpl != 0)
-# define user_stack(task,regs) ((long) regs - (long) task == IA64_STK_OFFSET - sizeof(*regs))
+# define user_stack(task,regs) (task->thread.on_ustack)
# define fsys_mode(task,regs) \
({ \
struct task_struct *_task = (task); \