* Re: [patch] Resched skip_rbs_switch to run 4 cycles faster on McKinley-type cores.
2005-01-19 5:00 [patch] Resched skip_rbs_switch to run 4 cycles faster on McKinley-type cores David Mosberger
@ 2005-01-19 22:25 ` Keith Owens
2005-01-20 6:50 ` David Mosberger
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Keith Owens @ 2005-01-19 22:25 UTC (permalink / raw)
To: linux-ia64
Damn, I was in the middle of developing a patch against this area :(.
David, since you are redoing some of this code, I probably need to
discuss my changes. My aim is to allow the kernel unwinder to work on
the per-cpu MCA and INIT stacks that Russ Anderson (rja) recently
added. This has never been an issue before because we only had one
stack and could not handle INIT over MCA.
The problem with unwinding from the MCA or INIT stacks is handling the
change of rbs. The current code assumes that all kernel work is done
on the same rbs, which is not true for the MCA and INIT stacks. I plan
to change the meaning of pt_regs ar_bspstore and ar_rnat. Instead of
being garbage when the interrupted code was in the kernel, ar_bspstore
and ar_rnat are set to zero. The test for "do I skip_rbs_switch"
changes from pUStk to "is saved ar_bspstore non-zero".
Interrupts in kernel context save a zero ar_bspstore and skip the rbs
swicth on return from interrupt. Interrupts in user context save a
valid ar_bspstore and switch rbs on exit. MCA and INIT events will
synthesize and save struct pt_regs on the MCA/INIT stack, this pt_regs
will contain non-zero ar_bspstore pointing back to the previous bsp,
which could be in a kernel or user space stack.
Comments?
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [patch] Resched skip_rbs_switch to run 4 cycles faster on McKinley-type cores.
2005-01-19 5:00 [patch] Resched skip_rbs_switch to run 4 cycles faster on McKinley-type cores David Mosberger
2005-01-19 22:25 ` Keith Owens
@ 2005-01-20 6:50 ` David Mosberger
2005-01-20 10:26 ` Keith Owens
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: David Mosberger @ 2005-01-20 6:50 UTC (permalink / raw)
To: linux-ia64
>>>>> On Thu, 20 Jan 2005 09:25:35 +1100, Keith Owens <kaos@sgi.com> said:
Keith> Damn, I was in the middle of developing a patch against this
Keith> area :(.
Oops.
Keith> Instead of being garbage when the interrupted code was in the
Keith> kernel, ar_bspstore and ar_rnat are set to zero. The test
Keith> for "do I skip_rbs_switch" changes from pUStk to "is saved
Keith> ar_bspstore non-zero".
Wouldn't this prevent user-level code from setting ar.bspstore to
zero? I'm not sure we should nail that into the kernel (by default
the first page is a NaT page, so it's not likely to be a real problem
as of today).
Keith> Comments?
Libunwind does support multiple register backing-stores, but since we
cannot unwind across firmware, I'm not sure whether this by itself
would make your life easier. If it would, let me know.
--david
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [patch] Resched skip_rbs_switch to run 4 cycles faster on McKinley-type cores.
2005-01-19 5:00 [patch] Resched skip_rbs_switch to run 4 cycles faster on McKinley-type cores David Mosberger
2005-01-19 22:25 ` Keith Owens
2005-01-20 6:50 ` David Mosberger
@ 2005-01-20 10:26 ` Keith Owens
2005-01-20 17:01 ` David Mosberger
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Keith Owens @ 2005-01-20 10:26 UTC (permalink / raw)
To: linux-ia64
On Wed, 19 Jan 2005 22:50:07 -0800,
David Mosberger <davidm@napali.hpl.hp.com> wrote:
>>>>>> On Thu, 20 Jan 2005 09:25:35 +1100, Keith Owens <kaos@sgi.com> said:
>
> Keith> Instead of being garbage when the interrupted code was in the
> Keith> kernel, ar_bspstore and ar_rnat are set to zero. The test
> Keith> for "do I skip_rbs_switch" changes from pUStk to "is saved
> Keith> ar_bspstore non-zero".
>
>Wouldn't this prevent user-level code from setting ar.bspstore to
>zero? I'm not sure we should nail that into the kernel (by default
>the first page is a NaT page, so it's not likely to be a real problem
>as of today).
Good point, use ar_bspstore = 1 to mean no rbs switch required.
> Keith> Comments?
>
>Libunwind does support multiple register backing-stores, but since we
>cannot unwind across firmware, I'm not sure whether this by itself
>would make your life easier. If it would, let me know.
It would help, if libunwind were in the kernel.
Unwinding across firmware is not an issue here, we have two views of
the MCA/INIT context. One view is "how to return to SAL?", that data
is stored outside the stack. The other view is "what was the cpu doing
when the event occurred?". It is the latter that I am working on.
From the point of view of unwind, I want the MCA/INIT to look like a
normal interrupt, with the addition of separate backing store. That
will let us backtrace during MCA/INIT processing to see what the cpu
was really doing. SAL will not appear in the backtrace at all.
One side effect of this change is that the unwinder needs an MCA/INIT
safe allocator. The existing code uses kmalloc which works most of the
time, but some MCA/INIT traces have been killed by the unwinder calling
kmalloc when the slab structures were inconsistent. I recently added
an MCA/INIT safe, last ditch allocator to kdb, so we can get
diagnostics even when GFP_ATOMIC has been exhausted and in MCA/INIT.
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [patch] Resched skip_rbs_switch to run 4 cycles faster on McKinley-type cores.
2005-01-19 5:00 [patch] Resched skip_rbs_switch to run 4 cycles faster on McKinley-type cores David Mosberger
` (2 preceding siblings ...)
2005-01-20 10:26 ` Keith Owens
@ 2005-01-20 17:01 ` David Mosberger
2005-01-28 2:08 ` David Mosberger
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: David Mosberger @ 2005-01-20 17:01 UTC (permalink / raw)
To: linux-ia64
>>>>> On Thu, 20 Jan 2005 21:26:18 +1100, Keith Owens <kaos@sgi.com> said:
Keith> It would help, if libunwind were in the kernel.
OK, it does sound like I need to get going with this. Fortunately,
it's nearing the top of my to-do-list. I'll see if I can get this
going next week.
Keith> One side effect of this change is that the unwinder needs an
Keith> MCA/INIT safe allocator.
Libunwind already has that. Need to double-check that it's MCA/INIT safe,
but if it isn't already, it should be real close.
--david
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [patch] Resched skip_rbs_switch to run 4 cycles faster on McKinley-type cores.
2005-01-19 5:00 [patch] Resched skip_rbs_switch to run 4 cycles faster on McKinley-type cores David Mosberger
` (3 preceding siblings ...)
2005-01-20 17:01 ` David Mosberger
@ 2005-01-28 2:08 ` David Mosberger
2005-01-28 3:04 ` Keith Owens
2005-01-28 5:22 ` David Mosberger
6 siblings, 0 replies; 8+ messages in thread
From: David Mosberger @ 2005-01-28 2:08 UTC (permalink / raw)
To: linux-ia64
>>>>> On Thu, 20 Jan 2005 21:26:18 +1100, Keith Owens <kaos@sgi.com> said:
Keith> Unwinding across firmware is not an issue here, we have two
Keith> views of the MCA/INIT context. One view is "how to return to
Keith> SAL?", that data is stored outside the stack. The other view
Keith> is "what was the cpu doing when the event occurred?". It is
Keith> the latter that I am working on.
How is this different from the "unw_init_from_interruption" call that
we're doing in mca.c:init_handler_platform()?
--david
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [patch] Resched skip_rbs_switch to run 4 cycles faster on McKinley-type cores.
2005-01-19 5:00 [patch] Resched skip_rbs_switch to run 4 cycles faster on McKinley-type cores David Mosberger
` (4 preceding siblings ...)
2005-01-28 2:08 ` David Mosberger
@ 2005-01-28 3:04 ` Keith Owens
2005-01-28 5:22 ` David Mosberger
6 siblings, 0 replies; 8+ messages in thread
From: Keith Owens @ 2005-01-28 3:04 UTC (permalink / raw)
To: linux-ia64
On Thu, 27 Jan 2005 18:08:18 -0800,
David Mosberger <davidm@napali.hpl.hp.com> wrote:
>>>>>> On Thu, 20 Jan 2005 21:26:18 +1100, Keith Owens <kaos@sgi.com> said:
>
> Keith> Unwinding across firmware is not an issue here, we have two
> Keith> views of the MCA/INIT context. One view is "how to return to
> Keith> SAL?", that data is stored outside the stack. The other view
> Keith> is "what was the cpu doing when the event occurred?". It is
> Keith> the latter that I am working on.
>
>How is this different from the "unw_init_from_interruption" call that
>we're doing in mca.c:init_handler_platform()?
That only works for the INIT call which uses the current bspstore, MCA
uses its own bspstore. The kernel unwinder is not set up to switch
bspstore between two kernel stacks, only between kernel and user space.
The INIT call will change to its own bspstore once we use the separate
INIT and MCA stacks for each cpu.
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [patch] Resched skip_rbs_switch to run 4 cycles faster on McKinley-type cores.
2005-01-19 5:00 [patch] Resched skip_rbs_switch to run 4 cycles faster on McKinley-type cores David Mosberger
` (5 preceding siblings ...)
2005-01-28 3:04 ` Keith Owens
@ 2005-01-28 5:22 ` David Mosberger
6 siblings, 0 replies; 8+ messages in thread
From: David Mosberger @ 2005-01-28 5:22 UTC (permalink / raw)
To: linux-ia64
>>>>> On Fri, 28 Jan 2005 14:04:35 +1100, Keith Owens <kaos@sgi.com> said:
>> How is this different from the "unw_init_from_interruption" call
>> that we're doing in mca.c:init_handler_platform()?
Keith> That only works for the INIT call which uses the current
Keith> bspstore, MCA uses its own bspstore.
Ah, OK, I understand now what you're after.
Thanks,
--david
PS: For what it's woth, I did start work on a libunwind-enabled kernel.
^ permalink raw reply [flat|nested] 8+ messages in thread