public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon@arm.com>
To: Jean Pihet <jean.pihet@linaro.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linaro-kernel@lists.linaro.org" <linaro-kernel@lists.linaro.org>,
	Jiri Olsa <jolsa@redhat.com>, Ingo Molnar <mingo@kernel.org>,
	Arnaldo <acme@ghostprotocols.net>,
	"patches@linaro.org" <patches@linaro.org>,
	Jean Pihet <jean.pihet@newoldbits.com>
Subject: Re: [PATCH 1/3] ARM64: perf: add support for perf registers API
Date: Mon, 6 Jan 2014 18:30:01 +0000	[thread overview]
Message-ID: <20140106183000.GG1096@mudshark.cambridge.arm.com> (raw)
In-Reply-To: <1388420732-13961-2-git-send-email-jean.pihet@linaro.org>

Hi Jean,

Thanks for the updated patches. One minor comment on this one.

On Mon, Dec 30, 2013 at 04:25:30PM +0000, Jean Pihet wrote:
> From: Jean Pihet <jean.pihet@newoldbits.com>
> 
> This patch implements the functions required for the perf registers API,
> allowing the perf tool to interface kernel register dumps with libunwind
> in order to provide userspace backtracing.
> Compat mode is also supported.

[...]

> +u64 perf_reg_value(struct pt_regs *regs, int idx)
> +{
> +	if (WARN_ON_ONCE((u32)idx >= PERF_REG_ARM64_MAX))
> +		return 0;

While this is probably fine, I'd feel more comfortable if you had separate
limit checks for native and compat...

> +	/*
> +	 * Compat (i.e. 32 bit) mode:
> +	 * - PC has been set in the pt_regs struct in kernel_entry,
> +	 * - Handle SP and LR here.
> +	 */
> +	if (compat_user_mode(regs)) {

i.e. have a WARN_ON_ONCE here for the compat structure size.

> +		if ((u32)idx == PERF_REG_ARM64_SP)
> +			return regs->compat_sp;
> +		if ((u32)idx == PERF_REG_ARM64_LR)
> +			return regs->compat_lr;
> +	}

then stick an else here with the original check.

Make sense?

Will

  reply	other threads:[~2014-01-06 18:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-30 16:25 [PATCH v4 0/3] perf: add AARCH64 arch support Jean Pihet
2013-12-30 16:25 ` [PATCH 1/3] ARM64: perf: add support for perf registers API Jean Pihet
2014-01-06 18:30   ` Will Deacon [this message]
2014-01-07  8:49     ` Jean Pihet
2014-01-15 10:30     ` Jean Pihet
2014-01-15 11:07       ` Will Deacon
2014-01-16 14:49         ` Jean Pihet
2013-12-30 16:25 ` [PATCH 2/3] ARM64: perf: wire up perf_regs and unwind support Jean Pihet
2014-01-06 18:36   ` Will Deacon
2013-12-30 16:25 ` [PATCH 3/3] ARM64: perf: add support for frame pointer unwinding in compat mode Jean Pihet
  -- strict thread matches above, loose matches on Subject: below --
2014-02-03 18:18 [PATCH v6 0/3] perf: AARCH64 arch support Jean Pihet
2014-02-03 18:18 ` [PATCH 1/3] ARM64: perf: add support for perf registers API Jean Pihet
     [not found] <1387212562-8128-1-git-send-email-y>
2013-12-16 16:49 ` jean.pihet
2013-12-17 11:11   ` Will Deacon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140106183000.GG1096@mudshark.cambridge.arm.com \
    --to=will.deacon@arm.com \
    --cc=acme@ghostprotocols.net \
    --cc=jean.pihet@linaro.org \
    --cc=jean.pihet@newoldbits.com \
    --cc=jolsa@redhat.com \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=patches@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox