From: "Jon Medhurst (Tixy)" <jon.medhurst@linaro.org>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>,
Dave Martin <dave.martin@linaro.org>,
Laura Abbott <lauraa@codeaurora.org>,
Nicolas Pitre <nico@fluxnic.net>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] arm: Add unwinding annotations for 64bit division functions
Date: Thu, 22 Sep 2011 14:19:37 +0100 [thread overview]
Message-ID: <1316697577.2053.48.camel@linaro1> (raw)
In-Reply-To: <20110922130031.GK12025@e102109-lin.cambridge.arm.com>
On Thu, 2011-09-22 at 14:00 +0100, Catalin Marinas wrote:
> The unwinding fix should be simple (I haven't tested it yet):
>
> 8<-----------------------------
> ARM: Ignore the unwinding information for the first instruction in a function
>
> From: Catalin Marinas <catalin.marinas@arm.com>
>
> When backtracing from the first instruction of a function, the prologue
> has not been executed and the unwinding information is not valid. This
> patch checks for this case and just assumes that the return address is
> in LR.
>
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> ---
> arch/arm/kernel/unwind.c | 10 ++++++++++
> 1 files changed, 10 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/kernel/unwind.c b/arch/arm/kernel/unwind.c
> index d2cb0b3..946face 100644
> --- a/arch/arm/kernel/unwind.c
> +++ b/arch/arm/kernel/unwind.c
> @@ -293,6 +293,16 @@ int unwind_frame(struct stackframe *frame)
> return -URC_FAILURE;
> }
>
> + /*
> + * Check for backtrace on the first instruction of a function. The
> + * prologue has not been executed yet and the unwinding information is
> + * not valid. Assume that the return address is in LR.
> + */
> + if (idx.addr == frame->pc) {
> + frame->pc = frame->lr;
> + return URC_OK;
> + }
> +
> ctrl.vrs[FP] = frame->fp;
> ctrl.vrs[SP] = frame->sp;
> ctrl.vrs[LR] = frame->lr;
>
I've never looked at the unwinding code before but the one comment I
would make is: does the patch work with Thumb code? I.e. does bit zero
of idx.addr, frame->pc or frame->lr ever get set to indicate Thumb
state? And if so, they had better all get set otherwise it won't
work :-)
--
Tixy
WARNING: multiple messages have this Message-ID (diff)
From: jon.medhurst@linaro.org (Jon Medhurst (Tixy))
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm: Add unwinding annotations for 64bit division functions
Date: Thu, 22 Sep 2011 14:19:37 +0100 [thread overview]
Message-ID: <1316697577.2053.48.camel@linaro1> (raw)
In-Reply-To: <20110922130031.GK12025@e102109-lin.cambridge.arm.com>
On Thu, 2011-09-22 at 14:00 +0100, Catalin Marinas wrote:
> The unwinding fix should be simple (I haven't tested it yet):
>
> 8<-----------------------------
> ARM: Ignore the unwinding information for the first instruction in a function
>
> From: Catalin Marinas <catalin.marinas@arm.com>
>
> When backtracing from the first instruction of a function, the prologue
> has not been executed and the unwinding information is not valid. This
> patch checks for this case and just assumes that the return address is
> in LR.
>
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> ---
> arch/arm/kernel/unwind.c | 10 ++++++++++
> 1 files changed, 10 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/kernel/unwind.c b/arch/arm/kernel/unwind.c
> index d2cb0b3..946face 100644
> --- a/arch/arm/kernel/unwind.c
> +++ b/arch/arm/kernel/unwind.c
> @@ -293,6 +293,16 @@ int unwind_frame(struct stackframe *frame)
> return -URC_FAILURE;
> }
>
> + /*
> + * Check for backtrace on the first instruction of a function. The
> + * prologue has not been executed yet and the unwinding information is
> + * not valid. Assume that the return address is in LR.
> + */
> + if (idx.addr == frame->pc) {
> + frame->pc = frame->lr;
> + return URC_OK;
> + }
> +
> ctrl.vrs[FP] = frame->fp;
> ctrl.vrs[SP] = frame->sp;
> ctrl.vrs[LR] = frame->lr;
>
I've never looked at the unwinding code before but the one comment I
would make is: does the patch work with Thumb code? I.e. does bit zero
of idx.addr, frame->pc or frame->lr ever get set to indicate Thumb
state? And if so, they had better all get set otherwise it won't
work :-)
--
Tixy
next prev parent reply other threads:[~2011-09-22 13:19 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-19 22:11 [PATCH] arm: Add unwinding annotations for 64bit division functions Laura Abbott
2011-09-19 22:11 ` Laura Abbott
2011-09-19 23:22 ` Nicolas Pitre
2011-09-19 23:22 ` Nicolas Pitre
2011-09-20 1:55 ` Laura Abbott
2011-09-20 1:55 ` Laura Abbott
2011-09-20 1:55 ` Laura Abbott
2011-09-20 13:27 ` Nicolas Pitre
2011-09-20 13:27 ` Nicolas Pitre
2011-09-20 14:57 ` Catalin Marinas
2011-09-20 14:57 ` Catalin Marinas
2011-09-21 11:39 ` Dave Martin
2011-09-21 11:39 ` Dave Martin
2011-09-21 11:55 ` Russell King - ARM Linux
2011-09-21 11:55 ` Russell King - ARM Linux
2011-09-21 13:33 ` Dave Martin
2011-09-21 13:33 ` Dave Martin
2011-09-22 7:28 ` Jon Medhurst (Tixy)
2011-09-22 7:28 ` Jon Medhurst (Tixy)
2011-09-22 9:48 ` Catalin Marinas
2011-09-22 9:48 ` Catalin Marinas
2011-09-22 11:06 ` Jon Medhurst (Tixy)
2011-09-22 11:06 ` Jon Medhurst (Tixy)
2011-09-22 11:57 ` Catalin Marinas
2011-09-22 11:57 ` Catalin Marinas
2011-09-22 12:13 ` Jon Medhurst (Tixy)
2011-09-22 12:13 ` Jon Medhurst (Tixy)
2011-09-22 13:00 ` Catalin Marinas
2011-09-22 13:00 ` Catalin Marinas
2011-09-22 13:19 ` Jon Medhurst (Tixy) [this message]
2011-09-22 13:19 ` Jon Medhurst (Tixy)
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=1316697577.2053.48.camel@linaro1 \
--to=jon.medhurst@linaro.org \
--cc=catalin.marinas@arm.com \
--cc=dave.martin@linaro.org \
--cc=lauraa@codeaurora.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=nico@fluxnic.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.