Re: [PATCH v5 6/8] tracing/bpf-trace: Add support for faultable tracepoints

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 26 Jun 2024 14:59:39 -0400
Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx> wrote:

> @@ -2443,9 +2443,15 @@ static int __bpf_probe_register(struct bpf_raw_event_map *btp, struct bpf_prog *
>  	if (prog->aux->max_tp_access > btp->writable_size)
>  		return -EINVAL;
>  
> -	return tracepoint_probe_register_prio_flags(tp, (void *)btp->bpf_func,
> -						    prog, TRACEPOINT_DEFAULT_PRIO,
> -						    TRACEPOINT_MAY_EXIST);
> +	if (tp->flags & TRACEPOINT_MAY_FAULT) {
> +		return tracepoint_probe_register_prio_flags(tp, (void *)btp->bpf_func,
> +							    prog, TRACEPOINT_DEFAULT_PRIO,
> +							    TRACEPOINT_MAY_EXIST | TRACEPOINT_MAY_FAULT);
> +	} else {
> +		return tracepoint_probe_register_prio_flags(tp, (void *)btp->bpf_func,
> +							    prog, TRACEPOINT_DEFAULT_PRIO,
> +							    TRACEPOINT_MAY_EXIST);
> +	}

nit: you can also just pass the flag directly,

		return tracepoint_probe_register_prio_flags(tp, (void *)btp->bpf_func,
							    prog, TRACEPOINT_DEFAULT_PRIO,
							    TRACEPOINT_MAY_EXIST | (tp->flags & TRACEPOINT_MAY_FAULT));

But others looks good to me.

Reviewed-by: Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>

Thank you,

-- 
Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux