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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87ehc530b2.fsf@sejong.aot.lge.com>
Date:	Fri, 14 Jun 2013 11:15:13 +0900
From:	Namhyung Kim <namhyung@...nel.org>
To:	Robert Richter <rric@...nel.org>
Cc:	Borislav Petkov <bp@...en8.de>, Ingo Molnar <mingo@...nel.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Arnaldo Carvalho de Melo <acme@...radead.org>,
	Jiri Olsa <jolsa@...hat.com>, linux-kernel@...r.kernel.org,
	Borislav Petkov <bp@...e.de>,
	Robert Richter <robert.richter@...aro.org>
Subject: Re: [PATCH v2 03/14] perf: Add persistent event facilities

Hi Robert and Boris,

On Tue, 11 Jun 2013 18:42:29 +0200, Robert Richter wrote:
> From: Borislav Petkov <bp@...en8.de>
>
> Add a barebones implementation for registering persistent events with
> perf. For that, we don't destroy the buffers when they're unmapped;
> also, we map them read-only so that multiple agents can access them.
>
> Also, we allocate the event buffers at event init time and not at mmap
> time so that we can log samples into them regardless of whether there
> are readers in userspace or not.
>
> Changes made by Robert Richter <robert.richter@...aro.org>:
>
> * Fixing wrongly determined attribute size.
>
> * The default buffer size used to setup event buffers with perf tools
>   is 512k. Using the same buffer size for persistent events. This also
>   avoids failed mmap calls due to different buffer sizes.
>
> * Improve error reporting.
>
> * Returning -ENODEV if no file descriptor is found. An error code of
>   -1 (-EPERM) is misleading in this case.
>
> * Adding cpu check to perf_get_persistent_event_fd()
>
> [ make percpu variable static ]
> Reported-by: Fengguang Wu <fengguang.wu@...el.com>
> Signed-off-by: Borislav Petkov <bp@...e.de>
> [ Fix attr size ]
> [ Setting default buffer size to 512k as in perf tools ]
> [ Print error code on failure when adding events ]
> [ Return resonable error code ]
> [ Adding cpu check to perf_get_persistent_event_fd() ]
> Reported-by: Jiri Olsa <jolsa@...hat.com>
> Signed-off-by: Robert Richter <robert.richter@...aro.org>
> Signed-off-by: Robert Richter <rric@...nel.org>
[SNIP]
> +int perf_add_persistent_event_by_id(int id)
> +{
> +	struct perf_event_attr *attr;
> +
> +	attr = kzalloc(sizeof(*attr), GFP_KERNEL);
> +	if (!attr)
> +		return -ENOMEM;
> +
> +	attr->sample_period	= 1;
> +	attr->wakeup_events	= 1;
> +	attr->sample_type	= PERF_SAMPLE_RAW;
> +	attr->persistent	= 1;
> +	attr->config		= id;
> +	attr->type		= PERF_TYPE_TRACEPOINT;
> +	attr->size		= sizeof(*attr);
> +
> +	return perf_add_persistent_event(attr, CPU_BUFFER_NR_PAGES);
> +}
> +
> +int perf_get_persistent_event_fd(unsigned cpu, struct perf_event_attr *attr)
> +{
> +	struct pers_event_desc *desc;
> +
> +	if (cpu >= (unsigned)nr_cpu_ids)
> +		return -EINVAL;
> +
> +	list_for_each_entry(desc, &per_cpu(pers_events, cpu), plist)
> +		if (desc->attr->config == attr->config)
> +			return __alloc_persistent_event_fd(desc);
> +

So it only supports tracepoint events.  Don't we need to add other types
of event?

Thanks,
Namhyung


> +	return -ENODEV;
> +}
> +
> +
> +void __init persistent_events_init(void)
> +{
> +	int i;
> +
> +	for_each_possible_cpu(i)
> +		INIT_LIST_HEAD(&per_cpu(pers_events, i));
> +}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