Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.kernel > #72257 > unrolled thread

Bug#990165: perf: allow using other versions than the running kernel

Started by"Steinar H. Gunderson" <sesse@debian.org>
First post2021-06-22 00:30 +0200
Last post2022-05-19 04:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.debian.kernel


Contents

  Bug#990165: perf: allow using other versions than the running kernel "Steinar H. Gunderson" <sesse@debian.org> - 2021-06-22 00:30 +0200
    Bug#990165: marked as done (perf: allow using other versions than  the running kernel) "Debian Bug Tracking System" <owner@bugs.debian.org> - 2022-05-19 04:40 +0200

#72257 — Bug#990165: perf: allow using other versions than the running kernel

From"Steinar H. Gunderson" <sesse@debian.org>
Date2021-06-22 00:30 +0200
SubjectBug#990165: perf: allow using other versions than the running kernel
Message-ID<CsAAx-1GU-1@gated-at.bofh.it>
Package: linux-base
Version: 4.6
Severity: normal
Tags: patch

Hi,

The perf wrapper script in Debian requires the perf binary of the running
kernel. However, there's not really a good reason for this; perf has a stable
ABI, and even though it's distributed and built with the kernel, you can freely
mix and match versions (I've done so, a lot).

There may still be reasons why people prefer to keep the versions matched,
but perf shouldn't just give up and die if it can't find the right version.
I've made a patch that makes this a bit more flexible; it first tries to
find a matching version, and if it doesn't exist, it simply picks the newest
one it can find. (If that's older than the kernel, it gives a warning,
since there may be new features the user would want to upgrade for, but it
doesn't die.)

Hopefully this should be safe, while being a lot less annoying when running
a newer or self-compiled kernel. :-)

--- linux-base-4.6.orig/bin/perf	2018-07-20 03:35:21.000000000 +0200
+++ linux-base-4.6/bin/perf	2021-06-22 00:15:59.618443368 +0200
@@ -10,9 +10,11 @@
 	;;
 esac
 shopt -s execfail
-exec "perf_$version" "$@"
+if [ -x "/usr/bin/perf_$version" ]; then
+    exec "perf_$version" "$@"
+fi
 
-# Not found? Tell the user which package to install.
+# Not found? Find out which version to install.
 case "$version" in
     3.* | 4.0 | 4.0.*)
 	package=linux-tools-$version
@@ -21,5 +23,16 @@
 	package=linux-perf-$version
 	;;
 esac
+
+# See if we have a usable alternative available.
+perfversion="$( linux-version sort --reverse $( echo /usr/bin/perf_* | sed "s,/usr/bin/perf_,,g" ) | head -n 1 )"
+if [ -x "/usr/bin/perf_$perfversion" ]; then
+    if linux-version compare "$perfversion" lt "$version"; then
+        echo >&2 "W: perf_$perfversion is older than the running kernel, consider installing $package."
+    fi
+    exec "perf_$perfversion" "$@"
+fi
+
+# Still nothing? Tell the user.
 echo >&2 "E: $package is not installed."
 exit 1

-- System Information:
Debian Release: 11.0
  APT prefers stable-debug
  APT policy: (500, 'stable-debug'), (500, 'testing'), (500, 'oldstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.12.8 (SMP w/40 CPU threads)
Locale: LANG=en_DK.UTF-8, LC_CTYPE=en_DK.UTF-8 (charmap=UTF-8), LANGUAGE=en_NO:en_US:en_GB:en
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages linux-base depends on:
ii  debconf [debconf-2.0]  1.5.75

linux-base recommends no packages.

linux-base suggests no packages.

-- debconf-show failed

[toc] | [next] | [standalone]


#75272 — Bug#990165: marked as done (perf: allow using other versions than the running kernel)

From"Debian Bug Tracking System" <owner@bugs.debian.org>
Date2022-05-19 04:40 +0200
SubjectBug#990165: marked as done (perf: allow using other versions than the running kernel)
Message-ID<EoEeZ-gqO9-1@gated-at.bofh.it>
In reply to#72257

[Multipart message — attachments visible in raw view] — view raw

Your message dated Thu, 19 May 2022 02:33:55 +0000
with message-id <E1nrVz9-0002lE-4T@fasolo.debian.org>
and subject line Bug#990165: fixed in linux-base 4.9
has caused the Debian Bug report #990165,
regarding perf: allow using other versions than the running kernel
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
990165: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=990165
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.kernel


csiph-web