[PATCH 3/5] powerpc/kprobes: Use preempt_enable() rather than the no_resched variant

Nicholas Piggin npiggin at gmail.com
Mon Nov 7 21:29:56 AEDT 2022


On Fri Oct 21, 2022 at 3:28 AM AEST, Naveen N. Rao wrote:
> preempt_enable_no_resched() is just the same as preempt_enable() when we
> are in a irqs disabled context. kprobe_handler() and the post/fault
> handlers are all called with irqs disabled. As such, convert those to
> just use preempt_enable().

Reviewed-by: Nicholas Piggin <npiggin at gmail.com>

>
> Reported-by: Nicholas Piggin <npiggin at gmail.com>
> Signed-off-by: Naveen N. Rao <naveen.n.rao at linux.vnet.ibm.com>
> ---
>  arch/powerpc/kernel/kprobes.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c
> index 88f42de681e1f8..86ca5a61ea9afb 100644
> --- a/arch/powerpc/kernel/kprobes.c
> +++ b/arch/powerpc/kernel/kprobes.c
> @@ -369,7 +369,7 @@ int kprobe_handler(struct pt_regs *regs)
>  
>  			if (ret > 0) {
>  				restore_previous_kprobe(kcb);
> -				preempt_enable_no_resched();
> +				preempt_enable();
>  				return 1;
>  			}
>  		}
> @@ -382,7 +382,7 @@ int kprobe_handler(struct pt_regs *regs)
>  	if (p->pre_handler && p->pre_handler(p, regs)) {
>  		/* handler changed execution path, so skip ss setup */
>  		reset_current_kprobe();
> -		preempt_enable_no_resched();
> +		preempt_enable();
>  		return 1;
>  	}
>  
> @@ -395,7 +395,7 @@ int kprobe_handler(struct pt_regs *regs)
>  
>  			kcb->kprobe_status = KPROBE_HIT_SSDONE;
>  			reset_current_kprobe();
> -			preempt_enable_no_resched();
> +			preempt_enable();
>  			return 1;
>  		}
>  	}
> @@ -404,7 +404,7 @@ int kprobe_handler(struct pt_regs *regs)
>  	return 1;
>  
>  no_kprobe:
> -	preempt_enable_no_resched();
> +	preempt_enable();
>  	return ret;
>  }
>  NOKPROBE_SYMBOL(kprobe_handler);
> @@ -490,7 +490,7 @@ int kprobe_post_handler(struct pt_regs *regs)
>  	}
>  	reset_current_kprobe();
>  out:
> -	preempt_enable_no_resched();
> +	preempt_enable();
>  
>  	/*
>  	 * if somebody else is singlestepping across a probe point, msr
> @@ -529,7 +529,7 @@ int kprobe_fault_handler(struct pt_regs *regs, int trapnr)
>  			restore_previous_kprobe(kcb);
>  		else
>  			reset_current_kprobe();
> -		preempt_enable_no_resched();
> +		preempt_enable();
>  		break;
>  	case KPROBE_HIT_ACTIVE:
>  	case KPROBE_HIT_SSDONE:
> -- 
> 2.38.0



More information about the Linuxppc-dev mailing list