Linux-MIPS Archive on lore.kernel.org
 help / Atom feed
* [PATCH] MIPS: Remove function size check in get_frame_info()
@ 2019-01-29  3:56 Jun-Ru Chang
  2019-02-04 23:16 ` Paul Burton
  0 siblings, 1 reply; 3+ messages in thread
From: Jun-Ru Chang @ 2019-01-29  3:56 UTC (permalink / raw)
  To: ralf
  Cc: paul.burton, jhogan, macro, yamada.masahiro, peterz, mingo,
	linux-mips, linux-kernel, tonywu, jrjang

Patch (b6c7a324df37b "MIPS: Fix get_frame_info() handling of
microMIPS function size.") introduces additional function size
check for microMIPS by only checking insn between ip and ip + func_size.
However, func_size in get_frame_info() is always 0 if KALLSYMS is not
enabled. This causes get_frame_info() to return immediately without
calculating correct frame_size, which in turn causes "Can't analyze
schedule() prologue" warning messages at boot time.

This patch removes func_size check, and let the frame_size check run
up to 128 insns for both MIPS and microMIPS.

Signed-off-by: Jun-Ru Chang <jrjang@realtek.com>
Signed-off-by: Tony Wu <tonywu@realtek.com>
Fixes: b6c7a324df37b ("MIPS: Fix get_frame_info() handling of microMIPS function size.")
---
 arch/mips/kernel/process.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index 6829a064aac8..339870ed92f7 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -371,7 +371,7 @@ static inline int is_sp_move_ins(union mips_instruction *ip, int *frame_size)
 static int get_frame_info(struct mips_frame_info *info)
 {
 	bool is_mmips = IS_ENABLED(CONFIG_CPU_MICROMIPS);
-	union mips_instruction insn, *ip, *ip_end;
+	union mips_instruction insn, *ip;
 	const unsigned int max_insns = 128;
 	unsigned int last_insn_size = 0;
 	unsigned int i;
@@ -384,10 +384,9 @@ static int get_frame_info(struct mips_frame_info *info)
 	if (!ip)
 		goto err;
 
-	ip_end = (void *)ip + info->func_size;
-
-	for (i = 0; i < max_insns && ip < ip_end; i++) {
+	for (i = 0; i < max_insns; i++) {
 		ip = (void *)ip + last_insn_size;
+
 		if (is_mmips && mm_insn_16bit(ip->halfword[0])) {
 			insn.word = ip->halfword[0] << 16;
 			last_insn_size = 2;
-- 
2.20.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] MIPS: Remove function size check in get_frame_info()
  2019-01-29  3:56 [PATCH] MIPS: Remove function size check in get_frame_info() Jun-Ru Chang
@ 2019-02-04 23:16 ` Paul Burton
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Burton @ 2019-02-04 23:16 UTC (permalink / raw)
  To: Jun-Ru Chang
  Cc: ralf, Paul Burton, jhogan, Maciej X Rozycki, yamada.masahiro,
	peterz, mingo, linux-mips, linux-kernel, tonywu, jrjang,
	linux-mips

Hello,

Jun-Ru Chang wrote:
> Patch (b6c7a324df37b "MIPS: Fix get_frame_info() handling of
> microMIPS function size.") introduces additional function size
> check for microMIPS by only checking insn between ip and ip + func_size.
> However, func_size in get_frame_info() is always 0 if KALLSYMS is not
> enabled. This causes get_frame_info() to return immediately without
> calculating correct frame_size, which in turn causes "Can't analyze
> schedule() prologue" warning messages at boot time.
> 
> This patch removes func_size check, and let the frame_size check run
> up to 128 insns for both MIPS and microMIPS.
> 
> Signed-off-by: Jun-Ru Chang <jrjang@realtek.com>
> Signed-off-by: Tony Wu <tonywu@realtek.com>
> Fixes: b6c7a324df37b ("MIPS: Fix get_frame_info() handling of microMIPS function size.")

Applied to mips-fixes.

Thanks,
    Paul

[ This message was auto-generated; if you believe anything is incorrect
  then please email paul.burton@mips.com to report it. ]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] MIPS: Remove function size check in get_frame_info()
@ 2019-01-21  3:45 Jun-Ru Chang
  0 siblings, 0 replies; 3+ messages in thread
From: Jun-Ru Chang @ 2019-01-21  3:45 UTC (permalink / raw)
  To: ralf
  Cc: paul.burton, jhogan, macro, tonywu, mingo, peterz, jrjang,
	linux-mips, linux-kernel

Patch (b6c7a324df37b "MIPS: Fix get_frame_info() handling of
microMIPS function size.") introduces additional function size
check for microMIPS by only checking insn between ip and ip + func_size.
However, func_size in get_frame_info() is always 0 if KALLSYMS is not
enabled. This causes get_frame_info() to return immediately without
calculating correct frame_size, which in turn causes "Can't analyze
schedule() prologue" warning messages at boot time.

This patch removes func_size check, and let the frame_size check run
up to 128 insns for both MIPS and microMIPS.

Signed-off-by: Jun-Ru Chang <jrjang@realtek.com>
Signed-off-by: Tony Wu <tonywu@realtek.com>
Fixes: b6c7a324df37b ("MIPS: Fix get_frame_info() handling of microMIPS function size.")
---
 arch/mips/kernel/process.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index 6829a064aac8..339870ed92f7 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -371,7 +371,7 @@ static inline int is_sp_move_ins(union mips_instruction *ip, int *frame_size)
 static int get_frame_info(struct mips_frame_info *info)
 {
 	bool is_mmips = IS_ENABLED(CONFIG_CPU_MICROMIPS);
-	union mips_instruction insn, *ip, *ip_end;
+	union mips_instruction insn, *ip;
 	const unsigned int max_insns = 128;
 	unsigned int last_insn_size = 0;
 	unsigned int i;
@@ -384,10 +384,9 @@ static int get_frame_info(struct mips_frame_info *info)
 	if (!ip)
 		goto err;
 
-	ip_end = (void *)ip + info->func_size;
-
-	for (i = 0; i < max_insns && ip < ip_end; i++) {
+	for (i = 0; i < max_insns; i++) {
 		ip = (void *)ip + last_insn_size;
+
 		if (is_mmips && mm_insn_16bit(ip->halfword[0])) {
 			insn.word = ip->halfword[0] << 16;
 			last_insn_size = 2;
-- 
2.20.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-29  3:56 [PATCH] MIPS: Remove function size check in get_frame_info() Jun-Ru Chang
2019-02-04 23:16 ` Paul Burton
  -- strict thread matches above, loose matches on Subject: below --
2019-01-21  3:45 Jun-Ru Chang

Linux-MIPS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-mips/0 linux-mips/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-mips linux-mips/ https://lore.kernel.org/linux-mips \
		linux-mips@vger.kernel.org linux-mips@archiver.kernel.org
	public-inbox-index linux-mips


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-mips


AGPL code for this site: git clone https://public-inbox.org/ public-inbox