linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sched/preempt: Tell about PREEMPT_DYNAMIC on kernel headers
@ 2022-02-02 14:59 Frederic Weisbecker
  2022-02-02 18:24 ` Valentin Schneider
  0 siblings, 1 reply; 5+ messages in thread
From: Frederic Weisbecker @ 2022-02-02 14:59 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: LKML, Frederic Weisbecker, Valentin Schneider

Displaying "PREEMPT" on kernel headers when CONFIG_PREEMPT_DYNAMIC=y
can be misleading for anybody involved in remote debugging because it
is then not guaranteed that there is an actual preemption behaviour. It
depends on default Kconfig or boot defined choices.

Therefore, tell about PREEMPT_DYNAMIC on static kernel headers and leave
the search for the actual preemption behaviour to browsing dmesg.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Cc: Valentin Schneider <valentin.schneider@arm.com>
---
 init/Makefile       |  3 ++-
 scripts/mkcompile_h | 15 +++++++++++----
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/init/Makefile b/init/Makefile
index 06326e304384..d82623d7fc8e 100644
--- a/init/Makefile
+++ b/init/Makefile
@@ -31,7 +31,8 @@ quiet_cmd_compile.h = CHK     $@
       cmd_compile.h = \
 	$(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@	\
 	"$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CONFIG_PREEMPT_BUILD)"	\
-	"$(CONFIG_PREEMPT_RT)" "$(CONFIG_CC_VERSION_TEXT)" "$(LD)"
+	"$(CONFIG_PREEMPT_DYNAMIC)" "$(CONFIG_PREEMPT_RT)" \
+	"$(CONFIG_CC_VERSION_TEXT)" "$(LD)"
 
 include/generated/compile.h: FORCE
 	$(call cmd,compile.h)
diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h
index 6a2a04d92f42..f4d6ca3c6fd7 100755
--- a/scripts/mkcompile_h
+++ b/scripts/mkcompile_h
@@ -5,9 +5,10 @@ TARGET=$1
 ARCH=$2
 SMP=$3
 PREEMPT=$4
-PREEMPT_RT=$5
-CC_VERSION="$6"
-LD=$7
+PREEMPT_DYNAMIC=$5
+PREEMPT_RT=$6
+CC_VERSION="$7"
+LD=$8
 
 # Do not expand names
 set -f
@@ -41,7 +42,13 @@ fi
 UTS_VERSION="#$VERSION"
 CONFIG_FLAGS=""
 if [ -n "$SMP" ] ; then CONFIG_FLAGS="SMP"; fi
-if [ -n "$PREEMPT" ] ; then CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT"; fi
+if [ -n "$PREEMPT" ] ; then
+	if [ -n "$PREEMPT_DYNAMIC" ] ; then
+		CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT_DYNAMIC";
+	else
+		CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT";
+	fi
+fi
 if [ -n "$PREEMPT_RT" ] ; then CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT_RT"; fi
 
 # Truncate to maximum length
-- 
2.25.1


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

* Re: [PATCH] sched/preempt: Tell about PREEMPT_DYNAMIC on kernel headers
  2022-02-02 14:59 [PATCH] sched/preempt: Tell about PREEMPT_DYNAMIC on kernel headers Frederic Weisbecker
@ 2022-02-02 18:24 ` Valentin Schneider
  2022-02-17 11:12   ` [PATCH v2] " Frederic Weisbecker
  0 siblings, 1 reply; 5+ messages in thread
From: Valentin Schneider @ 2022-02-02 18:24 UTC (permalink / raw)
  To: Frederic Weisbecker, Peter Zijlstra; +Cc: LKML, Frederic Weisbecker

On 02/02/22 15:59, Frederic Weisbecker wrote:
> Displaying "PREEMPT" on kernel headers when CONFIG_PREEMPT_DYNAMIC=y
> can be misleading for anybody involved in remote debugging because it
> is then not guaranteed that there is an actual preemption behaviour. It
> depends on default Kconfig or boot defined choices.
>
> Therefore, tell about PREEMPT_DYNAMIC on static kernel headers and leave
> the search for the actual preemption behaviour to browsing dmesg.
>

Looks sensible. One small further cleanup nit below, otherwise:

Reviewed-by: Valentin Schneider <valentin.schneider@arm.com>

> Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
> Cc: Valentin Schneider <valentin.schneider@arm.com>
> ---
>  init/Makefile       |  3 ++-
>  scripts/mkcompile_h | 15 +++++++++++----
>  2 files changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/init/Makefile b/init/Makefile
> index 06326e304384..d82623d7fc8e 100644
> --- a/init/Makefile
> +++ b/init/Makefile
> @@ -31,7 +31,8 @@ quiet_cmd_compile.h = CHK     $@
>        cmd_compile.h = \
>       $(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@	\
>       "$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CONFIG_PREEMPT_BUILD)"	\
> -	"$(CONFIG_PREEMPT_RT)" "$(CONFIG_CC_VERSION_TEXT)" "$(LD)"
> +	"$(CONFIG_PREEMPT_DYNAMIC)" "$(CONFIG_PREEMPT_RT)" \
> +	"$(CONFIG_CC_VERSION_TEXT)" "$(LD)"
>
>  include/generated/compile.h: FORCE
>       $(call cmd,compile.h)
> diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h
> index 6a2a04d92f42..f4d6ca3c6fd7 100755
> --- a/scripts/mkcompile_h
> +++ b/scripts/mkcompile_h
> @@ -5,9 +5,10 @@ TARGET=$1
>  ARCH=$2
>  SMP=$3
>  PREEMPT=$4
> -PREEMPT_RT=$5
> -CC_VERSION="$6"
> -LD=$7
> +PREEMPT_DYNAMIC=$5
> +PREEMPT_RT=$6
> +CC_VERSION="$7"
> +LD=$8
>
>  # Do not expand names
>  set -f
> @@ -41,7 +42,13 @@ fi
>  UTS_VERSION="#$VERSION"
>  CONFIG_FLAGS=""
>  if [ -n "$SMP" ] ; then CONFIG_FLAGS="SMP"; fi
> -if [ -n "$PREEMPT" ] ; then CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT"; fi
> +if [ -n "$PREEMPT" ] ; then
> +	if [ -n "$PREEMPT_DYNAMIC" ] ; then
> +		CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT_DYNAMIC";
> +	else
> +		CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT";
> +	fi
> +fi
>  if [ -n "$PREEMPT_RT" ] ; then CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT_RT"; fi
>

I got suspicious of that PREEMPT_RT line, but it works because
PREEMPT_BUILD and PREEMPT_RT are mutually exclusive. Nevertheless, could we
clear out the ambiguity and make that into:

if   [ -n "$PREEMPT_RT" ] ;      then CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT_RT";
elif [ -n "$PREEMPT_DYNAMIC" ] ; then CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT_DYNAMIC";
elif [ -n "$PREEMPT" ] ;         then CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT";
fi


>  # Truncate to maximum length
> --
> 2.25.1

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

* [PATCH v2] sched/preempt: Tell about PREEMPT_DYNAMIC on kernel headers
  2022-02-02 18:24 ` Valentin Schneider
@ 2022-02-17 11:12   ` Frederic Weisbecker
  2022-03-10  8:53     ` Peter Zijlstra
  2022-03-11 14:40     ` [tip: sched/core] " tip-bot2 for Frederic Weisbecker
  0 siblings, 2 replies; 5+ messages in thread
From: Frederic Weisbecker @ 2022-02-17 11:12 UTC (permalink / raw)
  To: Valentin Schneider; +Cc: Peter Zijlstra, LKML

On Wed, Feb 02, 2022 at 06:24:09PM +0000, Valentin Schneider wrote:
> On 02/02/22 15:59, Frederic Weisbecker wrote:
> > Displaying "PREEMPT" on kernel headers when CONFIG_PREEMPT_DYNAMIC=y
> > can be misleading for anybody involved in remote debugging because it
> > is then not guaranteed that there is an actual preemption behaviour. It
> > depends on default Kconfig or boot defined choices.
> >
> > Therefore, tell about PREEMPT_DYNAMIC on static kernel headers and leave
> > the search for the actual preemption behaviour to browsing dmesg.
> >
> 
> Looks sensible. One small further cleanup nit below, otherwise:
> 
> Reviewed-by: Valentin Schneider <valentin.schneider@arm.com>
[...]
> 
> I got suspicious of that PREEMPT_RT line, but it works because
> PREEMPT_BUILD and PREEMPT_RT are mutually exclusive. Nevertheless, could we
> clear out the ambiguity and make that into:
> 
> if   [ -n "$PREEMPT_RT" ] ;      then CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT_RT";
> elif [ -n "$PREEMPT_DYNAMIC" ] ; then CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT_DYNAMIC";
> elif [ -n "$PREEMPT" ] ;         then CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT";
> fi

Good point!

Here you go:

---
From: Frederic Weisbecker <frederic@kernel.org>
Date: Wed, 2 Feb 2022 15:59:54 +0100
Subject: [PATCH] sched/preempt: Tell about PREEMPT_DYNAMIC on kernel headers

Displaying "PREEMPT" on kernel headers when CONFIG_PREEMPT_DYNAMIC=y
can be misleading for anybody involved in remote debugging because it
is then not guaranteed that there is an actual preemption behaviour. It
depends on default Kconfig or boot defined choices.

Therefore, tell about PREEMPT_DYNAMIC on static kernel headers and leave
the search for the actual preemption behaviour to browsing dmesg.

Reviewed-by: Valentin Schneider <valentin.schneider@arm.com>
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
---
 init/Makefile       |  3 ++-
 scripts/mkcompile_h | 17 ++++++++++++-----
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/init/Makefile b/init/Makefile
index 06326e304384..d82623d7fc8e 100644
--- a/init/Makefile
+++ b/init/Makefile
@@ -31,7 +31,8 @@ quiet_cmd_compile.h = CHK     $@
       cmd_compile.h = \
 	$(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@	\
 	"$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CONFIG_PREEMPT_BUILD)"	\
-	"$(CONFIG_PREEMPT_RT)" "$(CONFIG_CC_VERSION_TEXT)" "$(LD)"
+	"$(CONFIG_PREEMPT_DYNAMIC)" "$(CONFIG_PREEMPT_RT)" \
+	"$(CONFIG_CC_VERSION_TEXT)" "$(LD)"
 
 include/generated/compile.h: FORCE
 	$(call cmd,compile.h)
diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h
index 6a2a04d92f42..ca40a5258c87 100755
--- a/scripts/mkcompile_h
+++ b/scripts/mkcompile_h
@@ -5,9 +5,10 @@ TARGET=$1
 ARCH=$2
 SMP=$3
 PREEMPT=$4
-PREEMPT_RT=$5
-CC_VERSION="$6"
-LD=$7
+PREEMPT_DYNAMIC=$5
+PREEMPT_RT=$6
+CC_VERSION="$7"
+LD=$8
 
 # Do not expand names
 set -f
@@ -41,8 +42,14 @@ fi
 UTS_VERSION="#$VERSION"
 CONFIG_FLAGS=""
 if [ -n "$SMP" ] ; then CONFIG_FLAGS="SMP"; fi
-if [ -n "$PREEMPT" ] ; then CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT"; fi
-if [ -n "$PREEMPT_RT" ] ; then CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT_RT"; fi
+
+if [ -n "$PREEMPT_RT" ] ; then
+	CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT_RT"
+elif [ -n "$PREEMPT_DYNAMIC" ] ; then
+	CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT_DYNAMIC"
+elif [ -n "$PREEMPT" ] ; then
+	CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT"
+fi
 
 # Truncate to maximum length
 UTS_LEN=64
-- 
2.25.1


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

* Re: [PATCH v2] sched/preempt: Tell about PREEMPT_DYNAMIC on kernel headers
  2022-02-17 11:12   ` [PATCH v2] " Frederic Weisbecker
