public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [RFC] Make target_read_string faster over high-latency links.
@ 2011-07-15 18:09 Paul Pluzhnikov
  2011-07-18 18:06 ` Tom Tromey
  2011-07-26 11:15 ` Jan Kratochvil
  0 siblings, 2 replies; 9+ messages in thread
From: Paul Pluzhnikov @ 2011-07-15 18:09 UTC (permalink / raw)
  To: gdb-patches; +Cc: ppluzhnikov

Greetings,

Here at Google we sometimes debug binaries running in production data
centers via remote gdbserver.

When GDB is running in Mountain View, California and the gdbserver is running
in Taiwan, the speed-of-light fiber round trip delay is approximately 110ms,
and the actual ping time I see is slightly better than 200ms.

Unfortunately (for us), GDB is not tuned for such high-latency links.

In particular, I see the following timestamped packet traces:

...
00:00:25 Sending packet: $m2b6b7958a7b8,28#3e...Packet received: 00c078796b2b000090a758796b2b0000f85d99796b2b000000509c796b2b0000d8b678796b2b0000
00:00:25 Sending packet: $m2b6b7958a790,4#d7...Packet received: 2f757372
00:00:25 Sending packet: $m2b6b7958a794,4#db...Packet received: 2f677274
00:00:26 Sending packet: $m2b6b7958a798,4#df...Packet received: 652f7632
00:00:26 Sending packet: $m2b6b7958a79c,4#0a...Packet received: 2f6c6962
00:00:26 Sending packet: $m2b6b7958a7a0,4#ff...Packet received: 36342f6c
00:00:26 Sending packet: $m2b6b7958a7a4,4#03...Packet received: 69626372
00:00:26 Sending packet: $m2b6b7958a7a8,4#07...Packet received: 7970742e
00:00:26 Sending packet: $m2b6b7958a7ac,4#32...Packet received: 736f2e31
00:00:27 Sending packet: $m2b6b7958a7b0,4#00...Packet received: 00000000
00:00:27 Sending packet: $m2b6b799c5000,28#00...Packet received: 00609c796b2b000078ac58796b2b0000a08dbc796b2b0000e0549c796b2b0000b8a758796b2b0000
00:00:27 Sending packet: $m2b6b7958ac78,4#09...Packet received: 2f757372
00:00:27 Sending packet: $m2b6b7958ac7c,4#34...Packet received: 2f677274
00:00:27 Sending packet: $m2b6b7958ac80,4#02...Packet received: 652f7632
00:00:27 Sending packet: $m2b6b7958ac84,4#06...Packet received: 2f6c6962
00:00:28 Sending packet: $m2b6b7958ac88,4#0a...Packet received: 36342f6c
00:00:28 Sending packet: $m2b6b7958ac8c,4#35...Packet received: 6962646c
00:00:28 Sending packet: $m2b6b7958ac90,4#03...Packet received: 2e736f2e
00:00:28 Sending packet: $m2b6b7958ac94,4#07...Packet received: 32000000
...

This is GDB walking through the shared library list, and reading shared
library names from gdbserver via target_read_string 4 bytes at a time ;-(

It takes approximately 15s to read 10 (relatively short) pathnames, and
this is repeated twice, for a total of 30s, which is about 1/3 of the
total time it takes to attach the remote process.

I have a patch that changes minimum size to read in target_read_string()
to MIN(len, 128), and with that patch I can save quite a few round trips:

...
00:00:29 Sending packet: $m2b6b7958a7b8,28#3e...Packet received: 00c078796b2b000090a758796b2b0000f85d99796b2b000000509c796b2b0000d8b678796b2b0000
00:00:29 Sending packet: $m2b6b7958a790,80#0b...Packet received: 2f7573722f677274652f76322f6c696236342f6c696263727970742e736f2e31000000000000000000c078796b2b000090a758796b2b0000f85d99796b2b000000509c796b2b0000d8b678796b2b0000b8a758796b2b0000000000000000000028ac58796b2b00000000000000000000f85d99796b2b0000a85e99796b2b0000
00:00:29 Sending packet: $m2b6b799c5000,28#00...Packet received: 00609c796b2b000078ac58796b2b0000a08dbc796b2b0000e0549c796b2b0000b8a758796b2b0000
00:00:29 Sending packet: $m2b6b7958ac78,80#3d...Packet received: 2f7573722f677274652f76322f6c696236342f6c6962646c2e736f2e32000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00:00:30 Sending packet: $m2b6b799c54e0,28#39...Packet received: 00a0bc796b2b0000b8549c796b2b0000881dde796b2b0000c0599c796b2b000000509c796b2b0000
00:00:30 Sending packet: $m2b6b799c54b8,80#3c...Packet received: 2f7573722f677274652f76322f6c696236342f6c6962707468726561642e736f2e3000000000000000a0bc796b2b0000b8549c796b2b0000881dde796b2b0000c0599c796b2b000000509c796b2b0000e0549c796b2b0000000000000000000050599c796b2b00000000000000000000981dde796b2b0000481ede796b2b0000
...

Questions:

1. is it ok to read strings 128 bytes at a time, or are there scenarios
   (JTAG?) where the latency is low but throughput is also low (and so reading
   "unnecessary" data is expensive) ?

1a. If yes, would it be acceptable to make this size a runtime-configurable
    parameter?

2. Current target_read_string aligns reads on a 4-byte boundary. Code
   could be simplified quite a bit if it didn't do that.
   Are there targets where such alignment is required?

Thanks,
--
Paul Pluzhnikov

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

end of thread, other threads:[~2011-07-26  8:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-15 18:09 [RFC] Make target_read_string faster over high-latency links Paul Pluzhnikov
2011-07-18 18:06 ` Tom Tromey
2011-07-18 19:01   ` Paul Pluzhnikov
2011-07-19 17:44     ` Paul Pluzhnikov
2011-07-19 17:52       ` Tom Tromey
2011-07-22 16:53   ` Joel Brobecker
2011-07-22 17:01     ` Paul Pluzhnikov
2011-07-25 14:42       ` Daniel Jacobowitz
2011-07-26 11:15 ` Jan Kratochvil

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 read-only IMAP folder(s) and NNTP newsgroup(s).