[Bug 226961] [wsp] [patch] Add support for right & middle click with integrated button

2018-03-27 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=226961

Mark Linimon  changed:

   What|Removed |Added

   Keywords||patch

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


[Bug 226961] [wsp] [patch] Add support for right & middle click with integrated button

2018-03-27 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=226961

Hans Petter Selasky  changed:

   What|Removed |Added

 CC||hsela...@freebsd.org
   Assignee|freebsd-usb@FreeBSD.org |hsela...@freebsd.org

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


[Bug 226968] IRQ storm on cpu0 timer when holding down key on USB keyboard

2018-03-27 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=226968

Bug ID: 226968
   Summary: IRQ storm on cpu0 timer when holding down key on USB
keyboard
   Product: Base System
   Version: CURRENT
  Hardware: Any
OS: Any
Status: New
  Severity: Affects Some People
  Priority: ---
 Component: usb
  Assignee: freebsd-usb@FreeBSD.org
  Reporter: johal...@gmail.com

I noticed this when playing a first person shooter with keyboard controls.
To verify, do the following:

Open a terminal window (I used xfce4-terminal)

Run 
$ systat -vmstat

On the USB keyboard, hold down some key like 'a'.
All is normal at this stage. 

Without releasing 'a', press and release another key, like 'b'.

See the irqs on cpu0:timer go up to several hundred thousand.

Release 'a' and it will go back to normal. 


USB debug information (hw.usb.xhci.debug=16) does not show abnormal amounts of
interrupts.

With this bug, playing a fps-like game with keyboard controls is impossible
since the whole game lags during irq storm.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


[Bug 226968] IRQ storm on cpu0 timer when holding down key on USB keyboard

2018-03-27 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=226968

--- Comment #1 from Johannes Lundberg  ---
I should mention that I'm using a EVDEV enabled kernel. I have not tried this
on a non-EVDEV kernel.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


[Bug 226968] IRQ storm on cpu0 timer when holding down key on USB keyboard

2018-03-27 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=226968

--- Comment #2 from Johannes Lundberg  ---
Also, the laptop's built-in PS/2 keyboard does not show this behavior, only the
external USB keyboard (tried two different keyboards).

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


[Bug 226968] IRQ storm on cpu0 timer when holding down key on USB keyboard

2018-03-27 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=226968

--- Comment #3 from Hans Petter Selasky  ---
Hi,

I have been discussing some patches with Bruce Evans on this topic. The problem
is the keyboard repeat rate is zero, which cause the timer to trigger
instantly. This issue fell off my radar. Here is the last patch WIP:

Index: sys/arm/samsung/exynos/chrome_kb.c
===
--- sys/arm/samsung/exynos/chrome_kb.c
+++ sys/arm/samsung/exynos/chrome_kb.c
@@ -514,17 +514,8 @@
 if (!KBD_HAS_DEVICE(kbd)) {
 return (0);
 }
-if (((int *)arg)[1] < 0) {
-return (EINVAL);
-}
-if (((int *)arg)[0] < 0) {
-return (EINVAL);
-}
-if (((int *)arg)[0] < 200)/* fastest possible value */
-kbd->kb_delay1 = 200;
-else
-kbd->kb_delay1 = ((int *)arg)[0];
-kbd->kb_delay2 = ((int *)arg)[1];
+kbd->kb_delay1 = KEYBOARD_REPEAT_GET(arg,0,200,1000);
+kbd->kb_delay2 = KEYBOARD_REPEAT_GET(arg,1,34,504);
 return (0);

 case KDSETRAD:/* set keyboard repeat rate (old
Index: sys/arm/versatile/pl050.c
===
--- sys/arm/versatile/pl050.c
+++ sys/arm/versatile/pl050.c
@@ -418,17 +418,8 @@
 if (!KBD_HAS_DEVICE(kbd)) {
 return (0);
 }
-if (((int *)arg)[1] < 0) {
-return (EINVAL);
-}
-if (((int *)arg)[0] < 0) {
-return (EINVAL);
-}
-if (((int *)arg)[0] < 200)/* fastest possible value */
-kbd->kb_delay1 = 200;
-else
-kbd->kb_delay1 = ((int *)arg)[0];
-kbd->kb_delay2 = ((int *)arg)[1];
+kbd->kb_delay1 = KEYBOARD_REPEAT_GET(arg,0,200,1000);
+kbd->kb_delay2 = KEYBOARD_REPEAT_GET(arg,1,34,504);
 return (0);

 #if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \
Index: sys/dev/adb/adb_kbd.c
===
--- sys/dev/adb/adb_kbd.c
+++ sys/dev/adb/adb_kbd.c
@@ -780,16 +780,8 @@
 case KDSETREPEAT:
 if (!KBD_HAS_DEVICE(kbd))
 return 0;
