Hi Steven,
this fix one of the different Bus Errors I see on sparc64.
The alignment code is basically a copy of the one provided by the
function right below.
Clearly we perform allocation and data copy back only if strictly
required.
with this patch ./cpgbench works fine independently from the
architecture it's executed.
Fabio
Index: exec/totempg.c
===================================================================
--- exec/totempg.c (revision 1884)
+++ exec/totempg.c (working copy)
@@ -343,13 +343,30 @@
{
unsigned short *group_len;
int i;
+ struct iovec iovec_aligned = { NULL, 0 };
+ struct iovec *iovec_swab;
- group_len = (unsigned short *)iovec->iov_base;
+ /*
+ * Align data structure for sparc and ia64
+ */
+ if ((size_t)iovec->iov_base % 4 != 0) {
+ iovec_aligned.iov_base = alloca(iovec->iov_len);
+ memcpy(iovec_aligned.iov_base, iovec->iov_base, iovec->iov_len);
+ iovec_aligned.iov_len = iovec->iov_len;
+ iovec_swab = &iovec_aligned;
+ } else {
+ iovec_swab = iovec;
+ }
+
+ group_len = (unsigned short *)iovec_swab->iov_base;
group_len[0] = swab16(group_len[0]);
for (i = 1; i < group_len[0] + 1; i++) {
group_len[i] = swab16(group_len[i]);
}
+ if (iovec_swab == &iovec_aligned) {
+ memcpy(iovec->iov_base, iovec_aligned.iov_base, iovec->iov_len);
+ }
}
static inline int group_matches (
@@ -372,7 +389,8 @@
*/
if ((size_t)iovec->iov_base % 4 != 0) {
iovec_aligned.iov_base = alloca(iovec->iov_len);
- memcpy(iovec_aligned.iov_base, iovec->iov_base, iovec->iov_len); iovec_aligned.iov_len = iovec->iov_len;
+ memcpy(iovec_aligned.iov_base, iovec->iov_base, iovec->iov_len);
+ iovec_aligned.iov_len = iovec->iov_len;
iovec = &iovec_aligned;
}
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais