Re: [patch] sched: unlocked context-switches

2005-04-12 Thread Nick Piggin
David Mosberger wrote: On Tue, 12 Apr 2005 12:12:45 +1000, Nick Piggin <[EMAIL PROTECTED]> said: >> Now, Ingo says that the order is reversed with his patch, i.e., >> switch_mm() happens after switch_to(). That means flush_tlb_mm() >> may now see a current->active_mm which hasn't really

Re: [patch] sched: unlocked context-switches

2005-04-12 Thread David Mosberger
> On Tue, 12 Apr 2005 08:42:53 +0200, Ingo Molnar <[EMAIL PROTECTED]> said: Ingo> * David Mosberger <[EMAIL PROTECTED]> wrote: >> Now, Ingo says that the order is reversed with his patch, i.e., >> switch_mm() happens after switch_to(). That means flush_tlb_mm() >> may now see a

Re: [patch] sched: unlocked context-switches

2005-04-12 Thread David Mosberger
> On Tue, 12 Apr 2005 12:12:45 +1000, Nick Piggin <[EMAIL PROTECTED]> said: >> Now, Ingo says that the order is reversed with his patch, i.e., >> switch_mm() happens after switch_to(). That means flush_tlb_mm() >> may now see a current->active_mm which hasn't really been >> activated

Re: [patch] sched: unlocked context-switches

2005-04-12 Thread Ingo Molnar
* David Mosberger <[EMAIL PROTECTED]> wrote: > Now, Ingo says that the order is reversed with his patch, i.e., > switch_mm() happens after switch_to(). That means flush_tlb_mm() may > now see a current->active_mm which hasn't really been activated yet. > That should be OK since it would

Re: [patch] sched: unlocked context-switches

2005-04-12 Thread Ingo Molnar
* David Mosberger [EMAIL PROTECTED] wrote: Now, Ingo says that the order is reversed with his patch, i.e., switch_mm() happens after switch_to(). That means flush_tlb_mm() may now see a current-active_mm which hasn't really been activated yet. That should be OK since it would just mean

Re: [patch] sched: unlocked context-switches

2005-04-12 Thread David Mosberger
On Tue, 12 Apr 2005 12:12:45 +1000, Nick Piggin [EMAIL PROTECTED] said: Now, Ingo says that the order is reversed with his patch, i.e., switch_mm() happens after switch_to(). That means flush_tlb_mm() may now see a current-active_mm which hasn't really been activated yet. Nick If

Re: [patch] sched: unlocked context-switches

2005-04-12 Thread David Mosberger
On Tue, 12 Apr 2005 08:42:53 +0200, Ingo Molnar [EMAIL PROTECTED] said: Ingo * David Mosberger [EMAIL PROTECTED] wrote: Now, Ingo says that the order is reversed with his patch, i.e., switch_mm() happens after switch_to(). That means flush_tlb_mm() may now see a current-active_mm

Re: [patch] sched: unlocked context-switches

2005-04-12 Thread Nick Piggin
David Mosberger wrote: On Tue, 12 Apr 2005 12:12:45 +1000, Nick Piggin [EMAIL PROTECTED] said: Now, Ingo says that the order is reversed with his patch, i.e., switch_mm() happens after switch_to(). That means flush_tlb_mm() may now see a current-active_mm which hasn't really been

Re: [patch] sched: unlocked context-switches

2005-04-11 Thread Nick Piggin
On Mon, 2005-04-11 at 18:06 -0700, David Mosberger wrote: > I had to refresh my memory with a quick Google search that netted [1] > (look for "Disable interrupts during context switch"). Actually, it > wasn't really a deadlock, but rather a livelock, since a CPU got stuck > on an infinite

Re: [patch] sched: unlocked context-switches

