[PATCH -next v4 04/19] arm64: entry: Remove __enter_from_kernel_mode()

Jinjie Ruan posted 19 patches 1 month, 1 week ago
There is a newer version of this series
[PATCH -next v4 04/19] arm64: entry: Remove __enter_from_kernel_mode()
Posted by Jinjie Ruan 1 month, 1 week ago
The __enter_from_kernel_mode() is only called by enter_from_kernel_mode(),
remove it.

No functional changes.

Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
 arch/arm64/kernel/entry-common.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/arch/arm64/kernel/entry-common.c b/arch/arm64/kernel/entry-common.c
index ccf59b44464d..a7fd4d6c7650 100644
--- a/arch/arm64/kernel/entry-common.c
+++ b/arch/arm64/kernel/entry-common.c
@@ -36,7 +36,7 @@
  * This is intended to match the logic in irqentry_enter(), handling the kernel
  * mode transitions only.
  */
-static __always_inline irqentry_state_t __enter_from_kernel_mode(struct pt_regs *regs)
+static noinstr irqentry_state_t enter_from_kernel_mode(struct pt_regs *regs)
 {
 	irqentry_state_t ret = {
 		.exit_rcu = false,
@@ -55,13 +55,6 @@ static __always_inline irqentry_state_t __enter_from_kernel_mode(struct pt_regs
 	rcu_irq_enter_check_tick();
 	trace_hardirqs_off_finish();
 
-	return ret;
-}
-
-static noinstr irqentry_state_t enter_from_kernel_mode(struct pt_regs *regs)
-{
-	irqentry_state_t ret = __enter_from_kernel_mode(regs);
-
 	mte_check_tfsr_entry();
 	mte_disable_tco_entry(current);
 
-- 
2.34.1
Re: [PATCH -next v4 04/19] arm64: entry: Remove __enter_from_kernel_mode()
Posted by Mark Rutland 1 month ago
On Fri, Oct 25, 2024 at 06:06:45PM +0800, Jinjie Ruan wrote:
> The __enter_from_kernel_mode() is only called by enter_from_kernel_mode(),
> remove it.

The point of this split is to cleanly separate the raw entry logic (in
__enter_from_kernel_mode() from pieces that run later and can safely be
instrumented (later in enter_from_kernel_mode()).

I had expected that a later patch would replace
__enter_from_kernel_mode() with the generic equivalent, leaving
enter_from_kernel_mode() unchanged. It looks like patch 16 could do that
without this patch being necessary -- am I missing something?

Mark.

> 
> No functional changes.
> 
> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
> ---
>  arch/arm64/kernel/entry-common.c | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/arch/arm64/kernel/entry-common.c b/arch/arm64/kernel/entry-common.c
> index ccf59b44464d..a7fd4d6c7650 100644
> --- a/arch/arm64/kernel/entry-common.c
> +++ b/arch/arm64/kernel/entry-common.c
> @@ -36,7 +36,7 @@
>   * This is intended to match the logic in irqentry_enter(), handling the kernel
>   * mode transitions only.
>   */
> -static __always_inline irqentry_state_t __enter_from_kernel_mode(struct pt_regs *regs)
> +static noinstr irqentry_state_t enter_from_kernel_mode(struct pt_regs *regs)
>  {
>  	irqentry_state_t ret = {
>  		.exit_rcu = false,
> @@ -55,13 +55,6 @@ static __always_inline irqentry_state_t __enter_from_kernel_mode(struct pt_regs
>  	rcu_irq_enter_check_tick();
>  	trace_hardirqs_off_finish();
>  
> -	return ret;
> -}
> -
> -static noinstr irqentry_state_t enter_from_kernel_mode(struct pt_regs *regs)
> -{
> -	irqentry_state_t ret = __enter_from_kernel_mode(regs);
> -
>  	mte_check_tfsr_entry();
>  	mte_disable_tco_entry(current);
>  
> -- 
> 2.34.1
>
Re: [PATCH -next v4 04/19] arm64: entry: Remove __enter_from_kernel_mode()
Posted by Jinjie Ruan 1 month ago

On 2024/10/29 22:37, Mark Rutland wrote:
> On Fri, Oct 25, 2024 at 06:06:45PM +0800, Jinjie Ruan wrote:
>> The __enter_from_kernel_mode() is only called by enter_from_kernel_mode(),
>> remove it.
> 
> The point of this split is to cleanly separate the raw entry logic (in
> __enter_from_kernel_mode() from pieces that run later and can safely be
> instrumented (later in enter_from_kernel_mode()).

Hi, Mark,

I reviewed your commit bc29b71f53b1 ("arm64: entry: clarify entry/exit
helpers"), and keep these functions is to make instrumentation
boundaries more clear, and will not change them.

> 
> I had expected that a later patch would replace
> __enter_from_kernel_mode() with the generic equivalent, leaving
> enter_from_kernel_mode() unchanged. It looks like patch 16 could do that
> without this patch being necessary -- am I missing something?

Yes, you are right! these useless cleanup patches will be removed.

And when switched to generic syscall, I found that proper refactoring
would also facilitate clear code switching.

Thank you.

> 
> Mark.
> 
>>
>> No functional changes.
>>
>> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
>> ---
>>  arch/arm64/kernel/entry-common.c | 9 +--------
>>  1 file changed, 1 insertion(+), 8 deletions(-)
>>
>> diff --git a/arch/arm64/kernel/entry-common.c b/arch/arm64/kernel/entry-common.c
>> index ccf59b44464d..a7fd4d6c7650 100644
>> --- a/arch/arm64/kernel/entry-common.c
>> +++ b/arch/arm64/kernel/entry-common.c
>> @@ -36,7 +36,7 @@
>>   * This is intended to match the logic in irqentry_enter(), handling the kernel
>>   * mode transitions only.
>>   */
>> -static __always_inline irqentry_state_t __enter_from_kernel_mode(struct pt_regs *regs)
>> +static noinstr irqentry_state_t enter_from_kernel_mode(struct pt_regs *regs)
>>  {
>>  	irqentry_state_t ret = {
>>  		.exit_rcu = false,
>> @@ -55,13 +55,6 @@ static __always_inline irqentry_state_t __enter_from_kernel_mode(struct pt_regs
>>  	rcu_irq_enter_check_tick();
>>  	trace_hardirqs_off_finish();
>>  
>> -	return ret;
>> -}
>> -
>> -static noinstr irqentry_state_t enter_from_kernel_mode(struct pt_regs *regs)
>> -{
>> -	irqentry_state_t ret = __enter_from_kernel_mode(regs);
>> -
>>  	mte_check_tfsr_entry();
>>  	mte_disable_tco_entry(current);
>>  
>> -- 
>> 2.34.1
>>
>