ehci: faster frame index calculation for skipped frames
commit72aa364b1d9daa889bb5898ea4aded9d27fd1c96
authorEvgeny Yakovlev <eyakovlev@virtuozzo.com>
Wed, 27 Jul 2016 16:55:20 +0000 (27 19:55 +0300)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 2 Aug 2016 11:35:24 +0000 (2 13:35 +0200)
treebb52004dc263716b2baf7b2da2aab04e7f020ce1
parentc16e366464a1884c355e85878874afffa790ecbf
ehci: faster frame index calculation for skipped frames

ehci_update_frindex takes time linearly proportional to a number
of uframes to calculate new frame index and raise FLR interrupts,
which is a problem for large amounts of uframes.

If we experience large delays between echi timer callbacks (i.e. because
other periodic handlers have taken a lot of time to complete) we
get a lot of skipped frames which then delay ehci timer callback more
and this leads to deadlocking the system when ehci schedules next
callback to be too soon.

Observable behaviour is qemu consuming 100% host CPU time while guest
is unresponsive. This misbehavior could happen for a while and QEMU does
not get out from this state automatically without the patch.

This change makes ehci_update_frindex execute in constant time.

Signed-off-by: Evgeny Yakovlev <eyakovlev@virtuozzo.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
Message-id: 1469638520-32706-1-git-send-email-den@openvz.org
CC: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
hw/usb/hcd-ehci.c