linux-mips
[Top] [All Lists]

Re: [PATCH] Add support for profiling Loongson 2E

To: "Ralf Baechle" <ralf@linux-mips.org>
Subject: Re: [PATCH] Add support for profiling Loongson 2E
From: "Dajie Tan" <jiankemeng@gmail.com>
Date: Wed, 25 Jul 2007 07:41:21 +0400
Cc: inux-mips <linux-mips@linux-mips.org>, phil.el@wanadoo.fr, levon@movementarian.org, oprofile-list@lists.sourceforge.net
Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Qk5ZIIqagsbh2vdC7nhcZ5wTI5cuaV1IaS2/0P019RoGSzSQtZsdlEVzD6BphAdsG5NUPxFdq/2NB4GYB2MzLVoSTHti1kfjgXpa3PVwCi4XKqztaif+paFmc1COpoqPP8vfGfaY+26O4me1D+TjLkuPJ8BUJoIl8QMyyD3BpOQ=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=t1XFkjgEJO9tRRZGDM31KNlgH0TCWDJcHAZLtiiqKJoZ96wvxfPsPWUMCX0KYhy74cU/UCUO5O+R7otAy0FAGnzN8GqI2aRzf1Mi91HgK0wLFsxCWDQcuKzM2iBGKniv0i3u7r7/YvKy5wfHuXSSh509jW8qFJa8toiMyNBoT4I=
In-reply-to: <20070724144051.GA17256@linux-mips.org>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <5861a7880707240220g5d8129anc95e10bea833e323@mail.gmail.com> <20070724144051.GA17256@linux-mips.org>
Sender: linux-mips-bounce@linux-mips.org
Why do you need this change?  It almost looks as if you're papering over
a bug where add_sample should not be called at all.

Yeah,this change is to enhance the robust of oprofile. When using
performace counter manually(writting control register in a module, no
need to use the oprofile),I usually make kernel panic if I do not
initialize the oprofile and enable the overflow interrupt carelessly.
So, this change can avoid this panic. :D

2007/7/24, Ralf Baechle <ralf@linux-mips.org>:
On Tue, Jul 24, 2007 at 01:20:27PM +0400, Dajie Tan wrote:

> This patch adds support for profiling Loongson 2E. It's been tested on
> FuLong mini PC(loongson2e inside).

First of all, your patch has been garbled when mailing.


[.. Lots of arch/mips code deleted ...]

No complaints upto this point.  But:

> diff -urN b/drivers/oprofile/cpu_buffer.c a/drivers/oprofile/cpu_buffer.c
> --- b/drivers/oprofile/cpu_buffer.c   2007-07-24 13:00:54.000000000 +0800
> +++ a/drivers/oprofile/cpu_buffer.c   2007-07-19 08:22:15.000000000 +0800
> @@ -148,6 +148,10 @@
>            unsigned long pc, unsigned long event)
> {
>       struct op_sample * entry = &cpu_buf->buffer[cpu_buf->head_pos];
> +
> +     if(!entry)
> +             return;
> +
>       entry->eip = pc;
>       entry->event = event;
>       increment_head(cpu_buf);

Why do you need this change?  It almost looks as if you're papering over
a bug where add_sample should not be called at all.

  Ralf



--
为天地立心
为生民立命
为往圣继绝学
为万世开太平
<Prev in Thread] Current Thread [Next in Thread>