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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 15 Dec 2020 12:45:46 -0300
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Jiri Olsa <jolsa@...nel.org>
Cc:     lkml <linux-kernel@...r.kernel.org>,
        Peter Zijlstra <a.p.zijlstra@...llo.nl>,
        Ingo Molnar <mingo@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Namhyung Kim <namhyung@...nel.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Michael Petlan <mpetlan@...hat.com>,
        Ian Rogers <irogers@...gle.com>,
        Stephane Eranian <eranian@...gle.com>,
        Alexei Budankov <abudankov@...wei.com>
Subject: Re: [PATCH 6/8] perf daemon: Add stop command

Em Sat, Dec 12, 2020 at 11:43:56AM +0100, Jiri Olsa escreveu:
> Allow 'perf daemon' to stop daemon process:
> 
>   # perf daemon --stop
>   perf daemon is exciting

It looks exciting, yes, a nice functionality! ;-)

- Arnaldo
 
> Signed-off-by: Jiri Olsa <jolsa@...nel.org>
> ---
>  tools/perf/Documentation/perf-daemon.txt |  8 ++++++++
>  tools/perf/builtin-daemon.c              | 10 ++++++++++
>  2 files changed, 18 insertions(+)
> 
> diff --git a/tools/perf/Documentation/perf-daemon.txt b/tools/perf/Documentation/perf-daemon.txt
> index 203ec4bf704c..87de2c77e4c7 100644
> --- a/tools/perf/Documentation/perf-daemon.txt
> +++ b/tools/perf/Documentation/perf-daemon.txt
> @@ -35,6 +35,9 @@ OPTIONS
>  	Send SIGUSR2 to specific session, if session is not specified,
>  	send SIGUSR2 to all sessions.
>  
> +--stop::
> +	Stop daemon.
> +
>  -v::
>  --verbose::
>  	Be more verbose.
> @@ -116,6 +119,11 @@ And check that the perf data dump was trigered:
>    [ perf record: Dump /opt/perfdata/2/perf.data.2020120715220385 ]
>  
>  
> +Stop daemon:
> +
> +  # perf daemon --stop
> +  perf daemon is exciting
> +
>  SEE ALSO
>  --------
>  linkperf:perf-record[1], linkperf:perf-config[1]
> diff --git a/tools/perf/builtin-daemon.c b/tools/perf/builtin-daemon.c
> index c53d4ddc2b49..855fed2fe364 100644
> --- a/tools/perf/builtin-daemon.c
> +++ b/tools/perf/builtin-daemon.c
> @@ -451,6 +451,7 @@ enum cmd {
>  	CMD_LIST         = 0,
>  	CMD_LIST_VERBOSE = 1,
>  	CMD_SIGNAL       = 2,
> +	CMD_STOP         = 3,
>  	CMD_MAX,
>  };
>  
> @@ -528,6 +529,10 @@ static int handle_server_socket(struct daemon *daemon, int sock_fd)
>  	case CMD_SIGNAL:
>  		ret = cmd_session_kill(daemon, out, fd);
>  		break;
> +	case CMD_STOP:
> +		done = 1;
> +		pr_debug("perf daemon is exciting\n");
> +		break;
>  	default:
>  		break;
>  	}
> @@ -811,6 +816,7 @@ int cmd_daemon(int argc, const char **argv)
>  {
>  	bool foreground = false;
>  	bool signal = false;
> +	bool stop = false;
>  	const char *config = NULL;
>  	const char *signal_str = NULL;
>  	struct daemon daemon = {
> @@ -821,6 +827,7 @@ int cmd_daemon(int argc, const char **argv)
>  		OPT_INCR('v', "verbose", &verbose, "be more verbose"),
>  		OPT_STRING(0, "config", &config,
>  			   "config file", "config file path"),
> +		OPT_BOOLEAN(0, "stop", &stop, "stop daemon"),
>  		OPT_BOOLEAN('f', "foreground", &foreground, "stay on console"),
>  		OPT_STRING_OPTARG_SET('s', "signal", &signal_str, &signal,
>  				      "signal", "send signal to session", "all"),
> @@ -837,5 +844,8 @@ int cmd_daemon(int argc, const char **argv)
>  	if (signal)
>  		return send_cmd(&daemon, CMD_SIGNAL, signal_str);
>  
> +	if (stop)
> +		return send_cmd(&daemon, CMD_STOP, NULL);
> +
>  	return send_cmd(&daemon, verbose ? CMD_LIST_VERBOSE : CMD_LIST, NULL);
>  }
> -- 
> 2.26.2
> 

-- 

- Arnaldo

Powered by blists - more mailing lists