Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Shuai Xue <xueshuai@linux.alibaba.com>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: rostedt@goodmis.org, Lukas Wunner <lukas@wunner.de>,
	linux-pci@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
	linux-edac@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
	helgaas@kernel.org, mattc@purestorage.com,
	Jonathan.Cameron@huawei.com, bhelgaas@google.com,
	tony.luck@intel.com, bp@alien8.de, mhiramat@kernel.org,
	mathieu.desnoyers@efficios.com, oleg@redhat.com,
	naveen@kernel.org, davem@davemloft.net,
	anil.s.keshavamurthy@intel.com, mark.rutland@arm.com,
	peterz@infradead.org, tianruidong@linux.alibaba.com
Subject: Re: [PATCH v10 1/3] PCI: trace: Add a generic RAS tracepoint for hotplug event
Date: Tue, 23 Sep 2025 16:09:53 +0800	[thread overview]
Message-ID: <8706188e-23b2-4cb1-b279-3b462ba9b9de@linux.alibaba.com> (raw)
In-Reply-To: <453b792a-23f9-6d72-f35a-60526b3e04e0@linux.intel.com>



在 2025/9/23 15:34, Ilpo Järvinen 写道:
> On Tue, 23 Sep 2025, Ilpo Järvinen wrote:
> 
>> On Tue, 23 Sep 2025, Shuai Xue wrote:
>>
>>>
>>>
>>> 在 2025/9/23 14:46, Ilpo Järvinen 写道:
>>>> On Tue, 23 Sep 2025, Shuai Xue wrote:
>>>>
>>>>>
>>>>>
>>>>> 在 2025/9/22 21:10, Ilpo Järvinen 写道:
>>>>>> On Sat, 20 Sep 2025, Shuai Xue wrote:
>>>>>>
>>>>>>> Hotplug events are critical indicators for analyzing hardware health,
>>>>>>> and surprise link downs can significantly impact system performance
>>>>>>> and
>>>>>>> reliability.
>>>>>>>
>>>>>>> Define a new TRACING_SYSTEM named "pci", add a generic RAS tracepoint
>>>>>>> for hotplug event to help health checks. Add enum pci_hotplug_event in
>>>>>>> include/uapi/linux/pci.h so applications like rasdaemon can register
>>>>>>> tracepoint event handlers for it.
>>>>>>>
>>>>>>> The following output is generated when a device is hotplugged:
>>>>>>>
>>>>>>> $ echo 1 > /sys/kernel/debug/tracing/events/pci/pci_hp_event/enable
>>>>>>> $ cat /sys/kernel/debug/tracing/trace_pipe
>>>>>>>       irq/51-pciehp-88      [001] .....  1311.177459: pci_hp_event:
>>>>>>> 0000:00:02.0 slot:10, event:CARD_PRESENT
>>>>>>>
>>>>>>>       irq/51-pciehp-88      [001] .....  1311.177566: pci_hp_event:
>>>>>>> 0000:00:02.0 slot:10, event:LINK_UP
>>>>>>>
>>>>>>> Suggested-by: Lukas Wunner <lukas@wunner.de>
>>>>>>> Suggested-by: Steven Rostedt <rostedt@goodmis.org>
>>>>>>> Signed-off-by: Shuai Xue <xueshuai@linux.alibaba.com>
>>>>>>> Reviewed-by: Lukas Wunner <lukas@wunner.de>
>>>>>>> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>>>>>>> ---
>>>>>>>     drivers/pci/Makefile              |  2 +
>>>>>>>     drivers/pci/hotplug/Makefile      |  3 +-
>>>>>>>     drivers/pci/hotplug/pciehp_ctrl.c | 31 ++++++++++++---
>>>>>>>     drivers/pci/trace.c               | 11 ++++++
>>>>>>>     include/trace/events/pci.h        | 63
>>>>>>> +++++++++++++++++++++++++++++++
>>>>>>>     include/uapi/linux/pci.h          |  7 ++++
>>>>>>>     6 files changed, 110 insertions(+), 7 deletions(-)
>>>>>>>     create mode 100644 drivers/pci/trace.c
>>>>>>>     create mode 100644 include/trace/events/pci.h
>>>>>>>
>>>>>>> diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile
>>>>>>> index 67647f1880fb..bf389bc4dd3c 100644
>>>>>>> --- a/drivers/pci/Makefile
>>>>>>> +++ b/drivers/pci/Makefile
>>>>>>> @@ -45,3 +45,5 @@ obj-y				+= controller/
>>>>>>>     obj-y				+= switch/
>>>>>>>       subdir-ccflags-$(CONFIG_PCI_DEBUG) := -DDEBUG
>>>>>>> +
>>>>>>> +CFLAGS_trace.o := -I$(src)
>>>>>>> diff --git a/drivers/pci/hotplug/Makefile
>>>>>>> b/drivers/pci/hotplug/Makefile
>>>>>>> index 40aaf31fe338..d41f7050b072 100644
>>>>>>> --- a/drivers/pci/hotplug/Makefile
>>>>>>> +++ b/drivers/pci/hotplug/Makefile
>>>>>>> @@ -65,7 +65,8 @@ rpadlpar_io-objs	:=	rpadlpar_core.o \
>>>>>>>     pciehp-objs		:=	pciehp_core.o	\
>>>>>>>     				pciehp_ctrl.o	\
>>>>>>>     				pciehp_pci.o	\
>>>>>>> -				pciehp_hpc.o
>>>>>>> +				pciehp_hpc.o	\
>>>>>>> +				../trace.o
>>>>>>
>>>>>> To make it useful for any PCI tracing, not juse hotplug, this object
>>>>>> file
>>>>>> should be added in drivers/pci/Makefile, not here.
>>>>>
>>>>> Make sence. How about adding to the main CONFIG_PCI object:
>>>>>
>>>>> diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile
>>>>> index bf389bc4dd3c..d7f83d06351d 100644
>>>>> --- a/drivers/pci/Makefile
>>>>> +++ b/drivers/pci/Makefile
>>>>> @@ -5,7 +5,7 @@
>>>>>    obj-$(CONFIG_PCI)              += access.o bus.o probe.o host-bridge.o \
>>>>>                                      remove.o pci.o pci-driver.o search.o \
>>>>>                                      rom.o setup-res.o irq.o vpd.o \
>>>>> -                                  setup-bus.o vc.o mmap.o devres.o
>>>>> +                                  setup-bus.o vc.o mmap.o devres.o
>>>>> trace.o
>>>>>
>>>>>    obj-$(CONFIG_PCI)              += msi/
>>>>>    obj-$(CONFIG_PCI)              += pcie/
>>>>
>>>> Yes, that's the right place to add it.
>>>>
>>>
>>> Thanks for confirm.
>>> Will send a new version to fix it.
>>
>> I actually now started to wonder if it should be made depend on some
>> tracing related config (sending this out quickly if you were just
>> waiting for my confirmation to send quickly... I'm still investigating
>> what other subsystems do).
> 
> Probably this is what we actually want:
> 
> obj-$(CONFIG_TRACING)			+= trace.o
> 


