public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Lukas Wunner <lukas@wunner.de>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
	linux-pci@vger.kernel.org,  Guenter Roeck <groeck@juniper.net>,
	 Mika Westerberg <mika.westerberg@linux.intel.com>,
	 "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	 Rajat Jain <rajatxjain@gmail.com>,
	 Joel Mathew Thomas <proxy0@tutamail.com>,
	 LKML <linux-kernel@vger.kernel.org>,
	 Jonathan Cameron <Jonathan.Cameron@huawei.com>
Subject: Re: [PATCH 3/4] PCI/hotplug: reset_lock is not required synchronizing with irq thread
Date: Fri, 14 Mar 2025 13:18:07 +0200 (EET)	[thread overview]
Message-ID: <c4023681-3899-ad3b-82d8-53cc42312970@linux.intel.com> (raw)
In-Reply-To: <Z9Ppr63yDUhOF1Xo@wunner.de>

[-- Attachment #1: Type: text/plain, Size: 1861 bytes --]

On Fri, 14 Mar 2025, Lukas Wunner wrote:

> On Thu, Mar 13, 2025 at 04:23:32PM +0200, Ilpo Järvinen wrote:
> > Disabling HPIE (Hot-Plug Interrupt Enable) and synchronizing with irq
> > handling in pciehp_reset_slot() is enough to ensure no pending events
> > are processed during the slot reset. Thus, there is no need to take
> > reset_lock in the IRQ thread.
> [...]
> > --- a/drivers/pci/hotplug/pciehp_hpc.c
> > +++ b/drivers/pci/hotplug/pciehp_hpc.c
> > @@ -748,12 +748,10 @@ static irqreturn_t pciehp_ist(int irq, void *dev_id)
> >  	 * Disable requests have higher priority than Presence Detect Changed
> >  	 * or Data Link Layer State Changed events.
> >  	 */
> > -	down_read_nested(&ctrl->reset_lock, ctrl->depth);
> >  	if (events & DISABLE_SLOT)
> >  		pciehp_handle_disable_request(ctrl);
> >  	else if (events & (PCI_EXP_SLTSTA_PDC | PCI_EXP_SLTSTA_DLLSC))
> >  		pciehp_handle_presence_or_link_change(ctrl, events);
> > -	up_read(&ctrl->reset_lock);
> >  
> >  	ret = IRQ_HANDLED;
> >  out:
> 
> The release and re-acquisition of reset_lock in
> pciehp_configure_device() and pciehp_unconfigure_device()
> needs to be removed as well if the above hunk is applied.

Ah, right. I also now removed reset_lock from 
pciehp_ignore_dpc_link_change() that is directly called from pciehp_ist().

This leaves reset_lock only into pciehp_free_irq(), pciehp_reset_slot(), 
and pciehp_check_presence(). It seems to me pciehp_check_presence() 
requires keeping reset_lock as is. The former two could have synchronized 
with a mutex and shorter critical sections in pciehp_reset_slot() but it 
doesn't look worth the effort (IMO) to divide reset_lock into two to 
realize that.

> But please wait a little while before respinning so that I can
> think through the whole series.

Sure, take your time. :-)

-- 
 i.

  reply	other threads:[~2025-03-14 11:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-13 14:23 [PATCH 0/4] PCI/hotplug: Fix interrupt / event handling problems Ilpo Järvinen
2025-03-13 14:23 ` [PATCH 1/4] PCI/hotplug: Disable HPIE over reset Ilpo Järvinen
2025-03-15 15:58   ` Lukas Wunner
     [not found]     ` <OLQ9qyD--F-9@tutamail.com>
2025-03-15 21:12       ` Lukas Wunner
2025-03-17 18:08     ` Ilpo Järvinen
2025-03-13 14:23 ` [PATCH 2/4] PCI/hotplug: Clearing HPIE for the duration of reset is enough Ilpo Järvinen
2025-03-13 14:23 ` [PATCH 3/4] PCI/hotplug: reset_lock is not required synchronizing with irq thread Ilpo Järvinen
2025-03-14  8:32   ` Lukas Wunner
2025-03-14 11:18     ` Ilpo Järvinen [this message]
2025-03-13 14:23 ` [PATCH 4/4] PCI/hotplug: Don't enabled HPIE in poll mode Ilpo Järvinen
2025-03-15 11:57   ` Lukas Wunner

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=c4023681-3899-ad3b-82d8-53cc42312970@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=bhelgaas@google.com \
    --cc=groeck@juniper.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=mika.westerberg@linux.intel.com \
    --cc=proxy0@tutamail.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=rajatxjain@gmail.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