Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: [netbsd-10] src/sys/dev/usb



Module Name:    src
Committed By:   martin
Date:           Mon Oct 30 17:45:10 UTC 2023

Modified Files:
        src/sys/dev/usb [netbsd-10]: ehci.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #440):

        sys/dev/usb/ehci.c: revision 1.318
        sys/dev/usb/ehci.c: revision 1.319

ehci(4): Fix cv_timedwait loop in ehci_sync_hc.

Stop when
        now - starttime >= delta,
i.e., when at least delta ticks have elapsed since the start, not
when
        endtime - now > delta,
i.e., more than delta ticks _remain_ to sleep, which is never going
to happen (except on arithmetic overflow).

As is, what will happen in the case that should time out is that we
wake up after delta ticks, and find now = getticks() is exactly
endtime, so we retry cv_timedwait with timo=(endtime - now)=0 which
means sleep indefinitely with no timeout as if with cv_wait.

PR port-i386/57662

ehci(4): Fix bug causing missed wakeups since ehci.c 1.308.

For reasons beyond me now, I used cv_signal on the same cv that is
used to wait for the doorbell to be available _and_ to wait for the
host controller to acknowledge the doorbell.  Which means when the
host controller acknowledges the doorbell, we might wake some thread
waiting for the doorbell to be available -- and leave the thread
waiting for the doorbell acknowledgment hanging indefinitely.

PR port-i386/57662


To generate a diff of this commit:
cvs rdiff -u -r1.315.2.1 -r1.315.2.2 src/sys/dev/usb/ehci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




Home | Main Index | Thread Index | Old Index