public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] arm64: remove unneeded BUILD_BUG_ON assertion
@ 2024-02-02  4:02 Dawei Li
  2024-02-05 12:06 ` Mark Rutland
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Dawei Li @ 2024-02-02  4:02 UTC (permalink / raw)
  To: catalin.marinas, will
  Cc: mark.rutland, mcgrof, jpoimboe, j.granados, linux-arm-kernel,
	linux-kernel, set_pte_at, Dawei Li

Since commit c02433dd6de3 ("arm64: split thread_info from task stack"),
CONFIG_THREAD_INFO_IN_TASK is enabled unconditionally for arm64. So
remove this always-true assertion from arch_dup_task_struct.

Signed-off-by: Dawei Li <dawei.li@shingroup.cn>
---
 arch/arm64/kernel/process.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
index 7387b68c745b..4ae31b7af6c3 100644
--- a/arch/arm64/kernel/process.c
+++ b/arch/arm64/kernel/process.c
@@ -290,9 +290,6 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
 		fpsimd_preserve_current_state();
 	*dst = *src;
 
-	/* We rely on the above assignment to initialize dst's thread_flags: */
-	BUILD_BUG_ON(!IS_ENABLED(CONFIG_THREAD_INFO_IN_TASK));
-
 	/*
 	 * Detach src's sve_state (if any) from dst so that it does not
 	 * get erroneously used or freed prematurely.  dst's copies
-- 
2.27.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64: remove unneeded BUILD_BUG_ON assertion
  2024-02-02  4:02 [PATCH] arm64: remove unneeded BUILD_BUG_ON assertion Dawei Li
@ 2024-02-05 12:06 ` Mark Rutland
  2024-02-06  1:39   ` Dawei Li
  2024-02-22  9:27 ` Dawei Li
  2024-02-22 22:05 ` Catalin Marinas
  2 siblings, 1 reply; 5+ messages in thread
From: Mark Rutland @ 2024-02-05 12:06 UTC (permalink / raw)
  To: Dawei Li
  Cc: catalin.marinas, will, mcgrof, jpoimboe, j.granados,
	linux-arm-kernel, linux-kernel, set_pte_at

On Fri, Feb 02, 2024 at 12:02:11PM +0800, Dawei Li wrote:
> Since commit c02433dd6de3 ("arm64: split thread_info from task stack"),
> CONFIG_THREAD_INFO_IN_TASK is enabled unconditionally for arm64. So
> remove this always-true assertion from arch_dup_task_struct.
> 
> Signed-off-by: Dawei Li <dawei.li@shingroup.cn>
> ---
>  arch/arm64/kernel/process.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
> index 7387b68c745b..4ae31b7af6c3 100644
> --- a/arch/arm64/kernel/process.c
> +++ b/arch/arm64/kernel/process.c
> @@ -290,9 +290,6 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
>  		fpsimd_preserve_current_state();
>  	*dst = *src;
>  
> -	/* We rely on the above assignment to initialize dst's thread_flags: */
> -	BUILD_BUG_ON(!IS_ENABLED(CONFIG_THREAD_INFO_IN_TASK));
> -

Does the above cause any problem today, or is this patch just a cleanup?

For the benefit of other reviewers, the assertion and comment were added in
commit:

  4585fc59c0e8 ("arm64/sve: Fix wrong free for task->thread.sve_state")

... back in 2019, 3 years after commit:

  c02433dd6de3 ("arm64: split thread_info from task stack")

The comment and assertion were a safety-net for backports, since commit
4585fc59c0e8 was a fix which dependend upon the thread_info being contained
within task_struct, and couldn't be backported to kernels without
CONFIG_THREAD_INFO_IN_TASK.

I'm sure that we currently have plenty of other code with a similar (but
undocumented) dependency. Given we've unconditionally selected
CONFIG_THREAD_INFO_IN_TASK since v4.10, and the oldest longterm stable kernel
is v4.19 (with v4.14 having EOL'd last month), I think it makes sense to delete
the assertion and comment.

So FWIW:

Acked-by: Mark Rutland <mark.rutland@arm.com>

Mark.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64: remove unneeded BUILD_BUG_ON assertion
  2024-02-05 12:06 ` Mark Rutland
