IP Library › Granted Patent US 12,288,072
Granted Patent B2
US 12,288,072 · App. 17/214,823 · Granted Apr 29, 2025

Methods, systems, and apparatuses for precise last branch record event logging

Inventors: Jonathan Combs (Austin, TX); Michael Chynoweth (Placitas, NM); Beeman Strong (Portland, OR); Charlie Hewett (Bellevue, WA); Patrick Konsor (Hillsboro, OR); Vidisha Chirra (Austin, TX); Asavari Paranjape (Austin, TX); Ahmad Yasin (Haifa, IL)
G06F9/3804G06F11/3024G06F11/3495G06F12/0802G06F2212/30
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,288,072
App. No.
17/214,823
Granted
Apr 29, 2025
Kind
B2
Abstract

Systems, methods, and apparatuses relating to circuitry to implement precise last branch record event logging in a processor are described. In one embodiment, a hardware processor core includes an execution circuit to execute instructions, a retirement circuit to retire executed instructions, a status register, and a last branch record circuit to, in response to retirement by the retirement circuit of a first taken branch instruction, start a cycle timer and a performance monitoring event counter, and in response to retirement by the retirement circuit of a second taken branch instruction, that is a next taken branch instruction in program order after the first taken branch instruction, write values from the cycle timer and the performance monitoring event counter into a first entry in the status register and clear the values from the cycle timer and the performance monitoring event counter.

Claims (45)

1. An apparatus comprising:

an execution circuit to execute instructions;

a retirement circuit to retire executed instructions;

a status register; and

a last branch record circuit to:

in response to retirement by the retirement circuit of a first taken branch instruction, start a cycle timer and a performance monitoring event counter that is distinct from the cycle timer, and

in response to retirement by the retirement circuit of a second taken branch instruction, that is a next taken branch instruction in program order after the first taken branch instruction, write values from the cycle timer and the performance monitoring event counter into a first entry in the status register and clear the values from the cycle timer and the performance monitoring event counter.

2. The apparatus of claim 1 , wherein the last branch record circuit is to:

in response to retirement by the retirement circuit of the second taken branch instruction, start the cycle timer and the performance monitoring event counter after the clear, and

in response to retirement by the retirement circuit of a third taken branch instruction, that is a next taken branch instruction in program order after the second taken branch instruction, write values from the cycle timer and the performance monitoring event counter into a second entry in the status register and clear the values from the cycle timer and the performance monitoring event counter.

3. The apparatus of claim 1 , further comprising a cache, wherein the last branch record circuit is to update a first counter of the performance monitoring event counter for a hit in the cache for an instruction between the first taken branch instruction and the second taken branch instruction in program order.

4. The apparatus of claim 3 , further comprising a translation lookaside buffer, wherein the last branch record circuit is to update a second counter of the performance monitoring event counter for a miss in the translation lookaside buffer for an instruction between the first taken branch instruction and the second taken branch instruction in program order.

5. The apparatus of claim 1 , wherein the execution circuit is to, in response to execution of a capabilities instruction, load a value into a register of the apparatus that indicates a number of counters of the performance monitoring event counter.

6. The apparatus of claim 1 , wherein the performance monitoring event counter comprises a plurality of counters for different performance monitoring events, and, in response to retirement by the retirement circuit of the second taken branch instruction, the last branch record circuit is further to write an instruction pointer of the first taken branch instruction and an instruction pointer of a target address of the first taken branch instruction into the first entry of the status register with the values of the plurality of counters.

7. The apparatus of claim 1 , wherein, in response to retirement by the retirement circuit of the second taken branch instruction, the last branch record circuit is further to write an instruction pointer of the first taken branch instruction and an instruction pointer of a target address of the first taken branch instruction into the first entry of the status register.

8. The apparatus of claim 1 , further comprising a command register comprising a plurality of bits, wherein the performance monitoring event counter comprises a plurality of counters for different performance monitoring events, and, when a corresponding bit is set in the command register, enables the performance monitoring event counter to count a corresponding performance monitoring event.

