drm/amdkfd: Remove vla
Subsystems (3)
PATCH v3 1/1 drm/amdkfd: Remove vla
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
---
v3: Introduced a #define for the max value, switched to pr_err_once to avoid log flood, switched to sizeof(array) per private suggestion.
--- drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c | 8 +++++--- drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c +5 -3
@@ -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[KFD_MAX_RING_ENTRY_SIZE ]; -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 >sizeof (ih_ring_entry)) { +dev_err_once (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,
drivers/gpu/drm/amd/amdkfd/kfd_priv.h +2 -0
@@ -39,6 +39,8 @@#include "amd_shared.h" +#define KFD_MAX_RING_ENTRY_SIZE 8 +#define KFD_SYSFS_FILE_MODE 0444#define KFD_MMAP_DOORBELL_MASK 0x8000000000000ull
Signature · 6 lines
2.14.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 9 lines · 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
Reviewed-by Felix Kuehling <[email protected]>Acked-by Christian König <[email protected]>Signed-off-by Laura Abbott <[email protected]>
Friendly ping -- I don't see this in -next yet. Oded, does this look okay to apply?
Thanks!
-Kees
Quoted 44 lines
---
v3: Introduced a #define for the max value, switched topr_err_onceto avoid log flood, switched to sizeof(array) per private suggestion.--- drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c | 8 +++++--- drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c +5
-3@@ -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[KFD_MAX_RING_ENTRY_SIZE ]; -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 >sizeof (ih_ring_entry)) { +dev_err_once (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,drivers/gpu/drm/amd/amdkfd/kfd_priv.h +2
-1@@ -39,6 +39,8 @@#include "amd_shared.h" +#define KFD_MAX_RING_ENTRY_SIZE 8 +#define KFD_SYSFS_FILE_MODE 0444#define KFD_MMAP_DOORBELL_MASK 0x8000000000000ull --2.14.3
Signature · 2 lines
Kees Cook Pixel Security
Quoted 11 lines · Kees Cook
Quoted 9 lines · 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
Reviewed-by Felix Kuehling <[email protected]>Acked-by Christian König <[email protected]>Signed-off-by Laura Abbott <[email protected]>
Quoted 6 lines
Friendly ping -- I don't see this in -next yet. Oded, does this look okay to apply?
Thanks!
-Kees
Thanks!
Applied to amdkfd-next
Oded
Quoted 41 lines
Quoted 41 lines
---
v3: Introduced a #define for the max value, switched topr_err_onceto avoid log flood, switched to sizeof(array) per private suggestion.--- drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c | 8 +++++--- drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c +5
-3@@ -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[KFD_MAX_RING_ENTRY_SIZE ]; -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 >sizeof (ih_ring_entry)) { +dev_err_once (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,drivers/gpu/drm/amd/amdkfd/kfd_priv.h +2
-0@@ -39,6 +39,8 @@#include "amd_shared.h" +#define KFD_MAX_RING_ENTRY_SIZE 8 +#define KFD_SYSFS_FILE_MODE 0444
Quoted 10 lines
Quoted 4 lines
drivers/gpu/drm/amd/amdkfd/kfd_priv.h +0
-1#define KFD_MMAP_DOORBELL_MASK 0x8000000000000ull --2.14.3
--
Kees Cook
Pixel Security
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx