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: <Z5oX5Fe5FY2Pym0u@ryzen>
Date: Wed, 29 Jan 2025 12:58:28 +0100
From: Niklas Cassel <cassel@...nel.org>
To: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
Cc: Kunihiko Hayashi <hayashi.kunihiko@...ionext.com>,
	Krzysztof Wilczy���ski <kw@...ux.com>,
	Kishon Vijay Abraham I <kishon@...nel.org>,
	Arnd Bergmann <arnd@...db.de>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Lorenzo Pieralisi <lpieralisi@...nel.org>,
	Gustavo Pimentel <gustavo.pimentel@...opsys.com>,
	Bjorn Helgaas <helgaas@...nel.org>, linux-pci@...r.kernel.org,
	linux-kernel@...r.kernel.org, stable@...r.kernel.org
Subject: Re: [PATCH v2 3/3] misc: pci_endpoint_test: Fix irq_type to convey
 the correct type

On Tue, Jan 28, 2025 at 08:02:31PM +0530, Manivannan Sadhasivam wrote:
> On Wed, Jan 22, 2025 at 11:24:46AM +0900, Kunihiko Hayashi wrote:
> > There are two variables that indicate the interrupt type to be used
> > in the next test execution, "irq_type" as global and test->irq_type.
> > 
> > The global is referenced from pci_endpoint_test_get_irq() to preserve
> > the current type for ioctl(PCITEST_GET_IRQTYPE).
> > 
> > The type set in this function isn't reflected in the global "irq_type",
> > so ioctl(PCITEST_GET_IRQTYPE) returns the previous type.
> > As a result, the wrong type will be displayed in "pcitest" as follows:
> > 
> >     # pcitest -i 0
> >     SET IRQ TYPE TO LEGACY:         OKAY
> >     # pcitest -I
> >     GET IRQ TYPE:           MSI
> > 
> > Fix this issue by propagating the current type to the global "irq_type".
> > 
> 
> This is becoming a nuisance. I think we should get rid of the global 'irq_type'
> and just stick to the one that is configurable using IOCTL command. Even if the
> user has configured the global 'irq_type' it is bound to change with IOCTL
> command.

+1


But I also don't like how since we migrated to selftests:
READ_TEST / WRITE_TEST / COPY_TEST unconditionally call
ioctl(PCITEST_SET_IRQTYPE, MSI) before doing their thing.

Will this cause the test case to fail for platforms that only support MSI-X?
(See e.g. dwc/pci-layerscape-ep.c where this could be the case.)


Sure, before, in pcitest.sh, we would do:


pcitest -i 2
        pcitest -x $msix


pcitest -i 1

pcitest -r -s 1
pcitest -r -s 1024
pcitest -r -s 1025
pcitest -r -s 1024000
pcitest -r -s 1024001


Which would probably print an error if:
pcitest -i 1
failed.

but the READ_TEST / WRITE_TEST / COPY_TEST tests themselves
would not fail.


Perhaps we should rethink this, and introduce a new
PCITEST_SET_IRQTYPE, AUTO

I would be fine if
READ_TEST / WRITE_TEST / COPY_TEST
called PCITEST_SET_IRQTYPE, AUTO
before doing their thing.



How I suggest PCITEST_SET_IRQTYPE, AUTO
would work:

Since we now have capabilties merged:
https://lore.kernel.org/linux-pci/20241203063851.695733-4-cassel@kernel.org/

Add epc_features->msi_capable and epc->features->msix_capable
as two new bits in the PCI_ENDPOINT_TEST_CAPS register.

If PCITEST_SET_IRQTYPE, AUTO:
if EP CAP has msi_capable set: set IRQ type MSI
else if EP CAP has msix_capable set: set IRQ type MSI-X
else: set legacy/INTx


Kind regards,
Niklas

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