linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kgdb: could not write to the last of valid memory with kgdb.
@ 2008-09-09  0:04 Atsuo Igarashi
  2008-09-09 13:14 ` Jason Wessel
  0 siblings, 1 reply; 2+ messages in thread
From: Atsuo Igarashi @ 2008-09-09  0:04 UTC (permalink / raw)
  To: jason.wessel; +Cc: linux-kernel, Atsuo Igarashi, Yoichi Yuasa

[-- Attachment #1: Type: text/plain, Size: 738 bytes --]

Hi,

I'm using i.MX31 ARM11 board which has 104Mbyte valid memory.
When I'd invoked a print command to write the last of valid memory from gdb,
there was no response from kgdb.

It seems that the following line causes this problem.

kernel/kgdb.c: write_mem_msg()
...
 491 			flush_icache_range(addr, addr + length + 1);

If the last byte of valid memory is specified, the last cache line and the next
cache line will be flushed by the ARM11 V6's function from flush_icache_range().
I'm not sure why the 2nd parameter has +1, I assume this +1 is unnecessary for
ARM11 V6's cache.
I send a patch to remove this +1, does anyone know necessity for other architectures?

Regards,

Signed-off-by Atsuo Igarashi <atsuo_igarashi@tripeaks.co.jp>

[-- Attachment #2: kgdb_write_mem_msg.diff --]
[-- Type: text/x-diff, Size: 415 bytes --]

 kernel/kgdb.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/kgdb.c b/kernel/kgdb.c
index eaa21fc..949806a 100644
--- a/kernel/kgdb.c
+++ b/kernel/kgdb.c
@@ -488,7 +488,7 @@ static int write_mem_msg(int binary)
 		if (err)
 			return err;
 		if (CACHE_FLUSH_IS_SAFE)
-			flush_icache_range(addr, addr + length + 1);
+			flush_icache_range(addr, addr + length);
 		return 0;
 	}
 

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

* Re: [PATCH] kgdb: could not write to the last of valid memory with kgdb.
  2008-09-09  0:04 [PATCH] kgdb: could not write to the last of valid memory with kgdb Atsuo Igarashi
@ 2008-09-09 13:14 ` Jason Wessel
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Wessel @ 2008-09-09 13:14 UTC (permalink / raw)
  To: Atsuo Igarashi; +Cc: linux-kernel, Yoichi Yuasa, Tom Rini

Atsuo Igarashi wrote:
> Hi,
>
> I'm using i.MX31 ARM11 board which has 104Mbyte valid memory.  When
> I'd invoked a print command to write the last of valid memory from
> gdb, there was no response from kgdb.
> It seems that the following line causes this problem.
>
> kernel/kgdb.c: write_mem_msg()
> ...
>  491             flush_icache_range(addr, addr + length + 1);
>
> If the last byte of valid memory is specified, the last cache line
> and the next cache line will be flushed by the ARM11 V6's function
> from flush_icache_range().  I'm not sure why the 2nd parameter has
> +1, I assume this +1 is unnecessary for ARM11 V6's cache.  I send a
> patch to remove this +1, does anyone know necessity for other
> architectures?

I had to go digging through the archives to find out where the "+1"
came from, as it pre-dates my involvement with kgdb.  It turns out
this actually appeared in the initial version of the 'X' 'M' gdb
serial packet write.

You can see historical first version if you scroll to line 973 at:

http://kgdb.cvs.sourceforge.net/kgdb/kgdb-2/core-lite.patch?annotate=1.40

That means we have carried this for 3 years, 10 months with no one
noticing it. :-)

The flush_icache_range() is a "start" to "end" address so there should
be no need for the +1, as it is already computed by adding the length.
I will queue this patch for some testing and pushing into the
mainline.

Thanks,
Jason.



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

end of thread, other threads:[~2008-09-09 13:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-09  0:04 [PATCH] kgdb: could not write to the last of valid memory with kgdb Atsuo Igarashi
2008-09-09 13:14 ` Jason Wessel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).