Bug 82977 - freeze when copying between larger OpenGL buffers (glCopyBufferSubData)
Summary: freeze when copying between larger OpenGL buffers (glCopyBufferSubData)
Status: CLOSED NOTOURBUG
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Gallium/radeonsi (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Default DRI bug account
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-22 22:32 UTC by Frederik vom Hofe
Modified: 2014-08-27 08:23 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
glxinfo (59.72 KB, text/plain)
2014-08-22 22:32 UTC, Frederik vom Hofe
Details
minimal example only needs sdl2 to compile (3.75 KB, text/plain)
2014-08-23 11:26 UTC, Frederik vom Hofe
Details
CMakeLists.txt (548 bytes, text/plain)
2014-08-23 11:26 UTC, Frederik vom Hofe
Details
FindSDL2.cmake (6.92 KB, text/plain)
2014-08-23 11:27 UTC, Frederik vom Hofe
Details
dmesg (117.16 KB, text/plain)
2014-08-23 22:29 UTC, Frederik vom Hofe
Details
console output (455 bytes, text/plain)
2014-08-23 22:30 UTC, Frederik vom Hofe
Details
main.cpp with looping (generating, copy, deleting) buffers (3.84 KB, text/plain)
2014-08-23 22:32 UTC, Frederik vom Hofe
Details
dmesg when trying to copy 256 MiB (3.28 KB, text/plain)
2014-08-26 13:11 UTC, Frederik vom Hofe
Details

Description Frederik vom Hofe 2014-08-22 22:32:07 UTC
Created attachment 105127 [details]
glxinfo

Ubuntu 14.04. With Oibaf repository for GPU drivers.
Radeon 7870 (Pitcairn)

When I try to run glCopyBufferSubData on large buffers (128MB works ok, 200MiB not) my Desktop freezes and I only can move the mouse around.
The mouse curser image stays the same after that. E.g. a normal pointer or text marker icon.

I have no relevant message in dmsg.0 or Xorg.1.log, as far as I can tell.


Minimal example code that will trigger the freeze (After using sdl2 to init Core GL3.3 Context + Window):

int bufferSize = 200 * 1024 * 1024;
GLuint clientBufferId, serverBufferId;
glGenBuffers(1, &clientBufferId);
glBindBuffer(GL_ARRAY_BUFFER, clientBufferId);
glBufferStorage(GL_ARRAY_BUFFER, bufferSize, 0, /*GL_DYNAMIC_STORAGE_BIT | GL_MAP_WRITE_BIT | GL_MAP_READ_BIT | GL_MAP_PERSISTENT_BIT| GL_CLIENT_STORAGE_BIT*/0);

glGenBuffers(1, &serverBufferId);
glBindBuffer(GL_ARRAY_BUFFER, serverBufferId);
glBufferStorage(GL_ARRAY_BUFFER, bufferSize, 0, 0);

glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_COPY_READ_BUFFER,  clientBufferId);
glBindBuffer(GL_COPY_WRITE_BUFFER, serverBufferId);
glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 0, bufferSize);
Comment 1 Michel Dänzer 2014-08-23 02:31:37 UTC
Can you flesh out the minimal reproducer so we can just compile and run it?
Comment 2 Frederik vom Hofe 2014-08-23 11:26:05 UTC
Created attachment 105143 [details]
minimal example only needs sdl2 to compile
Comment 3 Frederik vom Hofe 2014-08-23 11:26:54 UTC
Created attachment 105144 [details]
CMakeLists.txt
Comment 4 Frederik vom Hofe 2014-08-23 11:27:12 UTC
Created attachment 105145 [details]
FindSDL2.cmake
Comment 5 Frederik vom Hofe 2014-08-23 11:29:44 UTC
Here is a minimal example, only needs sdl2. cmake files included.
Sometimes I hat to run the executable 2-3 times before it froze my system.
Comment 6 Frederik vom Hofe 2014-08-23 22:29:01 UTC
I tryed to get a more exact size that triggers the freeze. And im down to 128MiB. (Still could be lower)
Because it often need several tries before it freezes I changed from repeating my program in the console to just a simple loop around the C++ code (generating, copy, deleting of the buffers)
Looping over 64 MiB sized buffers now gave me errors in the program console and in dmesg.
Comment 7 Frederik vom Hofe 2014-08-23 22:29:45 UTC
Created attachment 105177 [details]
dmesg

Ignore the ext4 errors please ;]
Comment 8 Frederik vom Hofe 2014-08-23 22:30:18 UTC
Created attachment 105178 [details]
console output
Comment 9 Frederik vom Hofe 2014-08-23 22:32:43 UTC
Created attachment 105179 [details]
main.cpp with looping (generating, copy, deleting) buffers

This triggers the error messages in the application console and dmesg
Comment 10 Frederik vom Hofe 2014-08-25 12:11:47 UTC
ok forget the errors I get except the freezing.
The driver was just ranning our of memory because I hat no glFinish and gave it no time for the actually copy/deleting of the buffers befor creating new ones.

There is no exact buffer size that causes the freeze.
If I try often enough I managed to kill it with a 123032 KiB buffer so far.
Comment 11 Michel Dänzer 2014-08-26 06:29:13 UTC
You're saying you can still get the freeze even with glFinish() in the loop? And it never recovers from that?

Can you still switch to a console with Ctrl-Alt-Fx after the freeze, or log in via SSH? If so, can you attach the dmesg output from at least 10 seconds after the freeze?

Does this still happen with a newer kernel?
Comment 12 Frederik vom Hofe 2014-08-26 13:10:14 UTC
Trying to copy 200 MiB, only the screen frezes. SSH works fine.
I can just kill -9 the program and everything is ok again. After that I have this line in dmesg

[ 1851.802876] radeon 0000:01:00.0: failed to get a new IB (-512)

When I try to switch to console while my program still runs it appears to do notihing, but after I kill -9 the program via ssh, I'm in the console.
I also tryed to move a windows around during the freeze, but that didn't work. 
Sometimes the mouse pointer freezes, too.

Also the size of the buffer does not matter, relevant is how much bytes get copyed by glCopyBufferSubData.
And the bigger the copy is the more likely the freeze seems to be.

With a 256 MiB copy I managed to get a kernel bug message in dmesg and could not recover by killing the program.

Will bake me some fresh kernels now.
Comment 13 Frederik vom Hofe 2014-08-26 13:11:00 UTC
Created attachment 105283 [details]
dmesg when trying to copy 256 MiB
Comment 14 Christian König 2014-08-26 13:49:00 UTC
(In reply to comment #13)
> Created attachment 105283 [details]
> dmesg when trying to copy 256 MiB

That's a known issue with older kernels, please update your kernel and make sure it has "drm/radeon: update IB size estimation for VM".
Comment 15 Frederik vom Hofe 2014-08-26 18:03:06 UTC
Yes, it works with 3.17.0-rc2.

For anyone else, here is a link to the Kernel Bug Tracker:
https://bugzilla.kernel.org/show_bug.cgi?id=71081
Comment 16 Christian König 2014-08-27 08:23:17 UTC
Thanks, please open up a new bug report if you have further issues.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.