lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Wed, 28 Sep 2016 09:18:23 -0600
From:   Shuah Khan <shuahkh@....samsung.com>
To:     peterz@...radead.org, mingo@...hat.com, acme@...nel.org,
        alexander.shishkin@...ux.intel.com, jpoimboe@...hat.com
Cc:     Shuah Khan <shuahkh@....samsung.com>, linux-kernel@...r.kernel.org
Subject: [PATCH v2] perf: sched-pipe add support for packet I/O mode

Add support to run sched-pipe benchmark test on pipe in packet I/O mode.
In packet I/O mode, each write() to the pipe is handled as a separate
packet and each read() from the pipe will read one packet at a time.

In the kernel, packet_pipe_buf_ops get used in this mode and pipe_write()
and pipe_read() handle this as a special case. As a result, it is helpful
to add support for benchmarking pipe I/O in packet mode.

Signed-off-by: Shuah Khan <shuahkh@....samsung.com>
---
Changes since v1:
- Fixed comment block style
- Updated change log to include packet I/O mode details

 tools/perf/bench/sched-pipe.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/tools/perf/bench/sched-pipe.c b/tools/perf/bench/sched-pipe.c
index 1dc2d13..10243b6 100644
--- a/tools/perf/bench/sched-pipe.c
+++ b/tools/perf/bench/sched-pipe.c
@@ -41,9 +41,17 @@ static	int			loops = LOOPS_DEFAULT;
 /* Use processes by default: */
 static bool			threaded;
 
+/*
+ * Use non-packet (normal) I/O mode by default.
+ * In packet mode, each write is a separate packet.
+ */
+static bool			packet_mode;
+
 static const struct option options[] = {
 	OPT_INTEGER('l', "loop",	&loops,		"Specify number of loops"),
 	OPT_BOOLEAN('T', "threaded",	&threaded,	"Specify threads/process based task setup"),
+	OPT_BOOLEAN('P', "packet mode",	&packet_mode,
+		    "Specify packet I/O mode - "),
 	OPT_END()
 };
 
@@ -83,6 +91,7 @@ int bench_sched_pipe(int argc, const char **argv, const char *prefix __maybe_unu
 	unsigned long long result_usec = 0;
 	int nr_threads = 2;
 	int t;
+	int flags = 0;
 
 	/*
 	 * why does "ret" exist?
@@ -94,6 +103,18 @@ int bench_sched_pipe(int argc, const char **argv, const char *prefix __maybe_unu
 
 	argc = parse_options(argc, argv, options, bench_sched_pipe_usage, 0);
 
+	if (packet_mode) {
+		/* BUG_ON doesn't make sense exit if pipe2() fails */
+		flags = O_DIRECT;
+		ret = pipe2(pipe_1, flags);
+		if (ret)
+			exit(1);
+		ret = pipe2(pipe_2, flags);
+		if (ret)
+			exit(1);
+		printf("Running sched-pipe in packet I/O mode\n\n");
+	}
+
 	BUG_ON(pipe(pipe_1));
 	BUG_ON(pipe(pipe_2));
 
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