All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH mesa] clover: Fix pipe_grid_info.indirect not being initialized
@ 2016-03-14 12:50 Hans de Goede
  2016-03-14 13:01 ` Samuel Pitoiset
  0 siblings, 1 reply; 7+ messages in thread
From: Hans de Goede @ 2016-03-14 12:50 UTC (permalink / raw)
  To: mesa-dev; +Cc: nouveau

After pipe_grid_info.indirect was introduced, clover was not modified
to set it causing it to pass uninitialized memory for it to launch_grid.

This commit fixes this by zero-ing the entire pipe_grid_info struct when
declaring it, to avoid similar problems popping-up in the future.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 src/gallium/state_trackers/clover/core/kernel.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/clover/core/kernel.cpp b/src/gallium/state_trackers/clover/core/kernel.cpp
index 8396be9..dad66aa 100644
--- a/src/gallium/state_trackers/clover/core/kernel.cpp
+++ b/src/gallium/state_trackers/clover/core/kernel.cpp
@@ -55,7 +55,7 @@ kernel::launch(command_queue &q,
    const auto reduced_grid_size =
       map(divides(), grid_size, block_size);
    void *st = exec.bind(&q, grid_offset);
-   struct pipe_grid_info info;
+   struct pipe_grid_info info = { 0, };
 
    // The handles are created during exec_context::bind(), so we need make
    // sure to call exec_context::bind() before retrieving them.
-- 
2.7.2

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH mesa] clover: Fix pipe_grid_info.indirect not being initialized
  2016-03-14 12:50 [PATCH mesa] clover: Fix pipe_grid_info.indirect not being initialized Hans de Goede
@ 2016-03-14 13:01 ` Samuel Pitoiset
       [not found]   ` <56E6B629.8080708-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Samuel Pitoiset @ 2016-03-14 13:01 UTC (permalink / raw)
  To: Hans de Goede, mesa-dev; +Cc: nouveau



On 03/14/2016 01:50 PM, Hans de Goede wrote:
> After pipe_grid_info.indirect was introduced, clover was not modified
> to set it causing it to pass uninitialized memory for it to launch_grid.
>
> This commit fixes this by zero-ing the entire pipe_grid_info struct when
> declaring it, to avoid similar problems popping-up in the future.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>   src/gallium/state_trackers/clover/core/kernel.cpp | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/gallium/state_trackers/clover/core/kernel.cpp b/src/gallium/state_trackers/clover/core/kernel.cpp
> index 8396be9..dad66aa 100644
> --- a/src/gallium/state_trackers/clover/core/kernel.cpp
> +++ b/src/gallium/state_trackers/clover/core/kernel.cpp
> @@ -55,7 +55,7 @@ kernel::launch(command_queue &q,
>      const auto reduced_grid_size =
>         map(divides(), grid_size, block_size);
>      void *st = exec.bind(&q, grid_offset);
> -   struct pipe_grid_info info;
> +   struct pipe_grid_info info = { 0, };

Right, good catch, it's my fault.

= { 0 }; is enough btw.

This should be backported to mesa 11.2 I guess, could you please send a 
v2 with this minor fix and add the cc thing?

Thanks.

>
>      // The handles are created during exec_context::bind(), so we need make
>      // sure to call exec_context::bind() before retrieving them.
>

-- 
-Samuel
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH mesa] clover: Fix pipe_grid_info.indirect not being initialized
       [not found]   ` <56E6B629.8080708-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2016-03-14 13:26     ` Hans de Goede
       [not found]       ` <56E6BBFC.2020306-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Hans de Goede @ 2016-03-14 13:26 UTC (permalink / raw)
  To: Samuel Pitoiset, mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Hi,

