Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Philipp Stanner <pstanner@redhat.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: "Bjorn Helgaas" <bhelgaas@google.com>,
	"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Damien Le Moal" <dlemoal@kernel.org>
Subject: Re: [PATCH] PCI: Fix devres regression in pci_intx()
Date: Thu, 25 Jul 2024 17:21:39 +0200	[thread overview]
Message-ID: <9529b8012b1a1573316d65727f231f5cf54d0315.camel@redhat.com> (raw)
In-Reply-To: <ZqJgkLxJjJS7xpp1@infradead.org>

On Thu, 2024-07-25 at 07:26 -0700, Christoph Hellwig wrote:
> Can we please fix this to never silently redirect to a manager
> version

It is not the fix or the recent changes (which the fix is for) to PCI
devres that is doing that. pci_intx() has been "silently redirect[ing]
to a managed version" since 15 years.

The changes merged into v6.11 attempted to keep this behavior exactly
identical as a preparation for later cleanups. The fix here only
corrects the position of the redirection to where the "crazy devres
voodoo" had always been:

void pci_intx(struct pci_dev *pdev, int enable)
{
	u16 pci_command, new;

	pci_read_config_word(pdev, PCI_COMMAND, &pci_command);

	if (enable)
		new = pci_command & ~PCI_COMMAND_INTX_DISABLE;
	else
		new = pci_command | PCI_COMMAND_INTX_DISABLE;

	if (new != pci_command) {
		struct pci_devres *dr;

		pci_write_config_word(pdev, PCI_COMMAND, new);

		/* voodoo_begin */
		dr = find_pci_dr(pdev);
		if (dr && !dr->restore_intx) {
			dr->restore_intx = 1;
			dr->orig_intx = !enable;
		}
		/* voodoo_end */
	}
}
EXPORT_SYMBOL_GPL(pci_intx);

> and add a proper pcim_intx instead 

That has already been done. pcim_intx() sits in drivers/pci/devres.c

> and use that where people actually
> want to use the crazy devres voodoo instead?  Doing this silently
> underneath will always create problems.

That's precisely what all my work is all about. The hybrid nature of
pci_intx(), pci_set_mwi() and all pci*request*() functions needs to be
removed.

However, that will take us some while, because the APIs are partly
ossificated and every user that relies on implicit crazy devres voodoo
has to be identified and then ported to *explicit* half-crazy devres
voodoo.

More details here:
https://lore.kernel.org/all/20240613115032.29098-1-pstanner@redhat.com/

P.

> 
> 


  reply	other threads:[~2024-07-25 15:21 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-25 12:07 [PATCH] PCI: Fix devres regression in pci_intx() Philipp Stanner
2024-07-25 14:26 ` Christoph Hellwig
2024-07-25 15:21   ` Philipp Stanner [this message]
2024-07-25 15:47     ` Christoph Hellwig
2024-07-25 21:00 ` Bjorn Helgaas
2024-07-26  0:19 ` Damien Le Moal
2024-07-26 18:43   ` pstanner
2024-07-26 18:59     ` Bjorn Helgaas
2024-07-29 11:29     ` Damien Le Moal
2024-07-29 15:45       ` Philipp Stanner
2024-09-03 15:44 ` Alex Williamson
2024-09-04  7:06   ` Philipp Stanner
2024-09-04  8:25     ` Damien Le Moal
2024-09-04 13:37       ` Philipp Stanner
2024-09-04 18:07         ` Alex Williamson
2024-09-04 20:24           ` Andy Shevchenko
2024-09-04 21:10             ` Alex Williamson
2024-09-05  0:33               ` Damien Le Moal
2024-09-05  1:56                 ` Alex Williamson
2024-09-05  7:13                 ` Philipp Stanner
2024-09-06  0:37                   ` Damien Le Moal
2024-09-06  6:45                     ` Philipp Stanner
2024-09-04 12:57     ` Alex Williamson
2024-09-04 13:29       ` Philipp Stanner

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=9529b8012b1a1573316d65727f231f5cf54d0315.camel@redhat.com \
    --to=pstanner@redhat.com \
    --cc=bhelgaas@google.com \
    --cc=dlemoal@kernel.org \
    --cc=hch@infradead.org \
    --cc=kwilczynski@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.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