diff mbox

[v3,4/4] KGDB: make kgdb_breakpoint() as noinline

Message ID 1382094469-7971-5-git-send-email-vijay.kilari@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Vijay Kilari Oct. 18, 2013, 11:07 a.m. UTC
From: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>

The function kgdb_breakpoint() sets up break point at
compile time by calling arch_kgdb_breakpoint();
Though this call is surrounded by wmb() barrier,
the compile can still re-order the break point,
because this scheduling barrier is not a code motion
barrier in gcc.

Making kgdb_breakpoint() as noinline solves this problem
of code reording around break point instruction and also
avoids problem of being called as inline function from
other places

More details about discussion on this can be found here
http://comments.gmane.org/gmane.linux.ports.arm.kernel/269732

Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
---
 kernel/debug/debug_core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Will Deacon Oct. 25, 2013, 3:40 p.m. UTC | #1
On Fri, Oct 18, 2013 at 12:07:49PM +0100, vijay.kilari@gmail.com wrote:
> From: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
> 
> The function kgdb_breakpoint() sets up break point at
> compile time by calling arch_kgdb_breakpoint();
> Though this call is surrounded by wmb() barrier,
> the compile can still re-order the break point,
> because this scheduling barrier is not a code motion
> barrier in gcc.
> 
> Making kgdb_breakpoint() as noinline solves this problem
> of code reording around break point instruction and also
> avoids problem of being called as inline function from
> other places
> 
> More details about discussion on this can be found here
> http://comments.gmane.org/gmane.linux.ports.arm.kernel/269732
> 
> Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>

  Acked-by: Will Deacon <will.deacon@arm.com>

I guess this goes via Jason's tree?

Will
Vijay Kilari Oct. 29, 2013, 5:12 a.m. UTC | #2
Hi Jason,

  Can you please consider this patch?.

On Fri, Oct 25, 2013 at 9:10 PM, Will Deacon <will.deacon@arm.com> wrote:
> On Fri, Oct 18, 2013 at 12:07:49PM +0100, vijay.kilari@gmail.com wrote:
>> From: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
>>
>> The function kgdb_breakpoint() sets up break point at
>> compile time by calling arch_kgdb_breakpoint();
>> Though this call is surrounded by wmb() barrier,
>> the compile can still re-order the break point,
>> because this scheduling barrier is not a code motion
>> barrier in gcc.
>>
>> Making kgdb_breakpoint() as noinline solves this problem
>> of code reording around break point instruction and also
>> avoids problem of being called as inline function from
>> other places
>>
>> More details about discussion on this can be found here
>> http://comments.gmane.org/gmane.linux.ports.arm.kernel/269732
>>
>> Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
>
>   Acked-by: Will Deacon <will.deacon@arm.com>
>
> I guess this goes via Jason's tree?
>
> Will
diff mbox

Patch

diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c
index 0506d44..359ce6a 100644
--- a/kernel/debug/debug_core.c
+++ b/kernel/debug/debug_core.c
@@ -1006,7 +1006,7 @@  int dbg_io_get_char(void)
  * otherwise as a quick means to stop program execution and "break" into
  * the debugger.
  */
-void kgdb_breakpoint(void)
+noinline void kgdb_breakpoint(void)
 {
 	atomic_inc(&kgdb_setting_breakpoint);
 	wmb(); /* Sync point before breakpoint */