linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH 0/2] Remove sched_trace_*() helper functions
       [not found] <20220428144338.479094-1-qais.yousef@arm.com>
@ 2022-04-29  8:52 ` Qais Yousef
       [not found] ` <20220428144338.479094-3-qais.yousef@arm.com>
       [not found] ` <20220428144338.479094-2-qais.yousef@arm.com>
  2 siblings, 0 replies; 5+ messages in thread
From: Qais Yousef @ 2022-04-29  8:52 UTC (permalink / raw)
  To: Peter Zijlstra (Intel), Ingo Molnar
  Cc: Dietmar Eggemann, Vincent Guittot, Steven Rostedt, Phil Auld,
	Giovanni Gherdovich, linux-kernel

+CC lkml

On 04/28/22 15:43, Qais Yousef wrote:
> This is a respin of the patches Dietmar sent a while ago
> 
> 	https://lore.kernel.org/all/20200907091717.26116-1-dietmar.eggemann@arm.com/
> 
> I moved the sched_tp module to use pahole + DWARF/BTF to get the definitions
> required so that we can maintain these helpers more easily out-of-tree within
> the module.
> 
> Thanks to my colleague Douglas Raillard for helping with fixing the alignment
> issues in pahole when using BTF.
> 
> 
> Dietmar Eggemann (2):
>   sched/fair: Remove sched_trace_*() helper functions
>   sched/fair: Remove cfs_rq_tg_path()
> 
>  include/linux/sched.h |  14 -----
>  kernel/sched/fair.c   | 117 ------------------------------------------
>  2 files changed, 131 deletions(-)
> 
> -- 
> 2.25.1
> 

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

* Re: [PATCH 1/2] sched/fair: Remove sched_trace_*() helper functions
       [not found] ` <20220428144338.479094-2-qais.yousef@arm.com>
@ 2022-04-29  8:52   ` Qais Yousef
  2022-04-29 20:35   ` [tip: sched/core] " tip-bot2 for Dietmar Eggemann
  1 sibling, 0 replies; 5+ messages in thread
From: Qais Yousef @ 2022-04-29  8:52 UTC (permalink / raw)
  To: Peter Zijlstra (Intel), Ingo Molnar
  Cc: Dietmar Eggemann, Vincent Guittot, Steven Rostedt, Phil Auld,
	Giovanni Gherdovich, linux-kernel

+CC lkml