-if (((int *)data)[1] < 0)
-return EINVAL;
-if (((int *)data)[0] < 0)
-return EINVAL;
-else if (((int *)data)[0] == 0)  /* fastest possible value */
-kbd->kb_delay1 = 200;
-else
-kbd->kb_delay1 = ((int *)data)[0];
-kbd->kb_delay2 = ((int *)data)[1];
-
+kbd->kb_delay1 = KEYBOARD_REPEAT_GET(data,0,200,1000);
+kbd->kb_delay2 = KEYBOARD_REPEAT_GET(data,1,34,504);
 break;

 case KDSETRAD:
Index: sys/dev/gpio/gpiokeys.c
===
--- sys/dev/gpio/gpiokeys.c
+++ sys/dev/gpio/gpiokeys.c
@@ -822,17 +822,8 @@
 if (!KBD_HAS_DEVICE(kbd)) {
 return (0);
 }
-if (((int *)arg)[1] < 0) {
-return (EINVAL);
-}
-if (((int *)arg)[0] < 0) {
-return (EINVAL);
-}
-if (((int *)arg)[0] < 200)/* fastest possible value */
-kbd->kb_delay1 = 200;
-else
-kbd->kb_delay1 = ((int *)arg)[0];
-kbd->kb_delay2 = ((int *)arg)[1];
+kbd->kb_delay1 = KEYBOARD_REPEAT_GET(arg,0,200,1000);
+kbd->kb_delay2 = KEYBOARD_REPEAT_GET(arg,1,34,504);
 return (0);

 #if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \
Index: sys/dev/usb/input/ukbd.c
===
--- sys/dev/usb/input/ukbd.c
+++ sys/dev/usb/input/ukbd.c
@@ -1946,14 +1946,8 @@
 if (!KBD_HAS_DEVICE(kbd)) {
 return (0);
 }
-/*
- * Convert negative, zero and tiny args to the same limits
- * as atkbd.  We could support delays of 1 msec, but
- * anything much shorter than the shortest atkbd value
- * of 250.34 is almost unusable as well as incompatible.
- */
-kbd->kb_delay1 = imax(((int *)arg)[0], 250);
-kbd->kb_delay2 = imax(((int *)arg)[1], 34);
+kbd->kb_delay1 = KEYBOARD_REPEAT_GET(arg,0,200,1000);
+kbd->kb_delay2 = KEYBOARD_REPEAT_GET(arg,1,34,504);
 #ifdef EVDEV_SUPPORT
 if (sc->sc_evdev != NULL)
 evdev_push_repeats(sc->sc_evdev, kbd);
Index: sys/sys/kbio.h
===
--- sys/sys/kbio.h
+++ sys/sys/kbio.h
@@ -87,6 +87,15 @@
 intkb_repeat[2];
 };
 typedef struct keyboard_repeat keyboard_repeat_t;
+
+#defineKEYBOARD_REPEAT_GET(p,i,min,max) ({\
+const struct keyboard_repeat *__ptr =\
+(const struct keyboard_repeat *)(p);\
+__ptr->kb_repeat[i] < (min) ? (int)(min) :\
+__ptr->kb_repeat[i] > (max) ? (int)(max) :\
+__ptr->kb_repeat[i];\
+})
+
 #define

[Bug 226968] IRQ storm on cpu0 timer when holding down key on USB keyboard

2018-03-27 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=226968

--- Comment #4 from Johannes Lundberg  ---
Hi

I tried a variant of this patch a few weeks ago and it did help a bit to reduce
interrupts but the problem described in this report still remains, even with
the patch you provided.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


[Bug 226968] IRQ storm on cpu0 timer when holding down key on USB keyboard

2018-03-27 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=226968

--- Comment #5 from Hans Petter Selasky  ---
Can you try to identify the timer causing this?

--HPS

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


[Bug 225794] VM images for 12.0-CURRENT have problem with USB 3.0 ports

2018-03-27 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=225794

