mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: "Manivannan Sadhasivam" <manivannan.sadhasivam@linaro.org>,
	"Krzysztof Wilczyński" <kw@linux.com>,
	"Kishon Vijay Abraham I" <kishon@kernel.org>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RESEND PATCH v1] misc: pci_endpoint_test: Fix irq_type to convey the correct type
Date: Mon, 20 Jan 2025 19:24:23 +0900	[thread overview]
Message-ID: <cba08e9c-9a91-4c55-b2f8-a24499321300@socionext.com> (raw)
In-Reply-To: <20250116150412.GA581512@bhelgaas>

Hi Bjorn,

Thank you for your comment.

On 2025/01/17 0:04, Bjorn Helgaas wrote:
> On Thu, Jan 16, 2025 at 11:41:45AM +0900, Kunihiko Hayashi wrote:
>> There are two variables that indicate the interrupt type to be used
>> in the next test execution, global "irq_type" and test->irq_type.
>>
>> The former is referenced from pci_endpoint_test_get_irq() to preserve
>> the current type for ioctl(PCITEST_GET_IRQTYPE).
>>
>> In pci_endpoint_test_request_irq(), since this global variable is
>> referenced when an error occurs, the unintended error message is
>> displayed.
> 
> Apparently this test fails (with an error message) when it shouldn't?
> Please include the error message here. >
> "... since this global variable is referenced ..." is not quite enough
> explanation of how this causes a spurious test failure or under what
> circumstances the failure occurs.

I see. This failure path is taken if devm_request_irq() returns with
an error. The message that causes an error in the third interrupt is for
example:

   pci-endpoint-test 0000:01:00.0: Failed to request IRQ 30 for MSI 3

Before this fix, this message will show "MSI" even if the current irq
type was "legacy" or "MSI-X".

I'll add such that description in the commit.

And I discovered that not releasing interrupt correctly caused WARN()
after displaying this message. I'll fix the issue additionally.

>> And the type set in pci_endpoint_test_set_irq() 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".
> 
> The global "irq_type" seems a little suspect.  Is it possible to run
> multiple tests concurrently?  If so, is this usage safe from races?

The global "irq_type" is only changed in pci_endpoint_test_set_irq().
I think this function is protected by the ioctl's mutex even if running
multiple tests.

Thank you,

---
Best Regards
Kunihiko Hayashi

      reply	other threads:[~2025-01-20 10:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-16  2:41 Kunihiko Hayashi
2025-01-16 10:54 ` Greg Kroah-Hartman
2025-01-16 15:04 ` Bjorn Helgaas
2025-01-20 10:24   ` Kunihiko Hayashi [this message]

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=cba08e9c-9a91-4c55-b2f8-a24499321300@socionext.com \
    --to=hayashi.kunihiko@socionext.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=helgaas@kernel.org \
    --cc=kishon@kernel.org \
    --cc=kw@linux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    /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

all inboxes | Powered by JetHome®