patches.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH] ntb_perf: Fix 64-bit division on 32-bit architectures
@ 2022-06-22 17:43 Nathan Chancellor
  2022-08-12 14:04 ` Jon Mason
  0 siblings, 1 reply; 3+ messages in thread
From: Nathan Chancellor @ 2022-06-22 17:43 UTC (permalink / raw)
  To: Jon Mason, Dave Jiang, Allen Hubbe
  Cc: Alexander Fomichev, ntb, patches, Nathan Chancellor,
	kernel test robot

When compiling for a 32-bit architecture, such as arm, an error occurs
during modpost:

  ERROR: modpost: "__aeabi_uldivmod" [drivers/ntb/test/ntb_perf.ko] undefined!

The tries member of struct perf_thread is u64 so a 64-bit division
helper is needed. Use div_u64_rem() to get the remainder of the division
so that it can be checked against zero.

Fixes: dc150dfb081f ("ntb_perf: extend with burst latency measurement")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 drivers/ntb/test/ntb_perf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/ntb/test/ntb_perf.c b/drivers/ntb/test/ntb_perf.c
index 23e154bd41b9..4e05c7aa070d 100644
--- a/drivers/ntb/test/ntb_perf.c
+++ b/drivers/ntb/test/ntb_perf.c
@@ -1118,6 +1118,7 @@ static int perf_run_latency(struct perf_thread *pthr)
 	void __iomem *flt_dst, *bnd_dst;
 	void *flt_src;
 	u64 stop_at;
+	u32 rem;
 	int ret;
 
 	pthr->tries = 0;
@@ -1146,7 +1147,8 @@ static int perf_run_latency(struct perf_thread *pthr)
 		}
 
 		/* Avoid processor soft lock-ups */
-		if (!(pthr->tries % RESCHEDULE_RATIO))
+		div_u64_rem(pthr->tries, RESCHEDULE_RATIO, &rem);
+		if (!rem)
 			schedule();
 	}
 

base-commit: 0c4b285d9636cc850f55151fa6a250dd131e5192
-- 
2.37.0.rc1


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

end of thread, other threads:[~2022-08-15 15:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-22 17:43 [PATCH] ntb_perf: Fix 64-bit division on 32-bit architectures Nathan Chancellor
2022-08-12 14:04 ` Jon Mason
2022-08-15 15:47   ` Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).