All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2] drm/amdkfd: Remove vla
@ 2018-04-11  1:02 Laura Abbott
  2018-04-11  9:30   ` Christian König
  2018-04-11 15:31   ` Felix Kuehling
  0 siblings, 2 replies; 5+ messages in thread
From: Laura Abbott @ 2018-04-11  1:02 UTC (permalink / raw)
  To: Oded Gabbay, Alex Deucher, Christian König,
	David (ChunMing) Zhou, Felix Kuehling
  Cc: Laura Abbott, David Airlie, dri-devel, amd-gfx, linux-kernel,
	kernel-hardening, Kees Cook

There's an ongoing effort to remove VLAs[1] from the kernel to eventually
turn on -Wvla. Switch to a constant value that covers all hardware.

[1] https://lkml.org/lkml/2018/3/7/621

Signed-off-by: Laura Abbott <labbott@redhat.com>
---
v2: Switch to a larger size to account for other hardware
---
 drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c b/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c
index 035c351f47c5..c3a5a80e31ae 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c
@@ -139,10 +139,12 @@ static void interrupt_wq(struct work_struct *work)
 {
 	struct kfd_dev *dev = container_of(work, struct kfd_dev,
 						interrupt_work);
+	uint32_t ih_ring_entry[8];
 
-	uint32_t ih_ring_entry[DIV_ROUND_UP(
-				dev->device_info->ih_ring_entry_size,
-				sizeof(uint32_t))];
+	if (dev->device_info->ih_ring_entry_size > (8 * sizeof(uint32_t))) {
+		dev_err(kfd_chardev(), "Ring entry too small\n");
+		return;
+	}
 
 	while (dequeue_ih_ring_entry(dev, ih_ring_entry))
 		dev->device_info->event_interrupt_class->interrupt_wq(dev,
-- 
2.14.3

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

* Re: [PATCHv2] drm/amdkfd: Remove vla
  2018-04-11  1:02 [PATCHv2] drm/amdkfd: Remove vla Laura Abbott
@ 2018-04-11  9:30   ` Christian König
  2018-04-11 15:31   ` Felix Kuehling
  1 sibling, 0 replies; 5+ messages in thread
From: Christian König @ 2018-04-11  9:30 UTC (permalink / raw)
  To: Laura Abbott, Oded Gabbay, Alex Deucher, Christian König,
	David (ChunMing) Zhou, Felix Kuehling
  Cc: Kees Cook, kernel-hardening, David Airlie, linux-kernel, amd-gfx,
	dri-devel

Am 11.04.2018 um 03:02 schrieb Laura Abbott:
> There's an ongoing effort to remove VLAs[1] from the kernel to eventually
> turn on -Wvla. Switch to a constant value that covers all hardware.
>
> [1] https://lkml.org/lkml/2018/3/7/621
>
> Signed-off-by: Laura Abbott <labbott@redhat.com>

It would be nicer to have a define for that somewhere.

Anyway the patch is Acked-by: Christian König <christian.koenig@amd.com> 
for now.

Regards,
Christian.

> ---
> v2: Switch to a larger size to account for other hardware
> ---
>   drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c | 8 +++++---
>   1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c b/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c
> index 035c351f47c5..c3a5a80e31ae 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c
> @@ -139,10 +139,12 @@ static void interrupt_wq(struct work_struct *work)
>   {
>   	struct kfd_dev *dev = container_of(work, struct kfd_dev,
>   						interrupt_work);
> +	uint32_t ih_ring_entry[8];
>   
> -	uint32_t ih_ring_entry[DIV_ROUND_UP(
> -				dev->device_info->ih_ring_entry_size,
> -				sizeof(uint32_t))];
> +	if (dev->device_info->ih_ring_entry_size > (8 * sizeof(uint32_t))) {
> +		dev_err(kfd_chardev(), "Ring entry too small\n");
> +		return;
> +	}
>   
>   	while (dequeue_ih_ring_entry(dev, ih_ring_entry))
>   		dev->device_info->event_interrupt_class->interrupt_wq(dev,

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

* Re: [PATCHv2] drm/amdkfd: Remove vla
@ 2018-04-11  9:30   ` Christian König
  0 siblings, 0 replies; 5+ messages in thread
From: Christian König @ 2018-04-11  9:30 UTC (permalink / raw)
  To: Laura Abbott, Oded Gabbay, Alex Deucher, Christian König,
	David (ChunMing) Zhou, Felix Kuehling
  Cc: Kees Cook, kernel-hardening, David Airlie, linux-kernel,
	dri-devel, amd-gfx

Am 11.04.2018 um 03:02 schrieb Laura Abbott:
> There's an ongoing effort to remove VLAs[1] from the kernel to eventually
> turn on -Wvla. Switch to a constant value that covers all hardware.
>
> [1] https://lkml.org/lkml/2018/3/7/621
>
> Signed-off-by: Laura Abbott <labbott@redhat.com>

It would be nicer to have a define for that somewhere.

Anyway the patch is Acked-by: Christian König <christian.koenig@amd.com> 
for now.

Regards,
Christian.

> ---
> v2: Switch to a larger size to account for other hardware
> ---
>   drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c | 8 +++++---
>   1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c b/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c
> index 035c351f47c5..c3a5a80e31ae 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c
> @@ -139,10 +139,12 @@ static void interrupt_wq(struct work_struct *work)
>   {
>   	struct kfd_dev *dev = container_of(work, struct kfd_dev,
>   						interrupt_work);
> +	uint32_t ih_ring_entry[8];
>   
> -	uint32_t ih_ring_entry[DIV_ROUND_UP(
> -				dev->device_info->ih_ring_entry_size,
> -				sizeof(uint32_t))];
> +	if (dev->device_info->ih_ring_entry_size > (8 * sizeof(uint32_t))) {
> +		dev_err(kfd_chardev(), "Ring entry too small\n");
> +		return;
> +	}
>   
>   	while (dequeue_ih_ring_entry(dev, ih_ring_entry))
>   		dev->device_info->event_interrupt_class->interrupt_wq(dev,

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCHv2] drm/amdkfd: Remove vla
  2018-04-11  1:02 [PATCHv2] drm/amdkfd: Remove vla Laura Abbott
@ 2018-04-11 15:31   ` Felix Kuehling
  2018-04-11 15:31   ` Felix Kuehling
  1 sibling, 0 replies; 5+ messages in thread
From: Felix Kuehling @ 2018-04-11 15:31 UTC (permalink / raw)
  To: Laura Abbott, Oded Gabbay, Alex Deucher, Christian König,
	David (ChunMing) Zhou
  Cc: David Airlie, dri-devel, amd-gfx, linux-kernel, kernel-hardening,
	Kees Cook

On 2018-04-10 09:02 PM, Laura Abbott wrote:
> There's an ongoing effort to remove VLAs[1] from the kernel to eventually
> turn on -Wvla. Switch to a constant value that covers all hardware.
>
> [1] https://lkml.org/lkml/2018/3/7/621
>
> Signed-off-by: Laura Abbott <labbott@redhat.com>
> ---
> v2: Switch to a larger size to account for other hardware
> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c b/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c
> index 035c351f47c5..c3a5a80e31ae 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c
> @@ -139,10 +139,12 @@ static void interrupt_wq(struct work_struct *work)
>  {
>  	struct kfd_dev *dev = container_of(work, struct kfd_dev,
>  						interrupt_work);
> +	uint32_t ih_ring_entry[8];
>  
> -	uint32_t ih_ring_entry[DIV_ROUND_UP(
> -				dev->device_info->ih_ring_entry_size,
> -				sizeof(uint32_t))];
> +	if (dev->device_info->ih_ring_entry_size > (8 * sizeof(uint32_t))) {
> +		dev_err(kfd_chardev(), "Ring entry too small\n");

When the ring entry size really is too small, this will potentially
flood the kernel log. Maybe a WARN_ONCE would be more helpful. With that
fixed, this patch is Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>

Regards,
  Felix

> +		return;
> +	}
>  
>  	while (dequeue_ih_ring_entry(dev, ih_ring_entry))
>  		dev->device_info->event_interrupt_class->interrupt_wq(dev,

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

* Re: [PATCHv2] drm/amdkfd: Remove vla
@ 2018-04-11 15:31   ` Felix Kuehling
  0 siblings, 0 replies; 5+ messages in thread
From: Felix Kuehling @ 2018-04-11 15:31 UTC (permalink / raw)
  To: Laura Abbott, Oded Gabbay, Alex Deucher, Christian König,
	David (ChunMing) Zhou
  Cc: Kees Cook, kernel-hardening, David Airlie, linux-kernel, amd-gfx,
	dri-devel

On 2018-04-10 09:02 PM, Laura Abbott wrote:
> There's an ongoing effort to remove VLAs[1] from the kernel to eventually
> turn on -Wvla. Switch to a constant value that covers all hardware.
>
> [1] https://lkml.org/lkml/2018/3/7/621
>
> Signed-off-by: Laura Abbott <labbott@redhat.com>
> ---
> v2: Switch to a larger size to account for other hardware
> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c b/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c
> index 035c351f47c5..c3a5a80e31ae 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c
> @@ -139,10 +139,12 @@ static void interrupt_wq(struct work_struct *work)
>  {
>  	struct kfd_dev *dev = container_of(work, struct kfd_dev,
>  						interrupt_work);
> +	uint32_t ih_ring_entry[8];
>  
> -	uint32_t ih_ring_entry[DIV_ROUND_UP(
> -				dev->device_info->ih_ring_entry_size,
> -				sizeof(uint32_t))];
> +	if (dev->device_info->ih_ring_entry_size > (8 * sizeof(uint32_t))) {
> +		dev_err(kfd_chardev(), "Ring entry too small\n");

When the ring entry size really is too small, this will potentially
flood the kernel log. Maybe a WARN_ONCE would be more helpful. With that
fixed, this patch is Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>

Regards,
  Felix

> +		return;
> +	}
>  
>  	while (dequeue_ih_ring_entry(dev, ih_ring_entry))
>  		dev->device_info->event_interrupt_class->interrupt_wq(dev,

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2018-04-11 15:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-11  1:02 [PATCHv2] drm/amdkfd: Remove vla Laura Abbott
2018-04-11  9:30 ` Christian König
2018-04-11  9:30   ` Christian König
2018-04-11 15:31 ` Felix Kuehling
2018-04-11 15:31   ` Felix Kuehling

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.