On 14-03-16 14:01, Samuel Pitoiset wrote:
>
>
> On 03/14/2016 01:50 PM, Hans de Goede wrote:
>> After pipe_grid_info.indirect was introduced, clover was not modified
>> to set it causing it to pass uninitialized memory for it to launch_grid.
>>
>> This commit fixes this by zero-ing the entire pipe_grid_info struct when
>> declaring it, to avoid similar problems popping-up in the future.
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> ---
>>   src/gallium/state_trackers/clover/core/kernel.cpp | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/gallium/state_trackers/clover/core/kernel.cpp b/src/gallium/state_trackers/clover/core/kernel.cpp
>> index 8396be9..dad66aa 100644
>> --- a/src/gallium/state_trackers/clover/core/kernel.cpp
>> +++ b/src/gallium/state_trackers/clover/core/kernel.cpp
>> @@ -55,7 +55,7 @@ kernel::launch(command_queue &q,
>>      const auto reduced_grid_size =
>>         map(divides(), grid_size, block_size);
>>      void *st = exec.bind(&q, grid_offset);
>> -   struct pipe_grid_info info;
>> +   struct pipe_grid_info info = { 0, };
>
> Right, good catch, it's my fault.
>
> = { 0 }; is enough btw.

I prefer to add the "," to make clear that we are initializing the entire struct,
I read it as  ", ...".

> This should be backported to mesa 11.2 I guess, could you please send a v2 with this minor fix and add the cc thing?

Sure, as soon as we're done bikeshedding on the "," :)

Regards,

Hans
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH mesa] clover: Fix pipe_grid_info.indirect not being initialized
       [not found]       ` <56E6BBFC.2020306-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2016-03-14 13:29         ` Samuel Pitoiset
       [not found]           ` <56E6BCD2.5000002-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Samuel Pitoiset @ 2016-03-14 13:29 UTC (permalink / raw)
  To: Hans de Goede, mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW



On 03/14/2016 02:26 PM, Hans de Goede wrote:
> Hi,
>
> On 14-03-16 14:01, Samuel Pitoiset wrote:
>>
>>
>> On 03/14/2016 01:50 PM, Hans de Goede wrote:
>>> After pipe_grid_info.indirect was introduced, clover was not modified
>>> to set it causing it to pass uninitialized memory for it to launch_grid.
>>>
>>> This commit fixes this by zero-ing the entire pipe_grid_info struct when
>>> declaring it, to avoid similar problems popping-up in the future.
>>>
>>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>>> ---
>>>   src/gallium/state_trackers/clover/core/kernel.cpp | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/src/gallium/state_trackers/clover/core/kernel.cpp
>>> b/src/gallium/state_trackers/clover/core/kernel.cpp
>>> index 8396be9..dad66aa 100644
>>> --- a/src/gallium/state_trackers/clover/core/kernel.cpp
>>> +++ b/src/gallium/state_trackers/clover/core/kernel.cpp
>>> @@ -55,7 +55,7 @@ kernel::launch(command_queue &q,
>>>      const auto reduced_grid_size =
>>>         map(divides(), grid_size, block_size);
>>>      void *st = exec.bind(&q, grid_offset);
>>> -   struct pipe_grid_info info;
>>> +   struct pipe_grid_info info = { 0, };
>>
>> Right, good catch, it's my fault.
>>
>> = { 0 }; is enough btw.
>
> I prefer to add the "," to make clear that we are initializing the
> entire struct,
> I read it as  ", ...".

Well, usually we use { 0 } in mesa, try to grep and you will see. :-)
There is only 3 occurrences of { 0, }, but I think they are quite old.

>
>> This should be backported to mesa 11.2 I guess, could you please send
>> a v2 with this minor fix and add the cc thing?
>
> Sure, as soon as we're done bikeshedding on the "," :)
>
> Regards,
>
> Hans

-- 
-Samuel
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH mesa] clover: Fix pipe_grid_info.indirect not being initialized
       [not found]           ` <56E6BCD2.5000002-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2016-03-14 13:31             ` Samuel Pitoiset
       [not found]               ` <56E6BD32.5000203-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Samuel Pitoiset @ 2016-03-14 13:31 UTC (permalink / raw)
  To: Hans de Goede, mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW



On 03/14/2016 02:29 PM, Samuel Pitoiset wrote:
>
>
> On 03/14/2016 02:26 PM, Hans de Goede wrote:
>> Hi,
>>
>> On 14-03-16 14:01, Samuel Pitoiset wrote:
>>>
>>>
>>> On 03/14/2016 01:50 PM, Hans de Goede wrote:
>>>> After pipe_grid_info.indirect was introduced, clover was not modified
>>>> to set it causing it to pass uninitialized memory for it to
>>>> launch_grid.
>>>>
>>>> This commit fixes this by zero-ing the entire pipe_grid_info struct
>>>> when
>>>> declaring it, to avoid similar problems popping-up in the future.
>>>>
>>>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>>>> ---
>>>>   src/gallium/state_trackers/clover/core/kernel.cpp | 2 +-
>>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/src/gallium/state_trackers/clover/core/kernel.cpp
>>>> b/src/gallium/state_trackers/clover/core/kernel.cpp
>>>> index 8396be9..dad66aa 100644
>>>> --- a/src/gallium/state_trackers/clover/core/kernel.cpp
>>>> +++ b/src/gallium/state_trackers/clover/core/kernel.cpp
>>>> @@ -55,7 +55,7 @@ kernel::launch(command_queue &q,
>>>>      const auto reduced_grid_size =
>>>>         map(divides(), grid_size, block_size);
>>>>      void *st = exec.bind(&q, grid_offset);
>>>> -   struct pipe_grid_info info;
>>>> +   struct pipe_grid_info info = { 0, };
>>>
>>> Right, good catch, it's my fault.
>>>
>>> = { 0 }; is enough btw.
>>
>> I prefer to add the "," to make clear that we are initializing the
>> entire struct,
>> I read it as  ", ...".
>
> Well, usually we use { 0 } in mesa, try to grep and you will see. :-)
> There is only 3 occurrences of { 0, }, but I think they are quite old.

