<div dir="ltr">Hi<br><div><br><div class="gmail_quote"><div dir="ltr">On Sat, Sep 24, 2016 at 12:00 AM Dave Airlie <<a href="mailto:airlied@gmail.com">airlied@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr"></p>
<p dir="ltr">On 14 September 2016 at 04:00, <<a href="mailto:marcandre.lureau@redhat.com" target="_blank">marcandre.lureau@redhat.com</a>> wrote:<br>
> From: Marc-André Lureau <<a href="mailto:marcandre.lureau@redhat.com" target="_blank">marcandre.lureau@redhat.com</a>><br>
><br>
> When updating the sampler views, virgl might need to flush. After<br>
> flushing, the resources are reattached, however, the sampler<br>
> enabled_mask isn't yet updated, and some views could be in the process<br>
> of being removed, which lead to the following crash:<br>
><br>
> Thread 1 "heaven_x64" received signal SIGSEGV, Segmentation fault.<br>
> 0x00007f83893cc3de in virgl_attach_res_sampler_views (vctx=vctx@entry=0x1c22c00, shader_type=shader_type@entry=1) at virgl_context.c:113<br>
> 113 res = virgl_resource(tinfo->views[i]->base.texture);<br>
> (gdb) bt<br>
> #0 0x00007f83893cc3de in virgl_attach_res_sampler_views (vctx=vctx@entry=0x1c22c00, shader_type=shader_type@entry=1) at virgl_context.c:113<br>
> #1 0x00007f83893cc703 in virgl_reemit_res (vctx=0x1c22c00) at virgl_context.c:182<br>
> #2 virgl_flush_eq (ctx=ctx@entry=0x1c22c00, closure=0x1c22c00) at virgl_context.c:637<br>
> #3 0x00007f83893ccbf8 in virgl_flush_from_st (ctx=0x1c22c00, fence=<optimized out>, flags=<optimized out>) at virgl_context.c:659<br>
> #4 0x00007f83893cd6b0 in virgl_encoder_write_cmd_dword (ctx=ctx@entry=0x1c22c00, dword=dword@entry=67075) at virgl_encode.c:43<br>
> #5 0x00007f83893cd76b in virgl_encode_delete_object (ctx=0x1c22c00, handle=1306480, object=object@entry=6) at virgl_encode.c:72<br>
> #6 0x00007f83893ccc81 in virgl_destroy_sampler_view (ctx=<optimized out>, view=0x7aca1b0) at virgl_context.c:741<br>
> #7 0x00007f83893cca17 in pipe_sampler_view_reference (view=0x0, ptr=0x1c22fc8) at ../../../../src/gallium/auxiliary/util/u_inlines.h:151<br>
> #8 virgl_set_sampler_views (ctx=0x1c22c00, shader_type=1, start_slot=<optimized out>, num_views=<optimized out>, views=<optimized out>) at virgl_context.c:724<br>
> #9 0x00007f8388fffd68 in cso_set_sampler_views (ctx=0x1ca2ee0, shader_stage=<optimized out>, count=9, views=<optimized out>) at cso_cache/cso_context.c:1301<br>
> #10 0x00007f8388e670c1 in update_textures (st=<optimized out>, mesa_shader=<optimized out>, prog=<optimized out>, max_units=16, sampler_views=0x1c8c140, num_textures=0x1c8c644) at state_tracker/st_atom_texture.c:465<br>
> #11 0x00007f8388e6296d in st_validate_state (st=st@entry=0x1c8a710, pipeline=pipeline@entry=ST_PIPELINE_RENDER) at state_tracker/st_atom.c:289<br>
> #12 0x00007f8388e8343b in st_draw_vbo (ctx=0x1c50600, prims=0x7ffe99b5a580, nr_prims=1, ib=0x7ffe99b5a560, index_bounds_valid=<optimized out>, min_index=<optimized out>, max_index=<optimized out>, tfb_vertcount=0x0, stream=0,<br>
> indirect=0x0) at state_tracker/st_draw.c:176<br>
> #13 0x00007f8388e44d34 in vbo_validated_drawrangeelements (ctx=ctx@entry=0x1c50600, mode=mode@entry=4, index_bounds_valid=index_bounds_valid@entry=0 '\000', start=start@entry=4294967295, end=end@entry=4294967295, count=count@entry=2688,<br>
> type=5123, indices=0x0, basevertex=0, numInstances=1, baseInstance=0) at vbo/vbo_exec_array.c:849<br>
> #14 0x00007f8388e44db5 in vbo_exec_DrawElementsInstanced (mode=4,<br>
> #count=2688, type=5123, indices=0x0, numInstances=1) at<br>
> #vbo/vbo_exec_array.c:1030<br>
><br>
> Instead, remove the views from enabled_mask immediately.</p>
<p dir="ltr">Couldn't this in theory still happen a few lines up, where we are removing things from the remaining_mask?</p></blockquote><div><br></div><div>Right, it looks like it could happen there too, I guess you could add tinfo->enabled_mask &= ~(1 << i); there too<br><br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<p dir="ltr">Dave.</p>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</blockquote></div></div></div><div dir="ltr">-- <br></div><div data-smartmail="gmail_signature"><div dir="ltr">Marc-André Lureau<br></div></div>