@ 2024-02-06  1:39   ` Dawei Li
  0 siblings, 0 replies; 5+ messages in thread
From: Dawei Li @ 2024-02-06  1:39 UTC (permalink / raw)
  To: Mark Rutland
  Cc: catalin.marinas, will, mcgrof, jpoimboe, j.granados,
	linux-arm-kernel, linux-kernel, set_pte_at

Hi Mark,

Thanks for reviewing.

On Mon, Feb 05, 2024 at 12:06:18PM +0000, Mark Rutland wrote:
> On Fri, Feb 02, 2024 at 12:02:11PM +0800, Dawei Li wrote:
> > Since commit c02433dd6de3 ("arm64: split thread_info from task stack"),
> > CONFIG_THREAD_INFO_IN_TASK is enabled unconditionally for arm64. So
> > remove this always-true assertion from arch_dup_task_struct.
> > 
> > Signed-off-by: Dawei Li <dawei.li@shingroup.cn>
> > ---
> >  arch/arm64/kernel/process.c | 3 ---
> >  1 file changed, 3 deletions(-)
> > 
> > diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
> > index 7387b68c745b..4ae31b7af6c3 100644
> > --- a/arch/arm64/kernel/process.c
> > +++ b/arch/arm64/kernel/process.c
> > @@ -290,9 +290,6 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
> >  		fpsimd_preserve_current_state();
> >  	*dst = *src;
> >  
> > -	/* We rely on the above assignment to initialize dst's thread_flags: */
> > -	BUILD_BUG_ON(!IS_ENABLED(CONFIG_THREAD_INFO_IN_TASK));
> > -
> 
> Does the above cause any problem today, or is this patch just a cleanup?

It's just a cleanup patch.

> 
> For the benefit of other reviewers, the assertion and comment were added in
> commit:
> 
>   4585fc59c0e8 ("arm64/sve: Fix wrong free for task->thread.sve_state")
> 
> .. back in 2019, 3 years after commit:
> 
>   c02433dd6de3 ("arm64: split thread_info from task stack")
> 
> The comment and assertion were a safety-net for backports, since commit
> 4585fc59c0e8 was a fix which dependend upon the thread_info being contained
> within task_struct, and couldn't be backported to kernels without
> CONFIG_THREAD_INFO_IN_TASK.

Thanks for the update! It helps.

> 
> I'm sure that we currently have plenty of other code with a similar (but
> undocumented) dependency. Given we've unconditionally selected

Totally agreed.

> CONFIG_THREAD_INFO_IN_TASK since v4.10, and the oldest longterm stable kernel
> is v4.19 (with v4.14 having EOL'd last month), I think it makes sense to delete
> the assertion and comment.
> 
> So FWIW:
> 
> Acked-by: Mark Rutland <mark.rutland@arm.com>
> 
> Mark.
> 

Thanks,

    Dawei

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64: remove unneeded BUILD_BUG_ON assertion
  2024-02-02  4:02 [PATCH] arm64: remove unneeded BUILD_BUG_ON assertion Dawei Li
  2024-02-05 12:06 ` Mark Rutland
@ 2024-02-22  9:27 ` Dawei Li
  2024-02-22 22:05 ` Catalin Marinas
  2 siblings, 0 replies; 5+ messages in thread
From: Dawei Li @ 2024-02-22  9:27 UTC (permalink / raw)
  To: catalin.marinas, will
  Cc: mark.rutland, mcgrof, jpoimboe, j.granados, linux-arm-kernel,
	linux-kernel, set_pte_at

Hi,

On Fri, Feb 02, 2024 at 12:02:11PM +0800, Dawei Li wrote:
> Since commit c02433dd6de3 ("arm64: split thread_info from task stack"),
> CONFIG_THREAD_INFO_IN_TASK is enabled unconditionally for arm64. So
> remove this always-true assertion from arch_dup_task_struct.
> 
> Signed-off-by: Dawei Li <dawei.li@shingroup.cn>

Just a gentle remainder:).

Thanks,

    Dawei

> ---
>  arch/arm64/kernel/process.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
> index 7387b68c745b..4ae31b7af6c3 100644
> --- a/arch/arm64/kernel/process.c
> +++ b/arch/arm64/kernel/process.c
> @@ -290,9 +290,6 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
>  		fpsimd_preserve_current_state();
>  	*dst = *src;
>  
> -	/* We rely on the above assignment to initialize dst's thread_flags: */
> -	BUILD_BUG_ON(!IS_ENABLED(CONFIG_THREAD_INFO_IN_TASK));
> -
>  	/*
>  	 * Detach src's sve_state (if any) from dst so that it does not
>  	 * get erroneously used or freed prematurely.  dst's copies
> -- 
> 2.27.0
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64: remove unneeded BUILD_BUG_ON assertion
  2024-02-02  4:02 [PATCH] arm64: remove unneeded BUILD_BUG_ON assertion Dawei Li
  2024-02-05 12:06 ` Mark Rutland
  2024-02-22  9:27 ` Dawei Li
@ 2024-02-22 22:05 ` Catalin Marinas
  2 siblings, 0 replies; 5+ messages in thread
From: Catalin Marinas @ 2024-02-22 22:05 UTC (permalink / raw)
  To: will, Dawei Li
  Cc: mark.rutland, mcgrof, jpoimboe, j.granados, linux-arm-kernel,
	linux-kernel, set_pte_at

On Fri, 02 Feb 2024 12:02:11 +0800, Dawei Li wrote:
> Since commit c02433dd6de3 ("arm64: split thread_info from task stack"),
> CONFIG_THREAD_INFO_IN_TASK is enabled unconditionally for arm64. So
> remove this always-true assertion from arch_dup_task_struct.
> 
> 

Applied to arm64 (for-next/misc), thanks!

[1/1] arm64: remove unneeded BUILD_BUG_ON assertion
      https://git.kernel.org/arm64/c/bce79b0c8097

-- 
Catalin


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2024-02-22 22:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-02  4:02 [PATCH] arm64: remove unneeded BUILD_BUG_ON assertion Dawei Li
2024-02-05 12:06 ` Mark Rutland
2024-02-06  1:39   ` Dawei Li
2024-02-22  9:27 ` Dawei Li
2024-02-22 22:05 ` Catalin Marinas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox