[Bug 269823] rand_harvest produces 100%CPU on 1 CPU with virtio_random.ko loaded

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 28 Feb 2023 12:48:07 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=269823

--- Comment #3 from Mina Galić <freebsd@igalic.co> ---
more info on the hardware, before i try to dive into what's actually going
wrong with the code:

works:

# devinfo -p vtrnd0 -v
vtrnd0 pnpinfo vendor=0x00001af4 device=0x1005 subvendor=0x1af4
device_type=0x00000004
 virtio_pci0 pnpinfo vendor=0x1af4 device=0x1005 subvendor=0x1af4
subdevice=0x0004 class=0x00ff00 at slot=2 function=0 dbsf=pci0:0:2:0
handle=\_SB_.PCI0.S10_
 pci0
 pcib0 pnpinfo _HID=PNP0A03 _UID=1 _CID=none at handle=\_SB_.PCI0
 acpi0
 nexus0

# pciconf -lv | grep -B2 -A1 RNG
virtio_pci0@pci0:0:2:0: class=0x00ff00 rev=0x00 hdr=0x00 vendor=0x1af4
device=0x1005 subvendor=0x1af4 subdevice=0x0004
    vendor     = 'Red Hat, Inc.'
    device     = 'Virtio RNG'
    class      = old

# sysctl kern.random
kern.random.fortuna.concurrent_read: 1
kern.random.fortuna.minpoolsize: 64
kern.random.rdrand.rdrand_independent_seed: 0
kern.random.use_chacha20_cipher: 1
kern.random.block_seeded_status: 0
kern.random.random_sources: 'VirtIO Entropy Adapter','Intel Secure Key RNG'
kern.random.harvest.mask_symbolic:
PURE_VIRTIO,PURE_RDRAND,[CALLOUT],[UMA],[FS_ATIME],SWI,INTERRUPT,NET_NG,[NET_ETHER],NET_TUN,MOUSE,KEYBOARD,ATTACH,CACHED
kern.random.harvest.mask_bin: 00000010010000000111011111
kern.random.harvest.mask: 590303
kern.random.initial_seeding.disable_bypass_warnings: 0
kern.random.initial_seeding.arc4random_bypassed_before_seeding: 0
kern.random.initial_seeding.read_random_bypassed_before_seeding: 0
kern.random.initial_seeding.bypass_before_seeding: 1


Misbehaves:

# devinfo -p vtrnd0 -v
vtrnd0 pnpinfo vendor=0x00001af4 device=0x1044 subvendor=0x1af4
device_type=0x00000004
 virtio_pci1 pnpinfo vendor=0x1af4 device=0x1044 subvendor=0x1af4
subdevice=0x1100 class=0x00ff00 at slot=0 function=1 dbsf=pci0:1:0:1
 pci1
 pcib1 pnpinfo vendor=0x1b36 device=0x000c subvendor=0x1b36 subdevice=0x0000
class=0x060400 at slot=1 function=0 dbsf=pci0:0:1:0 handle=\_SB_.PCI0.S08_
 pci0
 pcib0 pnpinfo _HID=PNP0A08 _UID=0 _CID=PNP0A03 at handle=\_SB_.PCI0
 acpi0
 nexus0

# pciconf -lv | grep -B2 -A1 RNG
virtio_pci1@pci0:1:0:1: class=0x00ff00 rev=0x01 hdr=0x00 vendor=0x1af4
device=0x1044 subvendor=0x1af4 subdevice=0x1100
    vendor     = 'Red Hat, Inc.'
    device     = 'Virtio RNG'
    class      = old

# sysctl kern.random
kern.random.fortuna.concurrent_read: 1
kern.random.fortuna.minpoolsize: 64
kern.random.rdrand.rdrand_independent_seed: 0
kern.random.use_chacha20_cipher: 1
kern.random.block_seeded_status: 0
kern.random.random_sources: 'VirtIO Entropy Adapter','Intel Secure Key RNG'
kern.random.harvest.mask_symbolic:
PURE_VIRTIO,PURE_RDRAND,[CALLOUT],[UMA],[FS_ATIME],SWI,INTERRUPT,NET_NG,[NET_ETHER],NET_TUN,MOUSE,KEYBOARD,ATTACH,CACHED
kern.random.harvest.mask_bin: 00000010010000000111011111
kern.random.harvest.mask: 590303
kern.random.initial_seeding.disable_bypass_warnings: 0
kern.random.initial_seeding.arc4random_bypassed_before_seeding: 0
kern.random.initial_seeding.read_random_bypassed_before_seeding: 0
kern.random.initial_seeding.bypass_before_seeding: 1

The only difference i can see is in the devinfo output.

-- 
You are receiving this mail because:
You are on the CC list for the bug.