2005-04-11 Thread David Mosberger
> On Sun, 10 Apr 2005 08:43:24 +0200, Ingo Molnar <[EMAIL PROTECTED]> said: Ingo> * David S. Miller <[EMAIL PROTECTED]> wrote: >> > Yes, of course. The deadlock was due to context-switching, not >> > switch_mm() per se. Hopefully someone else beats me to >> remembering > the

Re: [patch] sched: unlocked context-switches

2005-04-11 Thread David Mosberger
On Sun, 10 Apr 2005 08:43:24 +0200, Ingo Molnar [EMAIL PROTECTED] said: Ingo * David S. Miller [EMAIL PROTECTED] wrote: Yes, of course. The deadlock was due to context-switching, not switch_mm() per se. Hopefully someone else beats me to remembering the details before Monday.

Re: [patch] sched: unlocked context-switches

2005-04-11 Thread Nick Piggin
On Mon, 2005-04-11 at 18:06 -0700, David Mosberger wrote: I had to refresh my memory with a quick Google search that netted [1] (look for Disable interrupts during context switch). Actually, it wasn't really a deadlock, but rather a livelock, since a CPU got stuck on an infinite

Re: [patch] sched: unlocked context-switches

2005-04-10 Thread Richard Henderson
On Sat, Apr 09, 2005 at 03:46:12PM -0700, David S. Miller wrote: > On Sat, 09 Apr 2005 19:22:23 +1000 > Benjamin Herrenschmidt <[EMAIL PROTECTED]> wrote: > > > ppc64 already has a local_irq_save/restore in switch_to, around the low > > level asm bits, so it should be fine. > > Sparc64

Re: [patch] sched: unlocked context-switches

2005-04-10 Thread Ingo Molnar
* David S. Miller <[EMAIL PROTECTED]> wrote: > > Yes, of course. The deadlock was due to context-switching, not > > switch_mm() per se. Hopefully someone else beats me to remembering > > the details before Monday. > > Sparc64 has a deadlock because we hold mm->page_table_lock during >

Re: [patch] sched: unlocked context-switches

2005-04-10 Thread Ingo Molnar
* David S. Miller [EMAIL PROTECTED] wrote: Yes, of course. The deadlock was due to context-switching, not switch_mm() per se. Hopefully someone else beats me to remembering the details before Monday. Sparc64 has a deadlock because we hold mm-page_table_lock during switch_mm(). I

Re: [patch] sched: unlocked context-switches

2005-04-10 Thread Richard Henderson
On Sat, Apr 09, 2005 at 03:46:12PM -0700, David S. Miller wrote: On Sat, 09 Apr 2005 19:22:23 +1000 Benjamin Herrenschmidt [EMAIL PROTECTED] wrote: ppc64 already has a local_irq_save/restore in switch_to, around the low level asm bits, so it should be fine. Sparc64 essentially does as

Re: [patch] sched: unlocked context-switches

2005-04-09 Thread David S. Miller
On Sat, 9 Apr 2005 00:15:37 -0700 David Mosberger <[EMAIL PROTECTED]> wrote: > Yes, of course. The deadlock was due to context-switching, not > switch_mm() per se. Hopefully someone else beats me to remembering > the details before Monday. Sparc64 has a deadlock because we hold

Re: [patch] sched: unlocked context-switches

2005-04-09 Thread David S. Miller
On Sat, 09 Apr 2005 19:22:23 +1000 Benjamin Herrenschmidt <[EMAIL PROTECTED]> wrote: > ppc64 already has a local_irq_save/restore in switch_to, around the low > level asm bits, so it should be fine. Sparc64 essentially does as well. In fact, it uses an IRQ disable which is stronger than

Re: [patch] sched: unlocked context-switches

