From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5800 invoked by alias); 28 Oct 2009 22:23:28 -0000 Received: (qmail 5782 invoked by uid 22791); 28 Oct 2009 22:23:26 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 28 Oct 2009 22:23:20 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9SMNJGF022015 for ; Wed, 28 Oct 2009 18:23:19 -0400 Received: from [10.16.2.46] (dhcp-100-2-46.bos.redhat.com [10.16.2.46]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n9SMNIG0018407; Wed, 28 Oct 2009 18:23:18 -0400 Message-ID: <4AE8C456.7010709@redhat.com> Date: Wed, 28 Oct 2009 22:23:00 -0000 From: Masami Hiramatsu User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.4pre) Gecko/20091014 Fedora/3.0-2.8.b4.fc11 Thunderbird/3.0b4 MIME-Version: 1.0 To: Wenji Huang CC: Mahesh J Salgaonkar , systemtap@sources.redhat.com Subject: Re: [PATCH -tip tracing/kprobes] Powerpc port of the kprobe-based event tracer. References: <20091020121505.724222003@mars.in.ibm.com> <4AE65F54.70800@oracle.com> In-Reply-To: <4AE65F54.70800@oracle.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: 2009-q4/txt/msg00341.txt.bz2 Hi Wenji, Thank you for reviewing, it seems that same issues are in x86 version too... Wenji Huang wrote: > Hi, > >> +#define kernel_stack_pointer(regs) ((regs)->gpr[1]) >> + >> +/** >> + * regs_get_register() - get register value from its offset >> + * @regs: pt_regs from which register value is gotten >> + * @offset: offset number of the register. >> + * >> + * regs_get_register returns the value of a register whose offset from @regs >> + * is @offset. The @offset is the offset of the register in struct pt_regs. > > "is @offset." seems be redundant. >> + * If @offset is bigger than MAX_REG_OFFSET, this returns 0. >> + */ >> +static inline unsigned long regs_get_register(struct pt_regs *regs, > > [...] >> + * regs_within_kernel_stack() - check the address in the stack >> + * @regs: pt_regs which contains kernel stack pointer. >> + * @addr: address which is checked. >> + * >> + * regs_within_kenel_stack() checks @addr is within the kernel stack page(s). >> + * If @addr is within the kernel stack, it returns true. If not, returns false. > > s/regs_within_kenel_stack/regs_within_kernel_stack/ > The return type function is declared as int. >> + */ >> + >> +static inline int regs_within_kernel_stack(struct pt_regs *regs, >> + unsigned long addr) >> +{ >> + return ((addr& ~(THREAD_SIZE - 1)) == >> + (kernel_stack_pointer(regs)& ~(THREAD_SIZE - 1))); >> +} >> + >> +/** >> + * regs_get_kernel_stack_nth() - get Nth entry of the stack >> + * @regs: pt_regs which contains kernel stack pointer. >> + * @n: stack entry number. >> + * >> + * regs_get_kernel_stack_nth() returns @n th entry of the kernel stack which >> + * is specifined by @regs. If the @n th entry is NOT in the kernel stack, >> + * this returns 0. > > s/specifined/specified/ >> + */ >> +static inline unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs, >> + unsigned int n) >> +{ >> + unsigned long *addr = (unsigned long *)kernel_stack_pointer(regs); >> + addr += n; >> + if (regs_within_kernel_stack(regs, (unsigned long)addr)) >> + return *addr; >> + else >> + return 0; >> +} >> + >> + >> +/* Get Nth argument at function call */ >> +extern unsigned long regs_get_argument_nth(struct pt_regs *regs, >> + unsigned int n); >> + > > Maybe to put extern declaration at the very beginning is better. >> /* >> * These are defined as per linux/ptrace.h, which see. >> */ > [...] > > Regards, > Wenji -- Masami Hiramatsu Software Engineer Hitachi Computer Products (America), Inc. Software Solutions Division e-mail: mhiramat@redhat.com