patches.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Jon Mason <jdmason@kudzu.us>, Dave Jiang <dave.jiang@intel.com>,
	Allen Hubbe <allenbh@gmail.com>
Cc: Alexander Fomichev <a.fomichev@yadro.com>,
	ntb@lists.linux.dev, patches@lists.linux.dev,
	Nathan Chancellor <nathan@kernel.org>,
	kernel test robot <lkp@intel.com>
Subject: [PATCH] ntb_perf: Fix 64-bit division on 32-bit architectures
Date: Wed, 22 Jun 2022 10:43:26 -0700	[thread overview]
Message-ID: <20220622174326.1832697-1-nathan@kernel.org> (raw)

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


             reply	other threads:[~2022-06-22 17:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-22 17:43 Nathan Chancellor [this message]
2022-08-12 14:04 ` [PATCH] ntb_perf: Fix 64-bit division on 32-bit architectures Jon Mason
2022-08-15 15:47   ` Nathan Chancellor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220622174326.1832697-1-nathan@kernel.org \
    --to=nathan@kernel.org \
    --cc=a.fomichev@yadro.com \
    --cc=allenbh@gmail.com \
    --cc=dave.jiang@intel.com \
    --cc=jdmason@kudzu.us \
    --cc=lkp@intel.com \
    --cc=ntb@lists.linux.dev \
    --cc=patches@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).