All of lore.kernel.org
 help / color / mirror / Atom feed
From: Logan Gunthorpe <logang@deltatee.com>
To: Jon Mason <jdmason@kudzu.us>, Dave Jiang <dave.jiang@intel.com>,
	Allen Hubbe <Allen.Hubbe@emc.com>
Cc: Shuah Khan <shuahkh@osg.samsung.com>,
	Sudip Mukherjee <sudipm.mukherjee@gmail.com>,
	Arnd Bergmann <arnd@arndb.de>,
	linux-kernel@vger.kernel.org, linux-ntb@googlegroups.com,
	linux-kselftest@vger.kernel.org,
	Logan Gunthorpe <logang@deltatee.com>
Subject: [PATCH v2 1/8] ntb_perf: Schedule based on time not on performance
Date: Tue, 14 Jun 2016 11:02:21 -0600	[thread overview]
Message-ID: <2b42e0663ff7d04f01de7b904e37492a80796cea.1465919683.git.logang@deltatee.com> (raw)
In-Reply-To: <cover.1465919682.git.logang@deltatee.com>
In-Reply-To: <cover.1465919682.git.logang@deltatee.com>

When debugging performance problems, if some issue causes the ntb
hardware to be significantly slower than expected, ntb_perf will
hang requiring a reboot because it only schedules once every 4GB.

Instead, schedule based on jiffies so it will not hang the CPU if
the transfer is slow.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Acked-by: Dave Jiang <dave.jiang@intel.com>
---
 drivers/ntb/test/ntb_perf.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/ntb/test/ntb_perf.c b/drivers/ntb/test/ntb_perf.c
index 4368519..5008ccf 100644
--- a/drivers/ntb/test/ntb_perf.c
+++ b/drivers/ntb/test/ntb_perf.c
@@ -273,6 +273,7 @@ static int perf_move_data(struct pthr_ctx *pctx, char __iomem *dst, char *src,
 	char __iomem *tmp = dst;
 	u64 perf, diff_us;
 	ktime_t kstart, kstop, kdiff;
+	unsigned long last_sleep = jiffies;
 
 	chunks = div64_u64(win_size, buf_size);
 	total_chunks = div64_u64(total, buf_size);
@@ -288,8 +289,9 @@ static int perf_move_data(struct pthr_ctx *pctx, char __iomem *dst, char *src,
 		} else
 			tmp += buf_size;
 
-		/* Probably should schedule every 4GB to prevent soft hang. */
-		if (((copied % SZ_4G) == 0) && !use_dma) {
+		/* Probably should schedule every 5s to prevent soft hang. */
+		if (unlikely((jiffies - last_sleep) > 5 * HZ)) {
+			last_sleep = jiffies;
 			set_current_state(TASK_INTERRUPTIBLE);
 			schedule_timeout(1);
 		}
-- 
2.1.4


  reply	other threads:[~2016-06-14 17:02 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-14 17:02 [PATCH v2 0/8] NTB Selftest Script Logan Gunthorpe
2016-06-14 17:02 ` Logan Gunthorpe [this message]
2016-06-14 17:02 ` [PATCH v2 2/8] ntb_perf: Improve thread handling to increase robustness Logan Gunthorpe
2016-06-14 17:02 ` [PATCH v2 3/8] ntb_perf: Return results by reading the run file Logan Gunthorpe
2016-06-14 17:02 ` [PATCH v2 4/8] ntb_perf: Wait for link before running test Logan Gunthorpe
2016-06-14 17:02 ` [PATCH v2 5/8] ntb_tool: BUG: Ensure the buffer size is large enough to return all spads Logan Gunthorpe
2016-06-14 17:02 ` [PATCH v2 6/8] ntb_tool: Add link status and files to debugfs Logan Gunthorpe
2016-06-14 19:33   ` Allen Hubbe
2016-06-14 19:33     ` Allen Hubbe
2016-06-14 21:01     ` Logan Gunthorpe
2016-06-14 21:46       ` Allen Hubbe
2016-06-14 21:46         ` Allen Hubbe
2016-06-14 22:11         ` Logan Gunthorpe
2016-06-15 16:02           ` Allen Hubbe
2016-06-15 16:02             ` Allen Hubbe
2016-06-15 16:20             ` Logan Gunthorpe
2016-06-14 17:02 ` [PATCH v2 7/8] ntb_pingpong: Add a debugfs file to get the ping count Logan Gunthorpe
2016-06-14 17:02 ` [PATCH v2 8/8] ntb_test: Add a selftest script for the NTB subsystem Logan Gunthorpe

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=2b42e0663ff7d04f01de7b904e37492a80796cea.1465919683.git.logang@deltatee.com \
    --to=logang@deltatee.com \
    --cc=Allen.Hubbe@emc.com \
    --cc=arnd@arndb.de \
    --cc=dave.jiang@intel.com \
    --cc=jdmason@kudzu.us \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-ntb@googlegroups.com \
    --cc=shuahkh@osg.samsung.com \
    --cc=sudipm.mukherjee@gmail.com \
    /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.