On 04/28/22 15:43, Qais Yousef wrote:
> From: Dietmar Eggemann <dietmar.eggemann@arm.com>
> 
> We no longer need them as we can use DWARF debug info or BTF + pahole to
> re-generate the required structs to compile against them for a given
> kernel.
> 
> This moves the burden of maintaining these helper functions to the
> module.
> 
> 	https://github.com/qais-yousef/sched_tp
> 
> Note that pahole v1.15 is required at least for using DWARF. And for BTF
> v1.23 which is not yet released will be required. There's alignment
> problem that will lead to crashes in earlier versions when used with
> BTF.
> 
> We should have enough infrastructure to make these helper functions now
> obsolete, so remove them.
> 
> Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
> [Rewrote commit message to reflect the new alternative]
> Signed-off-by: Qais Yousef <qais.yousef@arm.com>
> ---
>  include/linux/sched.h | 14 -------
>  kernel/sched/fair.c   | 98 -------------------------------------------
>  2 files changed, 112 deletions(-)
> 
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index 67f06f72c50e..fc74ea2578b7 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -2378,20 +2378,6 @@ static inline void rseq_syscall(struct pt_regs *regs)
>  
>  #endif
>  
> -const struct sched_avg *sched_trace_cfs_rq_avg(struct cfs_rq *cfs_rq);
> -char *sched_trace_cfs_rq_path(struct cfs_rq *cfs_rq, char *str, int len);
> -int sched_trace_cfs_rq_cpu(struct cfs_rq *cfs_rq);
> -
> -const struct sched_avg *sched_trace_rq_avg_rt(struct rq *rq);
> -const struct sched_avg *sched_trace_rq_avg_dl(struct rq *rq);
> -const struct sched_avg *sched_trace_rq_avg_irq(struct rq *rq);
> -
> -int sched_trace_rq_cpu(struct rq *rq);
> -int sched_trace_rq_cpu_capacity(struct rq *rq);
> -int sched_trace_rq_nr_running(struct rq *rq);
> -
> -const struct cpumask *sched_trace_rd_span(struct root_domain *rd);
> -
>  #ifdef CONFIG_SCHED_CORE
>  extern void sched_core_free(struct task_struct *tsk);
>  extern void sched_core_fork(struct task_struct *p);
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 4c420124b5d6..ff1177a4a286 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -11882,101 +11882,3 @@ __init void init_sched_fair_class(void)
>  #endif /* SMP */
>  
>  }
> -
> -/*
> - * Helper functions to facilitate extracting info from tracepoints.
> - */
> -
> -const struct sched_avg *sched_trace_cfs_rq_avg(struct cfs_rq *cfs_rq)
> -{
> -#ifdef CONFIG_SMP
> -	return cfs_rq ? &cfs_rq->avg : NULL;
> -#else
> -	return NULL;
> -#endif
> -}
> -EXPORT_SYMBOL_GPL(sched_trace_cfs_rq_avg);
> -
> -char *sched_trace_cfs_rq_path(struct cfs_rq *cfs_rq, char *str, int len)
> -{
> -	if (!cfs_rq) {
> -		if (str)
> -			strlcpy(str, "(null)", len);
> -		else
> -			return NULL;
> -	}
> -
> -	cfs_rq_tg_path(cfs_rq, str, len);
> -	return str;
> -}
> -EXPORT_SYMBOL_GPL(sched_trace_cfs_rq_path);
> -
> -int sched_trace_cfs_rq_cpu(struct cfs_rq *cfs_rq)
> -{
> -	return cfs_rq ? cpu_of(rq_of(cfs_rq)) : -1;
> -}
> -EXPORT_SYMBOL_GPL(sched_trace_cfs_rq_cpu);
> -
> -const struct sched_avg *sched_trace_rq_avg_rt(struct rq *rq)
> -{
> -#ifdef CONFIG_SMP
> -	return rq ? &rq->avg_rt : NULL;
> -#else
> -	return NULL;
> -#endif
> -}
> -EXPORT_SYMBOL_GPL(sched_trace_rq_avg_rt);
> -
> -const struct sched_avg *sched_trace_rq_avg_dl(struct rq *rq)
> -{
> -#ifdef CONFIG_SMP
> -	return rq ? &rq->avg_dl : NULL;
> -#else
> -	return NULL;
> -#endif
> -}
> -EXPORT_SYMBOL_GPL(sched_trace_rq_avg_dl);
> -
> -const struct sched_avg *sched_trace_rq_avg_irq(struct rq *rq)
> -{
> -#if defined(CONFIG_SMP) && defined(CONFIG_HAVE_SCHED_AVG_IRQ)
> -	return rq ? &rq->avg_irq : NULL;
> -#else
> -	return NULL;
> -#endif
> -}
> -EXPORT_SYMBOL_GPL(sched_trace_rq_avg_irq);
> -
> -int sched_trace_rq_cpu(struct rq *rq)
> -{
> -	return rq ? cpu_of(rq) : -1;
> -}
> -EXPORT_SYMBOL_GPL(sched_trace_rq_cpu);
> -
> -int sched_trace_rq_cpu_capacity(struct rq *rq)
> -{
> -	return rq ?
> -#ifdef CONFIG_SMP
> -		rq->cpu_capacity
> -#else
> -		SCHED_CAPACITY_SCALE
> -#endif
> -		: -1;
> -}
> -EXPORT_SYMBOL_GPL(sched_trace_rq_cpu_capacity);
> -
> -const struct cpumask *sched_trace_rd_span(struct root_domain *rd)
> -{
> -#ifdef CONFIG_SMP
> -	return rd ? rd->span : NULL;
> -#else
> -	return NULL;
> -#endif
> -}
> -EXPORT_SYMBOL_GPL(sched_trace_rd_span);
> -
> -int sched_trace_rq_nr_running(struct rq *rq)
> -{
> -        return rq ? rq->nr_running : -1;
> -}
> -EXPORT_SYMBOL_GPL(sched_trace_rq_nr_running);
> -- 
> 2.25.1
> 

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

