[PATCH RESEND] kdb: Get rid of redundant kdb_curr_task()

Zheng Zengkai posted 1 patch 1 year, 5 months ago
kernel/debug/kdb/kdb_bt.c      |  2 +-
kernel/debug/kdb/kdb_main.c    | 18 ++++--------------
kernel/debug/kdb/kdb_private.h |  2 --
3 files changed, 5 insertions(+), 17 deletions(-)
[PATCH RESEND] kdb: Get rid of redundant kdb_curr_task()
Posted by Zheng Zengkai 1 year, 5 months ago
Commit cf8e8658100d ("arch: Remove Itanium (IA-64) architecture")
removed the only definition of macro _TIF_MCA_INIT, so kdb_curr_task()
is actually the same as curr_task() now and becomes redundant.

Let's remove the definition of kdb_curr_task() and replace remaining
calls with curr_task().

Signed-off-by: Zheng Zengkai <zhengzengkai@huawei.com>
---
 kernel/debug/kdb/kdb_bt.c      |  2 +-
 kernel/debug/kdb/kdb_main.c    | 18 ++++--------------
 kernel/debug/kdb/kdb_private.h |  2 --
 3 files changed, 5 insertions(+), 17 deletions(-)

diff --git a/kernel/debug/kdb/kdb_bt.c b/kernel/debug/kdb/kdb_bt.c
index 10b454554ab0..137ba73f56fc 100644
--- a/kernel/debug/kdb/kdb_bt.c
+++ b/kernel/debug/kdb/kdb_bt.c
@@ -144,7 +144,7 @@ kdb_bt(int argc, const char **argv)
 			kdb_ps_suppressed();
 		/* Run the active tasks first */
 		for_each_online_cpu(cpu) {
-			p = kdb_curr_task(cpu);
+			p = curr_task(cpu);
 			if (kdb_bt1(p, mask, btaprompt))
 				return 0;
 		}
diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c
index 664bae55f2c9..f5f7d7fb5936 100644
--- a/kernel/debug/kdb/kdb_main.c
+++ b/kernel/debug/kdb/kdb_main.c
@@ -155,16 +155,6 @@ static char *__env[31] = {
 
 static const int __nenv = ARRAY_SIZE(__env);
 
-struct task_struct *kdb_curr_task(int cpu)
-{
-	struct task_struct *p = curr_task(cpu);
-#ifdef	_TIF_MCA_INIT
-	if ((task_thread_info(p)->flags & _TIF_MCA_INIT) && KDB_TSK(cpu))
-		p = krp->p;
-#endif
-	return p;
-}
-
 /*
  * Update the permissions flags (kdb_cmd_enabled) to match the
  * current lockdown state.
@@ -1228,7 +1218,7 @@ static int kdb_local(kdb_reason_t reason, int error, struct pt_regs *regs,
 	char *cmdbuf;
 	int diag;
 	struct task_struct *kdb_current =
-		kdb_curr_task(raw_smp_processor_id());
+		curr_task(raw_smp_processor_id());
 
 	KDB_DEBUG_STATE("kdb_local 1", reason);
 
@@ -2278,7 +2268,7 @@ void kdb_ps_suppressed(void)
 	unsigned long cpu;
 	const struct task_struct *p, *g;
 	for_each_online_cpu(cpu) {
-		p = kdb_curr_task(cpu);
+		p = curr_task(cpu);
 		if (kdb_task_state(p, "-"))
 			++idle;
 	}
@@ -2314,7 +2304,7 @@ void kdb_ps1(const struct task_struct *p)
 		   kdb_task_has_cpu(p), kdb_process_cpu(p),
 		   kdb_task_state_char(p),
 		   (void *)(&p->thread),
-		   p == kdb_curr_task(raw_smp_processor_id()) ? '*' : ' ',
+		   p == curr_task(raw_smp_processor_id()) ? '*' : ' ',
 		   p->comm);
 	if (kdb_task_has_cpu(p)) {
 		if (!KDB_TSK(cpu)) {
@@ -2350,7 +2340,7 @@ static int kdb_ps(int argc, const char **argv)
 	for_each_online_cpu(cpu) {
 		if (KDB_FLAG(CMD_INTERRUPT))
 			return 0;
-		p = kdb_curr_task(cpu);
+		p = curr_task(cpu);
 		if (kdb_task_state(p, mask))
 			kdb_ps1(p);
 	}
diff --git a/kernel/debug/kdb/kdb_private.h b/kernel/debug/kdb/kdb_private.h
index 548fd4059bf9..d2520d72b1f5 100644
--- a/kernel/debug/kdb/kdb_private.h
+++ b/kernel/debug/kdb/kdb_private.h
@@ -210,8 +210,6 @@ extern void kdb_gdb_state_pass(char *buf);
 #define KDB_TSK(cpu) kgdb_info[cpu].task
 #define KDB_TSKREGS(cpu) kgdb_info[cpu].debuggerinfo
 
-extern struct task_struct *kdb_curr_task(int);
-
 #define kdb_task_has_cpu(p) (task_curr(p))
 
 #define GFP_KDB (in_dbg_master() ? GFP_ATOMIC : GFP_KERNEL)
-- 
2.20.1
Re: [PATCH RESEND] kdb: Get rid of redundant kdb_curr_task()
Posted by Daniel Thompson 1 year, 5 months ago
On Thu, 20 Jun 2024 22:21:32 +0800, Zheng Zengkai wrote:
> Commit cf8e8658100d ("arch: Remove Itanium (IA-64) architecture")
> removed the only definition of macro _TIF_MCA_INIT, so kdb_curr_task()
> is actually the same as curr_task() now and becomes redundant.
> 
> Let's remove the definition of kdb_curr_task() and replace remaining
> calls with curr_task().
> 
> [...]

Applied, thanks!

[1/1] kdb: Get rid of redundant kdb_curr_task()
      commit: 9bccbe7b20876a34c70b13430ea1b308fc8d5a7e

Best regards,
-- 
Daniel Thompson <daniel.thompson@linaro.org>
Re: [PATCH RESEND] kdb: Get rid of redundant kdb_curr_task()
Posted by Doug Anderson 1 year, 5 months ago
Hi,

On Thu, Jun 20, 2024 at 6:58 AM Zheng Zengkai <zhengzengkai@huawei.com> wrote:
>
> Commit cf8e8658100d ("arch: Remove Itanium (IA-64) architecture")
> removed the only definition of macro _TIF_MCA_INIT, so kdb_curr_task()
> is actually the same as curr_task() now and becomes redundant.
>
> Let's remove the definition of kdb_curr_task() and replace remaining
> calls with curr_task().
>
> Signed-off-by: Zheng Zengkai <zhengzengkai@huawei.com>
> ---
>  kernel/debug/kdb/kdb_bt.c      |  2 +-
>  kernel/debug/kdb/kdb_main.c    | 18 ++++--------------
>  kernel/debug/kdb/kdb_private.h |  2 --
>  3 files changed, 5 insertions(+), 17 deletions(-)

In case Daniel picks this one up since it CCs LKML, I'll copy my tag
from the one that didn't:

Reviewed-by: Douglas Anderson <dianders@chromium.org>
Re: [PATCH RESEND] kdb: Get rid of redundant kdb_curr_task()
Posted by Daniel Thompson 1 year, 5 months ago
On Fri, Jun 21, 2024 at 07:36:49AM -0700, Doug Anderson wrote:
> Hi,
>
> On Thu, Jun 20, 2024 at 6:58 AM Zheng Zengkai <zhengzengkai@huawei.com> wrote:
> >
> > Commit cf8e8658100d ("arch: Remove Itanium (IA-64) architecture")
> > removed the only definition of macro _TIF_MCA_INIT, so kdb_curr_task()
> > is actually the same as curr_task() now and becomes redundant.
> >
> > Let's remove the definition of kdb_curr_task() and replace remaining
> > calls with curr_task().
> >
> > Signed-off-by: Zheng Zengkai <zhengzengkai@huawei.com>
> > ---
> >  kernel/debug/kdb/kdb_bt.c      |  2 +-
> >  kernel/debug/kdb/kdb_main.c    | 18 ++++--------------
> >  kernel/debug/kdb/kdb_private.h |  2 --
> >  3 files changed, 5 insertions(+), 17 deletions(-)
>
> In case Daniel picks this one up since it CCs LKML, I'll copy my tag
> from the one that didn't:
>
> Reviewed-by: Douglas Anderson <dianders@chromium.org>

Thanks Doug. I was literally getting to it now!


Daniel.