@ 2022-03-10  8:53     ` Peter Zijlstra
  2022-03-11 14:40     ` [tip: sched/core] " tip-bot2 for Frederic Weisbecker
  1 sibling, 0 replies; 5+ messages in thread
From: Peter Zijlstra @ 2022-03-10  8:53 UTC (permalink / raw)
  To: Frederic Weisbecker; +Cc: Valentin Schneider, LKML

On Thu, Feb 17, 2022 at 12:12:40PM +0100, Frederic Weisbecker wrote:

> From: Frederic Weisbecker <frederic@kernel.org>
> Date: Wed, 2 Feb 2022 15:59:54 +0100
> Subject: [PATCH] sched/preempt: Tell about PREEMPT_DYNAMIC on kernel headers
> 
> Displaying "PREEMPT" on kernel headers when CONFIG_PREEMPT_DYNAMIC=y
> can be misleading for anybody involved in remote debugging because it
> is then not guaranteed that there is an actual preemption behaviour. It
> depends on default Kconfig or boot defined choices.
> 
> Therefore, tell about PREEMPT_DYNAMIC on static kernel headers and leave
> the search for the actual preemption behaviour to browsing dmesg.
> 
> Reviewed-by: Valentin Schneider <valentin.schneider@arm.com>
> Signed-off-by: Frederic Weisbecker <frederic@kernel.org>