Thanks for the input, lots of trace.o, e.g. for cxl and nvme, are compiled
under CONFIG_TRACING.

Will use CONFIG_TRACING :)

Thanks.
Shuai

  reply	other threads:[~2025-09-23  8:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-20  6:01 [PATCH v10 0/3] PCI: trace: Add a RAS tracepoint to monitor link speed changes Shuai Xue
2025-09-20  6:01 ` [PATCH v10 1/3] PCI: trace: Add a generic RAS tracepoint for hotplug event Shuai Xue
2025-09-22 13:10   ` Ilpo Järvinen
2025-09-23  2:08     ` Shuai Xue
2025-09-23  6:46       ` Ilpo Järvinen
2025-09-23  7:15         ` Shuai Xue
2025-09-23  7:20           ` Ilpo Järvinen
2025-09-23  7:34             ` Ilpo Järvinen
2025-09-23  8:09               ` Shuai Xue [this message]
2025-09-20  6:01 ` [PATCH v10 2/3] PCI: trace: Add a RAS tracepoint to monitor link speed changes Shuai Xue
2025-09-22 13:06   ` Ilpo Järvinen
2025-09-23  2:16     ` Shuai Xue
2025-09-20  6:01 ` [PATCH v10 3/3] Documentation: tracing: Add documentation about PCI tracepoints Shuai Xue

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8706188e-23b2-4cb1-b279-3b462ba9b9de@linux.alibaba.com \
    --to=xueshuai@linux.alibaba.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=anil.s.keshavamurthy@intel.com \
    --cc=bhelgaas@google.com \
    --cc=bp@alien8.de \
    --cc=davem@davemloft.net \
    --cc=helgaas@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mattc@purestorage.com \
    --cc=mhiramat@kernel.org \
    --cc=naveen@kernel.org \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tianruidong@linux.alibaba.com \
    --cc=tony.luck@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox