lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Wed, 6 Oct 2021 09:47:09 +0000
From:   Flavio Suligoi <f.suligoi@...m.it>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
CC:     Alan Stern <stern@...land.harvard.edu>,
        Thinh Nguyen <Thinh.Nguyen@...opsys.com>,
        Mathias Nyman <mathias.nyman@...ux.intel.com>,
        Bjorn Helgaas <bhelgaas@...gle.com>,
        Andrew Lunn <andrew@...n.ch>,
        Chris Chiu <chris.chiu@...onical.com>,
        Rajat Jain <rajatja@...gle.com>,
        "linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v1] usb: core: hub: improve port over-current alert msg

Hi Greg,

> > (such as the TPS20xx, etc.), after the over-current
> > detection and the consequent shutdown, return
> > in the normal state.
> 
> Please use the full 72 columns of the changelog text.

Ok

> 
> 
> >
> > So, in these cases, the over-current error message
> > never appears.
> >
> > To overcome this problem, the "over-current condition"
> > message is displayed even after some over-current events.
> >
> > Signed-off-by: Flavio Suligoi <f.suligoi@...m.it>
> > ---
> >  arch/arm64/boot/dts/Makefile | 1 +
> >  drivers/usb/core/hub.c       | 5 +++--
> >  2 files changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/arm64/boot/dts/Makefile b/arch/arm64/boot/dts/Makefile
> > index 639e01a4d855..bf26ce60d78a 100644
> > --- a/arch/arm64/boot/dts/Makefile
> > +++ b/arch/arm64/boot/dts/Makefile
> > @@ -8,6 +8,7 @@ subdir-y += amlogic
> >  subdir-y += apm
> >  subdir-y += apple
> >  subdir-y += arm
> > +subdir-y += asem
> >  subdir-y += bitmain
> >  subdir-y += broadcom
> >  subdir-y += cavium
> 
> I do not think this change is part of this :(

right, my mistake, sorry!

> 
> > diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> > index 86658a81d284..ff6c8e0e2673 100644
> > --- a/drivers/usb/core/hub.c
> > +++ b/drivers/usb/core/hub.c
> > @@ -5577,7 +5577,8 @@ static void port_event(struct usb_hub *hub, int
> port1)
> >  		msleep(100);	/* Cool down */
> >  		hub_power_on(hub, true);
> >  		hub_port_status(hub, port1, &status, &unused);
> > -		if (status & USB_PORT_STAT_OVERCURRENT)
> > +		if ((status & USB_PORT_STAT_OVERCURRENT) ||
> > +		    !(port_dev->over_current_count % 15))
> 
> What is 15?

It's an empiric value to have a message about every 1.5 - 2 seconds (100ms * 15).
Ok, this value is not clear; I can change this fixed number in something like this:
...
#define USB_OC_COOL_DOWN_TIME		100	/* ms */
#define USB_OC_REPEATED_MSG_DELAY	1500	/* ms */
...
...
msleep(COOLING_DOWN_TIME);	/* Cool down */
...
    if ((status & USB_PORT_STAT_OVERCURRENT) ||
        !(port_dev->over_current_count %
           (USB_OC_REPEATED_MSG_DELAY / USB_OC_COOL_DOWN_TIME)))
	dev_err(&port_dev->dev, "over-current condition\n");


> 
> >  			dev_err(&port_dev->dev, "over-current condition\n");
> >  	}
> >
> > @@ -5738,7 +5739,7 @@ static void hub_event(struct work_struct *work)
> >  			u16 status = 0;
> >  			u16 unused;
> >
> > -			dev_dbg(hub_dev, "over-current change\n");
> > +			dev_info(hub_dev, "over-current change\n");
> 
> This is just going to be noisy, what can a user do with this?

Right, it's a redundant information.

> 
> thanks,
> 
> greg k-h

Thanks for your time,

Flavio

Powered by blists - more mailing lists