Re: [PATCH] rv: sts, nrp: Fix UP build with CONFIG_X86_LOCAL_APIC

From: Gabriele Monaco

Date: Mon Nov 30 2026 - 10:25:30 EST


On Sat, 2026-11-28 at 21:01 +0100, Karl Mehltretter wrote:
> Building sts.c or nrp.c on x86 with CONFIG_SMP=n and
> CONFIG_X86_LOCAL_APIC=y fails:
>
>   include/rv/instrumentation.h:18:17: error: implicit declaration of function
> 'check_trace_callback_type_reschedule_entry'
>   include/rv/instrumentation.h:19:27: error: implicit declaration of function
> 'register_trace_reschedule_entry'
>
> arch/x86/include/asm/trace/irq_vectors.h only declares reschedule_entry,
> call_function_entry, and call_function_single_entry when CONFIG_SMP is
> enabled (and irq_work_entry when CONFIG_IRQ_WORK is enabled), so
> if (IS_ENABLED(...)) still references undeclared helpers when disabled.
>
> Guard these probes with preprocessor conditionals in attach_vector_irq()
> and detach_vector_irq() to match the header.
>
> Fixes: d0096c2f9cfc ("rv: Replace tss and sncid monitors with more complete
> sts")
> Fixes: e8440a88e56b ("rv: Add nrp and sssw per-task monitors")
> Signed-off-by: Karl Mehltretter <kmehltretter@xxxxxxxxx>
> ---

Makes sense, thanks.

Acked-by: Gabriele Monaco <gmonaco@xxxxxxxxxx>

>  kernel/trace/rv/monitors/nrp/nrp.c | 30 ++++++++++++++++--------------
>  kernel/trace/rv/monitors/sts/sts.c | 30 ++++++++++++++++--------------
>  2 files changed, 32 insertions(+), 28 deletions(-)
>
> diff --git a/kernel/trace/rv/monitors/nrp/nrp.c
> b/kernel/trace/rv/monitors/nrp/nrp.c
> index 4b5646a..48a268b 100644
> --- a/kernel/trace/rv/monitors/nrp/nrp.c
> +++ b/kernel/trace/rv/monitors/nrp/nrp.c
> @@ -29,25 +29,27 @@ static void handle_vector_irq_entry(void *data, int
> vector)
>  static void attach_vector_irq(void)
>  {
>   rv_attach_trace_probe("nrp", local_timer_entry,
> handle_vector_irq_entry);
> - if (IS_ENABLED(CONFIG_IRQ_WORK))
> - rv_attach_trace_probe("nrp", irq_work_entry,
> handle_vector_irq_entry);
> - if (IS_ENABLED(CONFIG_SMP)) {
> - rv_attach_trace_probe("nrp", reschedule_entry,
> handle_vector_irq_entry);
> - rv_attach_trace_probe("nrp", call_function_entry,
> handle_vector_irq_entry);
> - rv_attach_trace_probe("nrp", call_function_single_entry,
> handle_vector_irq_entry);
> - }
> +#ifdef CONFIG_IRQ_WORK
> + rv_attach_trace_probe("nrp", irq_work_entry,
> handle_vector_irq_entry);
> +#endif
> +#ifdef CONFIG_SMP
> + rv_attach_trace_probe("nrp", reschedule_entry,
> handle_vector_irq_entry);
> + rv_attach_trace_probe("nrp", call_function_entry,
> handle_vector_irq_entry);
> + rv_attach_trace_probe("nrp", call_function_single_entry,
> handle_vector_irq_entry);
> +#endif
>  }
>  
>  static void detach_vector_irq(void)
>  {
>   rv_detach_trace_probe("nrp", local_timer_entry,
> handle_vector_irq_entry);
> - if (IS_ENABLED(CONFIG_IRQ_WORK))
> - rv_detach_trace_probe("nrp", irq_work_entry,
> handle_vector_irq_entry);
> - if (IS_ENABLED(CONFIG_SMP)) {
> - rv_detach_trace_probe("nrp", reschedule_entry,
> handle_vector_irq_entry);
> - rv_detach_trace_probe("nrp", call_function_entry,
> handle_vector_irq_entry);
> - rv_detach_trace_probe("nrp", call_function_single_entry,
> handle_vector_irq_entry);
> - }
> +#ifdef CONFIG_IRQ_WORK
> + rv_detach_trace_probe("nrp", irq_work_entry,
> handle_vector_irq_entry);
> +#endif
> +#ifdef CONFIG_SMP
> + rv_detach_trace_probe("nrp", reschedule_entry,
> handle_vector_irq_entry);
> + rv_detach_trace_probe("nrp", call_function_entry,
> handle_vector_irq_entry);
> + rv_detach_trace_probe("nrp", call_function_single_entry,
> handle_vector_irq_entry);
> +#endif
>  }
>  
>  #else
> diff --git a/kernel/trace/rv/monitors/sts/sts.c
> b/kernel/trace/rv/monitors/sts/sts.c
> index 2a044cf..b5ff582 100644
> --- a/kernel/trace/rv/monitors/sts/sts.c
> +++ b/kernel/trace/rv/monitors/sts/sts.c
> @@ -30,25 +30,27 @@ static void handle_vector_irq_entry(void *data, int
> vector)
>  static void attach_vector_irq(void)
>  {
>   rv_attach_trace_probe("sts", local_timer_entry,
> handle_vector_irq_entry);
> - if (IS_ENABLED(CONFIG_IRQ_WORK))
> - rv_attach_trace_probe("sts", irq_work_entry,
> handle_vector_irq_entry);
> - if (IS_ENABLED(CONFIG_SMP)) {
> - rv_attach_trace_probe("sts", reschedule_entry,
> handle_vector_irq_entry);
> - rv_attach_trace_probe("sts", call_function_entry,
> handle_vector_irq_entry);
> - rv_attach_trace_probe("sts", call_function_single_entry,
> handle_vector_irq_entry);
> - }
> +#ifdef CONFIG_IRQ_WORK
> + rv_attach_trace_probe("sts", irq_work_entry,
> handle_vector_irq_entry);
> +#endif
> +#ifdef CONFIG_SMP
> + rv_attach_trace_probe("sts", reschedule_entry,
> handle_vector_irq_entry);
> + rv_attach_trace_probe("sts", call_function_entry,
> handle_vector_irq_entry);
> + rv_attach_trace_probe("sts", call_function_single_entry,
> handle_vector_irq_entry);
> +#endif
>  }
>  
>  static void detach_vector_irq(void)
>  {
>   rv_detach_trace_probe("sts", local_timer_entry,
> handle_vector_irq_entry);
> - if (IS_ENABLED(CONFIG_IRQ_WORK))
> - rv_detach_trace_probe("sts", irq_work_entry,
> handle_vector_irq_entry);
> - if (IS_ENABLED(CONFIG_SMP)) {
> - rv_detach_trace_probe("sts", reschedule_entry,
> handle_vector_irq_entry);
> - rv_detach_trace_probe("sts", call_function_entry,
> handle_vector_irq_entry);
> - rv_detach_trace_probe("sts", call_function_single_entry,
> handle_vector_irq_entry);
> - }
> +#ifdef CONFIG_IRQ_WORK
> + rv_detach_trace_probe("sts", irq_work_entry,
> handle_vector_irq_entry);
> +#endif
> +#ifdef CONFIG_SMP
> + rv_detach_trace_probe("sts", reschedule_entry,
> handle_vector_irq_entry);
> + rv_detach_trace_probe("sts", call_function_entry,
> handle_vector_irq_entry);
> + rv_detach_trace_probe("sts", call_function_single_entry,
> handle_vector_irq_entry);
> +#endif
>  }
>  
>  #else