Hi, Steven,

在 2025/7/24 22:06, Steven Rostedt 写道:
On Thu, 24 Jul 2025 03:30:17 +0800
kernel test robot <l...@intel.com> wrote:

url:    
https://github.com/intel-lab-lkp/linux/commits/Shuai-Xue/PCI-trace-Add-a-generic-RAS-tracepoint-for-hotplug-event/20250723-113454
base:   https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git for-linus
patch link:    
https://lore.kernel.org/r/20250723033108.61587-3-xueshuai%40linux.alibaba.com
patch subject: [PATCH v9 2/2] PCI: trace: Add a RAS tracepoint to monitor link 
speed changes
config: sparc-sparc64_defconfig 
(https://download.01.org/0day-ci/archive/20250724/202507240322.njgdyxsy-...@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 15.1.0
reproduce (this is a W=1 build): 
(https://download.01.org/0day-ci/archive/20250724/202507240322.njgdyxsy-...@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <l...@intel.com>
| Closes: 
https://lore.kernel.org/oe-kbuild-all/202507240322.njgdyxsy-...@intel.com/

All errors (new ones prefixed by >>):

    sparc64-linux-ld: drivers/pci/probe.o: in function `pcie_update_link_speed':
probe.c:(.text+0x370): undefined reference to `__tracepoint_pcie_link_event'
sparc64-linux-ld: probe.c:(.text+0x37c): undefined reference to 
`__tracepoint_pcie_link_event'
sparc64-linux-ld: probe.c:(.text+0x3dc): undefined reference to 
`__traceiter_pcie_link_event'

The config has:

# CONFIG_CPU_HOTPLUG_STATE_CONTROL is not set

Which looks to me from the first patch, would enable the code that
defines the trace events via the:

+#define CREATE_TRACE_POINTS
+#include <trace/events/pci.h>

Thus, without compiling that file, the tracepoints would not be created
and you would get the above errors.

Thanks for the detailed analysis! You're absolutely right about the root
cause.

The issue is that I have the tracepoint usage in drivers/pci/probe.c
(which is always compiled), but the tracepoint definition with:

#define CREATE_TRACE_POINTS
#include<trace/events/pci.h>

is in drivers/pci/hotplug/pciehp_ctrl.c that's conditionally compiled
based on CONFIG_HOTPLUG_PCI_PCIE=y, creating the undefined reference
when that config is not set.

I can see a few ways to fix this:

- Move tracepoint definition to always-compiled code - Create a dedicated 
drivers/pci/trace.c that always defines the PCI tracepoints
- Make the tracepoint usage conditional - Wrap the trace calls with the same 
config dependency
- Create a PCI-specific trace config - Add a CONFIG_PCI_TRACE option

I'm leaning toward option 1 (dedicated trace.c file) as it's the
cleanest approach and follows the pattern used in other subsystems. Does
that sound reasonable to you?


-- Steve

Thanks for valuable feedback.

Best Regards,
Shuai
















Reply via email to