* Re: [PATCH 2/2] sched/fair: Remove cfs_rq_tg_path()
       [not found] ` <20220428144338.479094-3-qais.yousef@arm.com>
@ 2022-04-29  8:53   ` Qais Yousef
  2022-04-29 20:35   ` [tip: sched/core] " tip-bot2 for Dietmar Eggemann
  1 sibling, 0 replies; 5+ messages in thread
From: Qais Yousef @ 2022-04-29  8:53 UTC (permalink / raw)
  To: Peter Zijlstra (Intel), Ingo Molnar
  Cc: Dietmar Eggemann, Vincent Guittot, Steven Rostedt, Phil Auld,
	Giovanni Gherdovich, linux-kernel

+CC lkml

On 04/28/22 15:43, Qais Yousef wrote:
> From: Dietmar Eggemann <dietmar.eggemann@arm.com>
> 
> cfs_rq_tg_path() is used by a tracepoint-to traceevent (tp-2-te)
> converter to format the path of a taskgroup or autogroup respectively.
> It doesn't have any in-kernel users after the removal of the
> sched_trace_cfs_rq_path() helper function.
> 
> cfs_rq_tg_path() can be coded in a tp-2-te converter.
> 
> Remove it from kernel/sched/fair.c.
> 
> Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
> Signed-off-by: Qais Yousef <qais.yousef@arm.com>
> ---
>  kernel/sched/fair.c | 19 -------------------
>  1 file changed, 19 deletions(-)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index ff1177a4a286..7487737c1275 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -313,19 +313,6 @@ const struct sched_class fair_sched_class;
>  #define for_each_sched_entity(se) \
>  		for (; se; se = se->parent)
>  
> -static inline void cfs_rq_tg_path(struct cfs_rq *cfs_rq, char *path, int len)
> -{
> -	if (!path)
> -		return;
> -
> -	if (cfs_rq && task_group_is_autogroup(cfs_rq->tg))
> -		autogroup_path(cfs_rq->tg, path, len);
> -	else if (cfs_rq && cfs_rq->tg->css.cgroup)
> -		cgroup_path(cfs_rq->tg->css.cgroup, path, len);
> -	else
> -		strlcpy(path, "(null)", len);
> -}
> -
>  static inline bool list_add_leaf_cfs_rq(struct cfs_rq *cfs_rq)
>  {
>  	struct rq *rq = rq_of(cfs_rq);
> @@ -493,12 +480,6 @@ static int se_is_idle(struct sched_entity *se)
>  #define for_each_sched_entity(se) \
>  		for (; se; se = NULL)
>  
> -static inline void cfs_rq_tg_path(struct cfs_rq *cfs_rq, char *path, int len)
> -{
> -	if (path)
> -		strlcpy(path, "(null)", len);
> -}
> -
>  static inline bool list_add_leaf_cfs_rq(struct cfs_rq *cfs_rq)
>  {
>  	return true;
> -- 
> 2.25.1
> 

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

* [tip: sched/core] sched/fair: Remove cfs_rq_tg_path()
       [not found] ` <20220428144338.479094-3-qais.yousef@arm.com>
  2022-04-29  8:53   ` [PATCH 2/2] sched/fair: Remove cfs_rq_tg_path() Qais Yousef
@ 2022-04-29 20:35   ` tip-bot2 for Dietmar Eggemann
  1 sibling, 0 replies; 5+ messages in thread
From: tip-bot2 for Dietmar Eggemann @ 2022-04-29 20:35 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Dietmar Eggemann, Qais Yousef, Peter Zijlstra (Intel), x86, linux-kernel

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     97956dd278d3af1b5657026b992b54cf2e1b50b9
Gitweb:        https://git.kernel.org/tip/97956dd278d3af1b5657026b992b54cf2e1b50b9
Author:        Dietmar Eggemann <dietmar.eggemann@arm.com>
AuthorDate:    Thu, 28 Apr 2022 15:43:38 +01:00
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Fri, 29 Apr 2022 11:06:29 +02:00

sched/fair: Remove cfs_rq_tg_path()

cfs_rq_tg_path() is used by a tracepoint-to traceevent (tp-2-te)
converter to format the path of a taskgroup or autogroup respectively.
It doesn't have any in-kernel users after the removal of the
sched_trace_cfs_rq_path() helper function.

cfs_rq_tg_path() can be coded in a tp-2-te converter.

Remove it from kernel/sched/fair.c.

Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Signed-off-by: Qais Yousef <qais.yousef@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20220428144338.479094-3-qais.yousef@arm.com
---
 kernel/sched/fair.c | 19 -------------------
 1 file changed, 19 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 19803e1..6ca054b 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -313,19 +313,6 @@ const struct sched_class fair_sched_class;
 #define for_each_sched_entity(se) \
 		for (; se; se = se->parent)
 
