All of lore.kernel.org
 help / color / mirror / Atom feed
From: james.morse@arm.com (James Morse)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3] arm64: Introduce IRQ stack
Date: Fri, 02 Oct 2015 17:23:59 +0100	[thread overview]
Message-ID: <560EAF9F.6090604@arm.com> (raw)
In-Reply-To: <1442923918-11289-1-git-send-email-jungseoklee85@gmail.com>

Hi,

On 22/09/15 13:11, Jungseok Lee wrote:
> Currently, kernel context and interrupts are handled using a single
> kernel stack navigated by sp_el1. This forces a system to use 16KB
> stack, not 8KB one. This restriction makes low memory platforms suffer
> from memory pressure accompanied by performance degradation.
> 
> This patch addresses the issue as introducing a separate percpu IRQ
> stack to handle both hard and soft interrupts with two ground rules:
> 
>   - Utilize sp_el0 in EL1 context, which is not used currently
>   - Do not complicate current_thread_info calculation
> 
> It is a core concept to directly retrieve struct thread_info from
> sp_el0. This approach helps to prevent text section size from being
> increased largely as removing masking operation using THREAD_SIZE
> in tons of places.

One observed change in behaviour:
Any stack-unwinding now stops at el1_irq(), which is the bottom of the irq
stack. This shows up with perf (using incantation [0]), and with any calls
to dump_stack() (which actually stops the frame before el1_irq()).

I don't know if this will break something, (perf still seems to work) - but
it makes the panic() output less useful, as all the 'other' cpus print:

> CPU3: stopping
> CPU: 3 PID: 0 Comm: swapper/3 Not tainted 4.3.0-rc3+ #223
> Hardware name: ARM Juno development board (r1) (DT)
> Call trace:
> [<ffff800000089878>] dump_backtrace+0x0/0x164
> [<ffff8000000899f8>] show_stack+0x1c/0x28
> [<ffff8000003134d0>] dump_stack+0x88/0xc8
> [<ffff80000008edcc>] handle_IPI+0x258/0x268
> [<ffff8000000824b8>] gic_handle_irq+0x88/0xa4
> Exception stack(0xffff8009769e3fc0 to 0xffff8009769e40e0)
> <...values from stack ...>
> CPU4: stopping
> CPU: 4 PID: 0 Comm: swapper/4 Not tainted 4.3.0-rc3+ #223
> Hardware name: ARM Juno development board (r1) (DT)
> Call trace:

So we don't get to see what they were doing, as the IPI-irq and subsequent
switch to the irq_stack hide the state.

I was trying to fix this with the other version, (see the changes to
kernel/stacktrace.c), but as Akashi Takahiro pointed out, I wasn't quite
right...

I will try to produce a fragment to tidy this up next week.


Thanks,

James

[0] perf record -e mem:<address of __do_softirq()>:x -ag -- sleep 10;
    perf report --call-graph --stdio

WARNING: multiple messages have this Message-ID (diff)
From: James Morse <james.morse@arm.com>
To: Jungseok Lee <jungseoklee85@gmail.com>
Cc: Catalin Marinas <Catalin.Marinas@arm.com>,
	Will Deacon <Will.Deacon@arm.com>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"takahiro.akashi@linaro.org" <takahiro.akashi@linaro.org>,
	Mark Rutland <Mark.Rutland@arm.com>,
	"barami97@gmail.com" <barami97@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3] arm64: Introduce IRQ stack
Date: Fri, 02 Oct 2015 17:23:59 +0100	[thread overview]
Message-ID: <560EAF9F.6090604@arm.com> (raw)
In-Reply-To: <1442923918-11289-1-git-send-email-jungseoklee85@gmail.com>

Hi,

On 22/09/15 13:11, Jungseok Lee wrote:
> Currently, kernel context and interrupts are handled using a single
> kernel stack navigated by sp_el1. This forces a system to use 16KB
> stack, not 8KB one. This restriction makes low memory platforms suffer
> from memory pressure accompanied by performance degradation.
> 
> This patch addresses the issue as introducing a separate percpu IRQ
> stack to handle both hard and soft interrupts with two ground rules:
> 
>   - Utilize sp_el0 in EL1 context, which is not used currently
>   - Do not complicate current_thread_info calculation
> 
> It is a core concept to directly retrieve struct thread_info from
> sp_el0. This approach helps to prevent text section size from being
> increased largely as removing masking operation using THREAD_SIZE
> in tons of places.

One observed change in behaviour:
Any stack-unwinding now stops at el1_irq(), which is the bottom of the irq
stack. This shows up with perf (using incantation [0]), and with any calls
to dump_stack() (which actually stops the frame before el1_irq()).

I don't know if this will break something, (perf still seems to work) - but
it makes the panic() output less useful, as all the 'other' cpus print:

> CPU3: stopping
> CPU: 3 PID: 0 Comm: swapper/3 Not tainted 4.3.0-rc3+ #223
> Hardware name: ARM Juno development board (r1) (DT)
> Call trace:
> [<ffff800000089878>] dump_backtrace+0x0/0x164
> [<ffff8000000899f8>] show_stack+0x1c/0x28
> [<ffff8000003134d0>] dump_stack+0x88/0xc8
> [<ffff80000008edcc>] handle_IPI+0x258/0x268
> [<ffff8000000824b8>] gic_handle_irq+0x88/0xa4
> Exception stack(0xffff8009769e3fc0 to 0xffff8009769e40e0)
> <...values from stack ...>
> CPU4: stopping
> CPU: 4 PID: 0 Comm: swapper/4 Not tainted 4.3.0-rc3+ #223
> Hardware name: ARM Juno development board (r1) (DT)
> Call trace:

So we don't get to see what they were doing, as the IPI-irq and subsequent
switch to the irq_stack hide the state.

I was trying to fix this with the other version, (see the changes to
kernel/stacktrace.c), but as Akashi Takahiro pointed out, I wasn't quite
right...

I will try to produce a fragment to tidy this up next week.


Thanks,

James

[0] perf record -e mem:<address of __do_softirq()>:x -ag -- sleep 10;
    perf report --call-graph --stdio




  parent reply	other threads:[~2015-10-02 16:23 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-22 12:11 [PATCH v3] arm64: Introduce IRQ stack Jungseok Lee
2015-09-22 12:11 ` Jungseok Lee
2015-09-23 19:59 ` Jungseok Lee
2015-09-23 19:59   ` Jungseok Lee
2015-10-02 16:23 ` James Morse [this message]
2015-10-02 16:23   ` James Morse
2015-10-04 14:32   ` Jungseok Lee
2015-10-04 14:32     ` Jungseok Lee
2015-10-05  6:37     ` AKASHI Takahiro
2015-10-05  6:37       ` AKASHI Takahiro
2015-10-05 17:24       ` James Morse
2015-10-05 17:24         ` James Morse
2015-10-05 20:03         ` Jungseok Lee
2015-10-05 20:03           ` Jungseok Lee
  -- strict thread matches above, loose matches on Subject: below --
2015-09-21 12:19 Jungseok Lee
2015-09-21 12:19 ` Jungseok Lee
2015-09-21 13:38 ` Jungseok Lee
2015-09-21 13:38   ` Jungseok Lee
     [not found] ` <CA+tMzQE58f9OGt5ucJvOg1wFb-0KruUxmTKjT7Zd9cFEpMCDAg@mail.gmail.com>
2015-10-07 15:33   ` Jungseok Lee
2015-10-07 15:33     ` Jungseok Lee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=560EAF9F.6090604@arm.com \
    --to=james.morse@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.