Virtual Private Server (VPS) Hosting provided by Central Point Networking cpnllc.com
For some reason, the "Nodelist" and "Recent Callers" features are not working.
Sysop: | Ray Quinn |
---|---|
Location: | Visalia, CA |
Users: | 50 |
Nodes: | 10 (0 / 10) |
Uptime: | 38:55:47 |
Calls: | 2 |
Files: | 11,854 |
Messages: | 148,240 |
Check out the US 99 menu above for links to information about US Highway 99, after which the US 99 BBS is named.
Be sure to click on the Amateur Radio menu item above for packet BBSes, packet software, packet organizations, as well as packet how-to's. Also included is links to local and some not-so-local Amateur Radio Clubs.
* Lu Baolu <baolu.lu@linux.intel.com> wrote:
Yeah - so could we do this in a more generic fashion, not in the early-printkHiding essentially an early udelay() implementation in an early-printk driver isSure. How about below change?
ugly and counterproductive.
diff --git a/drivers/usb/early/xhci-dbc.c b/drivers/usb/early/xhci-dbc.c
index d3f0c84..940989e 100644
--- a/drivers/usb/early/xhci-dbc.c
+++ b/drivers/usb/early/xhci-dbc.c
@@ -587,6 +587,35 @@ static int xdbc_bulk_transfer(void *data, int size, bool read)
return size;
}
+static void __init xdbc_udelay_calibration(void)
+{
+ unsigned long lpj = 0;
+ unsigned int tsc_khz, cpu_khz;
+
+ if (!boot_cpu_has(X86_FEATURE_TSC))
+ goto calibration_out;
+
+ cpu_khz = x86_platform.calibrate_cpu();
+ tsc_khz = x86_platform.calibrate_tsc();
+
+ if (tsc_khz == 0)
+ tsc_khz = cpu_khz;
+ else if (abs(cpu_khz - tsc_khz) * 10 > tsc_khz)
+ cpu_khz = tsc_khz;
+
+ if (!tsc_khz)
+ goto calibration_out;
+
+ lpj = tsc_khz * 1000;
+ do_div(lpj, HZ);
+
+calibration_out:
+ if (!lpj)
+ lpj = 1 << 22;
+
+ loops_per_jiffy = lpj;
+}
+
static int __init xdbc_early_setup(void)
{
int ret;
@@ -686,6 +715,8 @@ int __init early_xdbc_parse_parameter(char *s)
}
xdbc.xdbc_reg = (struct xdbc_regs __iomem *)(xdbc.xhci_base + offset);
+ xdbc_udelay_calibration();
+
return 0;
}
driver but in core x86 code?
On Wed, Jan 25, 2017 at 11:51:34PM +0800, Lu Baolu wrote:
I have vague memories from a prior discussion where you said this READYWhat is timeout and why?Put it in simple:
The driver sets the RUN bit in control register and polls READY
bit in status register for the successful USB device enumeration.
As the USB device enumeration might fail and the READY bit will
never be set, the driver must have a timeout logic to avoid
endless loop.
More details:
The operational model is that driver sets up all necessary registers
and data structures, and then starts the debug engine by setting
the RUN/STOP bit in the control register.
The debug engine then brings up itself as a ready-for-enumeration
USB device. The USB link between host and device starts link training
and then host will detect the connected device. The hub driver in
host will then starts the USB device enumeration processes (as defined
in USB spec). If everything goes smoothly, the device gets enumerated
and host can talk with the debug device.
After that, xdbc firmware will set the READY bit in status register. And
the driver can go ahead with data transfer over USB.
state can be lost at any time (cable unplug or whatnot) and at that
point the driver should re-start the setup, right?
So is there really no way to way to distinguish between "I did setup andIf there is an error other than !ready, I wouldYeah, this might be another choice of hardware design. But it's not a
expect the hardware to inform you of this through another status bit,
no?
topic for this driver.
am waiting for READY", "I did setup, am waiting for READY, but things
got hosed" and "I was READY, things be hosed" ?
I suppose the first and last can be distinguished by remembering if you
ever saw READY, but the first and second are the interesting case I
think.
Loosing output, esp. without indication, is very _very_ annoying whenSo why can't you poll indefinitely for either ready or error?Even if the hardware has both ready and error status bits, it's still
nice to have a time out watch dog. Buggy hardware or firmware
might not set any of these bits. Polling indefinitely might result in
a endless loop.
you're debugging things. Its just about on par with a stuck system, at
least then you know something bad happened.
Fair enough.
USB connection is stable enough, unless the user unplugs the
USB cable during debugging.
Hi,out.
On 01/25/2017 10:38 PM, Peter Zijlstra wrote:
On Wed, Jan 25, 2017 at 08:27:38PM +0800, Lu Baolu wrote:
In my driver, udelay() is mostly used to handle time out.
Xdbc hides most USB things in its firmware. Early printk driver only needs >> to setup the registers/data structures and wait until link ready or time
waitingWithout udelay(), I have no means to convert the polling times into
time.What is timeout and why?
Put it in simple:
The driver sets the RUN bit in control register and polls READY
bit in status register for the successful USB device enumeration.
As the USB device enumeration might fail and the READY bit will
never be set, the driver must have a timeout logic to avoid
endless loop.
* Lu Baolu <baolu.lu@linux.intel.com> wrote:status
Fair enough.What does the hardware do in this case? The XHCI registers are in the host hardware, so they won't disappear, right? Is there some cable connection
USB connection is stable enough, unless the user unplugs the
USB cable during debugging.
bit we can extract without interrupts?
I.e. if there's any polling component then it would be reasonable to add anerror
component: poll the status and if it goes 'disconnected' then disableearly-printk
altogether in this case and trigger an emergency printk() so that there'schance
that the user notices [if the system does not misbehave otherwise].host
I.e. try to be as robust and informative as lockdep - yet don't lock up the
kernel: lockdep too is called from very deep internals, there are various conditions where it sees corrupt data structures (i.e. a 'disconnect' - asystem
environment outside the normal bounds of operation), yet of the kernel andover
the last 10+ years of lockdep's existence we had very, very few cases oflockdep
itself locking up and behaving unpredictably.
Thanks,
Ingo
Hi Ingo,status
On 01/26/2017 03:19 PM, Ingo Molnar wrote:
* Lu Baolu <baolu.lu@linux.intel.com> wrote:
Fair enough.What does the hardware do in this case? The XHCI registers are in the host hardware, so they won't disappear, right? Is there some cable connection
USB connection is stable enough, unless the user unplugs the
USB cable during debugging.
bit we can extract without interrupts?
Yes, there are register bits for us to know the cable status. I will go through the spec again and give you more accurate answer later.
I'm sorry. I will be off during the next 7 days for Chinese New Year
holiday. My email access will be very limited during this time. I will revisit this thread after I am back from holiday.
Sorry for the inconvenience.
* Lu Baolu <baolu.lu@linux.intel.com> wrote:status
Fair enough.
USB connection is stable enough, unless the user unplugs the
USB cable during debugging.
What does the hardware do in this case? The XHCI registers are in the host hardware, so they won't disappear, right? Is there some cable connection
bit we can extract without interrupts?error
I.e. if there's any polling component then it would be reasonable to add an
component: poll the status and if it goes 'disconnected' then disableearly-printk
altogether in this case and trigger an emergency printk() so that there'schance
that the user notices [if the system does not misbehave otherwise].
On Thu, Jan 26, 2017 at 08:19:37AM +0100, Ingo Molnar wrote:status
* Lu Baolu <baolu.lu@linux.intel.com> wrote:
Fair enough.
USB connection is stable enough, unless the user unplugs the
USB cable during debugging.
What does the hardware do in this case? The XHCI registers are in the host hardware, so they won't disappear, right? Is there some cable connection
errorbit we can extract without interrupts?
I.e. if there's any polling component then it would be reasonable to add an
early-printkcomponent: poll the status and if it goes 'disconnected' then disable
chancealtogether in this case and trigger an emergency printk() so that there's
that the user notices [if the system does not misbehave otherwise].
That'll be fun when printk() == early_printk() :-)
I myself wouldn't mind the system getting stuck until the link is re-established. My own damn fault for taking that cable out etc.
an errorI.e. if there's any polling component then it would be reasonable to add
early-printkcomponent: poll the status and if it goes 'disconnected' then disable
chancealtogether in this case and trigger an emergency printk() so that there's
case,that the user notices [if the system does not misbehave otherwise].
That'll be fun when printk() == early_printk() :-)
My suggestion would be to just print into the printk buffer directly in this
without console output - the developer will notice it in 'dmesg'.
realizingI myself wouldn't mind the system getting stuck until the link is re-established. My own damn fault for taking that cable out etc.
That's fine too, although beyond the obvious "yanked the cable without
it" case there are corner cases where usability is increased massively if theUSB
kernel is more proactive about error conditions: for example there are sub-standard USB cables and there are too long USB pathways from overloaded
hubs which can result in intermittent behavior, etc.such
A clear diagnostic message in 'dmesg' that the USB host controller is unhappy
about the USB-debug dongle device is a _lot_ more useful when troubleshooting
problems than the occasional weird, non-deterministic hang...
On Thu, Jan 26, 2017 at 05:01:05PM +0100, Ingo Molnar wrote:add an error
I.e. if there's any polling component then it would be reasonable to
early-printkcomponent: poll the status and if it goes 'disconnected' then disable
there's chancealtogether in this case and trigger an emergency printk() so that
this case,that the user notices [if the system does not misbehave otherwise].
That'll be fun when printk() == early_printk() :-)
My suggestion would be to just print into the printk buffer directly in
without console output - the developer will notice it in 'dmesg'.
When you map printk() onto early_printk() dmesg will be empty, there
will be nothing there, and therefore no reason what so ever to look
there.
I certainly don't ever look there.
Note that the printk buffer itself is a major part of why printk sucks donkey
balls. Not to mention that you really cannot have an early_printk() implementation that depends on printk().
exampleI myself wouldn't mind the system getting stuck until the link is re-established. My own damn fault for taking that cable out etc.
That's fine too, although beyond the obvious "yanked the cable without realizing it" case there are corner cases where usability is increased massively if the kernel is more proactive about error conditions: for
unhappythere are sub-standard USB cables and there are too long USB pathways from overloaded USB hubs which can result in intermittent behavior, etc.
A clear diagnostic message in 'dmesg' that the USB host controller is
troubleshootingabout the USB-debug dongle device is a _lot_ more useful when
getssuch problems than the occasional weird, non-deterministic hang...
Sure, I'm just not sure what or where makes sense.
If your serial cable is bad you notice because you don't receive the right amount of characters and or stuff gets mangled. You chuck the cable and get a
new one.
I think the most important part is re-establishing the link when the cable
re-inserted. Maybe we should just drop all characters written when there's no
link and leave it at that, same as serial.