-static inline void cfs_rq_tg_path(struct cfs_rq *cfs_rq, char *path, int len)
-{
-	if (!path)
-		return;
-
-	if (cfs_rq && task_group_is_autogroup(cfs_rq->tg))
-		autogroup_path(cfs_rq->tg, path, len);
-	else if (cfs_rq && cfs_rq->tg->css.cgroup)
-		cgroup_path(cfs_rq->tg->css.cgroup, path, len);
-	else
-		strlcpy(path, "(null)", len);
-}
-
 static inline bool list_add_leaf_cfs_rq(struct cfs_rq *cfs_rq)
 {
 	struct rq *rq = rq_of(cfs_rq);
@@ -493,12 +480,6 @@ static int se_is_idle(struct sched_entity *se)
 #define for_each_sched_entity(se) \
 		for (; se; se = NULL)
 
-static inline void cfs_rq_tg_path(struct cfs_rq *cfs_rq, char *path, int len)
-{
-	if (path)
-		strlcpy(path, "(null)", len);
-}
-
 static inline bool list_add_leaf_cfs_rq(struct cfs_rq *cfs_rq)
 {
 	return true;

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

* [tip: sched/core] sched/fair: Remove sched_trace_*() helper functions
       [not found] ` <20220428144338.479094-2-qais.yousef@arm.com>
  2022-04-29  8:52   ` [PATCH 1/2] sched/fair: Remove sched_trace_*() helper functions Qais Yousef
@ 2022-04-29 20:35   ` tip-bot2 for Dietmar Eggemann
  1 sibling, 0 replies; 5+ messages in thread
From: tip-bot2 for Dietmar Eggemann @ 2022-04-29 20:35 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Dietmar Eggemann, Qais Yousef, Peter Zijlstra (Intel), x86, linux-kernel

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     50e7b416d2ab10b9771bd00a4d85df90ad2e4b37
Gitweb:        https://git.kernel.org/tip/50e7b416d2ab10b9771bd00a4d85df90ad2e4b37
Author:        Dietmar Eggemann <dietmar.eggemann@arm.com>
AuthorDate:    Thu, 28 Apr 2022 15:43:37 +01:00
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Fri, 29 Apr 2022 11:06:29 +02:00

sched/fair: Remove sched_trace_*() helper functions

We no longer need them as we can use DWARF debug info or BTF + pahole to
re-generate the required structs to compile against them for a given
kernel.

This moves the burden of maintaining these helper functions to the
module.

	https://github.com/qais-yousef/sched_tp

Note that pahole v1.15 is required at least for using DWARF. And for BTF
v1.23 which is not yet released will be required. There's alignment
problem that will lead to crashes in earlier versions when used with
BTF.

We should have enough infrastructure to make these helper functions now
obsolete, so remove them.

[Rewrote commit message to reflect the new alternative]
Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Signed-off-by: Qais Yousef <qais.yousef@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20220428144338.479094-2-qais.yousef@arm.com
---
 include/linux/sched.h | 14 +------
 kernel/sched/fair.c   | 98 +------------------------------------------
 2 files changed, 112 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 67f06f7..fc74ea2 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2378,20 +2378,6 @@ static inline void rseq_syscall(struct pt_regs *regs)
 
 #endif
 
-const struct sched_avg *sched_trace_cfs_rq_avg(struct cfs_rq *cfs_rq);
-char *sched_trace_cfs_rq_path(struct cfs_rq *cfs_rq, char *str, int len);
-int sched_trace_cfs_rq_cpu(struct cfs_rq *cfs_rq);
-
-const struct sched_avg *sched_trace_rq_avg_rt(struct rq *rq);
-const struct sched_avg *sched_trace_rq_avg_dl(struct rq *rq);
-const struct sched_avg *sched_trace_rq_avg_irq(struct rq *rq);
-
-int sched_trace_rq_cpu(struct rq *rq);
-int sched_trace_rq_cpu_capacity(struct rq *rq);
-int sched_trace_rq_nr_running(struct rq *rq);
-
-const struct cpumask *sched_trace_rd_span(struct root_domain *rd);
-
 #ifdef CONFIG_SCHED_CORE
 extern void sched_core_free(struct task_struct *tsk);
 extern void sched_core_fork(struct task_struct *p);
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 7d38728..19803e1 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -11839,101 +11839,3 @@ __init void init_sched_fair_class(void)
 #endif /* SMP */
 
 }
-
-/*
- * Helper functions to facilitate extracting info from tracepoints.
- */
-
-const struct sched_avg *sched_trace_cfs_rq_avg(struct cfs_rq *cfs_rq)
-{
-#ifdef CONFIG_SMP
-	return cfs_rq ? &cfs_rq->avg : NULL;
-#else
-	return NULL;
-#endif
-}
-EXPORT_SYMBOL_GPL(sched_trace_cfs_rq_avg);
-
-char *sched_trace_cfs_rq_path(struct cfs_rq *cfs_rq, char *str, int len)
-{
-	if (!cfs_rq) {
-		if (str)
-			strlcpy(str, "(null)", len);
-		else
-			return NULL;
-	}
-
-	cfs_rq_tg_path(cfs_rq, str, len);
-	return str;
-}
-EXPORT_SYMBOL_GPL(sched_trace_cfs_rq_path);
-
-int sched_trace_cfs_rq_cpu(struct cfs_rq *cfs_rq)
-{
-	return cfs_rq ? cpu_of(rq_of(cfs_rq)) : -1;
-}
-EXPORT_SYMBOL_GPL(sched_trace_cfs_rq_cpu);
-
-const struct sched_avg *sched_trace_rq_avg_rt(struct rq *rq)
-{
-#ifdef CONFIG_SMP
-	return rq ? &rq->avg_rt : NULL;
-#else
-	return NULL;
-#endif
-}
-EXPORT_SYMBOL_GPL(sched_trace_rq_avg_rt);
-
-const struct sched_avg *sched_trace_rq_avg_dl(struct rq *rq)
-{
-#ifdef CONFIG_SMP
-	return rq ? &rq->avg_dl : NULL;
-#else
-	return NULL;
-#endif
-}
-EXPORT_SYMBOL_GPL(sched_trace_rq_avg_dl);
-
-const struct sched_avg *sched_trace_rq_avg_irq(struct rq *rq)
-{
-#if defined(CONFIG_SMP) && defined(CONFIG_HAVE_SCHED_AVG_IRQ)
-	return rq ? &rq->avg_irq : NULL;
-#else
-	return NULL;
-#endif
-}
-EXPORT_SYMBOL_GPL(sched_trace_rq_avg_irq);
-
-int sched_trace_rq_cpu(struct rq *rq)
-{
-	return rq ? cpu_of(rq) : -1;
-}
-EXPORT_SYMBOL_GPL(sched_trace_rq_cpu);
-
-int sched_trace_rq_cpu_capacity(struct rq *rq)
-{
-	return rq ?
-#ifdef CONFIG_SMP
-		rq->cpu_capacity
-#else
-		SCHED_CAPACITY_SCALE
-#endif
-		: -1;
-}
-EXPORT_SYMBOL_GPL(sched_trace_rq_cpu_capacity);
-
-const struct cpumask *sched_trace_rd_span(struct root_domain *rd)
-{
-#ifdef CONFIG_SMP
-	return rd ? rd->span : NULL;
-#else
-	return NULL;
-#endif
-}
-EXPORT_SYMBOL_GPL(sched_trace_rd_span);
-
-int sched_trace_rq_nr_running(struct rq *rq)
-{
-        return rq ? rq->nr_running : -1;
-}
-EXPORT_SYMBOL_GPL(sched_trace_rq_nr_running);

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

end of thread, other threads:[~2022-04-29 20:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20220428144338.479094-1-qais.yousef@arm.com>
2022-04-29  8:52 ` [PATCH 0/2] Remove sched_trace_*() helper functions Qais Yousef
     [not found] ` <20220428144338.479094-3-qais.yousef@arm.com>
2022-04-29  8:53   ` [PATCH 2/2] sched/fair: Remove cfs_rq_tg_path() Qais Yousef
2022-04-29 20:35   ` [tip: sched/core] " tip-bot2 for Dietmar Eggemann
     [not found] ` <20220428144338.479094-2-qais.yousef@arm.com>
2022-04-29  8:52   ` [PATCH 1/2] sched/fair: Remove sched_trace_*() helper functions Qais Yousef
2022-04-29 20:35   ` [tip: sched/core] " tip-bot2 for Dietmar Eggemann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).