public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Wu, Hao A" <hao.a.wu@intel.com>
To: "Rhodes, Sean" <sean@starlabs.systems>
Cc: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"Ni, Ray" <ray.ni@intel.com>
Subject: Re: [edk2-devel] [PATCH 1/2] MdeModulePkg/UsbBusDxe: Avoid continuing on error path
Date: Wed, 21 Sep 2022 08:24:38 +0000	[thread overview]
Message-ID: <DM6PR11MB4025C72ED0A099756E62559CCA4F9@DM6PR11MB4025.namprd11.prod.outlook.com> (raw)
In-Reply-To: <CABtds-1q+tncwaY8V7mK1kuZ0uuQxpe27vALF=Cn+1OAKnUNrQ@mail.gmail.com>

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

Sorry, could you help to explain more on the endless loop? Like what causes the loop and why the proposed change can resolve the issue.
I am not experienced enough in the USB domain to quickly figure out the whole picture with only log being provided.

Best Regards,
Hao Wu

From: Sean Rhodes <sean@starlabs.systems>
Sent: Wednesday, September 21, 2022 4:01 PM
To: Wu, Hao A <hao.a.wu@intel.com>
Cc: devel@edk2.groups.io; Ni, Ray <ray.ni@intel.com>
Subject: Re: [edk2-devel] [PATCH 1/2] MdeModulePkg/UsbBusDxe: Avoid continuing on error path

Hi Hao

I've attached a debug log for the problem I'm trying to solve (these two patches solve it).

The reset happens before PortState changes, so it's an endless loop.

Thanks

Sean

On Wed, 21 Sept 2022 at 06:31, Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>> wrote:
Sorry, could you help to share more information on what issue is met for this proposed patch?

It seems to me that the change made below is to handle the case where:

  Status = HubApi->GetPortStatus (HubIf, Port, &PortState);

  if (EFI_ERROR (Status)) {
    DEBUG ((DEBUG_ERROR, "UsbEnumeratePort: failed to get state of port %d\n", Port));
    return Status;
  }

GetPortStatus() returns EFI_ SUCCESS, but does not update the output parameter 'PortState'.
Could you help to check what causes 'PortState' not being updated after a success return from GetPortStatus()? Thanks in advance.

Also, one inline comment below:


> -----Original Message-----
> From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>> On Behalf Of Sean
> Rhodes
> Sent: Tuesday, September 20, 2022 9:14 PM
> To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
> Cc: Rhodes, Sean <sean@starlabs.systems<mailto:sean@starlabs.systems>>; Wu, Hao A
> <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>
> Subject: [edk2-devel] [PATCH 1/2] MdeModulePkg/UsbBusDxe: Avoid
> continuing on error path
>
> Zero out the PortState in case GetPortStatus didn't set it, to avoid
> continuing with EFI_DEVICE_ERROR.
>
> Cc: Hao A Wu <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>
> Cc: Ray Ni <ray.ni@intel.com<mailto:ray.ni@intel.com>>
> Signed-off-by: Sean Rhodes <sean@starlabs.systems<mailto:sean@starlabs.systems>>
> ---
>  MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c
> b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c
> index aed34596f4..7fc567898a 100644
> --- a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c
> +++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c
> @@ -900,6 +900,11 @@ UsbEnumeratePort (
>    Child  = NULL;
>
>    HubApi = HubIf->HubApi;
>
>
>
> +  // Zero out PortState in case GetPortStatus does not set it and we
>
> +  // continue on the EFI_DEVICE_ERROR path
>
> +  PortState.PortStatus       = 0;
>
> +  PortState.PortChangeStatus = 0;


Could you help to use:

  ZeroMem (&PortState, sizeof (EFI_USB_PORT_STATUS));

here to align with other places in this driver?


Best Regards,
Hao Wu


>
> +
>
>    //
>
>    // Host learns of the new device by polling the hub for port changes.
>
>    //
>
> --
> 2.34.1
>
>
>
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#93989): https://edk2.groups.io/g/devel/message/93989
> Mute This Topic: https://groups.io/mt/93802896/1768737
> Group Owner: devel+owner@edk2.groups.io<mailto:devel%2Bowner@edk2.groups.io>
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>]
> -=-=-=-=-=-=
>

[-- Attachment #2: Type: text/html, Size: 8769 bytes --]

  reply	other threads:[~2022-09-21  8:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-20 13:14 [PATCH 1/2] MdeModulePkg/UsbBusDxe: Avoid continuing on error path Sean Rhodes
2022-09-20 13:14 ` [PATCH 2/2] MdeModulePkg/UsbBusDxe: Reset the device on error Sean Rhodes
2022-09-21  5:31   ` [edk2-devel] " Wu, Hao A
2022-09-21  5:30 ` [edk2-devel] [PATCH 1/2] MdeModulePkg/UsbBusDxe: Avoid continuing on error path Wu, Hao A
2022-09-21  8:00   ` Sean Rhodes
2022-09-21  8:24     ` Wu, Hao A [this message]
2022-09-21  8:36       ` Sean Rhodes
2022-09-22  7:30         ` Wu, Hao A
2022-09-23  8:02           ` Sean Rhodes
2022-09-23  8:12             ` Wu, Hao A

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-list 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=DM6PR11MB4025C72ED0A099756E62559CCA4F9@DM6PR11MB4025.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /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