9. A method comprising:

executing instructions with an execution circuit of a processor core;

retiring executed instructions with a retirement circuit of the processor core;

in response to retirement by the retirement circuit of a first taken branch instruction, starting a cycle timer and a performance monitoring event counter, that is distinct from the cycle timer, by a last branch record circuit of the processor core; and

in response to retirement by the retirement circuit of a second taken branch instruction, that is a next taken branch instruction in program order after the first taken branch instruction, writing values from the cycle timer and the performance monitoring event counter into a first entry in a status register of the processor core and clearing the values from the cycle timer and the performance monitoring event counter by the last branch record circuit.

10. The method of claim 9 , further comprising:

in response to retirement by the retirement circuit of the second taken branch instruction, starting the cycle timer and the performance monitoring event counter by the last branch record circuit after the clearing; and

in response to retirement by the retirement circuit of a third taken branch instruction, that is a next taken branch instruction in program order after the second taken branch instruction, writing values from the cycle timer and the performance monitoring event counter into a second entry in the status register and clearing the values from the cycle timer and the performance monitoring event counter by the last branch record circuit.

11. The method of claim 9 , further comprising updating a first counter of the performance monitoring event counter for a hit in a cache of the processor core for an instruction between the first taken branch instruction and the second taken branch instruction in program order by the last branch record circuit.

12. The method of claim 11 , further comprising updating a second counter of the performance monitoring event counter for a miss in a translation lookaside buffer of the processor core for an instruction between the first taken branch instruction and the second taken branch instruction in program order by the last branch record circuit.

13. The method of claim 9 , further comprising executing a capabilities instruction with the execution circuit to load a value into a register of the processor core that indicates a number of counters of the performance monitoring event counter.

14. The method of claim 9 , wherein the performance monitoring event counter comprises a plurality of counters for different performance monitoring events, and, in response to retirement by the retirement circuit of the second taken branch instruction, the method further comprising writing an instruction pointer of the first taken branch instruction and an instruction pointer of a target address of the first taken branch instruction into the first entry of the status register with the values of the plurality of counters by the last branch record circuit.

15. The method of claim 9 , wherein, in response to retirement by the retirement circuit of the second taken branch instruction, further comprising writing an instruction pointer of the first taken branch instruction and an instruction pointer of a target address of the first taken branch instruction into the first entry of the status register by the last branch record circuit.

16. The method of claim 9 , wherein the performance monitoring event counter comprises a plurality of counters for different performance monitoring events, and the method further comprises, when a corresponding bit is set in a plurality of bits of a command register of the processor core, enabling the performance monitoring event counter to count a corresponding performance monitoring event.

17. An apparatus comprising:

an execution circuit to execute instructions;

a status register; and

a last branch record circuit to:

in response to a first taken branch instruction, start a cycle timer and a performance monitoring event counter that is distinct from the cycle timer, and

in response to a second taken branch instruction, that is a next taken branch instruction in program order after the first taken branch instruction, write values from the cycle timer and the performance monitoring event counter into a first entry in the status register and clear the values from the cycle timer and the performance monitoring event counter.

18. The apparatus of claim 17 , wherein the last branch record circuit is to:

in response to the second taken branch instruction, start the cycle timer and the performance monitoring event counter after the clear, and

in response to a third taken branch instruction, that is a next taken branch instruction in program order after the second taken branch instruction, write values from the cycle timer and the performance monitoring event counter into a second entry in the status register and clear the values from the cycle timer and the performance monitoring event counter.

19. The apparatus of claim 17 , further comprising a cache, wherein the last branch record circuit is to update a first counter of the performance monitoring event counter for a hit in the cache for an instruction between the first taken branch instruction and the second taken branch instruction in program order.

