[PATCH 3.16 099/202] MIPS: Remove function size check in get_frame_info()

From: Ben Hutchings
Date: Sat Apr 27 2019 - 11:15:49 EST


3.16.66-rc1 review patch. If anyone has any objections, please let me know.

------------------

From: Jun-Ru Chang <jrjang@xxxxxxxxxxx>

commit 2b424cfc69728224fcb5fad138ea7260728e0901 upstream.

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@xxxxxxxxxxx>
Signed-off-by: Tony Wu <tonywu@xxxxxxxxxxx>
Signed-off-by: Paul Burton <paul.burton@xxxxxxxx>
Fixes: b6c7a324df37b ("MIPS: Fix get_frame_info() handling of microMIPS function size.")
Cc: <ralf@xxxxxxxxxxxxxx>
Cc: <jhogan@xxxxxxxxxx>
Cc: <macro@xxxxxxxx>
Cc: <yamada.masahiro@xxxxxxxxxxxxx>
Cc: <peterz@xxxxxxxxxxxxx>
Cc: <mingo@xxxxxxxxxx>
Cc: <linux-mips@xxxxxxxxxxxxxxx>
Cc: <linux-kernel@xxxxxxxxxxxxxxx>
Signed-off-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx>
---
arch/mips/kernel/process.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -373,7 +373,7 @@ static inline int is_sp_move_ins(union m
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;
@@ -385,10 +385,9 @@ static int get_frame_info(struct mips_fr
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;