Of course, I'm not really against this ",", but I just want consistency 
with the other parts.

>
>>
>>> This should be backported to mesa 11.2 I guess, could you please send
>>> a v2 with this minor fix and add the cc thing?
>>
>> Sure, as soon as we're done bikeshedding on the "," :)
>>
>> Regards,
>>
>> Hans
>

-- 
-Samuel
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH mesa] clover: Fix pipe_grid_info.indirect not being initialized
       [not found]               ` <56E6BD32.5000203-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2016-03-14 20:49                 ` Francisco Jerez
  2016-03-14 20:52                   ` [Nouveau] " Samuel Pitoiset
  0 siblings, 1 reply; 7+ messages in thread
From: Francisco Jerez @ 2016-03-14 20:49 UTC (permalink / raw)
  To: Samuel Pitoiset, Hans de Goede,
	mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW


[-- Attachment #1.1.1: Type: text/plain, Size: 2952 bytes --]

Samuel Pitoiset <samuel.pitoiset-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> On 03/14/2016 02:29 PM, Samuel Pitoiset wrote:
>>
>>
>> On 03/14/2016 02:26 PM, Hans de Goede wrote:
>>> Hi,
>>>
>>> On 14-03-16 14:01, Samuel Pitoiset wrote:
>>>>
>>>>
>>>> On 03/14/2016 01:50 PM, Hans de Goede wrote:
>>>>> After pipe_grid_info.indirect was introduced, clover was not modified
>>>>> to set it causing it to pass uninitialized memory for it to
>>>>> launch_grid.
>>>>>
>>>>> This commit fixes this by zero-ing the entire pipe_grid_info struct
>>>>> when
>>>>> declaring it, to avoid similar problems popping-up in the future.
>>>>>
>>>>> Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
>>>>> ---
>>>>>   src/gallium/state_trackers/clover/core/kernel.cpp | 2 +-
>>>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/src/gallium/state_trackers/clover/core/kernel.cpp
>>>>> b/src/gallium/state_trackers/clover/core/kernel.cpp
>>>>> index 8396be9..dad66aa 100644
>>>>> --- a/src/gallium/state_trackers/clover/core/kernel.cpp
>>>>> +++ b/src/gallium/state_trackers/clover/core/kernel.cpp
>>>>> @@ -55,7 +55,7 @@ kernel::launch(command_queue &q,
>>>>>      const auto reduced_grid_size =
>>>>>         map(divides(), grid_size, block_size);
>>>>>      void *st = exec.bind(&q, grid_offset);
>>>>> -   struct pipe_grid_info info;
>>>>> +   struct pipe_grid_info info = { 0, };
>>>>
>>>> Right, good catch, it's my fault.
>>>>
>>>> = { 0 }; is enough btw.
>>>
>>> I prefer to add the "," to make clear that we are initializing the
>>> entire struct,
>>> I read it as  ", ...".
>>
>> Well, usually we use { 0 } in mesa, try to grep and you will see. :-)
>> There is only 3 occurrences of { 0, }, but I think they are quite old.
>
> Of course, I'm not really against this ",", but I just want consistency 
> with the other parts.
>

In C++ '{}' is standard, more concise, and works for a wider range of
types regardless of their layout ('{ 0 }' is valid or not depending on
what the first member of the struct is, while '{}' works regardless, in
C++11 it can even be used to initialize non-POD types with custom
constructors), so it should be generally preferred instead.

Don't bother to resend just because of my nitpicking, I'll fix it up
before I push the last revision of your change, which is:

Reviewed-by: Francisco Jerez <currojerez-sGOZH3hwPm2sTnJN9+BGXg@public.gmane.org>

>>
>>>
>>>> This should be backported to mesa 11.2 I guess, could you please send
>>>> a v2 with this minor fix and add the cc thing?
>>>
>>> Sure, as soon as we're done bikeshedding on the "," :)
>>>
>>> Regards,
>>>
>>> Hans
>>
>
> -- 
> -Samuel
> _______________________________________________
> Nouveau mailing list
> Nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
> https://lists.freedesktop.org/mailman/listinfo/nouveau

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 212 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Nouveau] [PATCH mesa] clover: Fix pipe_grid_info.indirect not being initialized
  2016-03-14 20:49                 ` Francisco Jerez
