[HEAD, ARM/LINUX] Crash on Raspberry Pi with recent GIT ver

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: [HEAD, ARM/LINUX] Crash on Raspberry Pi with recent GIT ver

Re: [HEAD, ARM/LINUX] Crash on Raspberry Pi with recent GIT

by Graf Zahl » Wed May 11, 2016 4:05 am

Done.

Needless to say, it was a bad idea to begin with to hijack the openings array to store some other data in it...

Re: [HEAD, ARM/LINUX] Crash on Raspberry Pi with recent GIT

by Csonicgo » Thu May 05, 2016 11:07 am

Glad this was figured out. Any chance this fix can be pushed to master soon?

Re: [HEAD, ARM/LINUX] Crash on Raspberry Pi with recent GIT

by vanfanel » Wed May 04, 2016 3:42 pm

@Edward-san: done :)

Re: [HEAD, ARM/LINUX] Crash on Raspberry Pi with recent GIT

by Edward-san » Wed May 04, 2016 3:32 pm

vanfanel: you should show the new crash in the other thread.

Re: [HEAD, ARM/LINUX] Crash on Raspberry Pi with recent GIT

by vanfanel » Wed May 04, 2016 3:24 pm

@randi & Edward-san: adding "len = (len + 1) & ~1;" to R_NewOpening() does, indeed, prevent the crashes.

Now I get another crash but it happens with Chris patch only...

I will report to the other thread, because it's a different crash not appearing in the main git repo head, only in Chris fork with OpenAL threaded code.

Re: [HEAD, ARM/LINUX] Crash on Raspberry Pi with recent GIT

by randi » Wed May 04, 2016 6:42 am

No, it counts in shorts, not bytes.

Re: [HEAD, ARM/LINUX] Crash on Raspberry Pi with recent GIT

by Edward-san » Wed May 04, 2016 3:22 am

Maybe you meant:

Code: Select all

len = (len + 3) & ~3;
? Your code would keep only the 2-byte alignment..

Re: [HEAD, ARM/LINUX] Crash on Raspberry Pi with recent GIT

by randi » Tue May 03, 2016 9:47 pm

How about you just change R_NewOpening() so that it always returns 4-byte aligned addresses? Just stick this at the beginning of the function:

Code: Select all

len = (len + 1) & ~1;

Re: [HEAD, ARM/LINUX] Crash on Raspberry Pi with recent GIT

by Edward-san » Tue May 03, 2016 6:28 pm

hmmm, try to replace that code with this:

Code: Select all

	float temp;
	memcpy((BYTE *)&temp, (BYTE *)(MaskedSWall+dc_x), sizeof(float));
	dc_iscale = xs_Fix<16>::ToFix(temp * MaskedScaleY);

Re: [HEAD, ARM/LINUX] Crash on Raspberry Pi with recent GIT

by vanfanel » Tue May 03, 2016 5:37 pm

Another crash:

Code: Select all

[Thread 0x722ff450 (LWP 8363) exited]
[New Thread 0x712ff450 (LWP 8364)]
[Thread 0x71aff450 (LWP 8357) exited]

Program received signal SIGBUS, Bus error.
0x0018c188 in BlastMaskedColumn (blastfunc=0x19bf5c <R_DrawMaskedColumn(unsigned char const*, FTexture::Span const*)>, 
    tex=0xa88850) at /home/pi/src/zdoom/src/r_segs.cpp:183
183		dc_iscale = xs_Fix<16>::ToFix(MaskedSWall[dc_x] * MaskedScaleY);
(gdb) bt
#0  0x0018c188 in BlastMaskedColumn (
    blastfunc=0x19bf5c <R_DrawMaskedColumn(unsigned char const*, FTexture::Span const*)>, tex=0xa88850)
    at /home/pi/src/zdoom/src/r_segs.cpp:183
#1  0x0018d2c4 in R_RenderMaskedSegRange (ds=0xf58140, x1=98, x2=102) at /home/pi/src/zdoom/src/r_segs.cpp:457
#2  0x001a2f7c in R_DrawMaskedSingle (renew=false) at /home/pi/src/zdoom/src/r_things.cpp:2352
#3  0x001a3034 in R_DrawMasked () at /home/pi/src/zdoom/src/r_things.cpp:2366
#4  0x00183388 in R_RenderActorView (actor=0xdf36a8, dontmaplines=false) at /home/pi/src/zdoom/src/r_main.cpp:961
#5  0x0016ddd4 in FSoftwareRenderer::RenderView (this=0x9f0cb0, player=0x8c2068 <players>)
    at /home/pi/src/zdoom/src/r_swrenderer.cpp:111
#6  0x002ae244 in D_Display () at /home/pi/src/zdoom/src/d_main.cpp:770
#7  0x002aef58 in D_DoomLoop () at /home/pi/src/zdoom/src/d_main.cpp:1013
#8  0x002b37bc in D_DoomMain () at /home/pi/src/zdoom/src/d_main.cpp:2642
#9  0x001691c4 in main (argc=4, argv=0x7efff7e4) at /home/pi/src/zdoom/src/posix/sdl/i_main.cpp:317

