From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13849 invoked by alias); 3 Mar 2008 12:18:33 -0000 Received: (qmail 13840 invoked by uid 22791); 3 Mar 2008 12:18:31 -0000 X-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from e5.ny.us.ibm.com (HELO e5.ny.us.ibm.com) (32.97.182.145) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 03 Mar 2008 12:18:05 +0000 Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) by e5.ny.us.ibm.com (8.13.8/8.13.8) with ESMTP id m23CI28g017586 for ; Mon, 3 Mar 2008 07:18:02 -0500 Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v8.7) with ESMTP id m23CI2jV230588 for ; Mon, 3 Mar 2008 07:18:02 -0500 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m23CI2hT007631 for ; Mon, 3 Mar 2008 07:18:02 -0500 Received: from thinktux.in.ibm.com (thinktux.in.ibm.com [9.124.31.35]) by d01av02.pok.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id m23CI0m8007564; Mon, 3 Mar 2008 07:18:01 -0500 Received: from thinktux.in.ibm.com (localhost.localdomain [127.0.0.1]) by thinktux.in.ibm.com (Postfix) with ESMTP id 5319FE7920; Mon, 3 Mar 2008 17:48:42 +0530 (IST) Received: (from ananth@localhost) by thinktux.in.ibm.com (8.13.1/8.13.1/Submit) id m23CIfht018459; Mon, 3 Mar 2008 17:48:41 +0530 Date: Mon, 03 Mar 2008 12:18:00 -0000 From: Ananth N Mavinakayanahalli To: "Frank Ch. Eigler" Cc: srinivasa@in.ibm.com, systemtap@sources.redhat.com Subject: Re: changelog files, %( %) idioms Message-ID: <20080303121841.GA18212@in.ibm.com> Reply-To: ananth@in.ibm.com References: <20080225145915.GA8718@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080225145915.GA8718@redhat.com> User-Agent: Mutt/1.5.17 (2007-11-01) X-IsSubscribed: yes Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2008-q1/txt/msg00339.txt.bz2 On Mon, Feb 25, 2008 at 09:59:15AM -0500, Frank Ch. Eigler wrote: > > Thanks for the bug #5772 patch. It is possible to make the %( kernel > %) conditionals look more compact by realizing that they don't operate > at the statement but at the token level. That means one can use them > around just the smallest bit of code that needs to be changed for > different versions/architectures, so that instead of: > > %( kernel_vr > "2.6.24" %? > argstr = sprintf("%d, %p, %s, %p", $upid, $stat_addr, _wait4_opt_str($options), $ru) > %: > argstr = sprintf("%d, %p, %s, %p", $pid, $stat_addr, _wait4_opt_str($options), $ru) > %) > > and > > %( kernel_vr > "2.6.24" %? > pid = $upid > %: > pid = $pid > %) > > one could write ... > > argstr = sprintf("%d, %p, %s, %p", > %( kernel_vr > "2.6.24" %? $upid %: $pid %), > $stat_addr, _wait4_opt_str($options), $ru) > > and > > pid = %( kernel_vr > "2.6.24" %? $upid %: $pid %) We have a similar issue with the x86_32 syscalls tapset. sys_signalstack has a reference to ebx, while with register unification, its now bx. The tapset is thus broken for kernel_vr > 2.6.24. Following the compact method, the patch looks thus: --- tapset/i686/syscalls.stp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: systemtap-3mar/tapset/i686/syscalls.stp =================================================================== --- systemtap-3mar.orig/tapset/i686/syscalls.stp +++ systemtap-3mar/tapset/i686/syscalls.stp @@ -119,8 +119,8 @@ probe syscall.set_zone_reclaim.return = # probe syscall.sigaltstack = kernel.function("sys_sigaltstack") { name = "sigaltstack" - ebx = $ebx - argstr = sprintf("%p", $ebx) + bx = %( kernel_vr > "2.6.24" %? $bx %: $ebx %) + argstr = sprintf("%p", %( kernel_vr > "2.6.24" %? $bx %: $ebx %) ) } probe syscall.sigaltstack.return = kernel.function("sys_sigaltstack").return { name = "sigaltstack" Notice that the LHS has changed from ebx to bx. However, if we need to have a 100% backward compatibility, I'd prefer the older approach thus: --- tapset/i686/syscalls.stp | 5 +++++ 1 files changed, 5 insertions(+) Index: systemtap-3mar/tapset/i686/syscalls.stp =================================================================== --- systemtap-3mar.orig/tapset/i686/syscalls.stp +++ systemtap-3mar/tapset/i686/syscalls.stp @@ -119,8 +119,13 @@ probe syscall.set_zone_reclaim.return = # probe syscall.sigaltstack = kernel.function("sys_sigaltstack") { name = "sigaltstack" +%( kernel_vr > "2.6.24" %? + bx = $bx + argstr = sprintf("%p", $bx) +%: ebx = $ebx argstr = sprintf("%p", $ebx) +%) } probe syscall.sigaltstack.return = kernel.function("sys_sigaltstack").return { name = "sigaltstack" Comments? Ananth