@ 2016-03-14 20:52                   ` Samuel Pitoiset
  0 siblings, 0 replies; 7+ messages in thread
From: Samuel Pitoiset @ 2016-03-14 20:52 UTC (permalink / raw)
  To: Francisco Jerez, Hans de Goede, mesa-dev; +Cc: nouveau



On 03/14/2016 09:49 PM, Francisco Jerez wrote:
> Samuel Pitoiset <samuel.pitoiset@gmail.com> writes:
>
>> On 03/14/2016 02:29 PM, Samuel Pitoiset wrote:
>>>
>>>
>>> On 03/14/2016 02:26 PM, Hans de Goede wrote:
>>>> Hi,
>>>>
>>>> On 14-03-16 14:01, Samuel Pitoiset wrote:
>>>>>
>>>>>
>>>>> On 03/14/2016 01:50 PM, Hans de Goede wrote:
>>>>>> After pipe_grid_info.indirect was introduced, clover was not modified
>>>>>> to set it causing it to pass uninitialized memory for it to
>>>>>> launch_grid.
>>>>>>
>>>>>> This commit fixes this by zero-ing the entire pipe_grid_info struct
>>>>>> when
>>>>>> declaring it, to avoid similar problems popping-up in the future.
>>>>>>
>>>>>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>>>>>> ---
>>>>>>    src/gallium/state_trackers/clover/core/kernel.cpp | 2 +-
>>>>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>>
>>>>>> diff --git a/src/gallium/state_trackers/clover/core/kernel.cpp
>>>>>> b/src/gallium/state_trackers/clover/core/kernel.cpp
>>>>>> index 8396be9..dad66aa 100644
>>>>>> --- a/src/gallium/state_trackers/clover/core/kernel.cpp
>>>>>> +++ b/src/gallium/state_trackers/clover/core/kernel.cpp
>>>>>> @@ -55,7 +55,7 @@ kernel::launch(command_queue &q,
>>>>>>       const auto reduced_grid_size =
>>>>>>          map(divides(), grid_size, block_size);
>>>>>>       void *st = exec.bind(&q, grid_offset);
>>>>>> -   struct pipe_grid_info info;
>>>>>> +   struct pipe_grid_info info = { 0, };
>>>>>
>>>>> Right, good catch, it's my fault.
>>>>>
>>>>> = { 0 }; is enough btw.
>>>>
>>>> I prefer to add the "," to make clear that we are initializing the
>>>> entire struct,
>>>> I read it as  ", ...".
>>>
>>> Well, usually we use { 0 } in mesa, try to grep and you will see. :-)
>>> There is only 3 occurrences of { 0, }, but I think they are quite old.
>>
>> Of course, I'm not really against this ",", but I just want consistency
>> with the other parts.
>>
>
> In C++ '{}' is standard, more concise, and works for a wider range of
> types regardless of their layout ('{ 0 }' is valid or not depending on
> what the first member of the struct is, while '{}' works regardless, in
> C++11 it can even be used to initialize non-POD types with custom
> constructors), so it should be generally preferred instead.
>
> Don't bother to resend just because of my nitpicking, I'll fix it up
> before I push the last revision of your change, which is:

I didn't know that, thanks for this very good explanation. :-)

>
> Reviewed-by: Francisco Jerez <currojerez@riseup.net>
>
>>>
>>>>
>>>>> This should be backported to mesa 11.2 I guess, could you please send
>>>>> a v2 with this minor fix and add the cc thing?
>>>>
>>>> Sure, as soon as we're done bikeshedding on the "," :)
>>>>
>>>> Regards,
>>>>
>>>> Hans
>>>
>>
>> --
>> -Samuel
>> _______________________________________________
>> Nouveau mailing list
>> Nouveau@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/nouveau
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-03-14 20:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-14 12:50 [PATCH mesa] clover: Fix pipe_grid_info.indirect not being initialized Hans de Goede
2016-03-14 13:01 ` Samuel Pitoiset
     [not found]   ` <56E6B629.8080708-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-03-14 13:26     ` Hans de Goede
     [not found]       ` <56E6BBFC.2020306-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-03-14 13:29         ` Samuel Pitoiset
     [not found]           ` <56E6BCD2.5000002-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-03-14 13:31             ` Samuel Pitoiset
     [not found]               ` <56E6BD32.5000203-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-03-14 20:49                 ` Francisco Jerez
2016-03-14 20:52                   ` [Nouveau] " Samuel Pitoiset

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.