From: Bjorn Helgaas <helgaas@kernel.org>
To: Rongguang Wei <clementwei90@163.com>
Cc: linux-pci@vger.kernel.org, bhelgaas@google.com, lukas@wunner.de,
Rongguang Wei <weirongguang@kylinos.cn>
Subject: Re: [PATCH v1] PCI: pciehp: Fix the slot in BLINKINGON_STATE when Presence Detect Changed event occurred
Date: Tue, 11 Apr 2023 13:30:40 -0500 [thread overview]
Message-ID: <20230411183040.GA4166190@bhelgaas> (raw)
In-Reply-To: <20230403054619.19163-1-clementwei90@163.com>
On Mon, Apr 03, 2023 at 01:46:19PM +0800, Rongguang Wei wrote:
> From: Rongguang Wei <weirongguang@kylinos.cn>
>
> When a Presence Detect Changed event has occurred, the slot status
> in either BLINKINGOFF_STATE or OFF_STATE, turn it off unconditionally.
> But if the slot status is in BLINKINGON_STATE and the slot is currently
> empty, the slot status was staying in BLINKINGON_STATE.
>
> The message print like this:
> pcieport 0000:00:01.5: pciehp: Slot(0-5): Attention button pressed
> pcieport 0000:00:01.5: pciehp: Slot(0-5) Powering on due to button press
> pcieport 0000:00:01.5: pciehp: Slot(0-5): Attention button pressed
> pcieport 0000:00:01.5: pciehp: Slot(0-5): Button cancel
> pcieport 0000:00:01.5: pciehp: Slot(0-5): Action canceled due to button press
>
> It cause the next Attention Button Pressed event become Button cancel
> and missing the Presence Detect Changed event with this button press
> though this button presses event is occurred after 5s.
>
> According to the Commit d331710ea78f ("PCI: pciehp: Become resilient
> to missed events"), if the slot is currently occupied, turn it on and
> if the slot is empty, it need to set in OFF_STATE rather than stay in
> current status. So the slot which status in BLINKINGON_STATE is also
> turn off unconditionally.
>
> The message print like this after the patch:
> pcieport 0000:00:01.5: pciehp: Slot(0-5): Attention button pressed
> pcieport 0000:00:01.5: pciehp: Slot(0-5) Powering on due to button press
> pcieport 0000:00:01.5: pciehp: Slot(0-5): Card not present
> pcieport 0000:00:01.5: pciehp: Slot(0-5): Already disabled
> pcieport 0000:00:01.5: pciehp: Slot(0-5): Attention button pressed
> pcieport 0000:00:01.5: pciehp: Slot(0-5) Powering on due to button press
> pcieport 0000:00:01.5: pciehp: Slot(0-5): Card not present
> pcieport 0000:00:01.5: pciehp: Slot(0-5): Already disabled
> pcieport 0000:00:01.5: pciehp: Slot(0-5): Card present
> pcieport 0000:00:01.5: pciehp: Slot(0-5): Link Up
>
> After that, the next Attention Button Pressed event would power on
> the slot normally.
Lukas, any comment?
> Fixes: d331710ea78f ("PCI: pciehp: Become resilient to missed events")
> Signed-off-by: Rongguang Wei <weirongguang@kylinos.cn>
> ---
> drivers/pci/hotplug/pciehp_ctrl.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c
> index 529c34808440..86fc9342be68 100644
> --- 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;
> @@ -261,9 +262,6 @@ void pciehp_handle_presence_or_link_change(struct controller *ctrl, u32 events)
> }
>
> switch (ctrl->state) {
> - case BLINKINGON_STATE:
> - cancel_delayed_work(&ctrl->button_work);
> - fallthrough;
> case OFF_STATE:
> ctrl->state = POWERON_STATE;
> mutex_unlock(&ctrl->state_lock);
> --
> 2.25.1
>
>
> No virus found
> Checked by Hillstone Network AntiVirus
>
next prev parent reply other threads:[~2023-04-11 18:30 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 [this message]
2023-04-16 15:18 ` Lukas Wunner
2023-04-17 3:04 ` Rongguang Wei
2023-04-17 7:11 ` Lukas Wunner
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=20230411183040.GA4166190@bhelgaas \
--to=helgaas@kernel.org \
--cc=bhelgaas@google.com \
--cc=clementwei90@163.com \
--cc=linux-pci@vger.kernel.org \
--cc=lukas@wunner.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox