lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z8Co4ZnqObpnEbg7@lizhi-Precision-Tower-5810>
Date: Thu, 27 Feb 2025 13:03:13 -0500
From: Frank Li <Frank.li@....com>
To: Hans Zhang <18255117159@....com>
Cc: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>,
	tglx@...utronix.de, kw@...ux.com, kwilczynski@...nel.org,
	bhelgaas@...gle.com, cassel@...nel.org, linux-pci@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] genirq/msi: Add the address and data that show MSI/MSIX

On Fri, Feb 28, 2025 at 12:49:38AM +0800, Hans Zhang wrote:
>
>
> On 2025/2/28 00:39, Manivannan Sadhasivam wrote:
> > On Fri, Feb 28, 2025 at 12:28:21AM +0800, Hans Zhang wrote:
> > > Add to view the addresses and data stored in the MSI capability or the
> > > addresses and data stored in the MSIX vector table.
> > >
> > > e.g.
> > > root@...t:/sys/bus/pci/devices/<dev>/msi_irqs# ls
> > > 86  87  88  89
> > > root@...t:/sys/bus/pci/devices/<dev>/msi_irqs# cat *
> > > msix
> > >   address_hi: 0x00000000
> > >   address_lo: 0x0e060040
> > >   msg_data: 0x00000000
> > > msix
> > >   address_hi: 0x00000000
> > >   address_lo: 0x0e060040
> > >   msg_data: 0x00000001
> > > msix
> > >   address_hi: 0x00000000
> > >   address_lo: 0x0e060040
> > >   msg_data: 0x00000002
> > > msix
> > >   address_hi: 0x00000000
> > >   address_lo: 0x0e060040
> > >   msg_data: 0x00000003
> > >
> > > Signed-off-by: Hans Zhang <18255117159@....com>
> > > ---
> > >   kernel/irq/msi.c | 12 +++++++++++-
> > >   1 file changed, 11 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c
> > > index 396a067a8a56..a37a3e535fb8 100644
> > > --- a/kernel/irq/msi.c
> > > +++ b/kernel/irq/msi.c
> > > @@ -503,8 +503,18 @@ static ssize_t msi_mode_show(struct device *dev, struct device_attribute *attr,
> > >   {
> > >   	/* MSI vs. MSIX is per device not per interrupt */
> > >   	bool is_msix = dev_is_pci(dev) ? to_pci_dev(dev)->msix_enabled : false;
> > > +	struct msi_desc *desc;
> > > +	u32 irq;
> > > +
> > > +	if (kstrtoint(attr->attr.name, 10, &irq) < 0)
> > > +		return 0;
> > > -	return sysfs_emit(buf, "%s\n", is_msix ? "msix" : "msi");
> > > +	desc = irq_get_msi_desc(irq);
> > > +	return sysfs_emit(
> > > +		buf,
> > > +		"%s\n address_hi: 0x%08x\n address_lo: 0x%08x\n msg_data: 0x%08x\n",
> > > +		is_msix ? "msix" : "msi", desc->msg.address_hi,
> > > +		desc->msg.address_lo, desc->msg.data);
> >
> > Sysfs is an ABI. You cannot change the semantics of an attribute.
> >
>
> Thanks Mani for the tip.
>
> If I want to implement similar functionality, where should I add it? Since
> this sysfs node is the only one that displays the MSI/MSIX interrupt number,
> I don't know where to implement similar debug functionality at this time. Do
> you have any suggestions? Or it shouldn't have a similar function.

I think it is useful feature to help debug. Generally only one property
for one sys file.

A possible create 3 files under

/sys/kernel/irq/26/
	address_hi, address_lo, msg_data.

cat address_hi, only show 0x00000000. ... ABI doc need update also.

Thomas(tglx) may provide better suggestions.

Frank

>
> Best regards
> Hans
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