EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  <20022003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  <20022003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: ca_test bus error on solaris-sparc-gnu + fix
From: Till Straumann <[email protected]>
To: [email protected]
Cc: [email protected]
Date: Sat, 20 Apr 2002 09:24:58 -0700
Jeff Hill wrote:

Till,

After closer inspection, I see that there were two entries in the CVS
log related to this issue. Attached is the one that applies to
preserving the alignment returned by ::new().

Yeah -that's what I did also. I just was surprised that I could not
find any report of this problem in the tech-talk archive and yet,
the distribution Harvey downloaded not too long ago does not
contain the fix yet...

The change reported in my
previous message will have no impact because it is only rearranging
fields in a union.

Right - this one looks much better :-),

thanks.

-- Till.

Sorry about the confusion. I added "diff -c" to my
.cvsrc file and I now receive context diffs from CVS.

Revision : 1.22
Date : 2002/1/15 16:46:11
Author : 'jhill'
State : 'Exp'
Lines : +2 -2
Description :
fixed to preserve 8 byte alignment

cvs diff -r 1.22 -r 1.21 tsFreeList.h (in directory
D:\users\hill\epicsDvl\epics\base\src\libCom\cxxTemplates\)
Index: tsFreeList.h
===================================================================
RCS file:
/net/phoebus/epicsmgr/cvsroot/epics/base/src/libCom/cxxTemplates/tsFreeL
ist.h,v
retrieving revision 1.22
retrieving revision 1.21
diff -c -r1.22 -r1.21
*** tsFreeList.h 2002/01/15 16:46:11 1.22
--- tsFreeList.h 2001/12/14 00:36:25 1.21
***************
*** 1,5 ****
! /* $Id: tsFreeList.h,v 1.22 2002/01/15 16:46:11 jhill Exp $
*
* L O S A L A M O S
* Los Alamos National Laboratory
--- 1,5 ----
! /* $Id: tsFreeList.h,v 1.21 2001/12/14 00:36:25 jhill Exp $
*
* L O S A L A M O S
* Los Alamos National Laboratory
***************
*** 78,85 ****
template < class T, unsigned N = 0x400, unsigned DEBUG_LEVEL = 0u >
struct tsFreeListChunk {
- tsFreeListItem < T, DEBUG_LEVEL > items [N];
tsFreeListChunk < T, N, DEBUG_LEVEL > *pNext;
};
template < class T, unsigned N = 0x400, unsigned DEBUG_LEVEL = 0u >
--- 78,85 ----
template < class T, unsigned N = 0x400, unsigned DEBUG_LEVEL = 0u >
struct tsFreeListChunk {
tsFreeListChunk < T, N, DEBUG_LEVEL > *pNext;
+ tsFreeListItem < T, DEBUG_LEVEL > items [N];
};
template < class T, unsigned N = 0x400, unsigned DEBUG_LEVEL = 0u >


*****CVS exited normally with code 1*****


Jeff


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Till Straumann
Sent: Tuesday, April 09, 2002 6:35 PM
To: [email protected]
Cc: [email protected]
Subject: Re: ca_test bus error on solaris-sparc-gnu + fix

Jeff Hill wrote:

Till,

I think that we already eradicated that one along the way to the

next

R3.14 release. See attached. Nevertheless, thanks for the heads up.

Jeff

Jeff.

From the attached diff it is not obvious to me what your fix is
- would you mind giving me a hint, please?

I am not sure if 8byte alignment is enough
(e.g. optimized code on PPC/altivec may need 16 bytes.)
IMHO, it would be best to preserve the alignment
returned by malloc()

-- Till


---------------------------- Revision : 1.23 Date : 2002/1/15 20:2:45 Author : 'jhill' State : 'Exp' Lines : +2 -2 Description : fixed to preserve 8 byte alignment

cvs diff -r 1.23 -r 1.22 tsFreeList.h (in directory
D:\users\hill\epicsDvl\epics\base\src\libCom\cxxTemplates\)
Index: tsFreeList.h
===================================================================
RCS file:

/net/phoebus/epicsmgr/cvsroot/epics/base/src/libCom/cxxTemplates/tsFreeL

ist.h,v
retrieving revision 1.23
retrieving revision 1.22
diff -r1.23 -r1.22
2c2
< /*  $Id: tsFreeList.h,v 1.23 2002/01/15 20:02:45 jhill Exp $
---

/* $Id: tsFreeList.h,v 1.22 2002/01/15 16:46:11 jhill Exp $

75d74
<     char pad[ sizeof ( T ) ];
76a76

char pad[ sizeof ( T ) ];

*****CVS exited normally with code 1*****

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Till

Straumann

Sent: Thursday, April 04, 2002 9:04 PM
To: [email protected]
Cc: [email protected]
Subject: ca_test bus error on solaris-sparc-gnu + fix

Hi all.

We got a SIGBUS (due to an alignment violation)
running ca_test (and other apps)

EPICS:      3.14.0.beta1
system:    solaris-sparc-gnu
compiler: egcs-2.91.66

I found that

void *
tsFreeList<T,N,DEBUG_LEVEL>::allocate(size_t)

may return improperly aligned memory:
Because 'items' are declared

union {
  tsFreeListItem<T,...> *pNext;
  char                           pad[sizeof(T)];
}

the compiler only makes sure 'items' fulfill
the alignment requirements of pNext.

However, 'items' may need stricter alignment
(which goes unnoticed because the 'item' pointer
is later cast to (void*)): e.g. it may contain a double
which on sparc needs to be 8byte aligned...

The proposed fix is to put the 'items' into a
chunk first, so they get the chunk's alignment.

Unfortunately, this fix breaks binary compatibility
- everything needs to be rebuilt.

Regards,

-- Till






References:
RE: ca_test bus error on solaris-sparc-gnu + fix Jeff Hill

Navigate by Date:
Prev: RE: How to handle EPICS monitors? Jeff Hill
Next: Re: How to handle EPICS monitors? Geoff Savage
Index: 1994  1995  1996  1997  1998  1999  2000  2001  <20022003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: ca_test bus error on solaris-sparc-gnu + fix Jeff Hill
Next: R3.13.6 Known Bugs Marty Kraimer
Index: 1994  1995  1996  1997  1998  1999  2000  2001  <20022003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 10 Aug 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·