Bug #789
closedunaligned memory access on ARM
0%
Description
Commit id:
--------------------
babeltrace: 87353f23d5107c8cc09719d46cc8ccee5da989f7
Problem:
---------------------
Babeltrace performs unaligned memory access on ARM when converting CTF to text. This slows down conversion and floods syslog with warnings (if warnings are activated). For more info see below,
https://www.kernel.org/doc/Documentation/arm/mem_alignment
Anyhow, to rely on the kernels alignment trap seems to be a bad idea.
Files
Updated by Jérémie Galarneau over 10 years ago
Are you reading a trace produced on x86 on ARM, or is this trace read on the architecture that produced it?
Thanks!
Updated by Jérémie Galarneau over 10 years ago
That's interesting... Any chance you can share a sample trace that exhibits the problem? This (probably) means the tracer is performing unaligned accesses while producing the trace and may be indicative of a more serious problem.
This doesn't change the fact that this is a valid bug against Babeltrace, but I'd like to make sure the tracer works as intended.
Updated by Stanislav Vovk over 10 years ago
- File snapshot-1-20140506-124353-0.tgz snapshot-1-20140506-124353-0.tgz added
- File syslog syslog added
Attaching snapshot and syslog output after reading same snapshot.
Updated by Mathieu Desnoyers over 10 years ago
Can you tell us on which architecture the trace is generated, and on which architecture is babeltrace running ?
[ edit: sorry, I see it's already been answered ]
Updated by Mathieu Desnoyers over 10 years ago
The metadata files show that the alignment of integer types is OK for ARM (alignment on the type size).
We'd need to see which field (fields) is being read when the unaligned trap is triggered.
Updated by Stanislav Vovk over 10 years ago
- File snapshot.tgz snapshot.tgz added
- File syslog syslog added
more detailed architechture:
ARMv7 Processor rev 2 (v7l), cortex A15
Reading a snapshot containing one event produced attached syslog.
root@du1:~# babeltrace /trace/telog/ [13:13:21.492996545] (+?.?????????) du1 com_ericsson_plf_lttng_test:myevent: { cpu_id = 5 }, { }
'-Wcast-align' should give some hints when build with Arm compiler, right?
Updated by Jérémie Galarneau over 10 years ago
- Status changed from New to In Progress
A patch related to this issue has been contributed recently. I doubt it fixes the problem completely as the objstack is only used when parsing the trace metadata and you seem to make it further than that by reading actual events.
Still, including this for reference.
ID cae67efbd9ddf2cee6bbefec076dc8933ababc43 Parent 62f11f74 Added by Fredrik Markström about 3 hours ago Fix: Align buffers from objstack_alloc on sizeof(void *) The buffers from objstack_alloc will store pointers, so they must be aligned on a pointer's size, or else it will cause issues on the CPUs which do not support unaligned addresses access. Signed-off-by: Fredrik Markstrom <fredrik.markstrom@gmail.com> Signed-off-by: Roy Li <rongqing.li@windriver.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Updated by Mathieu Desnoyers over 10 years ago
- File fix-unaligned-babeltrace.patch fix-unaligned-babeltrace.patch added
- Status changed from In Progress to Feedback
Can you check if this patch fixes the issue ?
Updated by Mathieu Desnoyers over 10 years ago
FWIW, the patch I proposed is not ideal for architectures that support efficient unaligned accesses, especially for the bt bitfield read/writes. It uses unsigned char rather than unsigned long for the accesses. We should therefore detect in configure whether unaligned accesses are efficient for the architecture (like we do in lttng-ust), and use this to decide the type we use for the bitfield accesses (unsigned char or unsigned long).
Updated by Mathieu Desnoyers over 10 years ago
Fix committed as:
commit 6a0b6cd5133db9e3c72914d4e5dd7fc792360934 Author: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Date: Wed Jul 16 10:58:48 2014 -0400 Fix: don't perform unaligned integer read/writes Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Need confirmation that it fixes the issue.
Updated by Jonathan Rajotte Julien almost 5 years ago
- Status changed from Feedback to Invalid
State of babeltrace moved a lot since.
Closing this ticket. Reopen it if it stills apply to Babeltrace 2.