linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, "Kim Phillips" <kim.phillips@amd.com>,
	"Alexander Shishkin" <alexander.shishkin@linux.intel.com>,
	"Arnaldo Carvalho de Melo" <acme@kernel.org>,
	"Borislav Petkov" <bp@alien8.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"Janakarajan Natarajan" <Janakarajan.Natarajan@amd.com>,
	"Jiri Olsa" <jolsa@redhat.com>,
	"Linus Torvalds" <torvalds@linux-foundation.org>,
	"Martin Liška" <mliska@suse.cz>,
	"Namhyung Kim" <namhyung@kernel.org>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Pu Wen" <puwen@hygon.cn>,
	"Suravee Suthikulpanit" <Suravee.Suthikulpanit@amd.com>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Ingo Molnar" <mingo@kernel.org>
Subject: [PATCH 4.19 72/96] perf/x86/amd: Add event map for AMD Family 17h
Date: Wed, 24 Apr 2019 19:10:17 +0200	[thread overview]
Message-ID: <20190424170924.624388859@linuxfoundation.org> (raw)
In-Reply-To: <20190424170919.829037226@linuxfoundation.org>

From: Kim Phillips <kim.phillips@amd.com>

commit 3fe3331bb285700ab2253dbb07f8e478fcea2f1b upstream.

Family 17h differs from prior families by:

 - Does not support an L2 cache miss event
 - It has re-enumerated PMC counters for:
   - L2 cache references
   - front & back end stalled cycles

So we add a new amd_f17h_perfmon_event_map[] so that the generic
perf event names will resolve to the correct h/w events on
family 17h and above processors.

Reference sections 2.1.13.3.3 (stalls) and 2.1.13.3.6 (L2):

  https://www.amd.com/system/files/TechDocs/54945_PPR_Family_17h_Models_00h-0Fh.pdf

Signed-off-by: Kim Phillips <kim.phillips@amd.com>
Cc: <stable@vger.kernel.org> # v4.9+
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Janakarajan Natarajan <Janakarajan.Natarajan@amd.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Martin Liška <mliska@suse.cz>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Pu Wen <puwen@hygon.cn>
Cc: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Fixes: e40ed1542dd7 ("perf/x86: Add perf support for AMD family-17h processors")
[ Improved the formatting a bit. ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/x86/events/amd/core.c |   35 ++++++++++++++++++++++++++---------
 1 file changed, 26 insertions(+), 9 deletions(-)

--- a/arch/x86/events/amd/core.c
+++ b/arch/x86/events/amd/core.c
@@ -117,22 +117,39 @@ static __initconst const u64 amd_hw_cach
 };
 
 /*
- * AMD Performance Monitor K7 and later.
+ * AMD Performance Monitor K7 and later, up to and including Family 16h:
  */
 static const u64 amd_perfmon_event_map[PERF_COUNT_HW_MAX] =
 {
-  [PERF_COUNT_HW_CPU_CYCLES]			= 0x0076,
-  [PERF_COUNT_HW_INSTRUCTIONS]			= 0x00c0,
-  [PERF_COUNT_HW_CACHE_REFERENCES]		= 0x077d,
-  [PERF_COUNT_HW_CACHE_MISSES]			= 0x077e,
-  [PERF_COUNT_HW_BRANCH_INSTRUCTIONS]		= 0x00c2,
-  [PERF_COUNT_HW_BRANCH_MISSES]			= 0x00c3,
-  [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND]	= 0x00d0, /* "Decoder empty" event */
-  [PERF_COUNT_HW_STALLED_CYCLES_BACKEND]	= 0x00d1, /* "Dispatch stalls" event */
+	[PERF_COUNT_HW_CPU_CYCLES]		= 0x0076,
+	[PERF_COUNT_HW_INSTRUCTIONS]		= 0x00c0,
+	[PERF_COUNT_HW_CACHE_REFERENCES]	= 0x077d,
+	[PERF_COUNT_HW_CACHE_MISSES]		= 0x077e,
+	[PERF_COUNT_HW_BRANCH_INSTRUCTIONS]	= 0x00c2,
+	[PERF_COUNT_HW_BRANCH_MISSES]		= 0x00c3,
+	[PERF_COUNT_HW_STALLED_CYCLES_FRONTEND]	= 0x00d0, /* "Decoder empty" event */
+	[PERF_COUNT_HW_STALLED_CYCLES_BACKEND]	= 0x00d1, /* "Dispatch stalls" event */
+};
+
+/*
+ * AMD Performance Monitor Family 17h and later:
+ */
+static const u64 amd_f17h_perfmon_event_map[PERF_COUNT_HW_MAX] =
+{
+	[PERF_COUNT_HW_CPU_CYCLES]		= 0x0076,
+	[PERF_COUNT_HW_INSTRUCTIONS]		= 0x00c0,
+	[PERF_COUNT_HW_CACHE_REFERENCES]	= 0xff60,
+	[PERF_COUNT_HW_BRANCH_INSTRUCTIONS]	= 0x00c2,
+	[PERF_COUNT_HW_BRANCH_MISSES]		= 0x00c3,
+	[PERF_COUNT_HW_STALLED_CYCLES_FRONTEND]	= 0x0287,
+	[PERF_COUNT_HW_STALLED_CYCLES_BACKEND]	= 0x0187,
 };
 
 static u64 amd_pmu_event_map(int hw_event)
 {
+	if (boot_cpu_data.x86 >= 0x17)
+		return amd_f17h_perfmon_event_map[hw_event];
+
 	return amd_perfmon_event_map[hw_event];
 }
 



  parent reply	other threads:[~2019-04-24 17:47 UTC|newest]

