Re: [PATCH] Slight optimisation of the uhci-hcd init code

From: Alan Stern
Date: Mon Feb 09 2004 - 17:09:02 EST


Thanks for fowarding this, Johannes.

On Mon, 9 Feb 2004 eric.piel@xxxxxxxxxxxxxxxx wrote:

> Hello,
>
> While trying to understand why starting usb on my laptop made the bus master
> activity full I came accross a strange code in uhci-hcd: a seven level nested
> "if". The same thing can be achieved with a simgle ffz(). The attached patch
> should give to the code a bit better looking, on my x86 it even saves 96 bytes,
> cool ;-)
>
> hoping you like it,
> Eric Piel

It's a nice idea. I was planning to alter the logic behind that nested
"if" anyway, and I'll keep your recommendation in mind when I do it.

> PS: still, I'm not sure it's normal to see ffffffff as "bus master activity" in
> /proc/acpi/processor/CPU0/power as soon as uhci-hcd is loaded. In particular, it
> prevents the processor to go to C3 state. Could you give me your pint of view?

I'm not sure exactly what the ffffffff value means -- maximum utilization?

Anyway, a UHCI host controller is a bus master and it can generate a lot
of activity depending on what USB devices are plugged in. If no USB
devices are plugged, the controller will be suspended after 1 second.
Of course then it shouldn't be accessing the PCI bus at all.

There is one exception to this. Some manufacturers try to disable unused
USB ports on their motherboards by tying the overcurrent input permanently
high. (This seems to be particularly common among laptops.) With some
Intel controllers this strategy generates "device-connected" interrupts,
so the driver doesn't try to suspend the controller. There's a patch to
fix this behavior currently being tested.

Alan Stern

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/