* [PATCH 0/3] Collection of small fixes for Panfrost
@ 2026-08-20 14:04 Adrián Larumbe
2026-08-20 14:04 ` [PATCH 1/3] drm/panfrost: Check another bo field for cache option query Adrián Larumbe
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Adrián Larumbe @ 2026-08-20 14:04 UTC (permalink / raw)
To: Boris Brezillon, Rob Herring, Steven Price, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Faith Ekstrand, Tomeu Vizoso, Marty E. Plummer, Eric Anholt,
Neil Armstrong
Cc: dri-devel, linux-kernel, Adrián Larumbe, Claude
These fixes were originally part of a wider series, but since it seemed
to grow indefinitely as new issues were found, I decided to split them
into smaller more managable series. This one includes some minor fixes,
both manually found or else pointed to by an LLM.
The last pre-existing revision they were grafted from can be found at:
https://lore.kernel.org/all/20260729-claude-fixes-v4-0-01968f2ec77a@collabora.com/
Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
---
Adrián Larumbe (3):
drm/panfrost: Check another bo field for cache option query
drm/panfrost: Prevent division by 0
drm/panfrost: Remove unnecessary header file include
drivers/gpu/drm/panfrost/panfrost_devfreq.c | 2 +-
drivers/gpu/drm/panfrost/panfrost_device.c | 1 -
drivers/gpu/drm/panfrost/panfrost_drv.c | 2 +-
3 files changed, 2 insertions(+), 3 deletions(-)
---
base-commit: 063019ac51afffda4ab3d658701b086caa0c8e9e
change-id: 20260820-b4-panfrost-fixes-6b49f8f46183
Best regards,
--
Adrián Larumbe <adrian.larumbe@collabora.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] drm/panfrost: Check another bo field for cache option query
2026-08-20 14:04 [PATCH 0/3] Collection of small fixes for Panfrost Adrián Larumbe
@ 2026-08-20 14:04 ` Adrián Larumbe
2026-08-20 14:04 ` [PATCH 2/3] drm/panfrost: Prevent division by 0 Adrián Larumbe
2026-08-20 14:04 ` [PATCH 3/3] drm/panfrost: Remove unnecessary header file include Adrián Larumbe
2 siblings, 0 replies; 5+ messages in thread
From: Adrián Larumbe @ 2026-08-20 14:04 UTC (permalink / raw)
To: Boris Brezillon, Rob Herring, Steven Price, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Faith Ekstrand, Tomeu Vizoso, Marty E. Plummer, Eric Anholt,
Neil Armstrong
Cc: dri-devel, linux-kernel, Adrián Larumbe, Claude
When querying the properties of a BO, whether it was created in
Writeback caching mode for userspace mappings, is recorded in a Panfrost
BO's wb_mmap field.
Reported-by: Claude <noreply@anthropic.com>
Closes: https://gitlab.freedesktop.org/panfrost/linux/-/work_items/88
Fixes: 62eedf1ccba5 ("drm/panfrost: Add flag to map GEM object Write-Back Cacheable")
Reviewed-by: Steven Price <steven.price@arm.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
---
drivers/gpu/drm/panfrost/panfrost_drv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
index 36cc2e67a308..96a66d673ba6 100644
--- a/drivers/gpu/drm/panfrost/panfrost_drv.c
+++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
@@ -662,7 +662,7 @@ static int panfrost_ioctl_query_bo_info(struct drm_device *dev, void *data,
if (bo->is_heap)
args->create_flags |= PANFROST_BO_HEAP;
- if (!bo->base.map_wc)
+ if (bo->wb_mmap)
args->create_flags |= PANFROST_BO_WB_MMAP;
}
--
2.55.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] drm/panfrost: Prevent division by 0
2026-08-20 14:04 [PATCH 0/3] Collection of small fixes for Panfrost Adrián Larumbe
2026-08-20 14:04 ` [PATCH 1/3] drm/panfrost: Check another bo field for cache option query Adrián Larumbe
@ 2026-08-20 14:04 ` Adrián Larumbe
2026-08-20 14:11 ` sashiko-bot
2026-08-20 14:04 ` [PATCH 3/3] drm/panfrost: Remove unnecessary header file include Adrián Larumbe
2 siblings, 1 reply; 5+ messages in thread
From: Adrián Larumbe @ 2026-08-20 14:04 UTC (permalink / raw)
To: Boris Brezillon, Rob Herring, Steven Price, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Faith Ekstrand, Tomeu Vizoso, Marty E. Plummer, Eric Anholt,
Neil Armstrong
Cc: dri-devel, linux-kernel, Adrián Larumbe, Claude
When updating and debug-printing devfreq stats, in the very unlikely
off-chance that total device time is less than 100 ns, division by 0
would happen. Fix the divisor when relevant and rearrange operands.
Reported-by: Claude <noreply@anthropic.com>
Closes: https://gitlab.freedesktop.org/panfrost/linux/-/work_items/88
Fixes: f3ba91228e8e ("drm/panfrost: Add initial panfrost driver")
Reviewed-by: Steven Price <steven.price@arm.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
---
drivers/gpu/drm/panfrost/panfrost_devfreq.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c
index b51c30778811..0fe81d259274 100644
--- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c
+++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c
@@ -78,7 +78,7 @@ static int panfrost_devfreq_get_dev_status(struct device *dev,
dev_dbg(pfdev->base.dev, "busy %lu total %lu %lu %% freq %lu MHz\n",
status->busy_time, status->total_time,
- status->busy_time / (status->total_time / 100),
+ status->busy_time * 100 / MAX(status->total_time, 1),
status->current_frequency / 1000 / 1000);
return 0;
--
2.55.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] drm/panfrost: Remove unnecessary header file include
2026-08-20 14:04 [PATCH 0/3] Collection of small fixes for Panfrost Adrián Larumbe
2026-08-20 14:04 ` [PATCH 1/3] drm/panfrost: Check another bo field for cache option query Adrián Larumbe
2026-08-20 14:04 ` [PATCH 2/3] drm/panfrost: Prevent division by 0 Adrián Larumbe
@ 2026-08-20 14:04 ` Adrián Larumbe
2 siblings, 0 replies; 5+ messages in thread
From: Adrián Larumbe @ 2026-08-20 14:04 UTC (permalink / raw)
To: Boris Brezillon, Rob Herring, Steven Price, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Faith Ekstrand, Tomeu Vizoso, Marty E. Plummer, Eric Anholt,
Neil Armstrong
Cc: dri-devel, linux-kernel, Adrián Larumbe
None of panfrost_features.h definitions are used in panfrost_device.c
Reviewed-by: Steven Price <steven.price@arm.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
---
drivers/gpu/drm/panfrost/panfrost_device.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c b/drivers/gpu/drm/panfrost/panfrost_device.c
index d0a23c51be39..485349faf251 100644
--- a/drivers/gpu/drm/panfrost/panfrost_device.c
+++ b/drivers/gpu/drm/panfrost/panfrost_device.c
@@ -11,7 +11,6 @@
#include "panfrost_device.h"
#include "panfrost_devfreq.h"
-#include "panfrost_features.h"
#include "panfrost_gem.h"
#include "panfrost_issues.h"
#include "panfrost_gpu.h"
--
2.55.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/3] drm/panfrost: Prevent division by 0
2026-08-20 14:04 ` [PATCH 2/3] drm/panfrost: Prevent division by 0 Adrián Larumbe
@ 2026-08-20 14:11 ` sashiko-bot
0 siblings, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-08-20 14:11 UTC (permalink / raw)
To: Adrián Larumbe; +Cc: dri-devel
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Rearranging the expression to `status->busy_time * 100` introduces an integer overflow on 32-bit architectures, resulting in drastically incorrect devfreq load percentages being logged.
--
--- Patch [2]: [PATCH 2/3] drm/panfrost: Prevent division by 0 ---
commit f1707dda0ddcd92307754978d37b7e0bf9939612
Author: Adrián Larumbe <adrian.larumbe@collabora.com>
drm/panfrost: Prevent division by 0
This commit addresses a potential division by zero when calculating device
frequency utilization for debug logging. It rearranges the calculation to
multiply busy time by 100 before dividing by the maximum of total time or 1.
Closes: https://gitlab.freedesktop.org/panfrost/linux/-/work_items/88
> diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c
> --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c
> @@ -78,7 +78,7 @@ static int panfrost_devfreq_get_dev_status(struct device *dev,
>
> dev_dbg(pfdev->base.dev, "busy %lu total %lu %lu %% freq %lu MHz\n",
> status->busy_time, status->total_time,
> - status->busy_time / (status->total_time / 100),
> + status->busy_time * 100 / MAX(status->total_time, 1),
[Severity: Medium]
Will this calculation overflow on 32-bit architectures?
In panfrost_devfreq_get_dev_status(), status->busy_time is an unsigned long,
which is 32 bits on ARM32 architectures where Panfrost is widely used.
Since devfreq times are calculated in nanoseconds, a standard 50ms polling
interval can yield a busy_time of around 50,000,000 ns. Multiplying
50,000,000 by 100 results in 5,000,000,000, which exceeds the maximum
32-bit unsigned long value of 4,294,967,295.
Could this cause drastically incorrect load percentages to be logged during
normal GPU workloads when devfreq debug logging is enabled?
> status->current_frequency / 1000 / 1000);
>
> return 0;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260820-b4-panfrost-fixes-v1-0-1b2c2376f4bc@collabora.com?part=2
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-08-20 14:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-20 14:04 [PATCH 0/3] Collection of small fixes for Panfrost Adrián Larumbe
2026-08-20 14:04 ` [PATCH 1/3] drm/panfrost: Check another bo field for cache option query Adrián Larumbe
2026-08-20 14:04 ` [PATCH 2/3] drm/panfrost: Prevent division by 0 Adrián Larumbe
2026-08-20 14:11 ` sashiko-bot
2026-08-20 14:04 ` [PATCH 3/3] drm/panfrost: Remove unnecessary header file include Adrián Larumbe
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.