From: Michal Simek <monstr@monstr.eu>
To: michal.simek@petalogix.com
Cc: Oleg Nesterov <oleg@redhat.com>,
Roland McGrath <roland@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>,
linux-mm@kvack.org, John Williams <john.williams@petalogix.com>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
Arnd Bergmann <arnd@arndb.de>
Subject: Re: Flushing whole page instead of exact address for ptrace
Date: Tue, 30 Nov 2010 12:07:19 +0100 [thread overview]
Message-ID: <4CF4DAE7.1040107@monstr.eu> (raw)
In-Reply-To: <4CEFA8AE.2090804@petalogix.com>
Hi,
Michal Simek wrote:
> Hi,
>
> I have found one problem when I debug multithread application on
> Microblaze. Let me describe what I discovered.
>
> GDB has internal timeout which is setup to value 3. Which should mean if
> GDB sends packet and doesn't receive answer for it then after 3 internal
> timeouts GDB announces "Ignoring packet error, continuing..." and then
> fail. (communication is done over TCP).
>
> In any older version we could debug multithread application that's why
> I bisected all new patches which I have added to the kernel and I
> identify that the problem is caused by my patch.
>
> microblaze: Implement flush_dcache_page macro
> sha1(79e87830faf22ca636b1a1d8f4deb430ea6e1c8b)
>
> I had to implemented flush_dcache_page macro for new systems with
> write-back(WB) cache which is important for several components (for
> example jffs2 rootfs) to get it work on WB.
> BTW: For systems with write-through(WT) caches I don't need to implement
> this macro because flushing is done automatically.
>
> Then I replaced macro on WT by udelay loop to find out if the problem is
> time dependent. I tested it on two hw designs(on the same HZ and cache
> size) with two different network IPs/drivers (one with DMA and second
> without) and I found that system with dma network driver can spend more
> time on dcache flushing before GDB timeout happens because TCP
> communication is faster. Which means that the problem also depends on
> cpu speed and cache configuration - size, cache line length.
>
> Then I traced kernel part and I was focused why this macro is causing
> this problem.
>
> GDB sends symbol-lookup command (qSymbol) and I see a lot of kernel
> ptrace PEEKTEXT requests. I parse it and here is calling sequence.
>
> (kernel/ptrace.c) sys_ptrace ->
> (arch/microblaze/kernel/ptrace.c)arch_ptrace ->
> (kernel/ptrace.c)ptrace_request -> generic_ptrace_peek/poke data/text ->
> (mm/memory.c) access_process_vm -> get_user_pages -> __get_user_pages ->
> flush_dcache_page
>
> Function access_process_vm calls __get_user_pages which doesn't work
> with buffer len (which is for PEEK/POKE TEXT/DATA just 32 bit - for
> 32bit Microblaze) but only with start and PAGE size. There is also
> called flush_dcache_page macro which takes more time than in past,
> because was empty. Macro flushes whole page but it is necessary, for
> this case, just flush one address if is called from ptrace.
>
> What is the best way how to ensure that there will be flush only address
> instead of whole page for ptrace requests?
> I think that there shouldn't be a reason to flush whole page for ptraces.
>
> Please correct me if I am wrong somewhere.
Any suggestions?
Michal
--
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
WARNING: multiple messages have this Message-ID (diff)
From: Michal Simek <monstr@monstr.eu>
To: michal.simek@petalogix.com
Cc: Oleg Nesterov <oleg@redhat.com>,
Roland McGrath <roland@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>,
linux-mm@kvack.org, John Williams <john.williams@petalogix.com>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
Arnd Bergmann <arnd@arndb.de>
Subject: Re: Flushing whole page instead of exact address for ptrace
Date: Tue, 30 Nov 2010 12:07:19 +0100 [thread overview]
Message-ID: <4CF4DAE7.1040107@monstr.eu> (raw)
In-Reply-To: <4CEFA8AE.2090804@petalogix.com>
Hi,
Michal Simek wrote:
> Hi,
>
> I have found one problem when I debug multithread application on
> Microblaze. Let me describe what I discovered.
>
> GDB has internal timeout which is setup to value 3. Which should mean if
> GDB sends packet and doesn't receive answer for it then after 3 internal
> timeouts GDB announces "Ignoring packet error, continuing..." and then
> fail. (communication is done over TCP).
>
> In any older version we could debug multithread application that's why
> I bisected all new patches which I have added to the kernel and I
> identify that the problem is caused by my patch.
>
> microblaze: Implement flush_dcache_page macro
> sha1(79e87830faf22ca636b1a1d8f4deb430ea6e1c8b)
>
> I had to implemented flush_dcache_page macro for new systems with
> write-back(WB) cache which is important for several components (for
> example jffs2 rootfs) to get it work on WB.
> BTW: For systems with write-through(WT) caches I don't need to implement
> this macro because flushing is done automatically.
>
> Then I replaced macro on WT by udelay loop to find out if the problem is
> time dependent. I tested it on two hw designs(on the same HZ and cache
> size) with two different network IPs/drivers (one with DMA and second
> without) and I found that system with dma network driver can spend more
> time on dcache flushing before GDB timeout happens because TCP
> communication is faster. Which means that the problem also depends on
> cpu speed and cache configuration - size, cache line length.
>
> Then I traced kernel part and I was focused why this macro is causing
> this problem.
>
> GDB sends symbol-lookup command (qSymbol) and I see a lot of kernel
> ptrace PEEKTEXT requests. I parse it and here is calling sequence.
>
> (kernel/ptrace.c) sys_ptrace ->
> (arch/microblaze/kernel/ptrace.c)arch_ptrace ->
> (kernel/ptrace.c)ptrace_request -> generic_ptrace_peek/poke data/text ->
> (mm/memory.c) access_process_vm -> get_user_pages -> __get_user_pages ->
> flush_dcache_page
>
> Function access_process_vm calls __get_user_pages which doesn't work
> with buffer len (which is for PEEK/POKE TEXT/DATA just 32 bit - for
> 32bit Microblaze) but only with start and PAGE size. There is also
> called flush_dcache_page macro which takes more time than in past,
> because was empty. Macro flushes whole page but it is necessary, for
> this case, just flush one address if is called from ptrace.
>
> What is the best way how to ensure that there will be flush only address
> instead of whole page for ptrace requests?
> I think that there shouldn't be a reason to flush whole page for ptraces.
>
> Please correct me if I am wrong somewhere.
Any suggestions?
Michal
--
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2010-11-30 11:07 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-26 12:31 Flushing whole page instead of work for ptrace Michal Simek
2010-11-26 12:31 ` Michal Simek
2010-11-30 11:07 ` Michal Simek [this message]
2010-11-30 11:07 ` Flushing whole page instead of exact address " Michal Simek
2010-11-30 23:32 ` Flushing whole page instead of work " Roland McGrath
2010-11-30 23:32 ` Roland McGrath
2010-12-01 17:10 ` Michal Simek
2010-12-01 17:10 ` Michal Simek
2010-12-01 17:57 ` David Miller
2010-12-01 17:57 ` David Miller
2010-12-03 15:00 ` Oleg Nesterov
2010-12-03 15:00 ` Oleg Nesterov
2010-12-03 16:28 ` Minchan Kim
2010-12-03 16:28 ` Minchan Kim
2010-12-03 17:07 ` Oleg Nesterov
2010-12-03 17:07 ` Oleg Nesterov
2010-12-04 14:57 ` Minchan Kim
2010-12-04 14:57 ` Minchan Kim
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=4CF4DAE7.1040107@monstr.eu \
--to=monstr@monstr.eu \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=edgar.iglesias@gmail.com \
--cc=john.williams@petalogix.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=michal.simek@petalogix.com \
--cc=oleg@redhat.com \
--cc=roland@redhat.com \
/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.