2005-04-09 Thread Benjamin Herrenschmidt
On Sat, 2005-04-09 at 06:38 +0200, Ingo Molnar wrote: > * Luck, Tony <[EMAIL PROTECTED]> wrote: > > > >tested on x86, and all other arches should work as well, but if an > > >architecture has irqs-off assumptions in its switch_to() logic > > >it might break. (I havent found any but there may

Re: [patch] sched: unlocked context-switches

2005-04-09 Thread David Mosberger
> On Sat, 9 Apr 2005 09:07:38 +0200, Ingo Molnar <[EMAIL PROTECTED]> said: Ingo> * David Mosberger-Tang <[EMAIL PROTECTED]> wrote: >> > The ia64_switch_to() code includes a section that can change a >> > pinned MMU mapping (when the stack for the new process is in a >> > different

Re: [patch] sched: unlocked context-switches

2005-04-09 Thread Nick Piggin
Ingo Molnar wrote: * Nick Piggin <[EMAIL PROTECTED]> wrote: I did propose doing unconditionally unlocked switches a while back when my patch first popped up - you were against it then, but I guess you've had second thoughts? the reordering of switch_to() and the switch_mm()-related logic was

Re: [patch] sched: unlocked context-switches

2005-04-09 Thread Ingo Molnar
* David Mosberger-Tang <[EMAIL PROTECTED]> wrote: > > The ia64_switch_to() code includes a section that can change a > > pinned MMU mapping (when the stack for the new process is in a > > different granule from the stack for the old process). The code > > beyond the ".map" label in

Re: [patch] sched: unlocked context-switches

2005-04-09 Thread Ingo Molnar
* Nick Piggin <[EMAIL PROTECTED]> wrote: > Well that does look like a pretty good cleanup. It certainly is the > final step in freeing complex architecture switching code from > entanglement with scheduler internal locking, and unifies the locking > scheme. > > I did propose doing

Re: [patch] sched: unlocked context-switches

2005-04-09 Thread David Mosberger-Tang
> Tony: >> Ingo: >> tested on x86, and all other arches should work as well, but if an >> architecture has irqs-off assumptions in its switch_to() logic it >> might break. (I havent found any but there may such assumptions.) > The ia64_switch_to() code includes a section that can change

Re: [patch] sched: unlocked context-switches

2005-04-09 Thread Nick Piggin
Ingo Molnar wrote: * Luck, Tony <[EMAIL PROTECTED]> wrote: tested on x86, and all other arches should work as well, but if an architecture has irqs-off assumptions in its switch_to() logic it might break. (I havent found any but there may such assumptions.) The ia64_switch_to() code includes a

Re: [patch] sched: unlocked context-switches

2005-04-09 Thread Nick Piggin
Ingo Molnar wrote: * Luck, Tony [EMAIL PROTECTED] wrote: tested on x86, and all other arches should work as well, but if an architecture has irqs-off assumptions in its switch_to() logic it might break. (I havent found any but there may such assumptions.) The ia64_switch_to() code includes a

Re: [patch] sched: unlocked context-switches

2005-04-09 Thread David Mosberger-Tang
Tony: Ingo: tested on x86, and all other arches should work as well, but if an architecture has irqs-off assumptions in its switch_to() logic it might break. (I havent found any but there may such assumptions.) The ia64_switch_to() code includes a section that can change a pinned

Re: [patch] sched: unlocked context-switches

2005-04-09 Thread Ingo Molnar
* Nick Piggin [EMAIL PROTECTED] wrote: Well that does look like a pretty good cleanup. It certainly is the final step in freeing complex architecture switching code from entanglement with scheduler internal locking, and unifies the locking scheme. I did propose doing unconditionally

Re: [patch] sched: unlocked context-switches

2005-04-09 Thread Ingo Molnar
* David Mosberger-Tang [EMAIL PROTECTED] wrote: The ia64_switch_to() code includes a section that can change a pinned MMU mapping (when the stack for the new process is in a different granule from the stack for the old process). The code beyond the .map label in

Re: [patch] sched: unlocked context-switches

2005-04-09 Thread Nick Piggin
Ingo Molnar wrote: * Nick Piggin [EMAIL PROTECTED] wrote: I did propose doing unconditionally unlocked switches a while back when my patch first popped up - you were against it then, but I guess you've had second thoughts? the reordering of switch_to() and the switch_mm()-related logic was

Re: [patch] sched: unlocked context-switches

2005-04-09 Thread David Mosberger
On Sat, 9 Apr 2005 09:07:38 +0200, Ingo Molnar [EMAIL PROTECTED] said: Ingo * David Mosberger-Tang [EMAIL PROTECTED] wrote: The ia64_switch_to() code includes a section that can change a pinned MMU mapping (when the stack for the new process is in a different granule from the

Re: [patch] sched: unlocked context-switches

2005-04-09 Thread Benjamin Herrenschmidt
On Sat, 2005-04-09 at 06:38 +0200, Ingo Molnar wrote: * Luck, Tony [EMAIL PROTECTED] wrote: tested on x86, and all other arches should work as well, but if an architecture has irqs-off assumptions in its switch_to() logic it might break. (I havent found any but there may such

Re: [patch] sched: unlocked context-switches

2005-04-09 Thread David S. Miller
On Sat, 09 Apr 2005 19:22:23 +1000 Benjamin Herrenschmidt [EMAIL PROTECTED] wrote: ppc64 already has a local_irq_save/restore in switch_to, around the low level asm bits, so it should be fine. Sparc64 essentially does as well. In fact, it uses an IRQ disable which is stronger than

Re: [patch] sched: unlocked context-switches

2005-04-09 Thread David S. Miller
On Sat, 9 Apr 2005 00:15:37 -0700 David Mosberger [EMAIL PROTECTED] wrote: Yes, of course. The deadlock was due to context-switching, not switch_mm() per se. Hopefully someone else beats me to remembering the details before Monday. Sparc64 has a deadlock because we hold mm-page_table_lock

Re: [patch] sched: unlocked context-switches

2005-04-08 Thread Ingo Molnar
* Luck, Tony <[EMAIL PROTECTED]> wrote: > >tested on x86, and all other arches should work as well, but if an > >architecture has irqs-off assumptions in its switch_to() logic > >it might break. (I havent found any but there may such assumptions.) > > The ia64_switch_to() code includes a

RE: [patch] sched: unlocked context-switches

2005-04-08 Thread Luck, Tony
>tested on x86, and all other arches should work as well, but if an >architecture has irqs-off assumptions in its switch_to() logic >it might break. (I havent found any but there may such assumptions.) The ia64_switch_to() code includes a section that can change a pinned MMU mapping (when the

[patch] sched: unlocked context-switches

2005-04-08 Thread Ingo Molnar
the scheduler still has a complex maze of locking in the *arch_switch() / *lock_switch() code. Different arches do it differently, creating diverging context-switch behavior. There are now 3 variants: fully locked, unlocked but irqs-off, unlocked and irqs-on. Nick has cleaned them up in

[patch] sched: unlocked context-switches

2005-04-08 Thread Ingo Molnar
the scheduler still has a complex maze of locking in the *arch_switch() / *lock_switch() code. Different arches do it differently, creating diverging context-switch behavior. There are now 3 variants: fully locked, unlocked but irqs-off, unlocked and irqs-on. Nick has cleaned them up in

RE: [patch] sched: unlocked context-switches

2005-04-08 Thread Luck, Tony
tested on x86, and all other arches should work as well, but if an architecture has irqs-off assumptions in its switch_to() logic it might break. (I havent found any but there may such assumptions.) The ia64_switch_to() code includes a section that can change a pinned MMU mapping (when the

Re: [patch] sched: unlocked context-switches

2005-04-08 Thread Ingo Molnar
* Luck, Tony [EMAIL PROTECTED] wrote: tested on x86, and all other arches should work as well, but if an architecture has irqs-off assumptions in its switch_to() logic it might break. (I havent found any but there may such assumptions.) The ia64_switch_to() code includes a section that