Re: [HEAD, ARM/LINUX] Crash on Raspberry Pi with recent GIT

by Edward-san » Tue May 03, 2016 4:55 pm

Okay, regarding the new crash, change that line with:

Code: Select all

memcpy((BYTE *)&fstart, (BYTE *)(swal - 1), sizeof(float));
double iend = (double)fstart * yscale;
and try again.

Re: [HEAD, ARM/LINUX] Crash on Raspberry Pi with recent GIT

by Graf Zahl » Tue May 03, 2016 4:46 pm

Different place but same cause. It's still the openings array with some dirty casts.


My 2 cents: I think this needs to be refactored. The way this stuff is used is just an open invitation to trouble on hardware with strict alignment rules.

Re: [HEAD, ARM/LINUX] Crash on Raspberry Pi with recent GIT

by vanfanel » Tue May 03, 2016 4:28 pm

Still crashing, it seems to be catching fire on a different place now:

Code: Select all

[New Thread 0x72aff450 (LWP 26967)]
[New Thread 0x754ff450 (LWP 26968)]
[Thread 0x72aff450 (LWP 26967) exited]

Program received signal SIGBUS, Bus error.
0x00196ce8 in R_StoreWallRange (start=163, stop=168) at /home/pi/src/zdoom/src/r_segs.cpp:2526
2526					double iend = *(swal - 1) * yscale;
(gdb) bt
#0  0x00196ce8 in R_StoreWallRange (start=163, stop=168) at /home/pi/src/zdoom/src/r_segs.cpp:2526
#1  0x0016f884 in R_ClipWallSegment (first=160, last=168, solid=false) at /home/pi/src/zdoom/src/r_bsp.cpp:227
#2  0x0017168c in R_AddLine (line=0xe3e1c8) at /home/pi/src/zdoom/src/r_bsp.cpp:753
#3  0x00173e20 in R_Subsector (sub=0xe14988) at /home/pi/src/zdoom/src/r_bsp.cpp:1348
#4  0x00173f9c in R_RenderBSPNode (node=0xe14989) at /home/pi/src/zdoom/src/r_bsp.cpp:1388
#5  0x00173f20 in R_RenderBSPNode (node=0xe3a14c) at /home/pi/src/zdoom/src/r_bsp.cpp:1379
#6  0x00173f20 in R_RenderBSPNode (node=0xe3a188) at /home/pi/src/zdoom/src/r_bsp.cpp:1379
#7  0x00173f20 in R_RenderBSPNode (node=0xe3a278) at /home/pi/src/zdoom/src/r_bsp.cpp:1379
#8  0x00173f20 in R_RenderBSPNode (node=0xe3a3a4) at /home/pi/src/zdoom/src/r_bsp.cpp:1379
#9  0x00173f20 in R_RenderBSPNode (node=0xe3b538) at /home/pi/src/zdoom/src/r_bsp.cpp:1379
#10 0x001832a8 in R_RenderActorView (actor=0xdf2d88, dontmaplines=false) at /home/pi/src/zdoom/src/r_main.cpp:933
#11 0x0016ddd4 in FSoftwareRenderer::RenderView (this=0x9f0cb0, player=0x8c2058 <players>)
    at /home/pi/src/zdoom/src/r_swrenderer.cpp:111
#12 0x002ae22c in D_Display () at /home/pi/src/zdoom/src/d_main.cpp:770
#13 0x002aef40 in D_DoomLoop () at /home/pi/src/zdoom/src/d_main.cpp:1013
#14 0x002b37a4 in D_DoomMain () at /home/pi/src/zdoom/src/d_main.cpp:2642
#15 0x001691c4 in main (argc=4, argv=0x7efff7e4) at /home/pi/src/zdoom/src/posix/sdl/i_main.cpp:317

Re: [HEAD, ARM/LINUX] Crash on Raspberry Pi with recent GIT

by Edward-san » Mon May 02, 2016 10:59 am

The fast solution would be to use memcpy where a misalignment is possible. For example, that problematic line of code:

Code: Select all

double istart = *((float *)(openings + ds_p->swall)) * yscale;
could be replaced by:

Code: Select all

float fstart;
memcpy((BYTE *)&fstart, (BYTE *)(openings + ds_p->swall), sizeof(float)); 
double istart = (double)fstart * yscale;
Does this help with the crash?

Re: [HEAD, ARM/LINUX] Crash on Raspberry Pi with recent GIT

by Graf Zahl » Mon May 02, 2016 10:46 am

_mental_ wrote:is it possible that 32-bit integers are allowed to be unaligned but floats are not?
Easily. An int is relatively easy to read in two parts, but a float would have to be copied around. In any case, data structures like that are generally bad and should be avoided.

Top