From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: stable-review@kernel.org, torvalds@linux-foundation.org,
akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Ingo Molnar <mingo@elte.hu>
Subject: [64/70] perf: Fix throttle logic
Date: Tue, 22 Feb 2011 14:17:43 -0800 [thread overview]
Message-ID: <20110222221843.413069306@clark.kroah.org> (raw)
In-Reply-To: <20110222222003.GA15831@kroah.com>
2.6.37-stable review patch. If anyone has any objections, please let us know.
------------------
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
commit 4fe757dd48a9e95e1a071291f15dda5421dacb66 upstream.
It was possible to call pmu::start() on an already running event. In
particular this lead so some wreckage as the hrtimer events would
re-initialize active timers.
This was due to throttled events being activated again by scheduling.
Scheduling in a context would add and force start events, resulting in
running events with a possible throttle status. The next tick to hit
that task will then try to unthrottle the event and call ->start() on
an already running event.
Reported-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
kernel/perf_event.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -652,6 +652,10 @@ retry:
raw_spin_unlock_irq(&ctx->lock);
}
+#define MAX_INTERRUPTS (~0ULL)
+
+static void perf_log_throttle(struct perf_event *event, int enable);
+
static int
event_sched_in(struct perf_event *event,
struct perf_cpu_context *cpuctx,
@@ -662,6 +666,17 @@ event_sched_in(struct perf_event *event,
event->state = PERF_EVENT_STATE_ACTIVE;
event->oncpu = smp_processor_id();
+
+ /*
+ * Unthrottle events, since we scheduled we might have missed several
+ * ticks already, also for a heavily scheduling task there is little
+ * guarantee it'll get a tick in a timely manner.
+ */
+ if (unlikely(event->hw.interrupts == MAX_INTERRUPTS)) {
+ perf_log_throttle(event, 1);
+ event->hw.interrupts = 0;
+ }
+
/*
* The new state must be visible before we turn it on in the hardware:
*/
@@ -1469,10 +1484,6 @@ void __perf_event_task_sched_in(struct t
}
}
-#define MAX_INTERRUPTS (~0ULL)
-
-static void perf_log_throttle(struct perf_event *event, int enable);
-
static u64 perf_calculate_period(struct perf_event *event, u64 nsec, u64 count)
{
u64 frequency = event->attr.sample_freq;
next prev parent reply other threads:[~2011-02-22 22:24 UTC|newest]
Thread overview: 81+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-22 22:20 [00/70] 2.6.37.2-stable review Greg KH
2011-02-22 22:16 ` [01/70] NFSD: memory corruption due to writing beyond the stat array Greg KH
2011-02-22 22:16 ` [02/70] [SCSI] mptfusion: mptctl_release is required in mptctl.c Greg KH
2011-02-22 22:16 ` [03/70] [SCSI] mptfusion: Fix Incorrect return value in mptscsih_dev_reset Greg KH
2011-02-22 22:16 ` [04/70] drm/i915/sdvo: If we have an EDID confirm it matches the mode of the connection Greg KH
2011-02-22 22:16 ` [05/70] drm/radeon/kms: fix interlaced modes on dce4+ Greg KH
2011-02-22 22:16 ` [06/70] drm/radeon: fix memory debugging since d961db75ce86a84f1f04e91ad1014653ed7d9f46 Greg KH
2011-02-22 22:16 ` [07/70] drm/radeon/kms: add connector table for mac g5 9600 Greg KH
2011-02-22 22:16 ` [08/70] drm/radeon/kms: improve 6xx/7xx CS error output Greg KH
2011-02-22 22:16 ` [09/70] drm/radeon/kms: add bounds checking to avivo pll algo Greg KH
2011-02-22 22:16 ` [10/70] drm/radeon/kms: hopefully fix pll issues for real (v3) Greg KH
2011-02-22 22:16 ` [11/70] drm/nouveau: Only select ACPI_VIDEO if its dependencies are met Greg KH
2011-02-22 22:16 ` [12/70] vt: fix issue when fbcon wants to takeover a second time Greg KH
2011-02-22 22:16 ` [13/70] ARM: 6606/1: sa1100: Fix platform device registration Greg KH
2011-02-22 22:16 ` [14/70] HID: magicmouse: Dont report REL_{X, Y} for Magic Trackpad Greg KH
2011-02-22 22:16 ` [15/70] perf timechart: Adjust perf timechart to the new power events Greg KH
2011-02-23 0:17 ` Thomas Renninger
2011-02-24 18:22 ` Greg KH
2011-02-22 22:16 ` [16/70] x86: Clear irqstack thread_info Greg KH
2011-02-22 22:16 ` [17/70] drm/i915: make DP training try a little harder Greg KH
2011-02-22 22:16 ` [18/70] xen: p2m: correctly initialize partial p2m leaf Greg KH
2011-02-22 22:16 ` [19/70] xen/p2m: Mark INVALID_P2M_ENTRY the mfn_list past max_pfn Greg KH
2011-02-22 22:16 ` [20/70] [media] [v3,media] av7110: check for negative array offset Greg KH
2011-02-22 22:17 ` [21/70] xfs: fix dquot shaker deadlock Greg KH
2011-02-22 22:17 ` [22/70] HID: add Add Cando touch screen 10.1-inch product id Greg KH
2011-02-22 22:17 ` [23/70] HID: Switch turbox/mosart touchscreen to hid-mosart Greg KH
2011-02-22 22:17 ` [24/70] CRED: Fix kernel panic upon security_file_alloc() failure Greg KH
2011-02-22 22:17 ` [25/70] btrfs: prevent heap corruption in btrfs_ioctl_space_info() Greg KH
2011-02-22 22:17 ` [26/70] CRED: Fix BUG() upon security_cred_alloc_blank() failure Greg KH
2011-02-22 22:17 ` [27/70] CRED: Fix memory and refcount leaks upon security_prepare_creds() failure Greg KH
2011-02-22 22:17 ` [28/70] staging: brcm80211: bugfix for softmac crash on multi cpu configurations Greg KH
2011-02-23 2:23 ` [Stable-review] " Ben Hutchings
2011-02-23 7:40 ` Arend van Spriel
2011-02-23 18:06 ` Greg KH
2011-02-23 20:24 ` Arend van Spriel
2011-02-24 13:10 ` Roland Vossen
2011-02-24 18:21 ` Greg KH
2011-02-24 20:47 ` Arend van Spriel
2011-02-25 0:13 ` [stable] " Greg KH
2011-02-22 22:17 ` [29/70] security: add cred argument to security_capable() Greg KH
2011-02-22 22:17 ` [30/70] pci: use security_capable() when checking capablities during config space read Greg KH
2011-02-22 22:17 ` [31/70] ACPI / Wakeup: Enable button GPEs unconditionally during initialization Greg KH
2011-02-22 22:17 ` [32/70] nfsd: correctly handle return value from nfsd_map_name_to_* Greg KH
2011-02-22 22:17 ` [33/70] x86, hotplug: Fix powersavings with offlined cores on AMD Greg KH
2011-02-22 22:17 ` [34/70] s390: remove task_show_regs Greg KH
2011-02-22 22:17 ` [35/70] x86, mrst: Set correct APB timer IRQ affinity for secondary cpu Greg KH
2011-02-22 22:17 ` [36/70] PM / Hibernate: Return error code when alloc_image_page() fails Greg KH
2011-02-22 22:17 ` [37/70] drm/radeon/kms: add missing frac fb div flag for dce4+ Greg KH
2011-02-22 22:17 ` [38/70] fs/partitions: Validate map_count in Mac partition tables Greg KH
2011-02-22 22:17 ` [39/70] workqueue: wake up a worker when a rescuer is leaving a gcwq Greg KH
2011-02-22 22:17 ` [40/70] workqueue: make sure MAYDAY_INITIAL_TIMEOUT is at least 2 jiffies long Greg KH
2011-02-22 22:17 ` [41/70] net: deinit automatic LIST_HEAD Greg KH
2011-02-22 22:17 ` [42/70] iwl3945: remove plcp check Greg KH
2011-02-22 22:17 ` [43/70] ALSA: HDA: Add position_fix quirk for an Asus device Greg KH
2011-02-22 22:17 ` [44/70] ALSA: caiaq - Fix possible string-buffer overflow Greg KH
2011-02-22 22:17 ` [45/70] ALSA: HDA: Do not announce false surround in Conexant auto Greg KH
2011-02-22 22:17 ` [46/70] hwmon: (lm85) extend to support EMC6D103 chips Greg KH
2011-02-22 22:17 ` [47/70] x86, AMD, PCI: Add AMD northbridge PCI device id for CPU families 12h and 14h Greg KH
2011-02-22 22:17 ` [48/70] hwmon: (k10temp) add support for AMD Family 12h/14h CPUs Greg KH
2011-02-22 22:17 ` [49/70] hwmon: (jc42) fix type mismatch Greg KH
2011-02-22 22:17 ` [50/70] hwmon: (jc42) more helpful documentation Greg KH
2011-02-22 22:17 ` [51/70] hwmon: (jc42) do not allow writing to locked registers Greg KH
2011-02-22 22:17 ` [52/70] netfilter: fix race in conntrack between dump_table and destroy Greg KH
2011-02-22 22:17 ` [53/70] netfilter: ctnetlink: fix missing refcount increment during dumps Greg KH
2011-02-22 22:17 ` [54/70] [media] radio-aimslab.c needs #include <linux/delay.h> Greg KH
2011-02-22 22:17 ` [55/70] ARM: Ensure predictable endian state on signal handler entry Greg KH
2011-02-22 22:17 ` [56/70] ARM: Keep exit text/data around for SMP_ON_UP Greg KH
2011-02-22 22:17 ` [57/70] cifs: fix handling of scopeid in cifs_convert_address Greg KH
2011-02-22 22:17 ` [58/70] cifs: Fix regression in LANMAN (LM) auth code Greg KH
2011-02-22 22:17 ` [59/70] acer-wmi: Fix capitalisation of GUID Greg KH
2011-02-22 22:17 ` [60/70] pcmcia: re-enable Zoomed Video support Greg KH
2011-02-22 22:17 ` [61/70] eCryptfs: Copy up lower inode attrs in getattr Greg KH
2011-02-22 22:17 ` [62/70] genirq: Prevent access beyond allocated_irqs bitmap Greg KH
2011-02-22 22:17 ` [63/70] genirq: Disable the SHIRQ_DEBUG call in request_threaded_irq for now Greg KH
2011-02-22 22:17 ` Greg KH [this message]
2011-02-22 22:17 ` [65/70] ASoC: WM8903: Fix mic detection enable logic Greg KH
2011-02-22 22:17 ` [66/70] net: can: janz-ican3: world-writable sysfs termination file Greg KH
2011-02-22 22:17 ` [67/70] platform: x86: acer-wmi: world-writable sysfs threeg file Greg KH
2011-02-22 22:17 ` [68/70] platform: x86: asus_acpi: world-writable procfs files Greg KH
2011-02-22 22:17 ` [69/70] platform: x86: tc1100-wmi: world-writable sysfs wireless and jogdial files Greg KH
2011-02-22 22:17 ` [70/70] Revert: tpm_tis: Use timeouts returned from TPM Greg KH
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=20110222221843.413069306@clark.kroah.org \
--to=gregkh@suse.de \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=stable-review@kernel.org \
--cc=stable@kernel.org \
--cc=torvalds@linux-foundation.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®