All of lore.kernel.org
 help / color / mirror / Atom feed
From: Max Filippov <jcmvbkbc@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: linux-next@vger.kernel.org, ntb@lists.linux.dev,
	Alexander Fomichev <a.fomichev@yadro.com>,
	Dave Jiang <dave.jiang@intel.com>, Jon Mason <jdmason@kudzu.us>,
	Max Filippov <jcmvbkbc@gmail.com>
Subject: [PATCH] drivers/ntb/test: avoid 64-bit modulus operation
Date: Mon, 27 Jun 2022 08:57:10 -0700	[thread overview]
Message-ID: <20220627155710.2067032-1-jcmvbkbc@gmail.com> (raw)

Redefine RESCHEDULE_RATIO to a closest power of 2 so that the following
code in the perf_run_latency

	/* Avoid processor soft lock-ups */
	if (!(pthr->tries % RESCHEDULE_RATIO))
		schedule();

doesn't do 64-bit modulus operation.
This fixes the following build failures on 32-bit architectures visible
in linux-next:

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

Fixes: dc150dfb081f ("ntb_perf: extend with burst latency measurement")
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
 drivers/ntb/test/ntb_perf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ntb/test/ntb_perf.c b/drivers/ntb/test/ntb_perf.c
index 23e154bd41b9..536fab0030f3 100644
--- a/drivers/ntb/test/ntb_perf.c
+++ b/drivers/ntb/test/ntb_perf.c
@@ -126,7 +126,7 @@ MODULE_DESCRIPTION("PCIe NTB Performance Measurement Tool");
 #define PERF_BUF_LEN 1024
 
 #define LAT_MIN_TRIES	20
-#define RESCHEDULE_RATIO	10000
+#define RESCHEDULE_RATIO	8192 /* power of 2, to avoid actual division */
 
 static unsigned long max_mw_size;
 module_param(max_mw_size, ulong, 0644);
-- 
2.30.2


                 reply	other threads:[~2022-06-27 15:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220627155710.2067032-1-jcmvbkbc@gmail.com \
    --to=jcmvbkbc@gmail.com \
    --cc=a.fomichev@yadro.com \
    --cc=dave.jiang@intel.com \
    --cc=jdmason@kudzu.us \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=ntb@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 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.