CPU utilization is a known issue with UHCI emulation.  I spent a short
time poking around the code and USB specifications trying to come up
with a way to detect "idle" periods where we don't need to poll the
frame list at 1000 Hz.

I was hoping to find a solution to detect an "idle" UHCI state, i.e. a
stable state where the guest is waiting for UHCI to report events and
the guest isn't issuing new transfers.  If the idle state can be
detected, then UHCI stops its frame timer and protects the frame list
and other control structure guest memory pages.

When the guest writes to those memory pages again in order to issue a
new USB transaction, we catch the write.  UHCI unprotects the guest
memory pages and turns the frame timer back on.

Unfortunately the UHCI frame list, transfer descriptor, and QH
structure is complicated.  I didn't figure out whether it is feasible
to protect all the necessary guest memory pages.

Also, I'm not sure how easy it is for QEMU to protect guest memory in
this fashion (for TCG and KVM).  It seems like the VGA dirty memory
stuff polls - it accumulates dirty memory bits and gets checked by the
VGA emulation code in the necessary places - rather than intercepts
writes.

Any thoughts on this approach?

Stefan

Reply via email to