Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1381031
| From | Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 4.4 120/137] perf: Cure event->pending_disable race |
| Date | 2016-04-18 04:50 +0200 |
| Message-ID | <rp7qa-6np-3@gated-at.bofh.it> (permalink) |
| References | <rp7gt-6ho-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <peterz@infradead.org>
commit 28a967c3a2f99fa3b5f762f25cb2a319d933571b upstream.
Because event_sched_out() checks event->pending_disable _before_
actually disabling the event, it can happen that the event fires after
it checks but before it gets disabled.
This would leave event->pending_disable set and the queued irq_work
will try and process it.
However, if the event trigger was during schedule(), the event might
have been de-scheduled by the time the irq_work runs, and
perf_event_disable_local() will fail.
Fix this by checking event->pending_disable _after_ we call
event->pmu->del(). This depends on the latter being a compiler
barrier, such that the compiler does not lift the load and re-creates
the problem.
Tested-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: dvyukov@google.com
Cc: eranian@google.com
Cc: oleg@redhat.com
Cc: panand@redhat.com
Cc: sasha.levin@oracle.com
Cc: vince@deater.net
Link: http://lkml.kernel.org/r/20160224174948.040469884@infradead.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
kernel/events/core.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -1580,14 +1580,14 @@ event_sched_out(struct perf_event *event
perf_pmu_disable(event->pmu);
+ event->tstamp_stopped = tstamp;
+ event->pmu->del(event, 0);
+ event->oncpu = -1;
event->state = PERF_EVENT_STATE_INACTIVE;
if (event->pending_disable) {
event->pending_disable = 0;
event->state = PERF_EVENT_STATE_OFF;
}
- event->tstamp_stopped = tstamp;
- event->pmu->del(event, 0);
- event->oncpu = -1;
if (!is_software_event(event))
cpuctx->active_oncpu--;
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 4.4 000/137] 4.4.8-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:40 +0200
[PATCH 4.4 001/137] hwmon: (max1111) Return -ENODEV from max1111_read_channel if not instantiated Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:40 +0200
[PATCH 4.4 066/137] ipv4: initialize flowi4_flags before calling fib_lookup() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:40 +0200
[PATCH 4.4 100/137] mac80211: fix ibss scan parameters Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:40 +0200
[PATCH 4.4 025/137] tunnel: Clear IPCB(skb)->opt before dst_link_failure called Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:40 +0200
[PATCH 4.4 040/137] udp6: fix UDP/IPv6 encap resubmit path Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:40 +0200
[PATCH 4.4 107/137] iio: accel: bmc150: fix endianness when reading axes Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:40 +0200
[PATCH 4.4 097/137] virtio: virtio 1.0 cs04 spec compliance for reset Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:40 +0200
[PATCH 4.4 072/137] rtnl: fix msg size calculation in if_nlmsg_size() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:40 +0200
[PATCH 4.4 046/137] bpf: avoid copying junk bytes in bpf_get_current_comm() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:40 +0200
[PATCH 4.4 094/137] [media] v4l: vsp1: Set the SRU CTRL0 register when starting the stream Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:40 +0200
[PATCH 4.4 076/137] ipv6: l2tp: fix a potential issue in l2tp_ip6_recv Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:50 +0200
[PATCH 4.4 120/137] perf: Cure event->pending_disable race Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:50 +0200
[PATCH 4.4 128/137] ALSA: usb-audio: Skip volume controls triggers hangup on Dell USB Dock Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:50 +0200
[PATCH 4.4 134/137] staging: android: ion: Set the length of the DMA sg entries in buffer Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:50 +0200
[PATCH 4.4 118/137] arm64: replace read_lock to rcu lock in call_step_hook Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:50 +0200
[PATCH 4.4 122/137] ALSA: hda - Fixup speaker pass-through control for nid 0x14 on ALC225 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:50 +0200
[PATCH 4.4 125/137] ALSA: hda/realtek - Enable the ALC292 dock fixup on the Thinkpad T460s Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:50 +0200
[PATCH 4.4 116/137] iommu: Dont overwrite domain pointer when there is no default_domain Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:50 +0200
[PATCH 4.4 115/137] ext4: ignore quota mount options if the quota feature is enabled Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:50 +0200
[PATCH 4.4 119/137] perf: Do not double free Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:50 +0200
[PATCH 4.4 121/137] mmc: sdhci-pci: Add support and PCI IDs for more Broxton host controllers Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:50 +0200
[PATCH 4.4 106/137] iio: st_magn: always define ST_MAGN_TRIGGER_SET_STATE Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:50 +0200
[PATCH 4.4 105/137] usb: renesas_usbhs: fix to avoid using a disabled ep in usbhsg_queue_done() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:50 +0200
[PATCH 4.4 113/137] btrfs: fix crash/invalid memory access on fsync when using overlayfs Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:50 +0200
[PATCH 4.4 123/137] ALSA: hda - Fix headset support and noise on HP EliteBook 755 G2 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:50 +0200
[PATCH 4.4 114/137] ext4: add lockdep annotations for i_data_sem Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:50 +0200
[PATCH 4.4 136/137] [media] usbvision: fix crash on detecting device with invalid configuration Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:50 +0200
[PATCH 4.4 110/137] sd: Fix excessive capacity printing on devices with blocks bigger than 512 bytes Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:50 +0200
[PATCH 4.4 083/137] KVM: x86: Inject pending interrupt even if pending nmi exist Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:50 +0200
[PATCH 4.4 131/137] Revert "x86/PCI: Dont alloc pcibios-irq when MSI is enabled" Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:50 +0200
[PATCH 4.4 135/137] [media] usbvision fix overflow of interfaces array Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:50 +0200
[PATCH 4.4 130/137] HID: usbhid: fix inconsistent reset/resume/reset-resume behavior Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:50 +0200
[PATCH 4.4 108/137] iio: gyro: bmg160: fix buffer read values Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:50 +0200
[PATCH 4.4 126/137] ALSA: usb-audio: Add a sample rate quirk for Phoenix Audio TMX320 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:50 +0200
[PATCH 4.4 084/137] KVM: x86: reduce default value of halt_poll_ns parameter Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:50 +0200
[PATCH 4.4 127/137] ALSA: usb-audio: Add a quirk for Plantronics BT300 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:50 +0200
[PATCH 4.4 129/137] HID: wacom: fix Bamboo ONE oops Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:50 +0200
[PATCH 4.4 081/137] USB: uas: Add a new NO_REPORT_LUNS quirk Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:50 +0200
[PATCH 4.4 099/137] mac80211: avoid excessive stack usage in sta_info Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:50 +0200
[PATCH 4.4 124/137] ALSA: hda - fix front mic problem for a HP desktop Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:50 +0200
[PATCH 4.4 132/137] Revert "PCI: Add helpers to manage pci_dev->irq and pci_dev->irq_managed" Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:50 +0200
[PATCH 4.4 109/137] iio: gyro: bmg160: fix endianness when reading axes Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:50 +0200
[PATCH 4.4 111/137] fs: add file_dentry() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:50 +0200
[PATCH 4.4 112/137] nfs: use file_dentry() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:50 +0200
[PATCH 4.4 117/137] Btrfs: fix file/data loss caused by fsync after rename and new inode Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 04:50 +0200
[PATCH 4.4 077/137] ip6_tunnel: set rtnl_link_ops before calling register_netdevice Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:00 +0200
[PATCH 4.4 096/137] rbd: use GFP_NOIO consistently for request allocations Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:00 +0200
[PATCH 4.4 087/137] pinctrl: sh-pfc: only use dummy states for non-DT platforms Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:00 +0200
[PATCH 4.4 073/137] tun, bpf: fix suspicious RCU usage in tun_{attach, detach}_filter Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:00 +0200
[PATCH 4.4 089/137] pinctrl: nomadik: fix pull debug print inversion Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:00 +0200
[PATCH 4.4 086/137] pinctrl: pistachio: fix mfio84-89 function description and pinmux. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:00 +0200
[PATCH 4.4 078/137] ipv6: Count in extension headers in skb->network_header Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:00 +0200
[PATCH 4.4 064/137] bonding: fix bond_get_stats() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:00 +0200
[PATCH 4.4 047/137] sh_eth: fix NULL pointer dereference in sh_eth_ring_format() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:00 +0200
[PATCH 4.4 048/137] sh_eth: advance rxdesc later in sh_eth_ring_format() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:00 +0200
[PATCH 4.4 102/137] mac80211: fix txq queue related crashes Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:00 +0200
[PATCH 4.4 074/137] tuntap: restore default qdisc Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:00 +0200
[PATCH 4.4 071/137] bridge: Allow set bridge ageing time when switchdev disabled Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:00 +0200
[PATCH 4.4 095/137] pcmcia: db1xxx_ss: fix last irq_to_gpio user Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:00 +0200
[PATCH 4.4 067/137] ppp: take reference on channels netns Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:00 +0200
[PATCH 4.4 103/137] usb: renesas_usbhs: avoid NULL pointer derefernce in usbhsf_pkt_handler() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:00 +0200
[PATCH 4.4 070/137] ipv6: udp: fix UDP_MIB_IGNOREDMULTI updates Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:00 +0200
[PATCH 4.4 088/137] pinctrl: sunxi: Fix A33 external interrupts not working Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:00 +0200
[PATCH 4.4 098/137] mac80211: properly deal with station hashtable insert errors Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:00 +0200
[PATCH 4.4 049/137] qlcnic: Remove unnecessary usage of atomic_t Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:00 +0200
[PATCH 4.4 093/137] [media] coda: fix error path in case of missing pdata on non-DT platform Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:00 +0200
[PATCH 4.4 051/137] macvtap: always pass ethernet header in linear Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:00 +0200
[PATCH 4.4 065/137] ipv4: fix broadcast packets reception Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:00 +0200
[PATCH 4.4 091/137] [media] au0828: fix au0828_v4l2_close() dev_state race condition Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:00 +0200
[PATCH 4.4 028/137] net: vrf: Remove direct access to skb->data Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:10 +0200
[PATCH 4.4 045/137] packet: validate variable length ll headers Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:10 +0200
[PATCH 4.4 056/137] net: Fix use after free in the recvmmsg exit path Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:10 +0200
[PATCH 4.4 017/137] drm/udl: Use unlocked gem unreferencing Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:10 +0200
[PATCH 4.4 063/137] net: bcmgenet: fix dma api length mismatch Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:10 +0200
[PATCH 4.4 039/137] usbnet: cleanup after bind() in probe() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:10 +0200
[PATCH 4.4 015/137] arm64: opcodes.h: Add arm big-endian config options before including arm header Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:10 +0200
[PATCH 4.4 060/137] ppp: ensure file->private_data cant be overridden Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:10 +0200
[PATCH 4.4 057/137] mlx4: add missing braces in verify_qp_parameters Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:10 +0200
[PATCH 4.4 044/137] ax25: add link layer header validation function Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:10 +0200
[PATCH 4.4 023/137] xen/events: Mask a moving irq Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:10 +0200
[PATCH 4.4 029/137] net: qca_spi: Dont clear IFF_BROADCAST Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:10 +0200
[PATCH 4.4 042/137] ppp: release rtnl mutex when interface creation fails Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:10 +0200
[PATCH 4.4 024/137] tcp: convert cached rtt from usec to jiffies when feeding initial rto Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:10 +0200
[PATCH 4.4 055/137] ipv4: Dont do expensive useless work during inetdev destroy. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:10 +0200
[PATCH 4.4 013/137] libnvdimm, pfn: fix uuid validation Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:10 +0200
[PATCH 4.4 062/137] qlge: Fix receive packets drop. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:10 +0200
[PATCH 4.4 054/137] bridge: allow zero ageing time Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:10 +0200
[PATCH 4.4 026/137] ipv4: only create late gso-skb if skb is already set up with CHECKSUM_PARTIAL Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:10 +0200
[PATCH 4.4 034/137] tipc: Revert "tipc: use existing sk_write_queue for outgoing packet chain" Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:10 +0200
[PATCH 4.4 053/137] rocker: set FDB cleanup timer according to lowest ageing time Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:10 +0200
[PATCH 4.4 032/137] sctp: lack the check for ports in sctp_v6_cmp_addr Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:10 +0200
[PATCH 4.4 010/137] mm: fix invalid node in alloc_migrate_target() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:20 +0200
[PATCH 4.4 008/137] ALSA: hda - Fix white noise on Asus N750JV headphone Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:20 +0200
[PATCH 4.4 002/137] PKCS#7: pkcs7_validate_trust(): initialize the _trusted output argument Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:20 +0200
[PATCH 4.4 011/137] powerpc/mm: Fixup preempt underflow with huge pages Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:20 +0200
[PATCH 4.4 020/137] drm/radeon: add a dpm quirk for all R7 370 parts Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:20 +0200
[PATCH 4.4 009/137] ALSA: hda - Apply fix for white noise on Asus N550JV, too Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:20 +0200
[PATCH 4.4 006/137] ALSA: timer: Use mod_timer() for rearming the system timer Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:20 +0200
[PATCH 4.4 137/137] Revert "usb: hub: do not clear BOS field during reset device" Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-18 05:30 +0200
Re: [PATCH 4.4 000/137] 4.4.8-stable review Shuah Khan <shuahkh@osg.samsung.com> - 2016-04-18 18:40 +0200
Re: [PATCH 4.4 000/137] 4.4.8-stable review Guenter Roeck <linux@roeck-us.net> - 2016-04-18 18:40 +0200
Re: [PATCH 4.4 000/137] 4.4.8-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-19 08:00 +0200
Re: [PATCH 4.4 000/137] 4.4.8-stable review Kevin Hilman <khilman@baylibre.com> - 2016-04-19 23:50 +0200
csiph-web