mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: [patch, 2.6.10-rc3] safe_hlt() & NMIs
@ 2004-12-17 23:35 Chuck Ebbert
  0 siblings, 0 replies; 21+ messages in thread
From: Chuck Ebbert @ 2004-12-17 23:35 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel, Andi Kleen, Andrew Morton

On Tue, 14 Dec 2004 at 15:00:56 -0800 (PST) Linus Torvalds wrote:

> Checking for kernel CS also requires checking that it's not vm86 mode, 
> btw. So that's not just a "regs->xcs & 0xffff == __KERNEL_CS" either.
>
> But something like
> 
>       static inline int kernel_mode(struct pt_regs *regs)
>       {
>               return !((regs->eflags & VM_MASK) | (regs->xcs & 3));
>       }
>
> should DTRT.
>
> Can you pls double-check my thinking, and test?


 There is already a user_mode() macro in asm-i386/ptrace.h but it's slow.

 x86_64's macro is ugly but at least there's no logical-or in it.

 Your i386 code is better, so how about applying this patch (boots/runs/is faster
on my tests):

Signed-off-by: Chuck Ebbert <76306.1226@compuserve.com>

--- linux-2.6.9.1/include/asm-i386/ptrace.h     2004-10-19 15:28:18.000000000 -0400
+++ linux-2.6.9.2/include/asm-i386/ptrace.h     2004-12-17 16:59:39.956099664 -0500
@@ -55,7 +55,11 @@ struct pt_regs {
 #define PTRACE_SET_THREAD_AREA    26
 
 #ifdef __KERNEL__
-#define user_mode(regs) ((VM_MASK & (regs)->eflags) || (3 & (regs)->xcs))
+static inline int kernel_mode(struct pt_regs *regs)
+{
+       return !((3 & (regs)->xcs) | (VM_MASK & (regs)->eflags));
+}
+#define user_mode(regs) (!kernel_mode(regs))
 #define instruction_pointer(regs) ((regs)->eip)
 #if defined(CONFIG_SMP) && defined(CONFIG_FRAME_POINTER)
 extern unsigned long profile_pc(struct pt_regs *regs);

--
Please take it as a sign of my infinite respect for you,
that I insist on you doing all the work.
                                        -- Rusty Russell

^ permalink raw reply	[flat|nested] 21+ messages in thread
* Re: RCU question
@ 2004-12-11  3:29 George Anzinger
  2004-12-11 14:52 ` Zwane Mwaikambo
  0 siblings, 1 reply; 21+ messages in thread
From: George Anzinger @ 2004-12-11  3:29 UTC (permalink / raw)
  To: Zwane Mwaikambo; +Cc: Lee Revell, dipankar, ganzinger, Manfred Spraul, lkml

Zwane Mwaikambo wrote:
> On Fri, 10 Dec 2004, George Anzinger wrote:
> 
> 
>>>But that's a deadlock and if you enable interrupts you race.
>>
>>Again, I remind you we are in the idle task.  Nothing more important to do.
>>Or do you mean that softirq_pending() will NEVER return false?
>>
>>The other question is: "Is useful work being done?"
> 
> 
> We're in the idle task but obviously interrupts (such as network) are 
> still coming in. So you may take an interrupt after your while 
> (softirq_pending()) loop has exited.

That is ok.  Either we have interrupts off and no softirqs are pending and we 
proceed to the "hlt" (where the interrupt will be taken), or softirqs are 
pending, we turn interrupts on, do the softirq, turn interrupts off and try 
again.  Unless some tasklet (RCU?) never "gives up" or we will exit the while 
with interrupts off and move on to the "hlt".  Or did I miss something?
-
George Anzinger   george@mvista.com
High-res-timers:  http://sourceforge.net/projects/high-res-timers/


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2004-12-17 23:38 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-17 23:35 [patch, 2.6.10-rc3] safe_hlt() & NMIs Chuck Ebbert
  -- strict thread matches above, loose matches on Subject: below --
2004-12-11  3:29 RCU question George Anzinger
2004-12-11 14:52 ` Zwane Mwaikambo
2004-12-11 16:32   ` Manfred Spraul
2004-12-11 16:52     ` George Anzinger
2004-12-12  2:53       ` Zwane Mwaikambo
2004-12-12  8:59         ` Manfred Spraul
2004-12-12  9:37           ` Andrea Arcangeli
2004-12-12 10:22             ` Manfred Spraul
2004-12-12 12:15               ` Andrea Arcangeli
2004-12-14 21:40                 ` Lee Revell
2004-12-14 22:23                   ` [patch, 2.6.10-rc3] safe_hlt() & NMIs Ingo Molnar
2004-12-14 22:47                     ` Ingo Molnar
2004-12-14 23:09                       ` Linus Torvalds
2004-12-15  8:52                         ` Ingo Molnar
2004-12-15 15:44                           ` Linus Torvalds
2004-12-15 16:35                             ` Ingo Molnar
2004-12-16  0:37                         ` Alan Cox
2004-12-16  1:58                           ` Linus Torvalds
2004-12-16 14:51                             ` Ingo Molnar
2004-12-16 15:08                               ` Maciej W. Rozycki
2004-12-16 15:11                                 ` Ingo Molnar
2004-12-16 15:42                                   ` Maciej W. Rozycki
2004-12-16 15:54                               ` Linus Torvalds
2004-12-16  2:10                           ` Zwane Mwaikambo
2004-12-16 13:26                             ` Alan Cox
2004-12-14 23:41                       ` Andrea Arcangeli
2004-12-14 23:00                     ` Linus Torvalds
2004-12-15  5:04                       ` Andi Kleen
2004-12-15  6:27                     ` Avi Kivity
2004-12-15  8:51                       ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®