All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/msm/dpu: avoid open-coded 64-bit division
@ 2020-05-27 13:35 Arnd Bergmann
  2020-05-27 14:25 ` Georgi Djakov
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2020-05-27 13:35 UTC (permalink / raw)
  To: Georgi Djakov, Rob Clark, Kalyan Thota
  Cc: Arnd Bergmann, Matthias Kaehlcke, Sibi Sankar, Viresh Kumar,
	Evan Green, Akash Asthana, linux-pm, linux-kernel

64-bit integer division is normally not allowed in the kernel
because of the large overhead on 32-bit machines:

drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.o: in function `_dpu_core_perf_crtc_update_bus':
dpu_core_perf.c:(.text+0x810): undefined reference to `__aeabi_uldivmod'

The function already contains a call to do_div(), so I assume this
is never called in a performance critical context, and we can
use div_u64 for the second one as well.

Fixes: 04d9044f6c57 ("drm/msm/dpu: add support for clk and bw scaling for display")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 include/linux/interconnect.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/interconnect.h b/include/linux/interconnect.h
index 3a63d98613fc..8279fe9b2082 100644
--- a/include/linux/interconnect.h
+++ b/include/linux/interconnect.h
@@ -11,7 +11,7 @@
 #include <linux/types.h>
 
 /* macros for converting to icc units */
-#define Bps_to_icc(x)	((x) / 1000)
+#define Bps_to_icc(x)	div_u64((x), 1000)
 #define kBps_to_icc(x)	(x)
 #define MBps_to_icc(x)	((x) * 1000)
 #define GBps_to_icc(x)	((x) * 1000 * 1000)
-- 
2.26.2


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

* Re: [PATCH] drm/msm/dpu: avoid open-coded 64-bit division
  2020-05-27 13:35 [PATCH] drm/msm/dpu: avoid open-coded 64-bit division Arnd Bergmann
@ 2020-05-27 14:25 ` Georgi Djakov
  0 siblings, 0 replies; 2+ messages in thread
From: Georgi Djakov @ 2020-05-27 14:25 UTC (permalink / raw)
  To: Arnd Bergmann, Rob Clark, Kalyan Thota
  Cc: Matthias Kaehlcke, Sibi Sankar, Viresh Kumar, Evan Green,
	Akash Asthana, linux-pm, linux-kernel

On 27.05.20 16:35, Arnd Bergmann wrote:
> 64-bit integer division is normally not allowed in the kernel
> because of the large overhead on 32-bit machines:
> 
> drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.o: in function `_dpu_core_perf_crtc_update_bus':
> dpu_core_perf.c:(.text+0x810): undefined reference to `__aeabi_uldivmod'
> 
> The function already contains a call to do_div(), so I assume this
> is never called in a performance critical context, and we can
> use div_u64 for the second one as well.
> 
> Fixes: 04d9044f6c57 ("drm/msm/dpu: add support for clk and bw scaling for display")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Georgi Djakov <georgi.djakov@linaro.org>

Thanks for the patch Arnd. I just noticed this in linux-next.

Rob, could you please take it into msm-next, as the patch which
triggers the issue is also there?

Thanks,
Georgi

> ---
>  include/linux/interconnect.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/interconnect.h b/include/linux/interconnect.h
> index 3a63d98613fc..8279fe9b2082 100644
> --- a/include/linux/interconnect.h
> +++ b/include/linux/interconnect.h
> @@ -11,7 +11,7 @@
>  #include <linux/types.h>
>  
>  /* macros for converting to icc units */
> -#define Bps_to_icc(x)	((x) / 1000)
> +#define Bps_to_icc(x)	div_u64((x), 1000)
>  #define kBps_to_icc(x)	(x)
>  #define MBps_to_icc(x)	((x) * 1000)
>  #define GBps_to_icc(x)	((x) * 1000 * 1000)
> 


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

end of thread, other threads:[~2020-05-27 14:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-27 13:35 [PATCH] drm/msm/dpu: avoid open-coded 64-bit division Arnd Bergmann
2020-05-27 14:25 ` Georgi Djakov

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.