All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: Rongguang Wei <clementwei90@163.com>
Cc: linux-pci@vger.kernel.org, bhelgaas@google.com,
	Rongguang Wei <weirongguang@kylinos.cn>
Subject: Re: [PATCH v1] PCI: pciehp: Fix the slot in BLINKINGON_STATE when Presence Detect Changed event occurred
Date: Mon, 17 Apr 2023 09:11:25 +0200	[thread overview]
Message-ID: <20230417071125.GA4930@wunner.de> (raw)
In-Reply-To: <93177ee9-2e77-1ce3-8a57-91cfb58f6eed@163.com>

On Mon, Apr 17, 2023 at 11:04:31AM +0800, Rongguang Wei wrote:
> On 4/16/23 11:18 PM, Lukas Wunner wrote:
> > On Mon, Apr 03, 2023 at 01:46:19PM +0800, Rongguang Wei wrote:
> >> --- a/drivers/pci/hotplug/pciehp_ctrl.c
> >> +++ b/drivers/pci/hotplug/pciehp_ctrl.c
> >> @@ -232,6 +232,7 @@ void pciehp_handle_presence_or_link_change(struct controller *ctrl, u32 events)
> >>  	 */
> >>  	mutex_lock(&ctrl->state_lock);
> >>  	switch (ctrl->state) {
> >> +	case BLINKINGON_STATE:
> >>  	case BLINKINGOFF_STATE:
> >>  		cancel_delayed_work(&ctrl->button_work);
> >>  		fallthrough;
> > 
> > This solution has the disadvantage that a gratuitous "Card not present"
> > message is emitted even if the slot is occupied.
> 
> I think when the "Card not present" is emitted, it may not consider the
> slot status from the beginning.

I don't quite follow.  With the change you're proposing, if the Attention
Button has been pressed and there's a card in the slot, after five seconds
you'll emit an erroneous "Card not present" message.  Erroneous because
there's a card in the slot.


> If the slot is in ON_STATE and is occupied, turn the slot off and then
> back on. The message is also emitted at first.

That's intentional.  If the slot is occupied and a Presence Detect Changed
event was received, it means the card in the slot may be a different one.
So the "Card not present" message relates to the card that was
*previously* in the slot.

If the slot is still (or again) occupied, we'll then try to bring it up
and that will lead to a subsequent "Card present" message.


> Maybe I can rework to add like this to prevent the gratuitous message:

Could you just test if the 1-line change I suggested in my previous e-mail
fixes the issue for you?

Thanks,

Lukas

  reply	other threads:[~2023-04-17  7:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-03  5:46 [PATCH v1] PCI: pciehp: Fix the slot in BLINKINGON_STATE when Presence Detect Changed event occurred Rongguang Wei
2023-04-10  5:00 ` Rongguang Wei
2023-04-11 18:30 ` Bjorn Helgaas
2023-04-16 15:18 ` Lukas Wunner
2023-04-17  3:04   ` Rongguang Wei
2023-04-17  7:11     ` Lukas Wunner [this message]
2023-04-19  2:58       ` Rongguang Wei
2023-04-19  7:48         ` Lukas Wunner
2023-04-20  9:46           ` Rongguang Wei

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=20230417071125.GA4930@wunner.de \
    --to=lukas@wunner.de \
    --cc=bhelgaas@google.com \
    --cc=clementwei90@163.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=weirongguang@kylinos.cn \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.