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: <20130219192403.GA17767@krava.redhat.com>
Date:	Tue, 19 Feb 2013 20:24:03 +0100
From:	Jiri Olsa <jolsa@...hat.com>
To:	Stephane Eranian <eranian@...gle.com>
Cc:	linux-kernel@...r.kernel.org, peterz@...radead.org, mingo@...e.hu,
	ak@...ux.intel.com, acme@...hat.com, namhyung.kim@....com
Subject: Re: [PATCH v4 2/2] perf: add sysfs entry to adjust multiplexing
 interval per PMU

On Mon, Feb 18, 2013 at 06:54:44PM +0100, Stephane Eranian wrote:

SNIP

> +perf_event_mux_interval_ms_store(struct device *dev,
> +				 struct device_attribute *attr,
> +				 const char *buf, size_t count)
> +{
> +	struct pmu *pmu = dev_get_drvdata(dev);
> +	int timer, cpu, ret;
> +
> +	ret = kstrtoint(buf, 0, &timer);
> +	if (ret)
> +		return ret;
> +
> +	if (timer < 1)
> +		return -EINVAL;
> +
> +	pmu->hrtimer_interval_ms = timer;
> +
> +	/* update all cpuctx for this PMU */
> +	for_each_possible_cpu(cpu) {
> +		struct perf_cpu_context *cpuctx;
> +		cpuctx = per_cpu_ptr(pmu->pmu_cpu_context, cpu);
> +		cpuctx->hrtimer_interval = ns_to_ktime(NSEC_PER_MSEC * timer);
> +	}

If we set the timer to some big value like few minutes,
then run the meassurements and then set the value back to 1,
we actually need to wait till the big timer is expired before
the new value takes place.

I think we need to cancel the possible running timer in here
like in the atached patch, but maybe consider some locking.

jirka


diff --git a/kernel/events/core.c b/kernel/events/core.c
index 7c3f00f..ce9cd54 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -6038,6 +6038,9 @@ perf_event_mux_interval_ms_store(struct device *dev,
 		struct perf_cpu_context *cpuctx;
 		cpuctx = per_cpu_ptr(pmu->pmu_cpu_context, cpu);
 		cpuctx->hrtimer_interval = ns_to_ktime(NSEC_PER_MSEC * timer);
+
+		if (hrtimer_active(&cpuctx->hrtimer))
+			hrtimer_cancel(&cpuctx->hrtimer);
 	}
 
 	return count;
--
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