[Mesa-dev] [PATCH 1/2] r600: Fix possible endless loop in compute_memory_pool allocations.
Jan Vesely
jan.vesely at rutgers.edu
Thu Jun 19 08:40:03 PDT 2014
On Thu, 2014-06-19 at 17:27 +0200, Bruno Jimenez wrote:
> Hi,
>
> Thanks for catching this bug!
>
> Reviewed-by: Bruno Jiménez <brunojimen at gmail.com>
>
> Also, could you please send me a copy of the tests?
This got triggered by one of the gegl test. You'll need the attached
patches to run gegl git[0] on mesa/clover/r600. you 'll need babl git[1]
too. Let me know if I can help with setting it up.
Sry, I don't have any smaller reproducer.
Jan
[0] git://git.gnome.org/gegl
[1] git://git.gnome.org/babl
>
> On Thu, 2014-06-19 at 10:21 -0400, Jan Vesely wrote:
> > The important part is the change of the condition to <= 0. Otherwise the loop
> > gets stuck never actually growing the pool.
> >
> > The change in the aux-need calculation guarantees max 2 iterations, and
> > avoids wasting memory in case a smaller item can't fit into a relatively larger
> > pool.
> >
> > Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
> > CC: Bruno Jimenez <brunojimen at gmail.com>
> > ---
> >
> > This fixes hang in gegl colors.xml test
> >
> > src/gallium/drivers/r600/compute_memory_pool.c | 7 +++++--
> > 1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/gallium/drivers/r600/compute_memory_pool.c b/src/gallium/drivers/r600/compute_memory_pool.c
> > index ec8c470..0b6d2da6 100644
> > --- a/src/gallium/drivers/r600/compute_memory_pool.c
> > +++ b/src/gallium/drivers/r600/compute_memory_pool.c
> > @@ -320,8 +320,11 @@ int compute_memory_finalize_pending(struct compute_memory_pool* pool,
> > int64_t need = item->size_in_dw+2048 -
> > (pool->size_in_dw - allocated);
> >
> > - if (need < 0) {
> > - need = pool->size_in_dw / 10;
> > + if (need <= 0) {
> > + /* There's enough free space, but it's too
> > + * fragmented. Assume half of the item can fit
> > + * int the last chunk */
> > + need = (item->size_in_dw / 2) + ITEM_ALIGNMENT;
> > }
> >
> > need = align(need, ITEM_ALIGNMENT);
>
>
--
Jan Vesely <jan.vesely at rutgers.edu>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-opencl-Don-t-load-some-unused-extensions.patch
Type: text/x-patch
Size: 1060 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140619/f5cc40e2/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Don-t-use-color_kernels-they-are-broken-on-mesa.patch
Type: text/x-patch
Size: 1198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140619/f5cc40e2/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-cl-Make-noise-simplex-kernel-OpenCL-1.1-complaint.patch
Type: text/x-patch
Size: 2169 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140619/f5cc40e2/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140619/f5cc40e2/attachment.sig>
More information about the mesa-dev
mailing list