From patchwork Wed Apr 21 13:27:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Whitcroft X-Patchwork-Id: 50657 X-Patchwork-Delegate: apw@canonical.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 2B21DB7C48 for ; Wed, 21 Apr 2010 23:27:42 +1000 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.69) (envelope-from ) id 1O4Zxp-000474-1p; Wed, 21 Apr 2010 14:27:37 +0100 Received: from adelie.canonical.com ([91.189.90.139]) by chlorine.canonical.com with esmtp (Exim 4.69) (envelope-from ) id 1O4Zxo-00046t-0k for kernel-team@lists.ubuntu.com; Wed, 21 Apr 2010 14:27:36 +0100 Received: from hutte.canonical.com ([91.189.90.181]) by adelie.canonical.com with esmtp (Exim 4.69 #1 (Debian)) id 1O4Zxn-0004zF-UI; Wed, 21 Apr 2010 14:27:35 +0100 Received: from 79-70-111-109.dynamic.dsl.as9105.com ([79.70.111.109] helo=localhost) by hutte.canonical.com with esmtpsa (TLS-1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1O4Zxn-0000E2-BX; Wed, 21 Apr 2010 14:27:35 +0100 Date: Wed, 21 Apr 2010 14:27:34 +0100 From: Andy Whitcroft To: Jeremy Kerr Subject: Re: [RFC, PATCH] UBUNTU: fix perf kernel version detection for multiple-flavour strings Message-ID: <20100421132734.GF3045@shadowen.org> References: <1271853779.810767.819588158504.1.gpush@pororo> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1271853779.810767.819588158504.1.gpush@pororo> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: kernel-team@lists.ubuntu.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com On Wed, Apr 21, 2010 at 08:42:59PM +0800, Jeremy Kerr wrote: > Currently, the perf tool doesn't work for the generic-pae flavour: > > $ bash -x /usr/bin/perf > ++ uname -r > + version=2.6.32-21-generic-pae > + version=2.6.32-21-generic > + exec perf_2.6.32-21-generic > /usr/bin/perf: line 4: exec: perf_2.6.32-21-generic: not found > > - the PAE flavour has a version string ending in -generic-pae, but the > version cleaning in the perf script doesn't handle the multiple flavour > strings correctly. The perf tool is named perf_2.6.32-21, not > perf_2.6.32-21-generic. > > This change fixes the perf wrapper script to throw away version data > after a 'dash, non-digit' sequence instead of just the last dash. This > fixes the problem on the PAE kernel. We need to do a special pass for > the -386 flavour, as it's virtually indisinguishable from a normal > version number. Testing this parsing against the possible flavours > gives: > > 2.6.32-21-generic -> 2.6.32-21 > 2.6.32-21-server -> 2.6.32-21 > 2.6.32-21-preempt -> 2.6.32-21 > 2.6.32-21-versatile -> 2.6.32-21 > 2.6.32-21-generic -> 2.6.32-21 > 2.6.32-21-generic-pae -> 2.6.32-21 > 2.6.32-21-386 -> 2.6.32-21 > 2.6.32-21-ia64 -> 2.6.32-21 > 2.6.32-21-lpia -> 2.6.32-21 > 2.6.32-21-powerpc -> 2.6.32-21 > 2.6.32-21-powerpc-smp -> 2.6.32-21 > 2.6.32-21-powerpc64-smp -> 2.6.32-21 > 2.6.32-21-sparc64 -> 2.6.32-21 > 2.6.32-21-sparc64-smp -> 2.6.32-21 > > Signed-off-by: Jeremy Kerr > > --- > debian/tools/perf | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/debian/tools/perf b/debian/tools/perf > index 1a9915f..33df59d 100644 > --- a/debian/tools/perf > +++ b/debian/tools/perf > @@ -1,4 +1,5 @@ > #!/bin/bash > version=`uname -r` > -version=${version%-*} > +version=${version/-[^0-9]*} > +version=${version%-386} > exec "perf_$version" "$@" Yep, there is clearly an issue here. I don't like the fact we have to know the form of some of the flavours here. I think we can more generically do this by stripping the version-abi from the front which has a known form (two lots of *-) and stripping the result from the original version. Something like the patch below. Testing this gives: 2.6.32-21-generic -> 2.6.32-21 2.6.32-21-server -> 2.6.32-21 2.6.32-21-preempt -> 2.6.32-21 2.6.32-21-versatile -> 2.6.32-21 2.6.32-21-generic -> 2.6.32-21 2.6.32-21-generic-pae -> 2.6.32-21 2.6.32-21-386 -> 2.6.32-21 2.6.32-21-ia64 -> 2.6.32-21 2.6.32-21-lpia -> 2.6.32-21 2.6.32-21-powerpc -> 2.6.32-21 2.6.32-21-powerpc-smp -> 2.6.32-21 2.6.32-21-powerpc64-smp -> 2.6.32-21 2.6.32-21-sparc64 -> 2.6.32-21 2.6.32-21-sparc64-smp -> 2.6.32-21 -apw From 753b853b11e201905f7f0a183637b2951068993b Mon Sep 17 00:00:00 2001 From: Andy Whitcroft Date: Wed, 21 Apr 2010 14:19:55 +0100 Subject: [PATCH] UBUNTU: tools -- fix perf version extraction for multi-part flavours Currently, the perf tool doesn't work for the generic-pae flavour: $ bash -x /usr/bin/perf ++ uname -r + version=2.6.32-21-generic-pae + version=2.6.32-21-generic + exec perf_2.6.32-21-generic /usr/bin/perf: line 4: exec: perf_2.6.32-21-generic: not found We can work out the flavour by removing the known shaped version-abi combination from the start of the version string (which is two lots of *-), and then remove this flavour suffix from the original version to leave us with the version-abi we need. Based on a patch by Jeremy Kerr . Signed-off-by: Andy Whitcroft Acked-By: Jeremy Kerr --- debian/tools/perf | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/debian/tools/perf b/debian/tools/perf index 1a9915f..79253d2 100644 --- a/debian/tools/perf +++ b/debian/tools/perf @@ -1,4 +1,7 @@ #!/bin/bash version=`uname -r` -version=${version%-*} +flavour=${version#*-} +flavour=${flavour#*-} +version=${version%-$flavour} + exec "perf_$version" "$@"