Wind River Support Network

HomeDefectsLIN5-18141
Fixed

LIN5-18141 : Request for backport of enhanced perf functionality

Created: Feb 20, 2014    Updated: Dec 19, 2017
Resolved Date: Mar 20, 2014
Found In Version: 5.0.1
Fix Version: 5.0.1.13
Severity: Standard
Applicable for: Wind River Linux 5
Component/s: Kernel

Description

The perf tools are very useful for analysing the running system and with the default kernel configuration they work well. However, it has been found that the lockup detection code conflicts with perf in the current (WRL5) kernel. If the customer enables lockup detection then the cycle counter is no longer available for use by perf which causes "perf top" to fail completely and "perf stat" can only display partial results as follows.

Normal case:

{noformat}
root@localhost:~# perf stat -B dd if=/dev/zero of=/dev/null count=1000000
1000000+0 records in
1000000+0 records out
512000000 bytes (512 MB) copied, 0.312775 s, 1.6 GB/s

 Performance counter stats for 'dd if=/dev/zero of=/dev/null count=1000000':

        313.175769 task-clock                #    0.992 CPUs utilized
                34 context-switches          #    0.109 K/sec
                 0 cpu-migrations            #    0.000 K/sec
               162 page-faults               #    0.517 K/sec
        1016450963 cycles                    #    3.246 GHz
         389467102 stalled-cycles-frontend   #   38.32% frontend cycles idle
         116321441 stalled-cycles-backend    #   11.44% backend  cycles idle
        1546849209 instructions              #    1.52  insns per cycle
                                             #    0.25  stalled cycles per insn
         297373792 branches                  #  949.543 M/sec
             10136 branch-misses             #    0.00% of all branches

       0.315688493 seconds time elapsed
{noformat}

Case when lockup detection is enabled:

{noformat}
root@localhost:~# perf stat -B dd if=/dev/zero of=/dev/null count=1000000
1000000+0 records in
1000000+0 records out
512000000 bytes (512 MB) copied, 0.466134 s, 1.1 GB/s

 Performance counter stats for 'dd if=/dev/zero of=/dev/null count=1000000':

        465.290005 task-clock                #    0.887 CPUs utilized
               489 context-switches          #    0.001 M/sec
                 0 CPU-migrations            #    0.000 K/sec
               211 page-faults               #    0.453 K/sec
     <not counted> cycles
         433819665 stalled-cycles-frontend   #    0.00% frontend cycles idle
[16.77%]
         165313877 stalled-cycles-backend    #    0.00% backend  cycles idle
[33.53%]
        2144905204 instructions              #    0.00  insns per cycle
                                             #    0.20  stalled cycles per insn
[50.21%]
         395423901 branches                  #  849.844 M/sec
[66.84%]
           2015137 branch-misses             #    0.51% of all branches
[83.40%]

       0.524611923 seconds time elapsed
{noformat}

Notice that the cycles value states <not counted>.

Repeating the steps with WRL6 it was found that the cycle count was available to perf even with lockup detection enabled. This enhancement request therefore is to backport the perf code from the WRL6 kernel to the WRL5 kernel.

Steps to Reproduce

In WRL5:

  $ configure --enable-board=intel_xeon_core \
        --enable-rootfs=glibc_cgl --enable-kernel=cgl \
        --with-package=perf \
        --enable-jobs=4 --enable-parallel-pkgbuilds=4 \
        --enable-rm-work=yes --enable-rm-oldimgs=yes \
        --enable-reconfig --with-sstate-dir=/path/to/sstate/dir \
        --with-rcpl-version=0011

Note that the problem also occurs with a standard kernel/rootfs.

  $ make

Deploy to target and boot.

There are two tests to perform.

  # perf top

Should display the performance counter profile and:

  # perf stat -B dd if=/dev/zero of=/dev/null count=1000000

should display results like the ones shown in the description.

For the failing configuration you can now do this:

  $ make -C build linux-windriver.menuconfig

And under the Kernel Hacking options enable the Hard and Soft Lockup Detection option. Rebuild the kernel and redeploy it, boot the target and repeat the above tests. You will see that "perf top" no longer displays anything besides a zero event count and a prompt and "perf stat" shows results like those showin in the description where the count is <not counted>.

Other Downloads


Live chat
Online