20. The apparatus of claim 19 , further comprising a translation lookaside buffer, wherein the last branch record circuit is to update a second counter of the performance monitoring event counter for a miss in the translation lookaside buffer for an instruction between the first taken branch instruction and the second taken branch instruction in program order.

21. The apparatus of claim 17 , wherein the execution circuit is to, in response to execution of a capabilities instruction, load a value into a register of the apparatus that indicates a number of counters of the performance monitoring event counter.

22. The apparatus of claim 17 , wherein the performance monitoring event counter comprises a plurality of counters for different performance monitoring events, and, in response to the second taken branch instruction, the last branch record circuit is further to write an instruction pointer of the first taken branch instruction and an instruction pointer of a target address of the first taken branch instruction into the first entry of the status register with the values of the plurality of counters.

23. The apparatus of claim 17 , wherein, in response to the second taken branch instruction, the last branch record circuit is further to write an instruction pointer of the first taken branch instruction and an instruction pointer of a target address of the first taken branch instruction into the first entry of the status register.

24. The apparatus of claim 17 , further comprising a command register comprising a plurality of bits, wherein the performance monitoring event counter comprises a plurality of counters for different performance monitoring events, and, when a corresponding bit is set in the command register, enables the performance monitoring event counter to count a corresponding performance monitoring event.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded May 3, 2021
From: COMBS, JONATHAN; CHYNOWETH, MICHAEL; STRONG, BEEMAN; HEWETT, CHARLIE; KONSOR, PATRICK; CHIRRA, VIDISHA; PARANJAPE, ASAVARI; YASIN, AHMAD
To: INTEL CORPORATION
Reel/Frame 056112/0654 →
Continuity (1)
Related Publication 20220308882A1 · Sep 29, 2022
References Cited (24)
US 6233679B1 · Holmberg · 2001 [cited by examiner]
US 9384003B2 · Mizuno et al. · 2016 [cited by applicant]
US 10452417B2 · Serebrin · 2019 [cited by examiner]
US 11789735B2 · Shanbhogue · 2023 [cited by examiner]
US 20040107058A1 · Gomes · 2004 [cited by examiner]
US 20070214342A1 · Newburn · 2007 [cited by examiner]
US 20090210814A1 · Agrusa · 2009 [cited by examiner]
US 20120304779A1 · Ono · 2012 [cited by examiner]
US 20120311307A1 · Chynoweth · 2012 [cited by examiner]
US 20140380027A1 · Yasin · 2014 [cited by examiner]
US 20160259646A1 · Yasin · 2016 [cited by examiner]
US 20170083333A1 · Choudhary · 2017 [cited by examiner]
US 20180217839A1 · Chynoweth et al. · 2018 [cited by applicant]
US 20190034206A1 · Sane · 2019 [cited by examiner]
US 20200310957A1 · Sane · 2020 [cited by examiner]
US 20210200547A1 · Yasin · 2021 [cited by examiner]
US 20210342134A1 · Yasin · 2021 [cited by examiner]
US 20220308882A1 · Combs · 2022 [cited by examiner]
Andi Kleen, “An introduction to last branch records”, Mar. 23, 2016, LWN.net (Year: 2016). [cited by examiner]
Andy Kleen, “Advanced usage of last branch records”, Mar. 30, 2016, LWN.net (Year: 2016). [cited by examiner]
Intel, “Intel(registered) 64 and IA-32 Architectures Software Developer's Manual”, vol. 3B: System Programming Guide, Part 2, Order No. 253669-060US, Sep. 2016, 582 pages. [cited by applicant]
Weidmann, Martin, “Arm Architecture 2020 Extensions”, Linaro Connect Sep. 2020, Arm Limited, 2020, 21 pages. [cited by applicant]
International Search Report and Written Opinion, PCT App. No. PCT/US22/13415, Apr. 25, 2022, 12 pages. [cited by applicant]
Extended European search report and Search Opinion , EP App. No. 22781798.8, Feb. 18, 2025, 08 pages. [cited by applicant]