Thread overview: 102+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-24 17:09 [PATCH 4.19 00/96] 4.19.37-stable review Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 01/96] bonding: fix event handling for stacked bonds Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 02/96] failover: allow name change on IFF_UP slave interfaces Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 03/96] net: atm: Fix potential Spectre v1 vulnerabilities Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 04/96] net: bridge: fix per-port af_packet sockets Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 05/96] net: bridge: multicast: use rcu to access port list from br_multicast_start_querier Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 06/96] net: Fix missing meta data in skb with vlan packet Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 07/96] net: fou: do not use guehdr after iptunnel_pull_offloads in gue_udp_recv Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 08/96] tcp: tcp_grow_window() needs to respect tcp_space() Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 09/96] team: set slave to promisc if team is already in promisc mode Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 10/96] tipc: missing entries in name table of publications Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 11/96] vhost: reject zero size iova range Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 12/96] ipv4: recompile ip options in ipv4_link_failure Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 13/96] ipv4: ensure rcu_read_lock() in ipv4_link_failure() Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 14/96] net: thunderx: raise XDP MTU to 1508 Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 15/96] net: thunderx: dont allow jumbo frames with XDP Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 16/96] net/mlx5: FPGA, tls, hold rcu read lock a bit longer Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 17/96] net/tls: prevent bad memory access in tls_is_sk_tx_device_offloaded() Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 18/96] net/mlx5: FPGA, tls, idr remove on flow delete Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 19/96] route: Avoid crash from dereferencing NULL rt->from Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 20/96] sch_cake: Use tc_skb_protocol() helper for getting packet protocol Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 21/96] sch_cake: Make sure we can write the IP header before changing DSCP bits Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 22/96] nfp: flower: replace CFI with vlan present Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 23/96] nfp: flower: remove vlan CFI bit from push vlan action Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 24/96] sch_cake: Simplify logic in cake_select_tin() Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 25/96] net: IP defrag: encapsulate rbtree defrag code into callable functions Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 26/96] net: IP6 defrag: use rbtrees for IPv6 defrag Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 27/96] net: IP6 defrag: use rbtrees in nf_conntrack_reasm.c Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 28/96] CIFS: keep FileInfo handle live during oplock break Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 29/96] cifs: Fix use-after-free in SMB2_write Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 30/96] cifs: Fix use-after-free in SMB2_read Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 31/96] cifs: fix handle leak in smb2_query_symlink() Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 32/96] KVM: x86: Dont clear EFER during SMM transitions for 32-bit vCPU Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 33/96] KVM: x86: svm: make sure NMI is injected after nmi_singlestep Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 34/96] Staging: iio: meter: fixed typo Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 35/96] staging: iio: ad7192: Fix ad7193 channel address Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 36/96] iio: gyro: mpu3050: fix chip ID reading Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 37/96] iio/gyro/bmg160: Use millidegrees for temperature scale Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 38/96] iio:chemical:bme680: Fix, report temperature in millidegrees Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 39/96] iio:chemical:bme680: Fix SPI read interface Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 40/96] iio: cros_ec: Fix the maths for gyro scale calculation Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 41/96] iio: ad_sigma_delta: select channel when reading register Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 42/96] iio: dac: mcp4725: add missing powerdown bits in store eeprom Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 43/96] iio: Fix scan mask selection Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 44/96] iio: adc: at91: disable adc channel interrupt in timeout case Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 45/96] iio: core: fix a possible circular locking dependency Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 46/96] io: accel: kxcjk1013: restore the range after resume Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 47/96] staging: most: core: use device description as name Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 48/96] staging: comedi: vmk80xx: Fix use of uninitialized semaphore Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 49/96] staging: comedi: vmk80xx: Fix possible double-free of ->usb_rx_buf Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 50/96] staging: comedi: ni_usb6501: Fix use of uninitialized mutex Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 51/96] staging: comedi: ni_usb6501: Fix possible double-free of ->usb_rx_buf Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 52/96] ALSA: hda/realtek - add two more pin configuration sets to quirk table Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 53/96] ALSA: core: Fix card races between register and disconnect Greg Kroah-Hartman
2019-04-24 17:09 ` [PATCH 4.19 54/96] Input: elan_i2c - add hardware ID for multiple Lenovo laptops Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 55/96] serial: sh-sci: Fix HSCIF RX sampling point adjustment Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 56/96] serial: sh-sci: Fix HSCIF RX sampling point calculation Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 57/96] vt: fix cursor when clearing the screen Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 58/96] scsi: core: set result when the command cannot be dispatched Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 59/96] Revert "scsi: fcoe: clear FC_RP_STARTED flags when receiving a LOGO" Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 60/96] Revert "svm: Fix AVIC incomplete IPI emulation" Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 61/96] coredump: fix race condition between mmget_not_zero()/get_task_mm() and core dumping Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 62/96] ipmi: fix sleep-in-atomic in free_user at cleanup SRCU user->release_barrier Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 63/96] crypto: x86/poly1305 - fix overflow during partial reduction Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 64/96] drm/ttm: fix out-of-bounds read in ttm_put_pages() v2 Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 65/96] arm64: futex: Restore oldval initialization to work around buggy compilers Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 66/96] x86/kprobes: Verify stack frame on kretprobe Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 67/96] kprobes: Mark ftrace mcount handler functions nokprobe Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 68/96] kprobes: Fix error check when reusing optimized probes Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 69/96] rt2x00: do not increment sequence number while re-transmitting Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 70/96] mac80211: do not call driver wake_tx_queue op during reconfig Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 71/96] drm/amdgpu/gmc9: fix VM_L2_CNTL3 programming Greg Kroah-Hartman
2019-04-24 17:10 ` Greg Kroah-Hartman [this message]
2019-04-24 17:10 ` [PATCH 4.19 73/96] x86/cpu/bugs: Use __initconst for const init data Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 74/96] perf/x86: Fix incorrect PEBS_REGS Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 75/96] x86/speculation: Prevent deadlock on ssb_state::lock Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 76/96] timers/sched_clock: Prevent generic sched_clock wrap caused by tick_freeze() Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 77/96] nfit/ars: Remove ars_start_flags Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 78/96] nfit/ars: Introduce scrub_flags Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 79/96] nfit/ars: Allow root to busy-poll the ARS state machine Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 80/96] nfit/ars: Avoid stale ARS results Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 81/96] mmc: sdhci: Fix data command CRC error handling Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 82/96] mmc: sdhci: Rename SDHCI_ACMD12_ERR and SDHCI_INT_ACMD12ERR Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 83/96] mmc: sdhci: Handle auto-command errors Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 84/96] modpost: file2alias: go back to simple devtable lookup Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 85/96] modpost: file2alias: check prototype of handler Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 86/96] tpm/tpm_i2c_atmel: Return -E2BIG when the transfer is incomplete Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 87/96] tpm: Fix the type of the return value in calc_tpm2_event_size() Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 88/96] Revert "kbuild: use -Oz instead of -Os when using clang" Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 89/96] sched/fair: Limit sched_cfs_period_timer() loop to avoid hard lockup Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 90/96] device_cgroup: fix RCU imbalance in error case Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 91/96] mm/vmstat.c: fix /proc/vmstat format for CONFIG_DEBUG_TLBFLUSH=y CONFIG_SMP=n Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 92/96] ALSA: info: Fix racy addition/deletion of nodes Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 93/96] percpu: stop printing kernel addresses Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 94/96] tools include: Adopt linux/bits.h Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 95/96] ASoC: rockchip: add missing INTERLEAVED PCM attribute Greg Kroah-Hartman
2019-04-24 17:10 ` [PATCH 4.19 96/96] i2c-hid: properly terminate i2c_hid_dmi_desc_override_table[] array Greg Kroah-Hartman
2019-04-24 22:25 ` [PATCH 4.19 00/96] 4.19.37-stable review kernelci.org bot
2019-04-25  6:05 ` Naresh Kamboju
2019-04-25 11:56 ` Jon Hunter
2019-04-25 16:24 ` shuah
2019-04-25 19:38 ` Guenter Roeck

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=20190424170924.624388859@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=Janakarajan.Natarajan@amd.com \
    --cc=Suravee.Suthikulpanit@amd.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=jolsa@redhat.com \
    --cc=kim.phillips@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mliska@suse.cz \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=puwen@hygon.cn \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --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;
as well as URLs for NNTP newsgroup(s).