--- Comment #38 from Andriy Gapon  ---
(In reply to David.Boyd49 from comment #37)

That's interesting and puzzling.
When you rebooted to multi-user, did you still have the patched kernel?
If so, then maybe when you booted the hardware (or VirtualBox) was already
wedged?
Because single-user vs multi-user mode should not have any effect on CAM and
USB.

So, I'd like to double-check with you if the patch helps.
And, if yes, could you please repeat the single user mode test again?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


[Bug 226968] IRQ storm on cpu0 timer when holding down key on USB keyboard

2018-03-27 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=226968

--- Comment #6 from Johannes Lundberg  ---
Here output from 
# dtrace -n 'profile-997hz /arg0/ { @[func(arg0)]=count(); }'
run for about 10 seconds for each state 

First idle state

-- SNIP --
  linux_common.ko`linux_kernver 1
  linux.ko`linux_gettimeofday   1
  linux.ko`linux_sendsig1
  kernel`ithread_loop   2
  kernel`witness_checkorder 2
  kernel`witness_warn   2
  linux.ko`0x820c2f60   2
  kernel`_isitmyx   3
  kernel`witness_unlock 4
  kernel`vt_fb_bitblt_bitmap   11
  kernel`spinlock_exit 11
  kernel`cpu_idle  37
  kernel`acpi_cpu_idle  26778


And then with cpu0:timer firing at 800k/s

-- SNIP --
  kernel`pagezero   1
  linux.ko`0x820c2f60   1
  kernel`vt_fb_bitblt_text  2
  kernel`vt_fb_bitblt_bitmap   11
  kernel`lock_mtx  16
  kernel`lock_delay21
  kernel`unlock_mtx31
  kernel`cpu_idle  55
  kernel`callout_when  57
  kernel`witness_lock  77
  kernel`callout_reset_sbt_on  85
  kernel`spinlock_enter99
  kernel`__mtx_lock_spin_flags103
  kernel`softclock_call_cc118
  kernel`ukbd_timeout 119
  kernel`witness_checkorder   150
  kernel`__mtx_assert 155
  kernel`usbd_in_polling_mode 167
  kernel`__mtx_lock_flags 179
  kernel`__mtx_unlock_flags   180
  kernel`ukbd_interrupt   298
  kernel`memcpy   313
  kernel`witness_unlock   318
  kernel`spinlock_exit  11745
  kernel`acpi_cpu_idle  45519

And some procstat -ak during irq storm

root@jd2:/usr/home/johannes # procstat -ak|grep 100023
   12 100023 intrswi4: clock (0) mi_switch ithread_loop
fork_exit fork_trampoline 
root@jd2:/usr/home/johannes # procstat -ak | grep 100023
   12 100023 intrswi4: clock (0)   
root@jd2:/usr/home/johannes # procstat -ak | grep 100023
   12 100023 intrswi4: clock (0) callout_reset_sbt_on
ukbd_timeout softclock_call_cc softclock intr_event_execute_handlers
ithread_loop fork_exit fork_trampoline 
root@jd2:/usr/home/johannes # procstat -ak | grep 100023
   12 100023 intrswi4: clock (0)   
root@jd2:/usr/home/johannes # procstat -ak | grep 100023
   12 100023 intrswi4: clock (0) ukbd_timeout
softclock_call_cc softclock intr_event_execute_handlers ithread_loop fork_exit
fork_trampoline 
root@jd2:/usr/home/johannes # procstat -ak | grep 100023
   12 100023 intrswi4: clock (0)   
root@jd2:/usr/home/johannes # procstat -ak | grep 100023
   12 100023 intrswi4: clock (0) ukbd_interrupt
ukbd_timeout softclock_call_cc softclock intr_event_execute_handlers
ithread_loop fork_exit fork_trampoline 
root@jd2:/usr/home/johannes # procstat -ak | grep 100023
   12 100023 intrswi4: clock (0) callout_reset_sbt_on
ukbd_timeout softclock_call_cc softclock intr_event_execute_handlers
ithread_loop fork_exit fork_trampoline 
root@jd2:/usr/home/johannes # procstat -ak | grep 100023
   12 100023 intrswi4: clock (0) callout_reset_sbt_on
ukbd_timeout softclock_call_cc softclock intr_event_execute_handlers
ithread_loop fork_exit fork_trampoline 
root@jd2:/usr/home/johannes # procstat -ak | grep 100023
   12 100023 intrswi4: clock (0)   
root@jd2:/usr/home/johannes # procstat -ak | grep 100023
   12 100023 intrswi4: clock (0) callout_reset_sbt_on
ukbd_timeout

[Bug 225794] VM images for 12.0-CURRENT have problem with USB 3.0 ports

2018-03-27 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=225794

--- Comment #39 from david.boy...@twc.com ---
Andriy,

Yes, the patch disabling dareprobe(s) was/is applied to the kernel in both
single-user and multi-user mode.

In single-user mode the error condition in the dmesg output only appears if the
device is attached after the "camcontrol debug -c -p -I -P all" statement is
issued.

Just booting into single-user mode, but without issuing the debug command,
allows access to the USB flash drive (gpart show da0, mount/unmount, fsck,
etc.).

As stated, with the patch disabling dareprobe(s), booting into multi-user mode
allows access as above.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


[Bug 225794] VM images for 12.0-CURRENT have problem with USB 3.0 ports

2018-03-27 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=225794

Warner Losh  changed:

   What|Removed |Added

 CC||i...@freebsd.org

--- Comment #40 from Warner Losh  ---
What revision of FreeBSD were the latest tests done by?

I've fixed some locking bugs ending with r331435... dareprobe suggests this may
help, but I'm unsure.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


[Bug 226968] IRQ storm on cpu0 timer when holding down key on USB keyboard

2018-03-27 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=226968

--- Comment #7 from Hans Petter Selasky  ---
Can you try to trace the "sbt" argument passed to:

kernel`callout_reset_sbt_on  85

?

It might be some invalid timeout.

--HPS

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"