0

The Ubuntu version I am using is Ubuntu 18.04.6 LTS, and the kernel version is 5.4.0-148 generic. My processor is 12th Gen Intel (R) Core (TM) i7-12700.

I would like to know the number of TLB entries in my CPU for different page sizes (1G, 2MB, 4KB), as well as the number of dTLB misses during program execution.

cpuid -1 command told me they are 0:

    L1 TLB/cache information: 2M/4M pages & L1 TLB (0x80000005/eax):
      instruction # entries     = 0x0 (0)
      instruction associativity = 0x0 (0)
      data # entries            = 0x0 (0)
      data associativity        = 0x0 (0)
   L1 TLB/cache information: 4K pages & L1 TLB (0x80000005/ebx):
      instruction # entries     = 0x0 (0)
      instruction associativity = 0x0 (0)
      data # entries            = 0x0 (0)
      data associativity        = 0x0 (0)
   L1 data cache information (0x80000005/ecx):
      line size (bytes) = 0x0 (0)
      lines per tag     = 0x0 (0)
      associativity     = 0x0 (0)
      size (KB)         = 0x0 (0)
   L1 instruction cache information (0x80000005/edx):
      line size (bytes) = 0x0 (0)
      lines per tag     = 0x0 (0)
      associativity     = 0x0 (0)
      size (KB)         = 0x0 (0)
   L2 TLB/cache information: 2M/4M pages & L2 TLB (0x80000006/eax):
      instruction # entries     = 0x0 (0)
      instruction associativity = L2 off (0)
      data # entries            = 0x0 (0)
      data associativity        = L2 off (0)
   L2 TLB/cache information: 4K pages & L2 TLB (0x80000006/ebx):
      instruction # entries     = 0x0 (0)
      instruction associativity = L2 off (0)
      data # entries            = 0x0 (0)
      data associativity        = L2 off (0)
   L2 unified cache information (0x80000006/ecx):
      line size (bytes) = 0x40 (64)
      lines per tag     = 0x0 (0)
      associativity     = 0x7 (7)
      size (KB)         = 0x500 (1280)
   L3 cache information (0x80000006/edx):
      line size (bytes)     = 0x0 (0)
      lines per tag         = 0x0 (0)
      associativity         = L2 off (0)
      size (in 512KB units) = 0x0 (0)

perf stat -e dTLB-loads,dTLB-load-misses,iTLB-load-misses shows not supported

UPDATE:

$ cpuid -1 -l 2
CPU:
      0xff: cache data is in CPUID 4
      0xfe: unknown
      0xf0: 64 byte prefetching

$ cpuid -1 -l 0x18
CPU:
   0x00000018 0x00: eax=0x00000004 ebx=0x00000000 ecx=0x00000000 edx=0x00000000

$ perf -v
perf version 5.4.231


$ perf list

List of pre-defined events (to be used in -e):

  branch-instructions OR branches                    [Hardware event]
  branch-misses                                      [Hardware event]
  bus-cycles                                         [Hardware event]
  cache-misses                                       [Hardware event]
  cache-references                                   [Hardware event]
  cpu-cycles OR cycles                               [Hardware event]
  instructions                                       [Hardware event]
  ref-cycles                                         [Hardware event]

  alignment-faults                                   [Software event]
  bpf-output                                         [Software event]
  context-switches OR cs                             [Software event]
  cpu-clock                                          [Software event]
  cpu-migrations OR migrations                       [Software event]
  dummy                                              [Software event]
  emulation-faults                                   [Software event]
  major-faults                                       [Software event]
  minor-faults                                       [Software event]
  page-faults OR faults                              [Software event]
  task-clock                                         [Software event]

I'm completely confused about what's wrong with my machine.

1 Answer 1

1

I doubt there’s anything wrong with your machine. cpuid’s output is raw and needs some interpretation; specifically, for TLB information, you should look at the leaf 2 information rather than the section you quoted. You’ll find that further up in the output, or you can ask for it directly:

$ cpuid -1 -l 2
CPU:
      0x63: data TLB: 2M/4M pages, 4-way, 32 entries
            data TLB: 1G pages, 4-way, 4 entries
      0x03: data TLB: 4K pages, 4-way, 64 entries
      0x76: instruction TLB: 2M/4M pages, fully, 8 entries
      0xff: cache data is in CPUID leaf 4
      0xb5: instruction TLB: 4K, 8-way, 64 entries
      0xf0: 64 byte prefetching
      0xc1: L2 TLB: 4K/2M pages, 8-way, 1024 entries

As far as perf is concerned, the version you have might not know about your CPU (I haven’t checked).

2
  • I tried this command and updated the results in the question. Unfortunately, there is still no information about TLB. Additionally, from theperf list, it can collect events such as cache misses, which should be able to know my CPU. Do you think this is caused by my machine (hardware) or system (software)? I am considering whether installing the latest Ubuntu and kernel will solve this problem.
    – citrusyi
    Commented May 24, 2023 at 7:36
  • Ah, your CPU reports a value for 0xFE in leaf 2, which means that the TLB information is in leaf 0x18 (cpuid -1 -l 0x18). perf can indeed collect cache misses, but that doesn’t imply that it should know about your CPU — the 5.4 series was first released in late 2019, quite a while before details of 12th gen CPUs were available. In general, good support for 12th gen requires at least version 5.16 of the kernel, so at least version 5.16 of perf (which is tied to the kernel). Commented May 24, 2023 at 7:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .