android_kernel_xiaomi_sm7250/drivers/char
Jason A. Donenfeld 40d0a9feff random: use expired timer rather than wq for mixing fast pool
commit 748bc4dd9e663f23448d8ad7e58c011a67ea1eca upstream.

Previously, the fast pool was dumped into the main pool periodically in
the fast pool's hard IRQ handler. This worked fine and there weren't
problems with it, until RT came around. Since RT converts spinlocks into
sleeping locks, problems cropped up. Rather than switching to raw
spinlocks, the RT developers preferred we make the transformation from
originally doing:

    do_some_stuff()
    spin_lock()
    do_some_other_stuff()
    spin_unlock()

to doing:

    do_some_stuff()
    queue_work_on(some_other_stuff_worker)

This is an ordinary pattern done all over the kernel. However, Sherry
noticed a 10% performance regression in qperf TCP over a 40gbps
InfiniBand card. Quoting her message:

> MT27500 Family [ConnectX-3] cards:
> Infiniband device 'mlx4_0' port 1 status:
> default gid: fe80:0000:0000:0000:0010:e000:0178:9eb1
> base lid: 0x6
> sm lid: 0x1
> state: 4: ACTIVE
> phys state: 5: LinkUp
> rate: 40 Gb/sec (4X QDR)
> link_layer: InfiniBand
>
> Cards are configured with IP addresses on private subnet for IPoIB
> performance testing.
> Regression identified in this bug is in TCP latency in this stack as reported
> by qperf tcp_lat metric:
>
> We have one system listen as a qperf server:
> [root@yourQperfServer ~]# qperf
>
> Have the other system connect to qperf server as a client (in this
> case, it’s X7 server with Mellanox card):
> [root@yourQperfClient ~]# numactl -m0 -N0 qperf 20.20.20.101 -v -uu -ub --time 60 --wait_server 20 -oo msg_size:4K:1024K:*2 tcp_lat

Rather than incur the scheduling latency from queue_work_on, we can
instead switch to running on the next timer tick, on the same core. This
also batches things a bit more -- once per jiffy -- which is okay now
that mix_interrupt_randomness() can credit multiple bits at once.

Reported-by: Sherry Yang <sherry.yang@oracle.com>
Tested-by: Paul Webb <paul.x.webb@oracle.com>
Cc: Sherry Yang <sherry.yang@oracle.com>
Cc: Phillip Goerl <phillip.goerl@oracle.com>
Cc: Jack Vogel <jack.vogel@oracle.com>
Cc: Nicky Veitch <nicky.veitch@oracle.com>
Cc: Colm Harrington <colm.harrington@oracle.com>
Cc: Ramanan Govindarajan <ramanan.govindarajan@oracle.com>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Cc: Tejun Heo <tj@kernel.org>
Cc: Sultan Alsawaf <sultan@kerneltoast.com>
Cc: stable@vger.kernel.org
Fixes: 58340f8e952b ("random: defer fast pool mixing to worker")
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-10-26 13:19:19 +02:00
..
agp parisc/agp: Annotate parisc agp init functions with __init 2021-12-22 09:19:00 +01:00
hw_random random: pull add_hwgenerator_randomness() declaration into random.h 2022-06-25 11:49:07 +02:00
ipmi ipmi:ssif: Check for NULL msg when handling events and messages 2022-06-14 16:59:16 +02:00
mwave char/mwave: Adjust io port register size 2022-01-27 09:04:22 +01:00
pcmcia char: pcmcia: error out if 'num_bytes_read' is greater than 4 in set_protocol() 2021-07-20 16:15:55 +02:00
tpm tpm: ibmvtpm: Correct the return value in tpm_ibmvtpm_probe() 2022-06-06 08:24:22 +02:00
xilinx_hwicap
xillybus
adi.c
apm-emulation.c
applicom.c
applicom.h
bsr.c
ds1620.c
dsp56k.c
dtlk.c
efirtc.c
generic_nvram.c
hangcheck-timer.c
hpet.c char: hpet: add checks after calling ioremap 2021-06-03 08:38:09 +02:00
Kconfig random: credit cpu and bootloader seeds by default 2022-06-25 11:49:15 +02:00
lp.c
Makefile
mbcs.c
mbcs.h
mem.c random: restore O_NONBLOCK support 2022-10-26 13:19:19 +02:00
misc.c
mspec.c
nsc_gpio.c
nvram.c
nwbutton.c
nwbutton.h
nwflash.c
pc8736x_gpio.c
powernv-op-panel.c
ppdev.c
ps3flash.c
random.c random: use expired timer rather than wq for mixing fast pool 2022-10-26 13:19:19 +02:00
raw.c
rtc.c
scx200_gpio.c
snsc_event.c
snsc.c
snsc.h
sonypi.c
tb0219.c
tlclk.c
toshiba.c
ttyprintk.c ttyprintk: Add TTY hangup callback. 2021-05-22 10:59:32 +02:00
uv_mmtimer.c
virtio_console.c virtio_console: eliminate anonymous module_init & module_exit 2022-04-15 14:15:04 +02:00