Hurmph.. if you all think this matters I suppose.

Let me go queue it.

> ---
>  init/Makefile       |  3 ++-
>  scripts/mkcompile_h | 17 ++++++++++++-----
>  2 files changed, 14 insertions(+), 6 deletions(-)
> 
> diff --git a/init/Makefile b/init/Makefile
> index 06326e304384..d82623d7fc8e 100644
> --- a/init/Makefile
> +++ b/init/Makefile
> @@ -31,7 +31,8 @@ quiet_cmd_compile.h = CHK     $@
>        cmd_compile.h = \
>  	$(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@	\
>  	"$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CONFIG_PREEMPT_BUILD)"	\
> -	"$(CONFIG_PREEMPT_RT)" "$(CONFIG_CC_VERSION_TEXT)" "$(LD)"
> +	"$(CONFIG_PREEMPT_DYNAMIC)" "$(CONFIG_PREEMPT_RT)" \
> +	"$(CONFIG_CC_VERSION_TEXT)" "$(LD)"
>  
>  include/generated/compile.h: FORCE
>  	$(call cmd,compile.h)
> diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h
> index 6a2a04d92f42..ca40a5258c87 100755
> --- a/scripts/mkcompile_h
> +++ b/scripts/mkcompile_h
> @@ -5,9 +5,10 @@ TARGET=$1
>  ARCH=$2
>  SMP=$3
>  PREEMPT=$4
> -PREEMPT_RT=$5
> -CC_VERSION="$6"
> -LD=$7
> +PREEMPT_DYNAMIC=$5
> +PREEMPT_RT=$6
> +CC_VERSION="$7"
> +LD=$8
>  
>  # Do not expand names
>  set -f
> @@ -41,8 +42,14 @@ fi
>  UTS_VERSION="#$VERSION"
>  CONFIG_FLAGS=""
>  if [ -n "$SMP" ] ; then CONFIG_FLAGS="SMP"; fi
> -if [ -n "$PREEMPT" ] ; then CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT"; fi
> -if [ -n "$PREEMPT_RT" ] ; then CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT_RT"; fi
> +
> +if [ -n "$PREEMPT_RT" ] ; then
> +	CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT_RT"
> +elif [ -n "$PREEMPT_DYNAMIC" ] ; then
> +	CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT_DYNAMIC"
> +elif [ -n "$PREEMPT" ] ; then
> +	CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT"
> +fi
>  
>  # Truncate to maximum length
>  UTS_LEN=64
> -- 
> 2.25.1
> 

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

* [tip: sched/core] sched/preempt: Tell about PREEMPT_DYNAMIC on kernel headers
  2022-02-17 11:12   ` [PATCH v2] " Frederic Weisbecker
  2022-03-10  8:53     ` Peter Zijlstra
@ 2022-03-11 14:40     ` tip-bot2 for Frederic Weisbecker
  1 sibling, 0 replies; 5+ messages in thread
From: tip-bot2 for Frederic Weisbecker @ 2022-03-11 14:40 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Valentin Schneider, Frederic Weisbecker, Peter Zijlstra (Intel),
	x86, linux-kernel

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

Commit-ID:     a0a7e453b502cbbf7ff372f907a4e27a2ebf5445
Gitweb:        https://git.kernel.org/tip/a0a7e453b502cbbf7ff372f907a4e27a2ebf5445
Author:        Frederic Weisbecker <frederic@kernel.org>
AuthorDate:    Thu, 17 Feb 2022 12:12:40 +01:00
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Fri, 11 Mar 2022 15:36:35 +01:00

sched/preempt: Tell about PREEMPT_DYNAMIC on kernel headers

Displaying "PREEMPT" on kernel headers when CONFIG_PREEMPT_DYNAMIC=y
can be misleading for anybody involved in remote debugging because it
is then not guaranteed that there is an actual preemption behaviour. It
depends on default Kconfig or boot defined choices.

Therefore, tell about PREEMPT_DYNAMIC on static kernel headers and leave
the search for the actual preemption behaviour to browsing dmesg.

Reviewed-by: Valentin Schneider <valentin.schneider@arm.com>
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20220217111240.GA742892@lothringen
---
 init/Makefile       |  3 ++-
 scripts/mkcompile_h | 17 ++++++++++++-----
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/init/Makefile b/init/Makefile
index 06326e3..d82623d 100644
--- a/init/Makefile
+++ b/init/Makefile
@@ -31,7 +31,8 @@ quiet_cmd_compile.h = CHK     $@
       cmd_compile.h = \
 	$(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@	\
 	"$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CONFIG_PREEMPT_BUILD)"	\
-	"$(CONFIG_PREEMPT_RT)" "$(CONFIG_CC_VERSION_TEXT)" "$(LD)"
+	"$(CONFIG_PREEMPT_DYNAMIC)" "$(CONFIG_PREEMPT_RT)" \
+	"$(CONFIG_CC_VERSION_TEXT)" "$(LD)"
 
 include/generated/compile.h: FORCE
 	$(call cmd,compile.h)
diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h
index 6a2a04d..ca40a52 100755
--- a/scripts/mkcompile_h
+++ b/scripts/mkcompile_h
@@ -5,9 +5,10 @@ TARGET=$1
 ARCH=$2
 SMP=$3
 PREEMPT=$4
-PREEMPT_RT=$5
-CC_VERSION="$6"
-LD=$7
+PREEMPT_DYNAMIC=$5
+PREEMPT_RT=$6
+CC_VERSION="$7"
+LD=$8
 
 # Do not expand names
 set -f
@@ -41,8 +42,14 @@ fi
 UTS_VERSION="#$VERSION"
 CONFIG_FLAGS=""
 if [ -n "$SMP" ] ; then CONFIG_FLAGS="SMP"; fi
-if [ -n "$PREEMPT" ] ; then CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT"; fi
-if [ -n "$PREEMPT_RT" ] ; then CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT_RT"; fi
+
+if [ -n "$PREEMPT_RT" ] ; then
+	CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT_RT"
+elif [ -n "$PREEMPT_DYNAMIC" ] ; then
+	CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT_DYNAMIC"
+elif [ -n "$PREEMPT" ] ; then
+	CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT"
+fi
 
 # Truncate to maximum length
 UTS_LEN=64

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

end of thread, other threads:[~2022-03-11 14:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-02 14:59 [PATCH] sched/preempt: Tell about PREEMPT_DYNAMIC on kernel headers Frederic Weisbecker
2022-02-02 18:24 ` Valentin Schneider
2022-02-17 11:12   ` [PATCH v2] " Frederic Weisbecker
2022-03-10  8:53     ` Peter Zijlstra
2022-03-11 14:40     ` [tip: sched/core] " tip-bot2 for Frederic Weisbecker

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).