Re: [Qemu-devel] [PATCH 1/7] usb: remove old usb-host code

2013-11-11 Thread Gerd Hoffmann
On Fr, 2013-11-08 at 17:51 +0100, Jan Kiszka wrote:
 On 2013-11-08 16:39, Gerd Hoffmann wrote:
Hi,
  
  OK, then here is the first issue I ran into while trying libusbx (git
  head, i.e. 1.0.17+: The new stack causes significant latency issues that
  makes it almost unusable for pass-through of USB audio devices (some
  headset in my case). Reverting usb-linux and disabling libusb over QEMU
  git head makes things work again. I'll have to stick with this for now
  as it is affecting my work environment.
 
  Any spontaneous ideas how to analyse or even resolve this?
  
  Try setting isobsize property to something smaller than 32 (which is the
  default).
 
 OK, isobsize=2 and isobufs=32 helped, possibly other combinations as
 well - but not just reducing isobsize or increasing isobufs. Any theory
 about this? How can we find better defaults?

isobsize is the size of a single buffer (in MaxPacketSize units).
isobufs is the number of buffers in the ring.

So the total ring buffer size is MaxPacketSize * isobsize * isobufs.

isobsize basically trades overhead for latency.  Larger numbers reduce
the overhead, smaller numbers reduce latency.

isobufs should be as small as possible.  Start with 4 (default).  If you
get overruns/underruns increase.

We should probably look at the endpoint interval, then calculate how
many packets we should expect within a certain time range and use that
as additional factor for the buffer size.  That should get the defaults
closer to the actual needs of the device.

cheers,
  Gerd





Re: [Qemu-devel] [PATCH 1/7] usb: remove old usb-host code

2013-11-11 Thread Hans de Goede

Hi,

On 11/11/2013 09:47 AM, Gerd Hoffmann wrote:

On Fr, 2013-11-08 at 17:51 +0100, Jan Kiszka wrote:

On 2013-11-08 16:39, Gerd Hoffmann wrote:

   Hi,


OK, then here is the first issue I ran into while trying libusbx (git
head, i.e. 1.0.17+: The new stack causes significant latency issues that
makes it almost unusable for pass-through of USB audio devices (some
headset in my case). Reverting usb-linux and disabling libusb over QEMU
git head makes things work again. I'll have to stick with this for now
as it is affecting my work environment.

Any spontaneous ideas how to analyse or even resolve this?


Try setting isobsize property to something smaller than 32 (which is the
default).


OK, isobsize=2 and isobufs=32 helped, possibly other combinations as
well - but not just reducing isobsize or increasing isobufs. Any theory
about this? How can we find better defaults?


isobsize is the size of a single buffer (in MaxPacketSize units).
isobufs is the number of buffers in the ring.

So the total ring buffer size is MaxPacketSize * isobsize * isobufs.

isobsize basically trades overhead for latency.  Larger numbers reduce
the overhead, smaller numbers reduce latency.

isobufs should be as small as possible.  Start with 4 (default).  If you
get overruns/underruns increase.

We should probably look at the endpoint interval, then calculate how
many packets we should expect within a certain time range and use that
as additional factor for the buffer size.  That should get the defaults
closer to the actual needs of the device.


hw/usb/redirect.c actually has some code for that, you could use that as
a start for the host redirection code...

Regards,

Hans



Re: [Qemu-devel] [PATCH 1/7] usb: remove old usb-host code

2013-11-08 Thread Jan Kiszka
On 2013-10-09 13:42, Gerd Hoffmann wrote:
   Hi,
 
 Only very recent distros fulfill the need of = 1.0.13, so you naturally
 fall back to this code. I just realized that even the factory build of
 OpenSUSE is still on libusb-1.0.9. Current Ubuntu versions are on 1.0.12
 at best. Didn't check others so far.

 Ouch.  The 1.0.13 release is one year old by now.

 Fedora 19 is at 1.0.16 btw.

 So isn't this step a bit too early?

 There is always the 'git revert' option in case it turns out there are
 too many issues ...

 So what to do? Do you expect all the other distros to catch up regarding
 libusb until QEMU 1.7 is released?
 
 They will update once they figure this is needed for qemu 1.7 :)
 Updates will probably not yet be available at release time though.
 
 If we revert, thereby continue fallback to the old code, chances are
 high that nothing happens and we'll face the same issue for qemu 1.8.
 
 Given that there are some known issues in the host-linux code which are
 fixed in host-libusb I really want get rid of it.

OK, then here is the first issue I ran into while trying libusbx (git
head, i.e. 1.0.17+: The new stack causes significant latency issues that
makes it almost unusable for pass-through of USB audio devices (some
headset in my case). Reverting usb-linux and disabling libusb over QEMU
git head makes things work again. I'll have to stick with this for now
as it is affecting my work environment.

Any spontaneous ideas how to analyse or even resolve this?

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux



Re: [Qemu-devel] [PATCH 1/7] usb: remove old usb-host code

2013-11-08 Thread Gerd Hoffmann
  Hi,

 OK, then here is the first issue I ran into while trying libusbx (git
 head, i.e. 1.0.17+: The new stack causes significant latency issues that
 makes it almost unusable for pass-through of USB audio devices (some
 headset in my case). Reverting usb-linux and disabling libusb over QEMU
 git head makes things work again. I'll have to stick with this for now
 as it is affecting my work environment.
 
 Any spontaneous ideas how to analyse or even resolve this?

Try setting isobsize property to something smaller than 32 (which is the
default).

cheers,
  Gerd






Re: [Qemu-devel] [PATCH 1/7] usb: remove old usb-host code

2013-11-08 Thread Jan Kiszka
On 2013-11-08 16:39, Gerd Hoffmann wrote:
   Hi,
 
 OK, then here is the first issue I ran into while trying libusbx (git
 head, i.e. 1.0.17+: The new stack causes significant latency issues that
 makes it almost unusable for pass-through of USB audio devices (some
 headset in my case). Reverting usb-linux and disabling libusb over QEMU
 git head makes things work again. I'll have to stick with this for now
 as it is affecting my work environment.

 Any spontaneous ideas how to analyse or even resolve this?
 
 Try setting isobsize property to something smaller than 32 (which is the
 default).

OK, isobsize=2 and isobufs=32 helped, possibly other combinations as
well - but not just reducing isobsize or increasing isobufs. Any theory
about this? How can we find better defaults?

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux



Re: [Qemu-devel] [PATCH 1/7] usb: remove old usb-host code

2013-10-09 Thread Jan Kiszka
On 2013-10-07 09:16, Gerd Hoffmann wrote:
 On Mi, 2013-10-02 at 15:14 +0200, Jan Kiszka wrote:
 On 2013-09-19 11:34, Gerd Hoffmann wrote:
 The usb-host code has been rewritten for qemu 1.5 to use libusb,
 the old code has been left in as temporary fallback.  Now we are
 two releases further out, targeting the 1.7 release.  No major
 issues with the new code poped up until now.  Time to remove it
 from tre tree.  Should we ever need it again for some reason --
 git has a copy for us in the history.

 Well, maybe not many users were actually exploiting the new libusb code,
 thus were able to produce feedback.

 Only very recent distros fulfill the need of = 1.0.13, so you naturally
 fall back to this code. I just realized that even the factory build of
 OpenSUSE is still on libusb-1.0.9. Current Ubuntu versions are on 1.0.12
 at best. Didn't check others so far.
 
 Ouch.  The 1.0.13 release is one year old by now.
 
 Fedora 19 is at 1.0.16 btw.
 
 So isn't this step a bit too early?
 
 There is always the 'git revert' option in case it turns out there are
 too many issues ...

So what to do? Do you expect all the other distros to catch up regarding
libusb until QEMU 1.7 is released?

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux



Re: [Qemu-devel] [PATCH 1/7] usb: remove old usb-host code

2013-10-09 Thread Gerd Hoffmann
  Hi,

  Only very recent distros fulfill the need of = 1.0.13, so you naturally
  fall back to this code. I just realized that even the factory build of
  OpenSUSE is still on libusb-1.0.9. Current Ubuntu versions are on 1.0.12
  at best. Didn't check others so far.
  
  Ouch.  The 1.0.13 release is one year old by now.
  
  Fedora 19 is at 1.0.16 btw.
  
  So isn't this step a bit too early?
  
  There is always the 'git revert' option in case it turns out there are
  too many issues ...
 
 So what to do? Do you expect all the other distros to catch up regarding
 libusb until QEMU 1.7 is released?

They will update once they figure this is needed for qemu 1.7 :)
Updates will probably not yet be available at release time though.

If we revert, thereby continue fallback to the old code, chances are
high that nothing happens and we'll face the same issue for qemu 1.8.

Given that there are some known issues in the host-linux code which are
fixed in host-libusb I really want get rid of it.

cheers,
  Gerd





Re: [Qemu-devel] [PATCH 1/7] usb: remove old usb-host code

2013-10-07 Thread Gerd Hoffmann
On Mi, 2013-10-02 at 15:14 +0200, Jan Kiszka wrote:
 On 2013-09-19 11:34, Gerd Hoffmann wrote:
  The usb-host code has been rewritten for qemu 1.5 to use libusb,
  the old code has been left in as temporary fallback.  Now we are
  two releases further out, targeting the 1.7 release.  No major
  issues with the new code poped up until now.  Time to remove it
  from tre tree.  Should we ever need it again for some reason --
  git has a copy for us in the history.
 
 Well, maybe not many users were actually exploiting the new libusb code,
 thus were able to produce feedback.
 
 Only very recent distros fulfill the need of = 1.0.13, so you naturally
 fall back to this code. I just realized that even the factory build of
 OpenSUSE is still on libusb-1.0.9. Current Ubuntu versions are on 1.0.12
 at best. Didn't check others so far.

Ouch.  The 1.0.13 release is one year old by now.

Fedora 19 is at 1.0.16 btw.

 So isn't this step a bit too early?

There is always the 'git revert' option in case it turns out there are
too many issues ...

cheers,
  Gerd






Re: [Qemu-devel] [PATCH 1/7] usb: remove old usb-host code

2013-10-02 Thread Jan Kiszka
On 2013-09-19 11:34, Gerd Hoffmann wrote:
 The usb-host code has been rewritten for qemu 1.5 to use libusb,
 the old code has been left in as temporary fallback.  Now we are
 two releases further out, targeting the 1.7 release.  No major
 issues with the new code poped up until now.  Time to remove it
 from tre tree.  Should we ever need it again for some reason --
 git has a copy for us in the history.

Well, maybe not many users were actually exploiting the new libusb code,
thus were able to produce feedback.

Only very recent distros fulfill the need of = 1.0.13, so you naturally
fall back to this code. I just realized that even the factory build of
OpenSUSE is still on libusb-1.0.9. Current Ubuntu versions are on 1.0.12
at best. Didn't check others so far.

So isn't this step a bit too early?

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux