From: Andreas Arnez <arnez@linux.vnet.ibm.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 0/3] PR gdb/21220: Fix quadratic runtime of memory writes into inferior on GNU/Linux
Date: Mon, 06 Mar 2017 16:01:00 -0000 [thread overview]
Message-ID: <1488816060-20776-1-git-send-email-arnez@linux.vnet.ibm.com> (raw)
On GNU/Linux native targets, when writing into inferior memory, only a
single word is currently transferred at a time. This causes trouble with
large transfers, because memory_xfer_partial wastes a lot of effort in
this case: allocate a buffer and copy all remaining bytes of the transfer
request into it, then fill the breakpoints in, but just transfer the first
word of this buffer, and drop the rest. This quadratic behavior affects
large "restore" operations, as reported by PR 21220, as well as
reverse-stepping a large memory-copy instruction, such as in the
s390-specific test case s390-mvcle.exp. The quadratic run-time of a large
restore operation was already addressed and circumvented by this patch:
https://sourceware.org/ml/gdb-patches/2013-07/msg00611.html -- "Improve
performance of large restore commands"
But then another patch broke the circumvention:
https://sourceware.org/ml/gdb-patches/2016-06/msg00565.html -- "Optimize
memory_xfer_partial for remote"
This series fixes the problem in two different ways:
* When using ptrace with PTRACE_POKEDATA, do not return to the caller
after transferring a single word, but attempt to fulfill the whole
transfer request in one invocation.
* If possible, do not even use PTRACE_POKEDATA, but write to
/proc/<pid>/mem instead.
To avoid another regression, a new dump/restore test case is added as
well.
Andreas Arnez (3):
inf-ptrace: Do not stop memory transfers after a single word
Test case for dump/restore of large array
linux-nat: Exploit /proc/<pid>/mem for writing
gdb/inf-ptrace.c | 115 ++++++++++++++++++----------------------
gdb/linux-nat.c | 32 +++++------
gdb/testsuite/gdb.base/dump.c | 37 +++++++++++++
gdb/testsuite/gdb.base/dump.exp | 8 +++
4 files changed, 112 insertions(+), 80 deletions(-)
--
2.3.0
next reply other threads:[~2017-03-06 16:01 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-06 16:01 Andreas Arnez [this message]
2017-03-06 16:01 ` [PATCH 1/3] inf-ptrace: Do not stop memory transfers after a single word Andreas Arnez
2017-03-08 19:10 ` Simon Marchi
2017-03-09 17:22 ` Andreas Arnez
2017-03-10 15:49 ` Simon Marchi
2017-03-13 19:39 ` Pedro Alves
2017-03-13 19:50 ` Andreas Arnez
2017-03-13 19:51 ` Pedro Alves
2017-03-14 15:12 ` Andreas Arnez
2017-03-14 15:23 ` Pedro Alves
2017-03-06 16:02 ` [PATCH 2/3] Test case for dump/restore of large array Andreas Arnez
2017-03-13 19:51 ` Pedro Alves
2017-03-06 16:03 ` [PATCH 3/3] linux-nat: Exploit /proc/<pid>/mem for writing Andreas Arnez
2017-03-13 20:05 ` Pedro Alves
2017-03-13 20:08 ` Pedro Alves
2017-03-14 11:23 ` Andreas Arnez
2017-03-14 9:54 ` Andreas Arnez
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=1488816060-20776-1-git-send-email-arnez@linux.vnet.ibm.com \
--to=arnez@linux.vnet.ibm.com \
--cc=gdb-patches@sourceware.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox