linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: BUG: KASAN: use-after-free in xhci_trb_virt_to_dma.part.24+0x1c/0x80
       [not found]   ` <107dbdd1-4e45-836f-7f8f-85bc63374e4f@molgen.mpg.de>
@ 2020-01-02 14:10     ` Paul Menzel
  2020-01-03 11:04       ` Mika Westerberg
  0 siblings, 1 reply; 21+ messages in thread
From: Paul Menzel @ 2020-01-02 14:10 UTC (permalink / raw)
  To: Greg KH, Mika Westerberg; +Cc: Mathias Nyman, linux-usb, LKML


[-- Attachment #1.1: Type: text/plain, Size: 7168 bytes --]

Dear Linux folks,


On 2018-07-23 13:23, Paul Menzel wrote:

> On 07/20/18 11:54, Greg KH wrote:
>> On Fri, Jul 20, 2018 at 11:44:49AM +0200, Paul Menzel wrote:
> 
>>> Using Linux 4.18-rc5+ with kmemleak enabled on a MSI B350M MORTAR (MS-7A37)
>>> with an AMD Ryzen 3 2200G, the memory leak below is suspected.
>>>
>>> ```
>>> $ sudo less /sys/kernel/debug/kmemleak
>>> unreferenced object 0xffff894f8874a2b8 (size 8):
>>>   comm "systemd-udevd", pid 119, jiffies 4294893109 (age 908.348s)
>>>   hex dump (first 8 bytes):
>>>     34 01 05 00 00 00 00 00                          4.......
>>>   backtrace:
>>>     [<00000000308e4456>] xhci_init+0x81/0x170 [xhci_hcd]
>>>     [<00000000269aa18f>] xhci_gen_setup+0x2cb/0x510 [xhci_hcd]
>>>     [<000000007b70d85f>] xhci_pci_setup+0x4d/0x120 [xhci_pci]
>>>     [<0000000059f49127>] usb_add_hcd+0x2b6/0x800 [usbcore]
>>>     [<000000009a16d67c>] usb_hcd_pci_probe+0x1f3/0x460 [usbcore]
>>>     [<0000000001295c2e>] xhci_pci_probe+0x27/0x1d7 [xhci_pci]
>>>     [<00000000395bd8f9>] local_pci_probe+0x41/0x90
>>>     [<00000000a344e362>] pci_device_probe+0x189/0x1a0
>>>     [<00000000318999e5>] driver_probe_device+0x2b9/0x460
>>>     [<00000000c29d8a55>] __driver_attach+0xdd/0x110
>>>     [<00000000975b7f46>] bus_for_each_dev+0x76/0xc0
>>>     [<000000006bc40955>] bus_add_driver+0x152/0x230
>>>     [<00000000840ed63c>] driver_register+0x6b/0xb0
>>>     [<00000000123908c4>] do_one_initcall+0x46/0x1c3
>>>     [<00000000ce69c793>] do_init_module+0x5a/0x210
>>>     [<0000000091d4aef2>] load_module+0x21c4/0x2410
>>> […]
>>> ```
>>
>> That's really vague.  Any chance for a reproducer or some other types of
>> hints as to what you feel the problem is here?

I guess you just have to run your system also with kmemleak, and you will
be notified about similar leaks.

> Unfortunately, not really. I have a SanDisk USB storage medium attached.

On the system there is now an external DVD drive connected over USB Type-C.

> ```
> $ lsusb
> Bus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
> Bus 005 Device 002: ID 413c:3012 Dell Computer Corp. Optical Wheel Mouse
> Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> Bus 004 Device 002: ID 0781:558b SanDisk Corp. 
> Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
> Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
> Bus 001 Device 002: ID 413c:2105 Dell Computer Corp. Model L100 Keyboard
> Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> ```
> 
> After ten or eleven minutes after boot, systemd-udevd gets triggered
> and causes the kmemleak message.
> 
> ```
> [   82.196740] calling  fuse_init+0x0/0x1a6 [fuse] @ 4455
> [   82.196741] fuse init (API version 7.27)
> [   82.201779] initcall fuse_init+0x0/0x1a6 [fuse] returned 0 after 4925 usecs
> [  677.532745] kmemleak: 3 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
> ```

[…]

> Please tell me, if I can provide more information. Sorry for forgetting
> to attach the Linux messages.

I am still getting this with Linux 5.5-rc4, and the commit below
included.

> commit ce91f1a43b37463f517155bdfbd525eb43adbd1a
> Author: Mika Westerberg <mika.westerberg@linux.intel.com>
> Date:   Wed Dec 11 16:20:02 2019 +0200
> 
>     xhci: Fix memory leak in xhci_add_in_port()

Mika, as you fixed the other leak, any idea, how to continue from the
kmemleak log below?

```
unreferenced object 0xffff8c207a1e1408 (size 8):
  comm "systemd-udevd", pid 183, jiffies 4294667978 (age 752.292s)
  hex dump (first 8 bytes):
    34 01 05 00 00 00 00 00                          4.......
  backtrace:
    [<00000000aea7b46d>] xhci_mem_init+0xcfa/0xec0 [xhci_hcd]
    [<00000000417c4e3f>] xhci_init+0x81/0x170 [xhci_hcd]
    [<00000000dcdd3292>] xhci_gen_setup+0x26a/0x340 [xhci_hcd]
    [<0000000079014433>] xhci_pci_setup+0x4d/0x120 [xhci_pci]
    [<000000008f4fc4d1>] usb_add_hcd.cold+0x266/0x74b
    [<0000000023fadb59>] usb_hcd_pci_probe+0x216/0x3b1
    [<0000000006043143>] xhci_pci_probe+0x29/0x1bc [xhci_pci]
    [<000000006e8744e3>] local_pci_probe+0x42/0x80
    [<00000000120e570a>] pci_device_probe+0x107/0x1a0
    [<0000000074c180e1>] really_probe+0x147/0x3c0
    [<000000002d64c344>] driver_probe_device+0xb6/0x100
    [<00000000e695e4ae>] device_driver_attach+0x53/0x60
    [<00000000b7832c47>] __driver_attach+0x8a/0x150
    [<0000000069df77eb>] bus_for_each_dev+0x78/0xc0
    [<00000000aa6d98a4>] bus_add_driver+0x14d/0x1f0
    [<0000000002c7d24b>] driver_register+0x6c/0xc0
unreferenced object 0xffff8c207a1e1718 (size 8):
  comm "systemd-udevd", pid 183, jiffies 4294667978 (age 752.292s)
  hex dump (first 8 bytes):
    34 01 05 00 00 00 00 00                          4.......
  backtrace:
    [<00000000aea7b46d>] xhci_mem_init+0xcfa/0xec0 [xhci_hcd]
    [<00000000417c4e3f>] xhci_init+0x81/0x170 [xhci_hcd]
    [<00000000dcdd3292>] xhci_gen_setup+0x26a/0x340 [xhci_hcd]
    [<0000000079014433>] xhci_pci_setup+0x4d/0x120 [xhci_pci]
    [<000000008f4fc4d1>] usb_add_hcd.cold+0x266/0x74b
    [<0000000023fadb59>] usb_hcd_pci_probe+0x216/0x3b1
    [<0000000006043143>] xhci_pci_probe+0x29/0x1bc [xhci_pci]
    [<000000006e8744e3>] local_pci_probe+0x42/0x80
    [<00000000120e570a>] pci_device_probe+0x107/0x1a0
    [<0000000074c180e1>] really_probe+0x147/0x3c0
    [<000000002d64c344>] driver_probe_device+0xb6/0x100
    [<00000000e695e4ae>] device_driver_attach+0x53/0x60
    [<00000000b7832c47>] __driver_attach+0x8a/0x150
    [<0000000069df77eb>] bus_for_each_dev+0x78/0xc0
    [<00000000aa6d98a4>] bus_add_driver+0x14d/0x1f0
    [<0000000002c7d24b>] driver_register+0x6c/0xc0
unreferenced object 0xffff8c207a1e1338 (size 8):
  comm "systemd-udevd", pid 183, jiffies 4294667978 (age 752.292s)
  hex dump (first 8 bytes):
    34 01 05 00 00 00 00 00                          4.......
  backtrace:
    [<00000000aea7b46d>] xhci_mem_init+0xcfa/0xec0 [xhci_hcd]
    [<00000000417c4e3f>] xhci_init+0x81/0x170 [xhci_hcd]
    [<00000000dcdd3292>] xhci_gen_setup+0x26a/0x340 [xhci_hcd]
    [<0000000079014433>] xhci_pci_setup+0x4d/0x120 [xhci_pci]
    [<000000008f4fc4d1>] usb_add_hcd.cold+0x266/0x74b
    [<0000000023fadb59>] usb_hcd_pci_probe+0x216/0x3b1
    [<0000000006043143>] xhci_pci_probe+0x29/0x1bc [xhci_pci]
    [<000000006e8744e3>] local_pci_probe+0x42/0x80
    [<00000000120e570a>] pci_device_probe+0x107/0x1a0
    [<0000000074c180e1>] really_probe+0x147/0x3c0
    [<000000002d64c344>] driver_probe_device+0xb6/0x100
    [<00000000e695e4ae>] device_driver_attach+0x53/0x60
    [<00000000b7832c47>] __driver_attach+0x8a/0x150
    [<0000000069df77eb>] bus_for_each_dev+0x78/0xc0
    [<00000000aa6d98a4>] bus_add_driver+0x14d/0x1f0
    [<0000000002c7d24b>] driver_register+0x6c/0xc0
```


Kind regards,

Paul


> [1]: https://bugs.freedesktop.org/show_bug.cgi?id=105684
>      "Loading amdgpu hits general protection fault: 0000 [#1] SMP NOPTI"[2]: https://patchwork.kernel.org/patch/11242383/

[-- Attachment #1.2: 20200101–msi-MS-7A37–linux-5.5.0-rc4-drm-tip-messages-kmemleak.txt --]
[-- Type: text/plain, Size: 71512 bytes --]

[    0.000000] Linux version 5.5.0-rc4-01573-g8c7c363976f2 (root@f685f6da8dd4) (gcc version 9.2.1 20191130 (Debian 9.2.1-21)) #28 SMP Wed Jan 1 12:32:56 UTC 2020
[    0.000000] Command line: BOOT_IMAGE=/vmlinuz-5.5.0-rc4-01573-g8c7c363976f2 root=UUID=8883f733-2248-47e0-90b9-ee5384f18d62 ro quiet noisapnp cryptomgr.notests random.trust_cpu=on selinux=0 apparmor=0
[    0.000000] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'
[    0.000000] x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'
[    0.000000] x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers'
[    0.000000] x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]:  256
[    0.000000] x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using 'compacted' format.
[    0.000000] BIOS-provided physical RAM map:
[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009ffff] usable
[    0.000000] BIOS-e820: [mem 0x00000000000a0000-0x00000000000fffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000000100000-0x0000000009d7ffff] usable
[    0.000000] BIOS-e820: [mem 0x0000000009d80000-0x0000000009ffffff] reserved
[    0.000000] BIOS-e820: [mem 0x000000000a000000-0x000000000a1fffff] usable
[    0.000000] BIOS-e820: [mem 0x000000000a200000-0x000000000a20afff] ACPI NVS
[    0.000000] BIOS-e820: [mem 0x000000000a20b000-0x000000000affffff] usable
[    0.000000] BIOS-e820: [mem 0x000000000b000000-0x000000000b01ffff] reserved
[    0.000000] BIOS-e820: [mem 0x000000000b020000-0x00000000eba9efff] usable
[    0.000000] BIOS-e820: [mem 0x00000000eba9f000-0x00000000ebb94fff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000ebb95000-0x00000000ec013fff] usable
[    0.000000] BIOS-e820: [mem 0x00000000ec014000-0x00000000ec11efff] ACPI NVS
[    0.000000] BIOS-e820: [mem 0x00000000ec11f000-0x00000000ecf38fff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000ecf39000-0x00000000ecfd9fff] type 20
[    0.000000] BIOS-e820: [mem 0x00000000ecfda000-0x00000000eeffffff] usable
[    0.000000] BIOS-e820: [mem 0x00000000ef000000-0x00000000efffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000f8000000-0x00000000fbffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000fd000000-0x00000000ffffffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000100000000-0x000000038effffff] usable
[    0.000000] BIOS-e820: [mem 0x000000038f000000-0x000000040effffff] reserved
[    0.000000] NX (Execute Disable) protection: active
[    0.000000] efi: EFI v2.70 by American Megatrends
[    0.000000] efi:  ACPI 2.0=0xec09b000  ACPI=0xec09b000  SMBIOS=0xece25000  MEMATTR=0xe8c5a698  ESRT=0xe8c67f98 
[    0.000000] SMBIOS 2.8 present.
[    0.000000] DMI: Micro-Star International Co., Ltd. MS-7A37/B350M MORTAR (MS-7A37), BIOS 1.MR 12/02/2019
[    0.000000] tsc: Fast TSC calibration failed
[    0.000000] e820: update [mem 0x00000000-0x00000fff] usable ==> reserved
[    0.000000] e820: remove [mem 0x000a0000-0x000fffff] usable
[    0.000000] last_pfn = 0x38f000 max_arch_pfn = 0x400000000
[    0.000000] MTRR default type: uncachable
[    0.000000] MTRR fixed ranges enabled:
[    0.000000]   00000-9FFFF write-back
[    0.000000]   A0000-BFFFF write-through
[    0.000000]   C0000-DFFFF uncachable
[    0.000000]   E0000-FFFFF write-protect
[    0.000000] MTRR variable ranges enabled:
[    0.000000]   0 base 000000000000 mask FFFF80000000 write-back
[    0.000000]   1 base 000080000000 mask FFFFC0000000 write-back
[    0.000000]   2 base 0000C0000000 mask FFFFE0000000 write-back
[    0.000000]   3 base 0000E0000000 mask FFFFF0000000 write-back
[    0.000000]   4 disabled
[    0.000000]   5 disabled
[    0.000000]   6 disabled
[    0.000000]   7 disabled
[    0.000000] TOM2: 0000000410000000 aka 16640M
[    0.000000] x86/PAT: Configuration [0-7]: WB  WC  UC- UC  WB  WP  UC- WT  
[    0.000000] e820: update [mem 0xf0000000-0xffffffff] usable ==> reserved
[    0.000000] last_pfn = 0xef000 max_arch_pfn = 0x400000000
[    0.000000] esrt: Reserving ESRT space from 0x00000000e8c67f98 to 0x00000000e8c67fd0.
[    0.000000] e820: update [mem 0xe8c67000-0xe8c67fff] usable ==> reserved
[    0.000000] Using GB pages for direct mapping
[    0.000000] BRK [0x8f201000, 0x8f201fff] PGTABLE
[    0.000000] BRK [0x8f202000, 0x8f202fff] PGTABLE
[    0.000000] BRK [0x8f203000, 0x8f203fff] PGTABLE
[    0.000000] BRK [0x8f204000, 0x8f204fff] PGTABLE
[    0.000000] BRK [0x8f205000, 0x8f205fff] PGTABLE
[    0.000000] BRK [0x8f206000, 0x8f206fff] PGTABLE
[    0.000000] BRK [0x8f207000, 0x8f207fff] PGTABLE
[    0.000000] BRK [0x8f208000, 0x8f208fff] PGTABLE
[    0.000000] BRK [0x8f209000, 0x8f209fff] PGTABLE
[    0.000000] Secure boot could not be determined
[    0.000000] RAMDISK: [mem 0x37119000-0x37883fff]
[    0.000000] ACPI: Early table checksum verification disabled
[    0.000000] ACPI: RSDP 0x00000000EC09B000 000024 (v02 ALASKA)
[    0.000000] ACPI: XSDT 0x00000000EC09B0A0 0000C4 (v01 ALASKA A M I    01072009 AMI  00010013)
[    0.000000] ACPI: FACP 0x00000000EC0A2BA8 000114 (v06 ALASKA A M I    01072009 AMI  00010013)
[    0.000000] ACPI: DSDT 0x00000000EC09B200 0079A7 (v02 ALASKA A M I    01072009 INTL 20120913)
[    0.000000] ACPI: FACS 0x00000000EC107E00 000040
[    0.000000] ACPI: APIC 0x00000000EC0A2CC0 00015E (v03 ALASKA A M I    01072009 AMI  00010013)
[    0.000000] ACPI: FPDT 0x00000000EC0A2E20 000044 (v01 ALASKA A M I    01072009 AMI  00010013)
[    0.000000] ACPI: FIDT 0x00000000EC0A2E68 00009C (v01 ALASKA A M I    01072009 AMI  00010013)
[    0.000000] ACPI: SSDT 0x00000000EC0A2F08 000060 (v02 ALASKA CPUSSDT  01072009 AMI  01072009)
[    0.000000] ACPI: SSDT 0x00000000EC0A2F68 005419 (v02 AMD    AmdTable 00000002 MSFT 04000000)
[    0.000000] ACPI: SSDT 0x00000000EC0A8388 00366B (v01 AMD    AMD AOD  00000001 INTL 20120913)
[    0.000000] ACPI: MCFG 0x00000000EC0AB9F8 00003C (v01 ALASKA A M I    01072009 MSFT 00010013)
[    0.000000] ACPI: HPET 0x00000000EC0ABA38 000038 (v01 ALASKA A M I    01072009 AMI  00000005)
[    0.000000] ACPI: UEFI 0x00000000EC0ABA70 000042 (v01 ALASKA A M I    00000002      01000013)
[    0.000000] ACPI: VFCT 0x00000000EC0ABAB8 00D484 (v01 ALASKA A M I    00000001 AMD  31504F47)
[    0.000000] ACPI: IVRS 0x00000000EC0B8F40 0000D0 (v02 AMD    AMD IVRS 00000001 AMD  00000000)
[    0.000000] ACPI: SSDT 0x00000000EC0B9010 000854 (v01 AMD    AMD CPU  00000001 AMD  00000001)
[    0.000000] ACPI: CRAT 0x00000000EC0B9868 000810 (v01 AMD    AMD CRAT 00000001 AMD  00000001)
[    0.000000] ACPI: CDIT 0x00000000EC0BA078 000029 (v01 AMD    AMD CDIT 00000001 AMD  00000001)
[    0.000000] ACPI: SSDT 0x00000000EC0BA0A8 000C34 (v01 AMD    AmdTable 00000001 INTL 20120913)
[    0.000000] ACPI: SSDT 0x00000000EC0BACE0 0010AC (v01 AMD    AmdTable 00000001 INTL 20120913)
[    0.000000] ACPI: SSDT 0x00000000EC0BBD90 001D4A (v01 AMD    AmdTable 00000001 INTL 20120913)
[    0.000000] ACPI: SSDT 0x00000000EC0BDAE0 0000BF (v01 AMD    AMD PT   00001000 INTL 20120913)
[    0.000000] ACPI: WSMT 0x00000000EC0BDBA0 000028 (v01 ALASKA A M I    01072009 AMI  00010013)
[    0.000000] ACPI: Local APIC address 0xfee00000
[    0.000000] No NUMA configuration found
[    0.000000] Faking a node at [mem 0x0000000000000000-0x000000038effffff]
[    0.000000] NODE_DATA(0) allocated [mem 0x38efe6000-0x38effcfff]
[    0.000000] Zone ranges:
[    0.000000]   DMA      [mem 0x0000000000001000-0x0000000000ffffff]
[    0.000000]   DMA32    [mem 0x0000000001000000-0x00000000ffffffff]
[    0.000000]   Normal   [mem 0x0000000100000000-0x000000038effffff]
[    0.000000]   Device   empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000001000-0x000000000009ffff]
[    0.000000]   node   0: [mem 0x0000000000100000-0x0000000009d7ffff]
[    0.000000]   node   0: [mem 0x000000000a000000-0x000000000a1fffff]
[    0.000000]   node   0: [mem 0x000000000a20b000-0x000000000affffff]
[    0.000000]   node   0: [mem 0x000000000b020000-0x00000000eba9efff]
[    0.000000]   node   0: [mem 0x00000000ebb95000-0x00000000ec013fff]
[    0.000000]   node   0: [mem 0x00000000ecfda000-0x00000000eeffffff]
[    0.000000]   node   0: [mem 0x0000000100000000-0x000000038effffff]
[    0.000000] Zeroed struct page in unavailable ranges: 9160 pages
[    0.000000] Initmem setup node 0 [mem 0x0000000000001000-0x000000038effffff]
[    0.000000] On node 0 totalpages: 3656760
[    0.000000]   DMA zone: 64 pages used for memmap
[    0.000000]   DMA zone: 30 pages reserved
[    0.000000]   DMA zone: 3999 pages, LIFO batch:0
[    0.000000]   DMA32 zone: 15155 pages used for memmap
[    0.000000]   DMA32 zone: 969881 pages, LIFO batch:63
[    0.000000]   Normal zone: 41920 pages used for memmap
[    0.000000]   Normal zone: 2682880 pages, LIFO batch:63
[    0.000000] ACPI: PM-Timer IO Port: 0x808
[    0.000000] ACPI: Local APIC address 0xfee00000
[    0.000000] ACPI: LAPIC_NMI (acpi_id[0xff] high edge lint[0x1])
[    0.000000] IOAPIC[0]: apic_id 5, version 33, address 0xfec00000, GSI 0-23
[    0.000000] IOAPIC[1]: apic_id 6, version 33, address 0xfec01000, GSI 24-55
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 low level)
[    0.000000] ACPI: IRQ0 used by override.
[    0.000000] ACPI: IRQ9 used by override.
[    0.000000] Using ACPI (MADT) for SMP configuration information
[    0.000000] ACPI: HPET id: 0x10228201 base: 0xfed00000
[    0.000000] smpboot: Allowing 32 CPUs, 28 hotplug CPUs
[    0.000000] [mem 0xf0000000-0xf7ffffff] available for PCI devices
[    0.000000] clocksource: refined-jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1910969940391419 ns
[    0.000000] After setup_arch
[    0.000000] After setup_command_line
[    0.000000] After setup_nr_cpu_ids
[    0.000000] setup_percpu: NR_CPUS:64 nr_cpumask_bits:64 nr_cpu_ids:32 nr_node_ids:1
[    0.000000] percpu: Embedded 54 pages/cpu s182552 r8192 d30440 u262144
[    0.000000] pcpu-alloc: s182552 r8192 d30440 u262144 alloc=1*2097152
[    0.000000] pcpu-alloc: [0] 00 01 02 03 04 05 06 07 [0] 08 09 10 11 12 13 14 15 
[    0.000000] pcpu-alloc: [0] 16 17 18 19 20 21 22 23 [0] 24 25 26 27 28 29 30 31 
[    0.000000] After setup_per_cpu_areas
[    0.000000] After smp_perpare_boot_cpu
[    0.000000] After boot_cpu_hotplug_init
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 3599591
[    0.000000] Policy zone: Normal
[    0.000000] Kernel command line: BOOT_IMAGE=/vmlinuz-5.5.0-rc4-01573-g8c7c363976f2 root=UUID=8883f733-2248-47e0-90b9-ee5384f18d62 ro quiet noisapnp cryptomgr.notests random.trust_cpu=on selinux=0 apparmor=0
[    0.000000] Dentry cache hash table entries: 2097152 (order: 12, 16777216 bytes, linear)
[    0.000000] Inode-cache hash table entries: 1048576 (order: 11, 8388608 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 14175472K/14627040K available (12292K kernel code, 1323K rwdata, 4416K rodata, 1708K init, 7404K bss, 451568K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=32, Nodes=1
[    0.000000] After mm_init
[    0.000000] ftrace: allocating 39090 entries in 153 pages
[    0.000000] ftrace: allocated 153 pages with 4 groups
[    0.000000] After sched_init
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu: 	RCU restricting CPUs from NR_CPUS=64 to nr_cpu_ids=32.
[    0.000000] 	Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 100 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=32
[    0.000000] After rcu_init
[    0.000000] NR_IRQS: 4352, nr_irqs: 1224, preallocated irqs: 16
[    0.000000] rcu: 	Offload RCU callbacks from CPUs: (none).
[    0.000000] random: crng done (trusting CPU's manufacturer)
[    0.000000] After add_latent_entropy
[    0.000000] After add_device_randomness
[    0.000000] After boot_init_stack_canary
[    0.000000] Console: colour dummy device 80x25
[    0.000000] printk: console [tty0] enabled
[    0.000000] ACPI: Core revision 20191018
[    0.000000] clocksource: hpet: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 133484873504 ns
[    0.000000] APIC: Switch to symmetric I/O mode setup
[    0.002000] Switched APIC routing to physical flat.
[    0.003000] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
[    0.011000] tsc: Unable to calibrate against PIT
[    0.011000] tsc: using HPET reference calibration
[    0.011000] tsc: Detected 3500.142 MHz processor
[    0.000003] clocksource: tsc-early: mask: 0xffffffffffffffff max_cycles: 0x3273d7154ad, max_idle_ns: 440795306383 ns
[    0.000006] Calibrating delay loop (skipped), value calculated using timer frequency.. 7000.28 BogoMIPS (lpj=3500142)
[    0.000007] pid_max: default: 32768 minimum: 301
[    0.003678] LSM: Security Framework initializing
[    0.004221] Mount-cache hash table entries: 32768 (order: 6, 262144 bytes, linear)
[    0.004254] Mountpoint-cache hash table entries: 32768 (order: 6, 262144 bytes, linear)
[    0.004437] *** VALIDATE tmpfs ***
[    0.005447] *** VALIDATE proc ***
[    0.005954] *** VALIDATE cgroup1 ***
[    0.005956] *** VALIDATE cgroup2 ***
[    0.006372] Last level iTLB entries: 4KB 1024, 2MB 1024, 4MB 512
[    0.006372] Last level dTLB entries: 4KB 1536, 2MB 1536, 4MB 768, 1GB 0
[    0.006375] Spectre V1 : Mitigation: usercopy/swapgs barriers and __user pointer sanitization
[    0.006376] Spectre V2 : Mitigation: Full AMD retpoline
[    0.006377] Spectre V2 : Spectre v2 / SpectreRSB mitigation: Filling RSB on context switch
[    0.006378] Spectre V2 : mitigation: Enabling conditional Indirect Branch Prediction Barrier
[    0.006379] Speculative Store Bypass: Mitigation: Speculative Store Bypass disabled via prctl and seccomp
[    0.006552] Freeing SMP alternatives memory: 32K
[    0.006553] After check_bugs
[    0.007008] After acpi_subsystem_init
[    0.007009] After arch_post_acpi_subsys_init
[    0.007009] After sfi_init_late
[    0.007011] After rcu_scheduler_starting
[    0.007317] After find_task_by_pid_ns
[    0.007319] After numa_default_policy
[    0.007360] After rcu_read_lock
[    0.007360] After rcu_read_unlock
[    0.007361] After kthreadd_done
[    0.109782] smpboot: CPU0: AMD Ryzen 3 2200G with Radeon Vega Graphics (family: 0x17, model: 0x11, stepping: 0x0)
[    0.110004] Performance Events: Fam17h core perfctr, AMD PMU driver.
[    0.110004] ... version:                0
[    0.110004] ... bit width:              48
[    0.110004] ... generic registers:      6
[    0.110004] ... value mask:             0000ffffffffffff
[    0.110004] ... max period:             00007fffffffffff
[    0.110004] ... fixed-purpose events:   0
[    0.110004] ... event mask:             000000000000003f
[    0.110004] rcu: Hierarchical SRCU implementation.
[    0.110412] NMI watchdog: Enabled. Permanently consumes one hw-PMU counter.
[    0.111575] smp: Bringing up secondary CPUs ...
[    0.111842] x86: Booting SMP configuration:
[    0.111843] .... node  #0, CPUs:        #1
[    0.113012] After schedule_preempt_disabled
[    0.113283]   #2  #3
[    0.116079] smp: Brought up 1 node, 4 CPUs
[    0.116079] smpboot: Max logical packages: 8
[    0.116079] smpboot: Total of 4 processors activated (28001.13 BogoMIPS)
[    0.118468] devtmpfs: initialized
[    0.119027] x86/mm: Memory block size: 128MB
[    0.124160] PM: Registering ACPI NVS region [mem 0x0a200000-0x0a20afff] (45056 bytes)
[    0.124160] PM: Registering ACPI NVS region [mem 0xec014000-0xec11efff] (1093632 bytes)
[    0.124465] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275000 ns
[    0.124465] futex hash table entries: 8192 (order: 7, 524288 bytes, linear)
[    0.126642] pinctrl core: initialized pinctrl subsystem
[    0.126907] PM: RTC time: 12:41:20, date: 2020-01-01
[    0.126908] thermal_sys: Registered thermal governor 'fair_share'
[    0.126909] thermal_sys: Registered thermal governor 'bang_bang'
[    0.126909] thermal_sys: Registered thermal governor 'step_wise'
[    0.126909] thermal_sys: Registered thermal governor 'user_space'
[    0.127798] NET: Registered protocol family 16
[    0.128178] audit: initializing netlink subsys (disabled)
[    0.128187] audit: type=2000 audit(1577882479.139:1): state=initialized audit_enabled=0 res=1
[    0.128273] cpuidle: using governor menu
[    0.128273] ACPI: bus type PCI registered
[    0.129327] PCI: MMCONFIG for domain 0000 [bus 00-3f] at [mem 0xf8000000-0xfbffffff] (base 0xf8000000)
[    0.129330] PCI: MMCONFIG at [mem 0xf8000000-0xfbffffff] reserved in E820
[    0.129342] PCI: Using configuration type 1 for base access
[    0.135240] HugeTLB registered 1.00 GiB page size, pre-allocated 0 pages
[    0.135240] HugeTLB registered 2.00 MiB page size, pre-allocated 0 pages
[    0.136129] alg: self-tests disabled
[    0.138270] cryptd: max_cpu_qlen set to 1000
[    0.140220] ACPI: Added _OSI(Module Device)
[    0.140220] ACPI: Added _OSI(Processor Device)
[    0.140221] ACPI: Added _OSI(3.0 _SCP Extensions)
[    0.140221] ACPI: Added _OSI(Processor Aggregator Device)
[    0.140224] ACPI: Added _OSI(Linux-Dell-Video)
[    0.140226] ACPI: Added _OSI(Linux-Lenovo-NV-HDMI-Audio)
[    0.140228] ACPI: Added _OSI(Linux-HPI-Hybrid-Graphics)
[    0.167216] ACPI: DSDT successfully acquired and loaded (tables_loaded = 1)
[    0.202101] ACPI: 9 ACPI AML tables successfully acquired and loaded
[    0.206932] ACPI: [Firmware Bug]: BIOS _OSI(Linux) query ignored
[    0.216306] ACPI: Interpreter enabled
[    0.216330] ACPI: (supports S0 S3 S5)
[    0.216331] ACPI: Using IOAPIC for interrupt routing
[    0.217183] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug
[    0.218694] ACPI: Enabled 2 GPEs in block 00 to 1F
[    0.257890] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])
[    0.257898] acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI HPX-Type3]
[    0.258807] acpi PNP0A08:00: _OSC: platform does not support [PME LTR]
[    0.259683] acpi PNP0A08:00: _OSC: OS now controls [AER PCIeCapability]
[    0.259710] acpi PNP0A08:00: [Firmware Info]: MMCONFIG for domain 0000 [bus 00-3f] only partially covers this bridge
[    0.260853] PCI host bridge to bus 0000:00
[    0.260856] pci_bus 0000:00: root bus resource [io  0x0000-0x03af window]
[    0.260858] pci_bus 0000:00: root bus resource [io  0x03e0-0x0cf7 window]
[    0.260860] pci_bus 0000:00: root bus resource [io  0x03b0-0x03df window]
[    0.260862] pci_bus 0000:00: root bus resource [io  0x0d00-0xffff window]
[    0.260864] pci_bus 0000:00: root bus resource [mem 0x000a0000-0x000bffff window]
[    0.260866] pci_bus 0000:00: root bus resource [mem 0x000c0000-0x000dffff window]
[    0.260868] pci_bus 0000:00: root bus resource [mem 0xf0000000-0xfcffffff window]
[    0.260869] pci_bus 0000:00: root bus resource [mem 0x40f000000-0x7fffffffff window]
[    0.260871] pci_bus 0000:00: root bus resource [bus 00-ff]
[    0.260896] pci 0000:00:00.0: [1022:15d0] type 00 class 0x060000
[    0.261249] pci 0000:00:00.2: [1022:15d1] type 00 class 0x080600
[    0.261608] pci 0000:00:01.0: [1022:1452] type 00 class 0x060000
[    0.261866] pci 0000:00:01.2: [1022:15d3] type 01 class 0x060400
[    0.261923] pci 0000:00:01.2: enabling Extended Tags
[    0.261995] pci 0000:00:01.2: PME# supported from D0 D3hot D3cold
[    0.261996] pci 0000:00:01.2: pme_poll = true
[    0.261996] pci 0000:00:01.2: after device_set_wakeup_capable()
[    0.261999] pci 0000:00:01.2: after pci_pme_active()
[    0.262582] pci 0000:00:08.0: [1022:1452] type 00 class 0x060000
[    0.262834] pci 0000:00:08.1: [1022:15db] type 01 class 0x060400
[    0.262893] pci 0000:00:08.1: enabling Extended Tags
[    0.262971] pci 0000:00:08.1: PME# supported from D0 D3hot D3cold
[    0.262972] pci 0000:00:08.1: pme_poll = true
[    0.262972] pci 0000:00:08.1: after device_set_wakeup_capable()
[    0.262975] pci 0000:00:08.1: after pci_pme_active()
[    0.263503] pci 0000:00:08.2: [1022:15dc] type 01 class 0x060400
[    0.263564] pci 0000:00:08.2: enabling Extended Tags
[    0.263637] pci 0000:00:08.2: PME# supported from D0 D3hot D3cold
[    0.263638] pci 0000:00:08.2: pme_poll = true
[    0.263638] pci 0000:00:08.2: after device_set_wakeup_capable()
[    0.263641] pci 0000:00:08.2: after pci_pme_active()
[    0.264251] pci 0000:00:14.0: [1022:790b] type 00 class 0x0c0500
[    0.264641] pci 0000:00:14.3: [1022:790e] type 00 class 0x060100
[    0.265065] pci 0000:00:18.0: [1022:15e8] type 00 class 0x060000
[    0.265252] pci 0000:00:18.1: [1022:15e9] type 00 class 0x060000
[    0.265438] pci 0000:00:18.2: [1022:15ea] type 00 class 0x060000
[    0.265622] pci 0000:00:18.3: [1022:15eb] type 00 class 0x060000
[    0.265806] pci 0000:00:18.4: [1022:15ec] type 00 class 0x060000
[    0.265993] pci 0000:00:18.5: [1022:15ed] type 00 class 0x060000
[    0.266192] pci 0000:00:18.6: [1022:15ee] type 00 class 0x060000
[    0.266376] pci 0000:00:18.7: [1022:15ef] type 00 class 0x060000
[    0.266696] pci 0000:12:00.0: [1022:43bb] type 00 class 0x0c0330
[    0.266726] pci 0000:12:00.0: reg 0x10: [mem 0xfcea0000-0xfcea7fff 64bit]
[    0.266776] pci 0000:12:00.0: enabling Extended Tags
[    0.266860] pci 0000:12:00.0: PME# supported from D3hot D3cold
[    0.266861] pci 0000:12:00.0: pme_poll = true
[    0.266861] pci 0000:12:00.0: after device_set_wakeup_capable()
[    0.266864] pci 0000:12:00.0: after pci_pme_active()
[    0.267147] pci 0000:12:00.1: [1022:43b7] type 00 class 0x010601
[    0.267211] pci 0000:12:00.1: reg 0x24: [mem 0xfce80000-0xfce9ffff]
[    0.267221] pci 0000:12:00.1: reg 0x30: [mem 0xfce00000-0xfce7ffff pref]
[    0.267228] pci 0000:12:00.1: enabling Extended Tags
[    0.267290] pci 0000:12:00.1: PME# supported from D3hot D3cold
[    0.267290] pci 0000:12:00.1: pme_poll = true
[    0.267291] pci 0000:12:00.1: after device_set_wakeup_capable()
[    0.267294] pci 0000:12:00.1: after pci_pme_active()
[    0.267526] pci 0000:12:00.2: [1022:43b2] type 01 class 0x060400
[    0.267586] pci 0000:12:00.2: enabling Extended Tags
[    0.267653] pci 0000:12:00.2: PME# supported from D3hot D3cold
[    0.267654] pci 0000:12:00.2: pme_poll = true
[    0.267654] pci 0000:12:00.2: after device_set_wakeup_capable()
[    0.267657] pci 0000:12:00.2: after pci_pme_active()
[    0.267972] pci 0000:00:01.2: PCI bridge to [bus 12-25]
[    0.267977] pci 0000:00:01.2:   bridge window [io  0xf000-0xffff]
[    0.267979] pci 0000:00:01.2:   bridge window [mem 0xfcd00000-0xfcefffff]
[    0.268160] pci 0000:20:00.0: [1022:43b4] type 01 class 0x060400
[    0.268226] pci 0000:20:00.0: enabling Extended Tags
[    0.268310] pci 0000:20:00.0: PME# supported from D3hot D3cold
[    0.268311] pci 0000:20:00.0: pme_poll = true
[    0.268311] pci 0000:20:00.0: after device_set_wakeup_capable()
[    0.268314] pci 0000:20:00.0: after pci_pme_active()
[    0.268598] pci 0000:20:01.0: [1022:43b4] type 01 class 0x060400
[    0.268664] pci 0000:20:01.0: enabling Extended Tags
[    0.268749] pci 0000:20:01.0: PME# supported from D3hot D3cold
[    0.268750] pci 0000:20:01.0: pme_poll = true
[    0.268750] pci 0000:20:01.0: after device_set_wakeup_capable()
[    0.268753] pci 0000:20:01.0: after pci_pme_active()
[    0.269081] pci 0000:20:04.0: [1022:43b4] type 01 class 0x060400
[    0.269147] pci 0000:20:04.0: enabling Extended Tags
[    0.269232] pci 0000:20:04.0: PME# supported from D3hot D3cold
[    0.269233] pci 0000:20:04.0: pme_poll = true
[    0.269233] pci 0000:20:04.0: after device_set_wakeup_capable()
[    0.269236] pci 0000:20:04.0: after pci_pme_active()
[    0.269537] pci 0000:12:00.2: PCI bridge to [bus 20-25]
[    0.269543] pci 0000:12:00.2:   bridge window [io  0xf000-0xffff]
[    0.269546] pci 0000:12:00.2:   bridge window [mem 0xfcd00000-0xfcdfffff]
[    0.269629] pci 0000:20:00.0: PCI bridge to [bus 21]
[    0.269752] pci 0000:22:00.0: [10ec:8168] type 00 class 0x020000
[    0.269796] pci 0000:22:00.0: reg 0x10: [io  0xf000-0xf0ff]
[    0.269828] pci 0000:22:00.0: reg 0x18: [mem 0xfcd04000-0xfcd04fff 64bit]
[    0.269849] pci 0000:22:00.0: reg 0x20: [mem 0xfcd00000-0xfcd03fff 64bit]
[    0.270032] pci 0000:22:00.0: supports D1 D2
[    0.270033] pci 0000:22:00.0: PME# supported from D0 D1 D2 D3hot D3cold
[    0.270034] pci 0000:22:00.0: pme_poll = true
[    0.270034] pci 0000:22:00.0: after device_set_wakeup_capable()
[    0.270039] pci 0000:22:00.0: after pci_pme_active()
[    0.270344] pci 0000:20:01.0: PCI bridge to [bus 22]
[    0.270350] pci 0000:20:01.0:   bridge window [io  0xf000-0xffff]
[    0.270353] pci 0000:20:01.0:   bridge window [mem 0xfcd00000-0xfcdfffff]
[    0.270464] pci 0000:20:04.0: PCI bridge to [bus 25]
[    0.270685] pci 0000:26:00.0: [1002:15dd] type 00 class 0x030000
[    0.270731] pci 0000:26:00.0: reg 0x10: [mem 0x7fe0000000-0x7fefffffff 64bit pref]
[    0.270749] pci 0000:26:00.0: reg 0x18: [mem 0x7ff0000000-0x7ff01fffff 64bit pref]
[    0.270760] pci 0000:26:00.0: reg 0x20: [io  0xe000-0xe0ff]
[    0.270772] pci 0000:26:00.0: reg 0x24: [mem 0xfcc00000-0xfcc7ffff]
[    0.270792] pci 0000:26:00.0: enabling Extended Tags
[    0.270824] pci 0000:26:00.0: BAR 0: assigned to efifb
[    0.270933] pci 0000:26:00.0: PME# supported from D1 D2 D3hot D3cold
[    0.270933] pci 0000:26:00.0: pme_poll = true
[    0.270934] pci 0000:26:00.0: after device_set_wakeup_capable()
[    0.270937] pci 0000:26:00.0: after pci_pme_active()
[    0.271258] pci 0000:26:00.1: [1002:15de] type 00 class 0x040300
[    0.271284] pci 0000:26:00.1: reg 0x10: [mem 0xfcc88000-0xfcc8bfff]
[    0.271338] pci 0000:26:00.1: enabling Extended Tags
[    0.271420] pci 0000:26:00.1: PME# supported from D1 D2 D3hot D3cold
[    0.271421] pci 0000:26:00.1: pme_poll = true
[    0.271421] pci 0000:26:00.1: after device_set_wakeup_capable()
[    0.271425] pci 0000:26:00.1: after pci_pme_active()
[    0.271678] pci 0000:26:00.2: [1022:15df] type 00 class 0x108000
[    0.271719] pci 0000:26:00.2: reg 0x18: [mem 0xfcb00000-0xfcbfffff]
[    0.271742] pci 0000:26:00.2: reg 0x24: [mem 0xfcc8c000-0xfcc8dfff]
[    0.271759] pci 0000:26:00.2: enabling Extended Tags
[    0.272102] pci 0000:26:00.3: [1022:15e0] type 00 class 0x0c0330
[    0.272137] pci 0000:26:00.3: reg 0x10: [mem 0xfca00000-0xfcafffff 64bit]
[    0.272198] pci 0000:26:00.3: enabling Extended Tags
[    0.272287] pci 0000:26:00.3: PME# supported from D0 D3hot D3cold
[    0.272288] pci 0000:26:00.3: pme_poll = true
[    0.272288] pci 0000:26:00.3: after device_set_wakeup_capable()
[    0.272292] pci 0000:26:00.3: after pci_pme_active()
[    0.272550] pci 0000:26:00.4: [1022:15e1] type 00 class 0x0c0330
[    0.272585] pci 0000:26:00.4: reg 0x10: [mem 0xfc900000-0xfc9fffff 64bit]
[    0.272646] pci 0000:26:00.4: enabling Extended Tags
[    0.272734] pci 0000:26:00.4: PME# supported from D0 D3hot D3cold
[    0.272735] pci 0000:26:00.4: pme_poll = true
[    0.272736] pci 0000:26:00.4: after device_set_wakeup_capable()
[    0.272739] pci 0000:26:00.4: after pci_pme_active()
[    0.273014] pci 0000:26:00.6: [1022:15e3] type 00 class 0x040300
[    0.273040] pci 0000:26:00.6: reg 0x10: [mem 0xfcc80000-0xfcc87fff]
[    0.273094] pci 0000:26:00.6: enabling Extended Tags
[    0.273177] pci 0000:26:00.6: PME# supported from D0 D3hot D3cold
[    0.273177] pci 0000:26:00.6: pme_poll = true
[    0.273178] pci 0000:26:00.6: after device_set_wakeup_capable()
[    0.273182] pci 0000:26:00.6: after pci_pme_active()
[    0.273513] pci 0000:00:08.1: PCI bridge to [bus 26]
[    0.273519] pci 0000:00:08.1:   bridge window [io  0xe000-0xefff]
[    0.273522] pci 0000:00:08.1:   bridge window [mem 0xfc900000-0xfccfffff]
[    0.273527] pci 0000:00:08.1:   bridge window [mem 0x7fe0000000-0x7ff01fffff 64bit pref]
[    0.273672] pci 0000:27:00.0: [1022:7901] type 00 class 0x010601
[    0.273757] pci 0000:27:00.0: reg 0x24: [mem 0xfcf00000-0xfcf007ff]
[    0.273777] pci 0000:27:00.0: enabling Extended Tags
[    0.273886] pci 0000:27:00.0: PME# supported from D3hot D3cold
[    0.273887] pci 0000:27:00.0: pme_poll = true
[    0.273887] pci 0000:27:00.0: after device_set_wakeup_capable()
[    0.273891] pci 0000:27:00.0: after pci_pme_active()
[    0.274226] pci 0000:00:08.2: PCI bridge to [bus 27]
[    0.274233] pci 0000:00:08.2:   bridge window [mem 0xfcf00000-0xfcffffff]
[    0.276744] ACPI: PCI Interrupt Link [LNKA] (IRQs 4 5 7 10 11 14 15) *0
[    0.276996] ACPI: PCI Interrupt Link [LNKB] (IRQs 4 5 7 10 11 14 15) *0
[    0.277223] ACPI: PCI Interrupt Link [LNKC] (IRQs 4 5 7 10 11 14 15) *0
[    0.277476] ACPI: PCI Interrupt Link [LNKD] (IRQs 4 5 7 10 11 14 15) *0
[    0.277722] ACPI: PCI Interrupt Link [LNKE] (IRQs 4 5 7 10 11 14 15) *0
[    0.277930] ACPI: PCI Interrupt Link [LNKF] (IRQs 4 5 7 10 11 14 15) *0
[    0.278131] ACPI: PCI Interrupt Link [LNKG] (IRQs 4 5 7 10 11 14 15) *0
[    0.278339] ACPI: PCI Interrupt Link [LNKH] (IRQs 4 5 7 10 11 14 15) *0
[    0.280565] iommu: Default domain type: Translated 
[    0.280609] pci 0000:26:00.0: vgaarb: VGA device added: decodes=io+mem,owns=none,locks=none
[    0.280609] pci 0000:26:00.0: vgaarb: bridge control possible
[    0.280609] pci 0000:26:00.0: vgaarb: setting as boot device
[    0.280609] vgaarb: loaded
[    0.281638] SCSI subsystem initialized
[    0.281693] libata version 3.00 loaded.
[    0.281693] ACPI: bus type USB registered
[    0.281693] usbcore: registered new interface driver usbfs
[    0.281693] usbcore: registered new interface driver hub
[    0.281693] usbcore: registered new device driver usb
[    0.289766] Registered efivars operations
[    0.290051] PCI: Using ACPI for IRQ routing
[    0.292863] PCI: pci_cache_line_size set to 64 bytes
[    0.292948] e820: reserve RAM buffer [mem 0x09d80000-0x0bffffff]
[    0.292952] e820: reserve RAM buffer [mem 0x0a200000-0x0bffffff]
[    0.292954] e820: reserve RAM buffer [mem 0x0b000000-0x0bffffff]
[    0.292956] e820: reserve RAM buffer [mem 0xe8c67000-0xebffffff]
[    0.292957] e820: reserve RAM buffer [mem 0xeba9f000-0xebffffff]
[    0.292959] e820: reserve RAM buffer [mem 0xec014000-0xefffffff]
[    0.292960] e820: reserve RAM buffer [mem 0xef000000-0xefffffff]
[    0.292962] e820: reserve RAM buffer [mem 0x38f000000-0x38fffffff]
[    0.293451] hpet0: at MMIO 0xfed00000, IRQs 2, 8, 0
[    0.293453] hpet0: 3 comparators, 32-bit 14.318180 MHz counter
[    0.295266] clocksource: Switched to clocksource tsc-early
[    0.329077] *** VALIDATE bpf ***
[    0.329693] VFS: Disk quotas dquot_6.6.0
[    0.329941] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[    0.330007] *** VALIDATE ramfs ***
[    0.330068] *** VALIDATE hugetlbfs ***
[    0.330415] pnp: PnP ACPI init
[    0.330761] system 00:00: [mem 0xf8000000-0xfbffffff] has been reserved
[    0.330769] system 00:00: Plug and Play ACPI device, IDs PNP0c01 (active)
[    0.331002] system 00:01: [mem 0x38f000000-0x40effffff window] has been reserved
[    0.331007] system 00:01: Plug and Play ACPI device, IDs PNP0c02 (active)
[    0.331561] pnp 00:02: Plug and Play ACPI device, IDs PNP0b00 (active)
[    0.332259] system 00:03: [io  0x0a00-0x0a0f] has been reserved
[    0.332263] system 00:03: [io  0x0a10-0x0a1f] has been reserved
[    0.332266] system 00:03: [io  0x0a20-0x0a2f] has been reserved
[    0.332270] system 00:03: [io  0x0a40-0x0a4f] has been reserved
[    0.332275] system 00:03: Plug and Play ACPI device, IDs PNP0c02 (active)
[    0.333620] pnp 00:04: [dma 0 disabled]
[    0.333708] pnp 00:04: Plug and Play ACPI device, IDs PNP0501 (active)
[    0.334501] system 00:05: [io  0x04d0-0x04d1] has been reserved
[    0.334505] system 00:05: [io  0x040b] has been reserved
[    0.334508] system 00:05: [io  0x04d6] has been reserved
[    0.334512] system 00:05: [io  0x0c00-0x0c01] has been reserved
[    0.334515] system 00:05: [io  0x0c14] has been reserved
[    0.334518] system 00:05: [io  0x0c50-0x0c51] has been reserved
[    0.334521] system 00:05: [io  0x0c52] has been reserved
[    0.334525] system 00:05: [io  0x0c6c] has been reserved
[    0.334528] system 00:05: [io  0x0c6f] has been reserved
[    0.334531] system 00:05: [io  0x0cd0-0x0cd1] has been reserved
[    0.334534] system 00:05: [io  0x0cd2-0x0cd3] has been reserved
[    0.334538] system 00:05: [io  0x0cd4-0x0cd5] has been reserved
[    0.334541] system 00:05: [io  0x0cd6-0x0cd7] has been reserved
[    0.334544] system 00:05: [io  0x0cd8-0x0cdf] has been reserved
[    0.334547] system 00:05: [io  0x0800-0x089f] has been reserved
[    0.334551] system 00:05: [io  0x0b00-0x0b0f] has been reserved
[    0.334554] system 00:05: [io  0x0b20-0x0b3f] has been reserved
[    0.334567] system 00:05: [io  0x0900-0x090f] has been reserved
[    0.334570] system 00:05: [io  0x0910-0x091f] has been reserved
[    0.334574] system 00:05: [mem 0xfec00000-0xfec00fff] could not be reserved
[    0.334577] system 00:05: [mem 0xfec01000-0xfec01fff] could not be reserved
[    0.334581] system 00:05: [mem 0xfedc0000-0xfedc0fff] has been reserved
[    0.334584] system 00:05: [mem 0xfee00000-0xfee00fff] has been reserved
[    0.334587] system 00:05: [mem 0xfed80000-0xfed8ffff] could not be reserved
[    0.334590] system 00:05: [mem 0xfec10000-0xfec10fff] has been reserved
[    0.334593] system 00:05: [mem 0xff000000-0xffffffff] has been reserved
[    0.334599] system 00:05: Plug and Play ACPI device, IDs PNP0c02 (active)
[    0.336529] pnp: PnP ACPI: found 6 devices
[    0.347218] clocksource: acpi_pm: mask: 0xffffff max_cycles: 0xffffff, max_idle_ns: 2085701024 ns
[    0.347303] pci 0000:20:00.0: PCI bridge to [bus 21]
[    0.347317] pci 0000:20:01.0: PCI bridge to [bus 22]
[    0.347319] pci 0000:20:01.0:   bridge window [io  0xf000-0xffff]
[    0.347324] pci 0000:20:01.0:   bridge window [mem 0xfcd00000-0xfcdfffff]
[    0.347333] pci 0000:20:04.0: PCI bridge to [bus 25]
[    0.347345] pci 0000:12:00.2: PCI bridge to [bus 20-25]
[    0.347347] pci 0000:12:00.2:   bridge window [io  0xf000-0xffff]
[    0.347351] pci 0000:12:00.2:   bridge window [mem 0xfcd00000-0xfcdfffff]
[    0.347359] pci 0000:00:01.2: PCI bridge to [bus 12-25]
[    0.347360] pci 0000:00:01.2:   bridge window [io  0xf000-0xffff]
[    0.347365] pci 0000:00:01.2:   bridge window [mem 0xfcd00000-0xfcefffff]
[    0.347374] pci 0000:00:08.1: PCI bridge to [bus 26]
[    0.347381] pci 0000:00:08.1:   bridge window [io  0xe000-0xefff]
[    0.347385] pci 0000:00:08.1:   bridge window [mem 0xfc900000-0xfccfffff]
[    0.347388] pci 0000:00:08.1:   bridge window [mem 0x7fe0000000-0x7ff01fffff 64bit pref]
[    0.347394] pci 0000:00:08.2: PCI bridge to [bus 27]
[    0.347398] pci 0000:00:08.2:   bridge window [mem 0xfcf00000-0xfcffffff]
[    0.347408] pci_bus 0000:00: resource 4 [io  0x0000-0x03af window]
[    0.347409] pci_bus 0000:00: resource 5 [io  0x03e0-0x0cf7 window]
[    0.347410] pci_bus 0000:00: resource 6 [io  0x03b0-0x03df window]
[    0.347411] pci_bus 0000:00: resource 7 [io  0x0d00-0xffff window]
[    0.347412] pci_bus 0000:00: resource 8 [mem 0x000a0000-0x000bffff window]
[    0.347412] pci_bus 0000:00: resource 9 [mem 0x000c0000-0x000dffff window]
[    0.347413] pci_bus 0000:00: resource 10 [mem 0xf0000000-0xfcffffff window]
[    0.347414] pci_bus 0000:00: resource 11 [mem 0x40f000000-0x7fffffffff window]
[    0.347415] pci_bus 0000:12: resource 0 [io  0xf000-0xffff]
[    0.347415] pci_bus 0000:12: resource 1 [mem 0xfcd00000-0xfcefffff]
[    0.347416] pci_bus 0000:20: resource 0 [io  0xf000-0xffff]
[    0.347417] pci_bus 0000:20: resource 1 [mem 0xfcd00000-0xfcdfffff]
[    0.347417] pci_bus 0000:22: resource 0 [io  0xf000-0xffff]
[    0.347418] pci_bus 0000:22: resource 1 [mem 0xfcd00000-0xfcdfffff]
[    0.347419] pci_bus 0000:26: resource 0 [io  0xe000-0xefff]
[    0.347420] pci_bus 0000:26: resource 1 [mem 0xfc900000-0xfccfffff]
[    0.347420] pci_bus 0000:26: resource 2 [mem 0x7fe0000000-0x7ff01fffff 64bit pref]
[    0.347421] pci_bus 0000:27: resource 1 [mem 0xfcf00000-0xfcffffff]
[    0.347993] NET: Registered protocol family 2
[    0.348665] tcp_listen_portaddr_hash hash table entries: 8192 (order: 5, 131072 bytes, linear)
[    0.348683] TCP established hash table entries: 131072 (order: 8, 1048576 bytes, linear)
[    0.348810] TCP bind hash table entries: 65536 (order: 8, 1048576 bytes, linear)
[    0.348923] TCP: Hash tables configured (established 131072 bind 65536)
[    0.349101] UDP hash table entries: 8192 (order: 6, 262144 bytes, linear)
[    0.349134] UDP-Lite hash table entries: 8192 (order: 6, 262144 bytes, linear)
[    0.349753] NET: Registered protocol family 1
[    0.350192] pci 0000:26:00.1: D0 power state depends on 0000:26:00.0
[    0.351012] PCI: CLS 64 bytes, default 64
[    0.351108] Trying to unpack rootfs image as initramfs...
[    0.371599] Freeing initrd memory: 7596K
[    0.371672] pci 0000:00:00.2: AMD-Vi: Unable to write to IOMMU perf counter.
[    0.371985] pci 0000:00:00.2: can't derive routing for PCI INT A
[    0.371986] pci 0000:00:00.2: PCI INT A: not connected
[    0.372094] pci 0000:00:01.0: Adding to iommu group 0
[    0.373546] pci 0000:00:01.2: Adding to iommu group 1
[    0.374636] pci 0000:00:08.0: Adding to iommu group 2
[    0.375945] pci 0000:00:08.1: Adding to iommu group 3
[    0.377070] pci 0000:00:08.2: Adding to iommu group 4
[    0.378282] pci 0000:00:14.0: Adding to iommu group 5
[    0.379444] pci 0000:00:14.3: Adding to iommu group 5
[    0.379523] pci 0000:00:18.0: Adding to iommu group 6
[    0.380694] pci 0000:00:18.1: Adding to iommu group 6
[    0.380741] pci 0000:00:18.2: Adding to iommu group 6
[    0.380787] pci 0000:00:18.3: Adding to iommu group 6
[    0.380834] pci 0000:00:18.4: Adding to iommu group 6
[    0.380885] pci 0000:00:18.5: Adding to iommu group 6
[    0.380937] pci 0000:00:18.6: Adding to iommu group 6
[    0.380983] pci 0000:00:18.7: Adding to iommu group 6
[    0.381061] pci 0000:12:00.0: Adding to iommu group 7
[    0.382230] pci 0000:12:00.1: Adding to iommu group 7
[    0.382283] pci 0000:12:00.2: Adding to iommu group 7
[    0.382328] pci 0000:20:00.0: Adding to iommu group 7
[    0.382383] pci 0000:20:01.0: Adding to iommu group 7
[    0.382427] pci 0000:20:04.0: Adding to iommu group 7
[    0.382477] pci 0000:22:00.0: Adding to iommu group 7
[    0.382616] pci 0000:26:00.0: Adding to iommu group 8
[    0.382710] pci 0000:26:00.0: Using iommu direct mapping
[    0.382800] pci 0000:26:00.1: Adding to iommu group 9
[    0.384001] pci 0000:26:00.2: Adding to iommu group 9
[    0.384064] pci 0000:26:00.3: Adding to iommu group 9
[    0.384122] pci 0000:26:00.4: Adding to iommu group 9
[    0.384177] pci 0000:26:00.6: Adding to iommu group 9
[    0.384251] pci 0000:27:00.0: Adding to iommu group 10
[    0.385623] pci 0000:00:00.2: AMD-Vi: Found IOMMU cap 0x40
[    0.385624] pci 0000:00:00.2: AMD-Vi: Extended features (0x4f77ef22294ada):
[    0.385624]  PPR NX GT IA GA PC GA_vAPIC
[    0.385626] AMD-Vi: Interrupt remapping enabled
[    0.385626] AMD-Vi: Virtual APIC enabled
[    0.385967] AMD-Vi: Lazy IO/TLB flushing enabled
[    0.387294] amd_uncore: AMD NB counters detected
[    0.387388] amd_uncore: AMD LLC counters detected
[    0.391281] Initialise system trusted keyrings
[    0.391479] workingset: timestamp_bits=37 max_order=22 bucket_order=0
[    0.398184] zbud: loaded
[    0.401103] NET: Registered protocol family 38
[    0.401108] Key type asymmetric registered
[    0.401109] Asymmetric key parser 'x509' registered
[    0.401123] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 249)
[    0.401282] io scheduler mq-deadline registered
[    0.401283] io scheduler kyber registered
[    0.401817] pcieport 0000:00:01.2: AER: enabled with IRQ 26
[    0.402689] pcieport 0000:00:08.2: AER: enabled with IRQ 28
[    0.404700] efifb: probing for efifb
[    0.404736] efifb: framebuffer at 0x7fe0000000, using 3072k, total 3072k
[    0.404736] efifb: mode is 1024x768x32, linelength=4096, pages=1
[    0.404737] efifb: scrolling: redraw
[    0.404737] efifb: Truecolor: size=8:8:8:8, shift=24:16:8:0
[    0.404999] Console: switching to colour frame buffer device 128x48
[    0.406272] fb0: EFI VGA frame buffer device
[    0.406500] input: Power Button as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0C:00/input/input0
[    0.406569] ACPI: Power Button [PWRB]
[    0.406667] input: Power Button as /devices/LNXSYSTM:00/LNXPWRBN:00/input/input1
[    0.406734] ACPI: Power Button [PWRF]
[    0.406818] Monitor-Mwait will be used to enter C-1 state
[    0.408118] Serial: 8250/16550 driver, 32 ports, IRQ sharing enabled
[    0.429085] 00:04: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
[    0.432951] Non-volatile memory driver v1.3
[    0.433036] Linux agpgart interface v0.103
[    0.433646] AMD-Vi: AMD IOMMUv2 driver by Joerg Roedel <jroedel@suse.de>
[    0.433880] [drm] radeon kernel modesetting enabled.
[    0.434901] ahci 0000:12:00.1: version 3.0
[    0.435247] ahci 0000:12:00.1: SSS flag set, parallel bus scan disabled
[    0.435305] ahci 0000:12:00.1: AHCI 0001.0301 32 slots 8 ports 6 Gbps 0x33 impl SATA mode
[    0.435307] ahci 0000:12:00.1: flags: 64bit ncq sntf stag pm led clo only pmp pio slum part sxs deso sadm sds apst 
[    0.437658] scsi host0: ahci
[    0.438308] scsi host1: ahci
[    0.438791] scsi host2: ahci
[    0.439229] scsi host3: ahci
[    0.439757] scsi host4: ahci
[    0.440246] scsi host5: ahci
[    0.440754] scsi host6: ahci
[    0.441255] scsi host7: ahci
[    0.441551] ata1: SATA max UDMA/133 abar m131072@0xfce80000 port 0xfce80100 irq 36
[    0.441553] ata2: SATA max UDMA/133 abar m131072@0xfce80000 port 0xfce80180 irq 36
[    0.441554] ata3: DUMMY
[    0.441554] ata4: DUMMY
[    0.441556] ata5: SATA max UDMA/133 abar m131072@0xfce80000 port 0xfce80300 irq 36
[    0.441557] ata6: SATA max UDMA/133 abar m131072@0xfce80000 port 0xfce80380 irq 36
[    0.441558] ata7: DUMMY
[    0.441558] ata8: DUMMY
[    0.441616] ata1: SATA link down (SStatus 0 SControl 0)
[    0.441690] ata2: SATA link down (SStatus 0 SControl 0)
[    0.441786] ata5: SATA link down (SStatus 0 SControl 0)
[    0.441859] ata6: SATA link down (SStatus 0 SControl 0)
[    0.452321] ahci 0000:27:00.0: AHCI 0001.0301 32 slots 1 ports 6 Gbps 0x1 impl SATA mode
[    0.452323] ahci 0000:27:00.0: flags: 64bit ncq sntf ilck pm led clo only pmp fbs pio slum part 
[    0.452880] scsi host8: ahci
[    0.453234] ata9: SATA max UDMA/133 abar m2048@0xfcf00000 port 0xfcf00100 irq 38
[    0.453437] libphy: Fixed MDIO Bus: probed
[    0.453611] i8042: PNP: No PS/2 controller found.
[    0.453696] mousedev: PS/2 mouse device common for all mice
[    0.453936] rtc_cmos 00:02: RTC can wake from S4
[    0.454401] rtc_cmos 00:02: registered as rtc0
[    0.454468] rtc_cmos 00:02: alarms up to one month, y3k, 114 bytes nvram, hpet irqs
[    0.454661] device-mapper: uevent: version 1.0.3
[    0.454936] device-mapper: ioctl: 4.41.0-ioctl (2019-09-16) initialised: dm-devel@redhat.com
[    0.456189] hid: raw HID events driver (C) Jiri Kosina
[    0.456268] usbcore: registered new interface driver usbhid
[    0.456268] usbhid: USB HID core driver
[    0.456668] Initializing XFRM netlink socket
[    0.457572] NET: Registered protocol family 10
[    0.458603] Segment Routing with IPv6
[    0.458623] mip6: Mobile IPv6
[    0.458624] NET: Registered protocol family 17
[    0.459148] ata9: SATA link up 6.0 Gbps (SStatus 133 SControl 0)
[    0.459268] ata9.00: supports DRM functions and may not be fully accessible
[    0.459302] ata9.00: ATA-10: CT1000MX500SSD4, M3CR020, max UDMA/133
[    0.459303] ata9.00: 1953525168 sectors, multi 1: LBA48 NCQ (depth 32), AA
[    0.459507] microcode: CPU0: patch_level=0x08101016
[    0.459529] microcode: CPU1: patch_level=0x08101016
[    0.459539] microcode: CPU2: patch_level=0x08101016
[    0.459561] microcode: CPU3: patch_level=0x08101016
[    0.459629] microcode: Microcode Update Driver: v2.2.
[    0.459631] IPI shorthand broadcast: enabled
[    0.459650] AVX2 version of gcm_enc/dec engaged.
[    0.459650] AES CTR mode by8 optimization enabled
[    0.460063] ata9.00: supports DRM functions and may not be fully accessible
[    0.460676] ata9.00: configured for UDMA/133
[    0.461815] scsi 8:0:0:0: Direct-Access     ATA      CT1000MX500SSD4  020  PQ: 0 ANSI: 5
[    0.462271] sd 8:0:0:0: Attached scsi generic sg0 type 0
[    0.462415] sd 8:0:0:0: [sda] 1953525168 512-byte logical blocks: (1.00 TB/932 GiB)
[    0.462418] sd 8:0:0:0: [sda] 4096-byte physical blocks
[    0.462429] sd 8:0:0:0: [sda] Write Protect is off
[    0.462431] sd 8:0:0:0: [sda] Mode Sense: 00 3a 00 00
[    0.462447] sd 8:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    0.463283]  sda: sda1 sda2 sda3
[    0.465312] sd 8:0:0:0: [sda] Attached SCSI disk
[    0.476536] sched_clock: Marking stable (487511802, -10995110)->(480927678, -4410986)
[    0.476784] registered taskstats version 1
[    0.476787] Loading compiled-in X.509 certificates
[    0.481274] Loaded X.509 cert 'Build time autogenerated kernel key: 91b5e042fe2c53b9e28e9b8228b2a1504b5ab494'
[    0.481401] zswap: loaded using pool lzo/zbud
[    0.481570] kmemleak: Kernel memory leak detector initialized (mem pool available: 14473)
[    0.481575] kmemleak: Automatic memory scanning thread started
[    0.485544] Key type encrypted registered
[    0.488777] PM:   Magic number: 4:447:682
[    0.488939] rtc_cmos 00:02: setting system clock to 2020-01-01T12:41:20 UTC (1577882480)
[    0.489343] After kernel_init_freeable
[    0.492322] Freeing unused kernel image (initmem) memory: 1708K
[    0.495527] Write protecting the kernel read-only data: 20480k
[    0.495945] Freeing unused kernel image (text/rodata gap) memory: 2040K
[    0.496246] Freeing unused kernel image (rodata/data gap) memory: 1728K
[    0.502440] x86/mm: Checked W+X mappings: passed, no W+X pages found.
[    0.502445] rodata_test: all tests were successful
[    0.502445] After mark_readonly
[    0.502445] After pti_finalize
[    0.502453] rcu_end_inkernel_boot
[    0.502453] Run /init as init process
[    0.627192] xhci_hcd 0000:12:00.0: xHCI Host Controller
[    0.627326] xhci_hcd 0000:12:00.0: new USB bus registered, assigned bus number 1
[    0.683146] xhci_hcd 0000:12:00.0: hcc params 0x0200ef81 hci version 0x110 quirks 0x0000000048000410
[    0.684227] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.05
[    0.684228] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    0.684229] usb usb1: Product: xHCI Host Controller
[    0.684230] usb usb1: Manufacturer: Linux 5.5.0-rc4-01573-g8c7c363976f2 xhci-hcd
[    0.684231] usb usb1: SerialNumber: 0000:12:00.0
[    0.684563] hub 1-0:1.0: USB hub found
[    0.684704] hub 1-0:1.0: 10 ports detected
[    0.687623] xhci_hcd 0000:12:00.0: xHCI Host Controller
[    0.687746] xhci_hcd 0000:12:00.0: new USB bus registered, assigned bus number 2
[    0.687752] xhci_hcd 0000:12:00.0: Host supports USB 3.1 Enhanced SuperSpeed
[    0.687870] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
[    0.687941] usb usb2: New USB device found, idVendor=1d6b, idProduct=0003, bcdDevice= 5.05
[    0.687942] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    0.687943] usb usb2: Product: xHCI Host Controller
[    0.687943] usb usb2: Manufacturer: Linux 5.5.0-rc4-01573-g8c7c363976f2 xhci-hcd
[    0.687944] usb usb2: SerialNumber: 0000:12:00.0
[    0.688979] hub 2-0:1.0: USB hub found
[    0.689015] hub 2-0:1.0: 4 ports detected
[    0.690004] xhci_hcd 0000:26:00.3: xHCI Host Controller
[    0.690119] xhci_hcd 0000:26:00.3: new USB bus registered, assigned bus number 3
[    0.691093] xhci_hcd 0000:26:00.3: hcc params 0x0270ffe5 hci version 0x110 quirks 0x0000000840000410
[    0.693082] usb usb3: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.05
[    0.693083] usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    0.693084] usb usb3: Product: xHCI Host Controller
[    0.693084] usb usb3: Manufacturer: Linux 5.5.0-rc4-01573-g8c7c363976f2 xhci-hcd
[    0.693085] usb usb3: SerialNumber: 0000:26:00.3
[    0.693381] hub 3-0:1.0: USB hub found
[    0.693404] hub 3-0:1.0: 4 ports detected
[    0.694590] xhci_hcd 0000:26:00.3: xHCI Host Controller
[    0.694690] xhci_hcd 0000:26:00.3: new USB bus registered, assigned bus number 4
[    0.694695] xhci_hcd 0000:26:00.3: Host supports USB 3.1 Enhanced SuperSpeed
[    0.694763] usb usb4: We don't know the algorithms for LPM for this host, disabling LPM.
[    0.694828] usb usb4: New USB device found, idVendor=1d6b, idProduct=0003, bcdDevice= 5.05
[    0.694828] usb usb4: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    0.694829] usb usb4: Product: xHCI Host Controller
[    0.694830] usb usb4: Manufacturer: Linux 5.5.0-rc4-01573-g8c7c363976f2 xhci-hcd
[    0.694830] usb usb4: SerialNumber: 0000:26:00.3
[    0.695093] hub 4-0:1.0: USB hub found
[    0.695130] hub 4-0:1.0: 4 ports detected
[    0.696425] xhci_hcd 0000:26:00.4: xHCI Host Controller
[    0.696518] xhci_hcd 0000:26:00.4: new USB bus registered, assigned bus number 5
[    0.696815] xhci_hcd 0000:26:00.4: hcc params 0x0260ffe5 hci version 0x110 quirks 0x0000000840000410
[    0.697781] usb usb5: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.05
[    0.697782] usb usb5: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    0.697783] usb usb5: Product: xHCI Host Controller
[    0.697783] usb usb5: Manufacturer: Linux 5.5.0-rc4-01573-g8c7c363976f2 xhci-hcd
[    0.697784] usb usb5: SerialNumber: 0000:26:00.4
[    0.698037] hub 5-0:1.0: USB hub found
[    0.698071] hub 5-0:1.0: 1 port detected
[    0.698472] xhci_hcd 0000:26:00.4: xHCI Host Controller
[    0.698546] xhci_hcd 0000:26:00.4: new USB bus registered, assigned bus number 6
[    0.698551] xhci_hcd 0000:26:00.4: Host supports USB 3.1 Enhanced SuperSpeed
[    0.698620] usb usb6: We don't know the algorithms for LPM for this host, disabling LPM.
[    0.698674] usb usb6: New USB device found, idVendor=1d6b, idProduct=0003, bcdDevice= 5.05
[    0.698675] usb usb6: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    0.698676] usb usb6: Product: xHCI Host Controller
[    0.698676] usb usb6: Manufacturer: Linux 5.5.0-rc4-01573-g8c7c363976f2 xhci-hcd
[    0.698677] usb usb6: SerialNumber: 0000:26:00.4
[    0.698927] hub 6-0:1.0: USB hub found
[    0.698950] hub 6-0:1.0: 1 port detected
[    1.010360] usb 1-7: new low-speed USB device number 2 using xhci_hcd
[    1.018340] usb 5-1: new high-speed USB device number 2 using xhci_hcd
[    1.202394] usb 5-1: New USB device found, idVendor=1c6b, idProduct=a223, bcdDevice= 0.00
[    1.202395] usb 5-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    1.202397] usb 5-1: Product: Mass Storage Device
[    1.202398] usb 5-1: Manufacturer: USB2.0 External
[    1.202398] usb 5-1: SerialNumber: 86 406817504398
[    1.244868] usb 1-7: New USB device found, idVendor=093a, idProduct=2521, bcdDevice= 1.00
[    1.244870] usb 1-7: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[    1.244871] usb 1-7: Product: USB OPTICAL MOUSE
[    1.271986] input: USB OPTICAL MOUSE as /devices/pci0000:00/0000:00:01.2/0000:12:00.0/usb1/1-7/1-7:1.0/0003:093A:2521.0001/input/input2
[    1.272257] hid-generic 0003:093A:2521.0001: input,hidraw0: USB HID v1.11 Mouse [USB OPTICAL MOUSE] on usb-0000:12:00.0-7/input0
[    1.386353] usb 1-10: new low-speed USB device number 3 using xhci_hcd
[    1.428047] tsc: Refined TSC clocksource calibration: 3502.961 MHz
[    1.428059] clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x327e3e45559, max_idle_ns: 440795235664 ns
[    1.428334] clocksource: Switched to clocksource tsc
[    1.628733] usb 1-10: New USB device found, idVendor=045e, idProduct=07b9, bcdDevice= 1.14
[    1.628735] usb 1-10: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    1.628737] usb 1-10: Product: USB Keyboard
[    1.628738] usb 1-10: Manufacturer: LITEON Technology
[    1.658912] input: LITEON Technology USB Keyboard as /devices/pci0000:00/0000:00:01.2/0000:12:00.0/usb1/1-10/1-10:1.0/0003:045E:07B9.0002/input/input3
[    1.711182] hid-generic 0003:045E:07B9.0002: input,hidraw1: USB HID v1.10 Keyboard [LITEON Technology USB Keyboard] on usb-0000:12:00.0-10/input0
[   12.967707] EXT4-fs (dm-0): mounted filesystem with ordered data mode. Opts: (null)
[   13.141514] systemd[1]: systemd 244-3 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=hybrid)
[   13.153054] systemd[1]: Detected architecture x86-64.
[   13.166516] systemd[1]: Set hostname to <tokeiihto>.
[   13.169673] systemd[1]: Couldn't move remaining userspace processes, ignoring: Input/output error
[   13.262250] systemd[1]: /lib/systemd/system/dbus.socket:5: ListenStream= references a path below legacy directory /var/run/, updating /var/run/dbus/system_bus_socket → /run/dbus/system_bus_socket; please update the unit file accordingly.
[   13.299326] systemd[1]: Created slice system-systemd\x2dcryptsetup.slice.
[   13.300519] systemd[1]: Created slice system-systemd\x2dfsck.slice.
[   13.301551] systemd[1]: Created slice User and Session Slice.
[   13.301651] systemd[1]: Started Dispatch Password Requests to Console Directory Watch.
[   13.301723] systemd[1]: Started Forward Password Requests to Wall Directory Watch.
[   13.302263] systemd[1]: Set up automount Arbitrary Executable File Formats File System Automount Point.
[   13.302354] systemd[1]: Reached target Remote File Systems.
[   13.302385] systemd[1]: Reached target Slices.
[   13.302419] systemd[1]: Reached target Swap.
[   13.304090] systemd[1]: Listening on Process Core Dump Socket.
[   13.304228] systemd[1]: Listening on fsck to fsckd communication Socket.
[   13.304307] systemd[1]: Listening on initctl Compatibility Named Pipe.
[   13.304486] systemd[1]: Listening on Journal Audit Socket.
[   13.304603] systemd[1]: Listening on Journal Socket (/dev/log).
[   13.304734] systemd[1]: Listening on Journal Socket.
[   13.304855] systemd[1]: Listening on udev Control Socket.
[   13.304971] systemd[1]: Listening on udev Kernel Socket.
[   13.307690] systemd[1]: Mounting Huge Pages File System...
[   13.309903] systemd[1]: Mounting POSIX Message Queue File System...
[   13.310025] systemd[1]: Condition check resulted in FUSE Control File System being skipped.
[   13.312622] systemd[1]: Mounting Kernel Configuration File System...
[   13.315715] systemd[1]: Mounting Kernel Debug File System...
[   13.322505] systemd[1]: Starting Create list of static device nodes for the current kernel...
[   13.322975] systemd[1]: Condition check resulted in Set Up Additional Binary Formats being skipped.
[   13.323014] systemd[1]: Condition check resulted in File System Check on Root Device being skipped.
[   13.325955] systemd[1]: Starting Journal Service...
[   13.329805] systemd[1]: Starting Remount Root and Kernel File Systems...
[   13.332304] systemd[1]: Starting Apply Kernel Variables...
[   13.334937] systemd[1]: Starting udev Coldplug all Devices...
[   13.336597] systemd[1]: Mounted Huge Pages File System.
[   13.336736] systemd[1]: Mounted POSIX Message Queue File System.
[   13.336839] systemd[1]: Mounted Kernel Configuration File System.
[   13.336945] systemd[1]: Mounted Kernel Debug File System.
[   13.337651] systemd[1]: Started Create list of static device nodes for the current kernel.
[   13.343771] EXT4-fs (dm-0): re-mounted. Opts: errors=remount-ro
[   13.345709] systemd[1]: Started Remount Root and Kernel File Systems.
[   13.347386] systemd[1]: Condition check resulted in Rebuild Hardware Database being skipped.
[   13.350816] systemd[1]: Starting Load/Save Random Seed...
[   13.353195] systemd[1]: Starting Create System Users...
[   13.353979] systemd[1]: Started Apply Kernel Variables.
[   13.366928] systemd[1]: Started Create System Users.
[   13.369294] systemd[1]: Starting Create Static Device Nodes in /dev...
[   13.378544] systemd[1]: Started Load/Save Random Seed.
[   13.384921] systemd[1]: Started Create Static Device Nodes in /dev.
[   13.385155] systemd[1]: Reached target Local File Systems (Pre).
[   13.388372] systemd[1]: Starting udev Kernel Device Manager...
[   13.453302] systemd[1]: Started udev Coldplug all Devices.
[   13.468413] systemd[1]: Started udev Kernel Device Manager.
[   13.512293] acpi_cpufreq: overriding BIOS provided _PSD data
[   13.535817] ACPI: Video Device [VGA1] (multi-head: yes  rom: no  post: no)
[   13.536486] acpi device:10: registered as cooling_device4
[   13.536619] input: Video Bus as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:0f/LNXVIDEO:01/input/input4
[   13.590290] acpi PNP0C14:02: duplicate WMI GUID 05901221-D566-11D1-B2F0-00A0C9062910 (first instance was on PNP0C14:01)
[   13.638720] r8169 0000:22:00.0: enabling device (0000 -> 0003)
[   13.646184] libphy: r8169: probed
[   13.646666] r8169 0000:22:00.0 eth0: RTL8168h/8111h, 30:9c:23:04:d6:98, XID 541, IRQ 52
[   13.646668] r8169 0000:22:00.0 eth0: jumbo features [frames: 9200 bytes, tx checksumming: ko]
[   13.696188] systemd[1]: Started Journal Service.
[   13.705555] piix4_smbus 0000:00:14.0: SMBus Host Controller at 0xb00, revision 0
[   13.705556] piix4_smbus 0000:00:14.0: Using register 0x02 for SMBus port selection
[   13.714240] systemd-journald[295]: Received client request to flush runtime journal.
[   13.731627] usb-storage 5-1:1.0: USB Mass Storage device detected
[   13.735404] [drm] amdgpu kernel modesetting enabled.
[   13.735457] checking generic (7fe0000000 300000) vs hw (7fe0000000 10000000)
[   13.735458] fb0: switching to amdgpudrmfb from EFI VGA
[   13.735567] Console: switching to colour dummy device 80x25
[   13.735615] amdgpu 0000:26:00.0: vgaarb: deactivate vga console
[   13.736090] amdgpu 0000:26:00.0: enabling device (0006 -> 0007)
[   13.736533] [drm] initializing kernel modesetting (RAVEN 0x1002:0x15DD 0x1002:0x15DD 0xC8).
[   13.736554] [drm] register mmio base: 0xFCC00000
[   13.736555] [drm] register mmio size: 524288
[   13.736573] [drm] add ip block number 0 <soc15_common>
[   13.736574] [drm] add ip block number 1 <gmc_v9_0>
[   13.736574] [drm] add ip block number 2 <vega10_ih>
[   13.736575] [drm] add ip block number 3 <psp>
[   13.736575] [drm] add ip block number 4 <gfx_v9_0>
[   13.736576] [drm] add ip block number 5 <sdma_v4_0>
[   13.736577] [drm] add ip block number 6 <powerplay>
[   13.736577] [drm] add ip block number 7 <dm>
[   13.736578] [drm] add ip block number 8 <vcn_v1_0>
[   13.737726] ATOM BIOS: 113-RAVEN-114
[   13.738233] scsi host9: usb-storage 5-1:1.0
[   13.738414] [drm] VCN decode is enabled in VM mode
[   13.738414] [drm] VCN encode is enabled in VM mode
[   13.738415] [drm] JPEG decode is enabled in VM mode
[   13.738590] [drm] vm size is 262144 GB, 4 levels, block size is 9-bit, fragment size is 9-bit
[   13.738597] usbcore: registered new interface driver usb-storage
[   13.738616] amdgpu 0000:26:00.0: VRAM: 2048M 0x000000F400000000 - 0x000000F47FFFFFFF (2048M used)
[   13.738618] amdgpu 0000:26:00.0: GART: 1024M 0x0000000000000000 - 0x000000003FFFFFFF
[   13.738619] amdgpu 0000:26:00.0: AGP: 267419648M 0x000000F800000000 - 0x0000FFFFFFFFFFFF
[   13.738625] [drm] Detected VRAM RAM=2048M, BAR=2048M
[   13.738626] [drm] RAM width 128bits DDR4
[   13.738733] [TTM] Zone  kernel: Available graphics memory: 7168258 KiB
[   13.738734] [TTM] Zone   dma32: Available graphics memory: 2097152 KiB
[   13.738734] [TTM] Initializing pool allocator
[   13.738747] [TTM] Initializing DMA pool allocator
[   13.738883] [drm] amdgpu: 2048M of VRAM memory ready
[   13.738895] [drm] amdgpu: 3072M of GTT memory ready.
[   13.738947] [drm] GART: num cpu pages 262144, num gpu pages 262144
[   13.739593] [drm] PCIE GART of 1024M enabled (table at 0x000000F400900000).
[   13.743307] amdgpu 0000:26:00.0: Direct firmware load for amdgpu/raven_ta.bin failed with error -2
[   13.743310] amdgpu 0000:26:00.0: psp v10.0: Failed to load firmware "amdgpu/raven_ta.bin"
[   13.748435] 1
[   13.748465] 2
[   13.748467] 1
[   13.748471] snd_hda_intel 0000:26:00.6: enabling device (0000 -> 0002)
[   13.748547] 2
[   13.748550] snd_hda_intel 0000:26:00.1: enabling device (0000 -> 0002)
[   13.749797] 3
[   13.749798] 4
[   13.749798] 5
[   13.749798] 6
[   13.749798] 7
[   13.749799] 8
[   13.749799] 9
[   13.749853] 3
[   13.749853] 4
[   13.749853] 5
[   13.749854] 6
[   13.749854] 7
[   13.749854] 8
[   13.749854] 9
[   13.758191] [drm] Warning: check cp_fw_version and update it to realize 			      GRBM requires 1-cycle delay in cp firmware
[   13.775376] input: HD-Audio Generic HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:08.1/0000:26:00.1/sound/card1/input5
[   13.775620] input: HD-Audio Generic HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:08.1/0000:26:00.1/sound/card1/input6
[   13.775891] input: HD-Audio Generic HDMI/DP,pcm=8 as /devices/pci0000:00/0000:00:08.1/0000:26:00.1/sound/card1/input7
[   13.777801] snd_hda_codec_realtek hdaudioC0D0: autoconfig for ALC892: line_outs=3 (0x14/0x15/0x16/0x0/0x0) type:line
[   13.777802] snd_hda_codec_realtek hdaudioC0D0:    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
[   13.777803] snd_hda_codec_realtek hdaudioC0D0:    hp_outs=1 (0x1b/0x0/0x0/0x0/0x0)
[   13.777804] snd_hda_codec_realtek hdaudioC0D0:    mono: mono_out=0x0
[   13.777805] snd_hda_codec_realtek hdaudioC0D0:    dig-out=0x1e/0x0
[   13.777805] snd_hda_codec_realtek hdaudioC0D0:    inputs:
[   13.777806] snd_hda_codec_realtek hdaudioC0D0:      Front Mic=0x19
[   13.777807] snd_hda_codec_realtek hdaudioC0D0:      Rear Mic=0x18
[   13.777808] snd_hda_codec_realtek hdaudioC0D0:      Line=0x1a
[   13.784481] [drm] use_doorbell being set to: [true]
[   13.784807] amdgpu: [powerplay] hwmgr_sw_init smu backed is smu10_smu
[   13.788174] [drm] Found VCN firmware Version ENC: 1.9 DEC: 1 VEP: 0 Revision: 28
[   13.788193] [drm] PSP loading VCN firmware
[   13.815266] [drm] reserve 0x400000 from 0xf47f800000 for PSP TMR
[   13.835215] input: HD-Audio Generic Front Mic as /devices/pci0000:00/0000:00:08.1/0000:26:00.6/sound/card0/input8
[   13.835372] input: HD-Audio Generic Rear Mic as /devices/pci0000:00/0000:00:08.1/0000:26:00.6/sound/card0/input9
[   13.835507] input: HD-Audio Generic Line as /devices/pci0000:00/0000:00:08.1/0000:26:00.6/sound/card0/input10
[   13.835823] input: HD-Audio Generic Line Out Front as /devices/pci0000:00/0000:00:08.1/0000:26:00.6/sound/card0/input11
[   13.835971] input: HD-Audio Generic Line Out Surround as /devices/pci0000:00/0000:00:08.1/0000:26:00.6/sound/card0/input12
[   13.836141] input: HD-Audio Generic Line Out CLFE as /devices/pci0000:00/0000:00:08.1/0000:26:00.6/sound/card0/input13
[   13.836349] input: HD-Audio Generic Front Headphone as /devices/pci0000:00/0000:00:08.1/0000:26:00.6/sound/card0/input14
[   13.851555] EXT4-fs (sda2): mounted filesystem with ordered data mode. Opts: errors=remount-ro
[   13.851612] ext4 filesystem being mounted at /boot supports timestamps until 2038 (0x7fffffff)
[   13.891526] r8169 0000:22:00.0 enp34s0: renamed from eth0
[   13.919758] [drm] DM_PPLIB: values for F clock
[   13.919760] [drm] DM_PPLIB:	 0 in kHz, 3649 in mV
[   13.919760] [drm] DM_PPLIB:	 400000 in kHz, 3649 in mV
[   13.919761] [drm] DM_PPLIB:	 933000 in kHz, 4074 in mV
[   13.919761] [drm] DM_PPLIB:	 1067000 in kHz, 4250 in mV
[   13.919776] ------------[ cut here ]------------
[   13.919846] WARNING: CPU: 3 PID: 309 at drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c:1460 dcn_bw_update_from_pplib+0xaa/0x2f0 [amdgpu]
[   13.919846] Modules linked in: crct10dif_pclmul crc32_pclmul ghash_clmulni_intel snd_hda_codec_realtek snd_hda_codec_generic snd_hda_codec_hdmi snd_hda_intel snd_intel_dspcfg snd_hda_codec snd_hda_core k10temp usb_storage amdgpu(+) i2c_piix4 snd_hwdep snd_pcm snd_timer gpu_sched snd soundcore r8169 realtek wmi video acpi_cpufreq crc32c_intel xhci_pci xhci_hcd
[   13.919855] CPU: 3 PID: 309 Comm: systemd-udevd Not tainted 5.5.0-rc4-01573-g8c7c363976f2 #28
[   13.919856] Hardware name: Micro-Star International Co., Ltd. MS-7A37/B350M MORTAR (MS-7A37), BIOS 1.MR 12/02/2019
[   13.919915] RIP: 0010:dcn_bw_update_from_pplib+0xaa/0x2f0 [amdgpu]
[   13.919916] Code: 0c 24 85 c9 74 24 8d 71 ff 48 8d 44 24 04 48 8d 54 f4 0c eb 0d 48 83 c0 08 48 39 d0 0f 84 2e 01 00 00 44 8b 00 45 85 c0 75 eb <0f> 0b e8 0f 7d bc f1 4c 89 e2 be 04 00 00 00 4c 89 ef e8 6f 54 fe
[   13.919917] RSP: 0018:ffff9f0540317670 EFLAGS: 00010246
[   13.919918] RAX: ffff9f0540317674 RBX: ffff8c206fe30000 RCX: 0000000000000004
[   13.919918] RDX: ffff9f0540317694 RSI: 0000000000000003 RDI: ffff8c20806d8900
[   13.919919] RBP: ffff9f05403177b0 R08: 0000000000000000 R09: 00000000000003c2
[   13.919919] R10: 0000000000013868 R11: 0000000000000004 R12: ffff9f0540317700
[   13.919919] R13: ffff8c20788ff2c0 R14: 0000000000000001 R15: ffff9f0540317850
[   13.919920] FS:  00007fa848774880(0000) GS:ffff8c20806c0000(0000) knlGS:0000000000000000
[   13.919921] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   13.919921] CR2: 00007fa847ca1000 CR3: 000000037b412000 CR4: 00000000003406e0
[   13.919922] Call Trace:
[   13.919982]  dcn10_create_resource_pool+0x836/0xb70 [amdgpu]
[   13.920042]  ? dal_gpio_service_create+0x92/0x110 [amdgpu]
[   13.920098]  dc_create_resource_pool+0xcf/0x150 [amdgpu]
[   13.920154]  dc_create+0x241/0x720 [amdgpu]
[   13.920205]  ? amdgpu_cgs_create_device+0x23/0x50 [amdgpu]
[   13.920261]  amdgpu_dm_init+0x145/0x1d0 [amdgpu]
[   13.920265]  ? stack_trace_save+0x4b/0x70
[   13.920321]  dm_hw_init+0xe/0x20 [amdgpu]
[   13.920377]  amdgpu_device_init.cold+0x1419/0x183b [amdgpu]
[   13.920420]  amdgpu_driver_load_kms+0x48/0x150 [amdgpu]
[   13.920422]  drm_dev_register+0x111/0x150
[   13.920464]  amdgpu_pci_probe+0xbb/0x120 [amdgpu]
[   13.920466]  ? __pm_runtime_resume+0x58/0x80
[   13.920468]  local_pci_probe+0x42/0x80
[   13.920470]  pci_device_probe+0x107/0x1a0
[   13.920472]  really_probe+0x147/0x3c0
[   13.920473]  driver_probe_device+0xb6/0x100
[   13.920474]  device_driver_attach+0x53/0x60
[   13.920475]  __driver_attach+0x8a/0x150
[   13.920476]  ? device_driver_attach+0x60/0x60
[   13.920477]  ? device_driver_attach+0x60/0x60
[   13.920477]  bus_for_each_dev+0x78/0xc0
[   13.920478]  bus_add_driver+0x14d/0x1f0
[   13.920479]  driver_register+0x6c/0xc0
[   13.920480]  ? 0xffffffffc0774000
[   13.920482]  do_one_initcall+0x46/0x1f0
[   13.920484]  ? kmem_cache_alloc_trace+0x18b/0x250
[   13.920486]  ? do_init_module+0x23/0x230
[   13.920487]  do_init_module+0x5c/0x230
[   13.920489]  load_module+0x2767/0x2a10
[   13.920491]  ? vfs_read+0x124/0x150
[   13.920493]  ? __do_sys_finit_module+0xaa/0x110
[   13.920494]  __do_sys_finit_module+0xaa/0x110
[   13.920496]  do_syscall_64+0x55/0x1c0
[   13.920498]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[   13.920499] RIP: 0033:0x7fa848ce10b9
[   13.920500] Code: 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d a7 3d 0c 00 f7 d8 64 89 01 48
[   13.920501] RSP: 002b:00007ffd79b39888 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
[   13.920502] RAX: ffffffffffffffda RBX: 000056059f0a8650 RCX: 00007fa848ce10b9
[   13.920502] RDX: 0000000000000000 RSI: 00007fa848be4cad RDI: 000000000000000f
[   13.920503] RBP: 0000000000020000 R08: 0000000000000000 R09: 000056059f0acb28
[   13.920503] R10: 000000000000000f R11: 0000000000000246 R12: 00007fa848be4cad
[   13.920503] R13: 0000000000000000 R14: 000056059f0afa20 R15: 000056059f0a8650
[   13.920505] ---[ end trace b85761d46c314e4a ]---
[   13.920603] [drm] DM_PPLIB: values for DCF clock
[   13.920604] [drm] DM_PPLIB:	 300000 in kHz, 3649 in mV
[   13.920604] [drm] DM_PPLIB:	 600000 in kHz, 4074 in mV
[   13.920605] [drm] DM_PPLIB:	 626000 in kHz, 4250 in mV
[   13.920605] [drm] DM_PPLIB:	 654000 in kHz, 4399 in mV
[   13.921411] [drm] Display Core initialized with v3.2.62!
[   13.961282] snd_hda_intel 0000:26:00.1: bound 0000:26:00.0 (ops amdgpu_dm_audio_component_bind_ops [amdgpu])
[   13.980349] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[   13.980350] [drm] Driver supports precise vblank timestamp query.
[   14.023652] [drm] VCN decode and encode initialized successfully(under SPG Mode).
[   14.025401] [drm] fb mappable at 0x38FBC1000
[   14.025402] [drm] vram apper at 0x38F000000
[   14.025402] [drm] size 5242880
[   14.025402] [drm] fb depth is 24
[   14.025402] [drm]    pitch is 5120
[   14.025533] fbcon: amdgpudrmfb (fb0) is primary device
[   14.045679] Console: switching to colour frame buffer device 160x64
[   14.066082] amdgpu 0000:26:00.0: fb0: amdgpudrmfb frame buffer device
[   14.072485] amdgpu 0000:26:00.0: ring gfx uses VM inv eng 0 on hub 0
[   14.072487] amdgpu 0000:26:00.0: ring comp_1.0.0 uses VM inv eng 1 on hub 0
[   14.072488] amdgpu 0000:26:00.0: ring comp_1.1.0 uses VM inv eng 4 on hub 0
[   14.072489] amdgpu 0000:26:00.0: ring comp_1.2.0 uses VM inv eng 5 on hub 0
[   14.072491] amdgpu 0000:26:00.0: ring comp_1.3.0 uses VM inv eng 6 on hub 0
[   14.072492] amdgpu 0000:26:00.0: ring comp_1.0.1 uses VM inv eng 7 on hub 0
[   14.072493] amdgpu 0000:26:00.0: ring comp_1.1.1 uses VM inv eng 8 on hub 0
[   14.072494] amdgpu 0000:26:00.0: ring comp_1.2.1 uses VM inv eng 9 on hub 0
[   14.072495] amdgpu 0000:26:00.0: ring comp_1.3.1 uses VM inv eng 10 on hub 0
[   14.072496] amdgpu 0000:26:00.0: ring kiq_2.1.0 uses VM inv eng 11 on hub 0
[   14.072498] amdgpu 0000:26:00.0: ring sdma0 uses VM inv eng 0 on hub 1
[   14.072499] amdgpu 0000:26:00.0: ring vcn_dec uses VM inv eng 1 on hub 1
[   14.072500] amdgpu 0000:26:00.0: ring vcn_enc0 uses VM inv eng 4 on hub 1
[   14.072501] amdgpu 0000:26:00.0: ring vcn_enc1 uses VM inv eng 5 on hub 1
[   14.072502] amdgpu 0000:26:00.0: ring jpeg_dec uses VM inv eng 6 on hub 1
[   14.125418] [drm] Initialized amdgpu 3.36.0 20150101 for 0000:26:00.0 on minor 0
[   14.599285] r8169 0000:22:00.0: Direct firmware load for rtl_nic/rtl8168h-2.fw failed with error -2
[   14.599290] r8169 0000:22:00.0: Unable to load firmware rtl_nic/rtl8168h-2.fw (-2)
[   14.599474] Generic FE-GE Realtek PHY r8169-2200:00: attached PHY driver [Generic FE-GE Realtek PHY] (mii_bus:phy_addr=r8169-2200:00, irq=IGNORE)
[   14.678501] r8169 0000:22:00.0 enp34s0: Link is Down
[   14.753949] scsi 9:0:0:0: CD-ROM            ASUS     SDRW-08U9M-U     B101 PQ: 0 ANSI: 0
[   14.762043] sr 9:0:0:0: Power-on or device reset occurred
[   14.773554] sr 9:0:0:0: [sr0] scsi3-mmc drive: 24x/24x writer cd/rw xa/form2 cdda tray
[   14.773557] cdrom: Uniform CD-ROM driver Revision: 3.20
[   14.780971] sr 9:0:0:0: Attached scsi CD-ROM sr0
[   14.781440] sr 9:0:0:0: Attached scsi generic sg1 type 5
[   18.267224] r8169 0000:22:00.0 enp34s0: Link is Up - 1Gbps/Full - flow control rx/tx
[   18.267233] IPv6: ADDRCONF(NETDEV_CHANGE): enp34s0: link becomes ready
[   22.162471] fuse: init (API version 7.31)
[   22.162738] *** VALIDATE fuse ***
[   22.162741] *** VALIDATE fuse ***
[  694.014627] kmemleak: 3 new suspected memory leaks (see /sys/kernel/debug/kmemleak)

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 5174 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: BUG: KASAN: use-after-free in xhci_trb_virt_to_dma.part.24+0x1c/0x80
  2020-01-02 14:10     ` BUG: KASAN: use-after-free in xhci_trb_virt_to_dma.part.24+0x1c/0x80 Paul Menzel
@ 2020-01-03 11:04       ` Mika Westerberg
  2020-01-07 12:09         ` Mathias Nyman
  2020-01-09  8:53         ` BUG: KASAN: use-after-free in xhci_trb_virt_to_dma.part.24+0x1c/0x80 Felipe Balbi
  0 siblings, 2 replies; 21+ messages in thread
From: Mika Westerberg @ 2020-01-03 11:04 UTC (permalink / raw)
  To: Paul Menzel; +Cc: Greg KH, Mathias Nyman, linux-usb, LKML

On Thu, Jan 02, 2020 at 03:10:14PM +0100, Paul Menzel wrote:
> Mika, as you fixed the other leak, any idea, how to continue from the
> kmemleak log below?
> 
> ```
> unreferenced object 0xffff8c207a1e1408 (size 8):
>   comm "systemd-udevd", pid 183, jiffies 4294667978 (age 752.292s)
>   hex dump (first 8 bytes):
>     34 01 05 00 00 00 00 00                          4.......
>   backtrace:
>     [<00000000aea7b46d>] xhci_mem_init+0xcfa/0xec0 [xhci_hcd]

There are probably better ways for doing this but you can use objdump
for example:

  $ objdump -l --prefix-addresses -j .text --disassemble=xhci_mem_init drivers/usb/host/xhci-hcd.ko

then find the offset xhci_mem_init+0xcfa. It should show you the line
numbers as well if you have compiled your kernel with debug info. This
should be close to the line that allocated the memory that was leaked.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: BUG: KASAN: use-after-free in xhci_trb_virt_to_dma.part.24+0x1c/0x80
  2020-01-03 11:04       ` Mika Westerberg
@ 2020-01-07 12:09         ` Mathias Nyman
  2020-01-07 15:35           ` Paul Menzel
  2020-01-09  8:53         ` BUG: KASAN: use-after-free in xhci_trb_virt_to_dma.part.24+0x1c/0x80 Felipe Balbi
  1 sibling, 1 reply; 21+ messages in thread
From: Mathias Nyman @ 2020-01-07 12:09 UTC (permalink / raw)
  To: Mika Westerberg, Paul Menzel; +Cc: Greg KH, Mathias Nyman, linux-usb, LKML

On 3.1.2020 13.04, Mika Westerberg wrote:
> On Thu, Jan 02, 2020 at 03:10:14PM +0100, Paul Menzel wrote:
>> Mika, as you fixed the other leak, any idea, how to continue from the
>> kmemleak log below?
>>
>> ```
>> unreferenced object 0xffff8c207a1e1408 (size 8):
>>    comm "systemd-udevd", pid 183, jiffies 4294667978 (age 752.292s)
>>    hex dump (first 8 bytes):
>>      34 01 05 00 00 00 00 00                          4.......
>>    backtrace:
>>      [<00000000aea7b46d>] xhci_mem_init+0xcfa/0xec0 [xhci_hcd]
> 
> There are probably better ways for doing this but you can use objdump
> for example:
> 
>    $ objdump -l --prefix-addresses -j .text --disassemble=xhci_mem_init drivers/usb/host/xhci-hcd.ko
> 
> then find the offset xhci_mem_init+0xcfa. It should show you the line
> numbers as well if you have compiled your kernel with debug info. This
> should be close to the line that allocated the memory that was leaked.
> 

Paul, it possible that your xhci controller has several
supported protocol extended capabilities for usb 3 ports, each
with their own custom protocol speed ID table.

xhci driver assumes there is only one custome PSI table per roothub,
and we will end up allocating the second PSI table on top of the first,
leaking the first.

Could you boot with xhci dynamic debug enabled, and show dmesg after boot, add:
xhci_hcd.dyndbg=+p
to you kernel cmdline.

Or as an alternative, show output of:

sudo cat /sys/kernel/debug/usb/xhci/*/reg-ext-protocol*

-Mathias

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: BUG: KASAN: use-after-free in xhci_trb_virt_to_dma.part.24+0x1c/0x80
  2020-01-07 12:09         ` Mathias Nyman
@ 2020-01-07 15:35           ` Paul Menzel
  2020-01-08  9:34             ` Mathias Nyman
  0 siblings, 1 reply; 21+ messages in thread
From: Paul Menzel @ 2020-01-07 15:35 UTC (permalink / raw)
  To: Mathias Nyman, Mika Westerberg; +Cc: Greg KH, Mathias Nyman, linux-usb, LKML

[-- Attachment #1: Type: text/plain, Size: 3659 bytes --]

Dear Mathias, dear Mika,


On 2020-01-07 13:09, Mathias Nyman wrote:
> On 3.1.2020 13.04, Mika Westerberg wrote:
>> On Thu, Jan 02, 2020 at 03:10:14PM +0100, Paul Menzel wrote:
>>> Mika, as you fixed the other leak, any idea, how to continue from the
>>> kmemleak log below?
>>>
>>> ```
>>> unreferenced object 0xffff8c207a1e1408 (size 8):
>>>    comm "systemd-udevd", pid 183, jiffies 4294667978 (age 752.292s)
>>>    hex dump (first 8 bytes):
>>>      34 01 05 00 00 00 00 00                          4.......
>>>    backtrace:
>>>      [<00000000aea7b46d>] xhci_mem_init+0xcfa/0xec0 [xhci_hcd]
>>
>> There are probably better ways for doing this but you can use objdump
>> for example:
>>
>>    $ objdump -l --prefix-addresses -j .text --disassemble=xhci_mem_init drivers/usb/host/xhci-hcd.ko
>>
>> then find the offset xhci_mem_init+0xcfa. It should show you the line
>> numbers as well if you have compiled your kernel with debug info. This
>> should be close to the line that allocated the memory that was leaked.

Thank you. I actually remembered `script/f2addr2line`.

    $ scripts/faddr2line drivers/usb/host/xhci-hcd.o xhci_mem_init+0xcfa
    xhci_mem_init+0xcfa/0xec0:
    xhci_add_in_port at /mnt/drivers/usb/host/xhci-mem.c:2161
    (inlined by) xhci_setup_port_arrays at /mnt/drivers/usb/host/xhci-mem.c:2309
    (inlined by) xhci_mem_init at /mnt/drivers/usb/host/xhci-mem.c:2538

> Paul, it possible that your xhci controller has several
> supported protocol extended capabilities for usb 3 ports, each
> with their own custom protocol speed ID table.
> 
> xhci driver assumes there is only one custome PSI table per roothub,
> and we will end up allocating the second PSI table on top of the first,
> leaking the first.
> 
> Could you boot with xhci dynamic debug enabled, and show dmesg after boot, add:
> xhci_hcd.dyndbg=+p
> to you kernel cmdline.
> 
> Or as an alternative, show output of:
> 
> sudo cat /sys/kernel/debug/usb/xhci/*/reg-ext-protocol*

`/sys/kernel/debug/` cannot be read by unprivileged users, so the wildcard does
not work with `sudo`.

```
$ sudo ls /sys/kernel/debug/usb/xhci
0000:12:00.0  0000:26:00.3  0000:26:00.4
# cat /sys/kernel/debug/usb/xhci/*/reg-ext-protocol*
EXTCAP_REVISION = 0x03100802
EXTCAP_NAME = 0x20425355
EXTCAP_PORTINFO = 0x00000201
EXTCAP_PORTTYPE = 0x00000000
EXTCAP_REVISION = 0x03000802
EXTCAP_NAME = 0x20425355
EXTCAP_PORTINFO = 0x00000203
EXTCAP_PORTTYPE = 0x00000000
EXTCAP_REVISION = 0x02000802
EXTCAP_NAME = 0x20425355
EXTCAP_PORTINFO = 0x00190a05
EXTCAP_PORTTYPE = 0x00000000
EXTCAP_REVISION = 0x02000402
EXTCAP_NAME = 0x20425355
EXTCAP_PORTINFO = 0x00180401
EXTCAP_PORTTYPE = 0x00000000
EXTCAP_REVISION = 0x03100802
EXTCAP_NAME = 0x20425355
EXTCAP_PORTINFO = 0x10000105
EXTCAP_PORTTYPE = 0x00000000
EXTCAP_MANTISSA1 = 0x00050134
EXTCAP_REVISION = 0x03100802
EXTCAP_NAME = 0x20425355
EXTCAP_PORTINFO = 0x10000106
EXTCAP_PORTTYPE = 0x00000000
EXTCAP_MANTISSA1 = 0x00050134
EXTCAP_REVISION = 0x03100802
EXTCAP_NAME = 0x20425355
EXTCAP_PORTINFO = 0x10000107
EXTCAP_PORTTYPE = 0x00000000
EXTCAP_MANTISSA1 = 0x00050134
EXTCAP_REVISION = 0x03100802
EXTCAP_NAME = 0x20425355
EXTCAP_PORTINFO = 0x10000108
EXTCAP_PORTTYPE = 0x00000000
EXTCAP_MANTISSA1 = 0x00050134
EXTCAP_REVISION = 0x02000402
EXTCAP_NAME = 0x20425355
EXTCAP_PORTINFO = 0x00180101
EXTCAP_PORTTYPE = 0x00000000
EXTCAP_REVISION = 0x03100802
EXTCAP_NAME = 0x20425355
EXTCAP_PORTINFO = 0x10000102
EXTCAP_PORTTYPE = 0x00000000
EXTCAP_MANTISSA1 = 0x00050134
```


Kind regards,

Paul


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 5174 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: BUG: KASAN: use-after-free in xhci_trb_virt_to_dma.part.24+0x1c/0x80
  2020-01-07 15:35           ` Paul Menzel
@ 2020-01-08  9:34             ` Mathias Nyman
  2020-01-08 15:17               ` [RFT PATCH] xhci: Fix memory leak when caching protocol extended capability PSI tables Mathias Nyman
  0 siblings, 1 reply; 21+ messages in thread
From: Mathias Nyman @ 2020-01-08  9:34 UTC (permalink / raw)
  To: Paul Menzel, Mika Westerberg; +Cc: Greg KH, Mathias Nyman, linux-usb, LKML

On 7.1.2020 17.35, Paul Menzel wrote:
> Dear Mathias, dear Mika,
> 
> 
> On 2020-01-07 13:09, Mathias Nyman wrote:
>> On 3.1.2020 13.04, Mika Westerberg wrote:
>>> On Thu, Jan 02, 2020 at 03:10:14PM +0100, Paul Menzel wrote:
>>>> Mika, as you fixed the other leak, any idea, how to continue from the
>>>> kmemleak log below?
>>>>
>>>> ```
>>>> unreferenced object 0xffff8c207a1e1408 (size 8):
>>>>     comm "systemd-udevd", pid 183, jiffies 4294667978 (age 752.292s)
>>>>     hex dump (first 8 bytes):
>>>>       34 01 05 00 00 00 00 00                          4.......
>>>>     backtrace:
>>>>       [<00000000aea7b46d>] xhci_mem_init+0xcfa/0xec0 [xhci_hcd]
>>>
>>> There are probably better ways for doing this but you can use objdump
>>> for example:
>>>
>>>     $ objdump -l --prefix-addresses -j .text --disassemble=xhci_mem_init drivers/usb/host/xhci-hcd.ko
>>>
>>> then find the offset xhci_mem_init+0xcfa. It should show you the line
>>> numbers as well if you have compiled your kernel with debug info. This
>>> should be close to the line that allocated the memory that was leaked.
> 
> Thank you. I actually remembered `script/f2addr2line`.
> 
>      $ scripts/faddr2line drivers/usb/host/xhci-hcd.o xhci_mem_init+0xcfa
>      xhci_mem_init+0xcfa/0xec0:
>      xhci_add_in_port at /mnt/drivers/usb/host/xhci-mem.c:2161
>      (inlined by) xhci_setup_port_arrays at /mnt/drivers/usb/host/xhci-mem.c:2309
>      (inlined by) xhci_mem_init at /mnt/drivers/usb/host/xhci-mem.c:2538
> 
>> Paul, it possible that your xhci controller has several
>> supported protocol extended capabilities for usb 3 ports, each
>> with their own custom protocol speed ID table.
>>
>> xhci driver assumes there is only one custome PSI table per roothub,
>> and we will end up allocating the second PSI table on top of the first,
>> leaking the first.
>>
>> Could you boot with xhci dynamic debug enabled, and show dmesg after boot, add:
>> xhci_hcd.dyndbg=+p
>> to you kernel cmdline.
>>
>> Or as an alternative, show output of:
>>
>> sudo cat /sys/kernel/debug/usb/xhci/*/reg-ext-protocol*
> 
> `/sys/kernel/debug/` cannot be read by unprivileged users, so the wildcard does
> not work with `sudo`.
> 
> ```
> $ sudo ls /sys/kernel/debug/usb/xhci
> 0000:12:00.0  0000:26:00.3  0000:26:00.4
> # cat /sys/kernel/debug/usb/xhci/*/reg-ext-protocol*

problematic xhci:
capability for first four USB 2 ports
> EXTCAP_REVISION = 0x02000402
> EXTCAP_NAME = 0x20425355
> EXTCAP_PORTINFO = 0x00180401
> EXTCAP_PORTTYPE = 0x00000000

capability for one USB 3.1 port (5th port)
> EXTCAP_REVISION = 0x03100802
> EXTCAP_NAME = 0x20425355
> EXTCAP_PORTINFO = 0x10000105
> EXTCAP_PORTTYPE = 0x00000000
> EXTCAP_MANTISSA1 = 0x00050134
capability for one USB 3.1 port (6th port)
> EXTCAP_REVISION = 0x03100802
> EXTCAP_NAME = 0x20425355
> EXTCAP_PORTINFO = 0x10000106
> EXTCAP_PORTTYPE = 0x00000000
> EXTCAP_MANTISSA1 = 0x00050134
capability for one USB 3.1 port (7th port)
> EXTCAP_REVISION = 0x03100802
> EXTCAP_NAME = 0x20425355
> EXTCAP_PORTINFO = 0x10000107
> EXTCAP_PORTTYPE = 0x00000000
> EXTCAP_MANTISSA1 = 0x00050134
capability for one USB 3.1 port (8th port)
> EXTCAP_REVISION = 0x03100802
> EXTCAP_NAME = 0x20425355
> EXTCAP_PORTINFO = 0x10000108
> EXTCAP_PORTTYPE = 0x00000000
> EXTCAP_MANTISSA1 = 0x00050134

It has eight ports.  last four of them are USB 3.1 ports.
It has a very odd setup where each 3.1 port has their own
supported protocol capability with a custom PSI, but all the PSI's are similar,
telling the port only support a 5Gbps speed.

We leak all the custom PSI tables for USB 3.1 ports except the last,
these would be the EXTCAP_MANTISSA1 = 0x00050134, which is the same as
the hex dump of the unreferenced object you posted earlier (considering byte order):

hex dump (first 8 bytes):
34 01 05 00 00 00 00 00                          4.......

I'm working on a patch for this

-Mathias

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [RFT PATCH] xhci: Fix memory leak when caching protocol extended capability PSI tables
  2020-01-08  9:34             ` Mathias Nyman
@ 2020-01-08 15:17               ` Mathias Nyman
  2020-01-08 15:40                 ` Greg KH
       [not found]                 ` <CGME20200211105613eucas1p27cac4202c4287a5967b2ed988779d523@eucas1p2.samsung.com>
  0 siblings, 2 replies; 21+ messages in thread
From: Mathias Nyman @ 2020-01-08 15:17 UTC (permalink / raw)
  To: pmenzel; +Cc: mika.westerberg, linux-usb, greg, linux-kernel, Mathias Nyman

xhci driver assumed that xHC controllers have at most one custom
supported speed table (PSI) for all usb 3.x ports.
Memory was allocated for one PSI table under the xhci hub structure.

Turns out this is not the case, some controllers have a separate
"supported protocol capability" entry with a PSI table for each port.
This means each usb3 port can in theory support different custom speeds.

To solve this cache all supported protocol capabilities with their PSI
tables in an array, and add pointers to the xhci port structure so that
every port points to its capability entry in the array.

When creating the SuperSpeedPlus USB Device Capability BOS descriptor
for the xhci USB 3.1 roothub we for now will use only data from the
first USB 3.1 capable protocol capability entry in the array.
This could be improved later, this patch focuses resolving
the memory leak.

Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
Reported-by: Sajja Venkateswara Rao <VenkateswaraRao.Sajja@amd.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
---
 drivers/usb/host/xhci-hub.c | 25 +++++++++++-----
 drivers/usb/host/xhci-mem.c | 60 +++++++++++++++++++++++--------------
 drivers/usb/host/xhci.h     | 14 +++++++--
 3 files changed, 66 insertions(+), 33 deletions(-)

diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index 7a3a29e5e9d2..0974eebd28e7 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -55,6 +55,7 @@ static u8 usb_bos_descriptor [] = {
 static int xhci_create_usb3_bos_desc(struct xhci_hcd *xhci, char *buf,
 				     u16 wLength)
 {
+	struct xhci_port_cap *port_cap;
 	int i, ssa_count;
 	u32 temp;
 	u16 desc_size, ssp_cap_size, ssa_size = 0;
@@ -64,16 +65,24 @@ static int xhci_create_usb3_bos_desc(struct xhci_hcd *xhci, char *buf,
 	ssp_cap_size = sizeof(usb_bos_descriptor) - desc_size;
 
 	/* does xhci support USB 3.1 Enhanced SuperSpeed */
-	if (xhci->usb3_rhub.min_rev >= 0x01) {
+	for (i = 0; i < xhci->num_port_caps; i++) {
+		if (xhci->port_caps[i].maj_rev == 0x03 &&
+		    xhci->port_caps[i].min_rev >= 0x01) {
+			usb3_1 = true;
+			port_cap = &xhci->port_caps[i];
+			break;
+		}
+	}
+
+	if (usb3_1) {
 		/* does xhci provide a PSI table for SSA speed attributes? */
-		if (xhci->usb3_rhub.psi_count) {
+		if (port_cap->psi_count) {
 			/* two SSA entries for each unique PSI ID, RX and TX */
-			ssa_count = xhci->usb3_rhub.psi_uid_count * 2;
+			ssa_count = port_cap->psi_uid_count * 2;
 			ssa_size = ssa_count * sizeof(u32);
 			ssp_cap_size -= 16; /* skip copying the default SSA */
 		}
 		desc_size += ssp_cap_size;
-		usb3_1 = true;
 	}
 	memcpy(buf, &usb_bos_descriptor, min(desc_size, wLength));
 
@@ -99,7 +108,7 @@ static int xhci_create_usb3_bos_desc(struct xhci_hcd *xhci, char *buf,
 	}
 
 	/* If PSI table exists, add the custom speed attributes from it */
-	if (usb3_1 && xhci->usb3_rhub.psi_count) {
+	if (usb3_1 && port_cap->psi_count) {
 		u32 ssp_cap_base, bm_attrib, psi, psi_mant, psi_exp;
 		int offset;
 
@@ -111,7 +120,7 @@ static int xhci_create_usb3_bos_desc(struct xhci_hcd *xhci, char *buf,
 
 		/* attribute count SSAC bits 4:0 and ID count SSIC bits 8:5 */
 		bm_attrib = (ssa_count - 1) & 0x1f;
-		bm_attrib |= (xhci->usb3_rhub.psi_uid_count - 1) << 5;
+		bm_attrib |= (port_cap->psi_uid_count - 1) << 5;
 		put_unaligned_le32(bm_attrib, &buf[ssp_cap_base + 4]);
 
 		if (wLength < desc_size + ssa_size)
@@ -124,8 +133,8 @@ static int xhci_create_usb3_bos_desc(struct xhci_hcd *xhci, char *buf,
 		 * USB 3.1 requires two SSA entries (RX and TX) for every link
 		 */
 		offset = desc_size;
-		for (i = 0; i < xhci->usb3_rhub.psi_count; i++) {
-			psi = xhci->usb3_rhub.psi[i];
+		for (i = 0; i < port_cap->psi_count; i++) {
+			psi = port_cap->psi[i];
 			psi &= ~USB_SSP_SUBLINK_SPEED_RSVD;
 			psi_exp = XHCI_EXT_PORT_PSIE(psi);
 			psi_mant = XHCI_EXT_PORT_PSIM(psi);
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 3b1388fa2f36..cf4d27774a7d 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -1909,17 +1909,18 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci)
 	xhci->usb3_rhub.num_ports = 0;
 	xhci->num_active_eps = 0;
 	kfree(xhci->usb2_rhub.ports);
-	kfree(xhci->usb2_rhub.psi);
 	kfree(xhci->usb3_rhub.ports);
-	kfree(xhci->usb3_rhub.psi);
 	kfree(xhci->hw_ports);
 	kfree(xhci->rh_bw);
 	kfree(xhci->ext_caps);
+	for (i = 0; i < xhci->num_port_caps; i++) {
+		kfree(xhci->port_caps[i].psi);
+		xhci->port_caps[i].psi = NULL;
+	}
+	kfree(xhci->port_caps);
 
 	xhci->usb2_rhub.ports = NULL;
-	xhci->usb2_rhub.psi = NULL;
 	xhci->usb3_rhub.ports = NULL;
-	xhci->usb3_rhub.psi = NULL;
 	xhci->hw_ports = NULL;
 	xhci->rh_bw = NULL;
 	xhci->ext_caps = NULL;
@@ -2120,6 +2121,7 @@ static void xhci_add_in_port(struct xhci_hcd *xhci, unsigned int num_ports,
 	u8 major_revision, minor_revision;
 	struct xhci_hub *rhub;
 	struct device *dev = xhci_to_hcd(xhci)->self.sysdev;
+	struct xhci_port_cap *port_cap;
 
 	temp = readl(addr);
 	major_revision = XHCI_EXT_PORT_MAJOR(temp);
@@ -2154,31 +2156,39 @@ static void xhci_add_in_port(struct xhci_hcd *xhci, unsigned int num_ports,
 		/* WTF? "Valid values are ‘1’ to MaxPorts" */
 		return;
 
-	rhub->psi_count = XHCI_EXT_PORT_PSIC(temp);
-	if (rhub->psi_count) {
-		rhub->psi = kcalloc_node(rhub->psi_count, sizeof(*rhub->psi),
-				    GFP_KERNEL, dev_to_node(dev));
-		if (!rhub->psi)
-			rhub->psi_count = 0;
+	port_cap = &xhci->port_caps[xhci->num_port_caps++];
+	if (xhci->num_port_caps > max_caps)
+		return;
+
+	port_cap->maj_rev = major_revision;
+	port_cap->min_rev = minor_revision;
+	port_cap->psi_count = XHCI_EXT_PORT_PSIC(temp);
+
+	if (port_cap->psi_count) {
+		port_cap->psi = kcalloc_node(port_cap->psi_count,
+					     sizeof(*port_cap->psi),
+					     GFP_KERNEL, dev_to_node(dev));
+		if (!port_cap->psi)
+			port_cap->psi_count = 0;
 
-		rhub->psi_uid_count++;
-		for (i = 0; i < rhub->psi_count; i++) {
-			rhub->psi[i] = readl(addr + 4 + i);
+		port_cap->psi_uid_count++;
+		for (i = 0; i < port_cap->psi_count; i++) {
+			port_cap->psi[i] = readl(addr + 4 + i);
 
 			/* count unique ID values, two consecutive entries can
 			 * have the same ID if link is assymetric
 			 */
-			if (i && (XHCI_EXT_PORT_PSIV(rhub->psi[i]) !=
-				  XHCI_EXT_PORT_PSIV(rhub->psi[i - 1])))
-				rhub->psi_uid_count++;
+			if (i && (XHCI_EXT_PORT_PSIV(port_cap->psi[i]) !=
+				  XHCI_EXT_PORT_PSIV(port_cap->psi[i - 1])))
+				port_cap->psi_uid_count++;
 
 			xhci_dbg(xhci, "PSIV:%d PSIE:%d PLT:%d PFD:%d LP:%d PSIM:%d\n",
-				  XHCI_EXT_PORT_PSIV(rhub->psi[i]),
-				  XHCI_EXT_PORT_PSIE(rhub->psi[i]),
-				  XHCI_EXT_PORT_PLT(rhub->psi[i]),
-				  XHCI_EXT_PORT_PFD(rhub->psi[i]),
-				  XHCI_EXT_PORT_LP(rhub->psi[i]),
-				  XHCI_EXT_PORT_PSIM(rhub->psi[i]));
+				  XHCI_EXT_PORT_PSIV(port_cap->psi[i]),
+				  XHCI_EXT_PORT_PSIE(port_cap->psi[i]),
+				  XHCI_EXT_PORT_PLT(port_cap->psi[i]),
+				  XHCI_EXT_PORT_PFD(port_cap->psi[i]),
+				  XHCI_EXT_PORT_LP(port_cap->psi[i]),
+				  XHCI_EXT_PORT_PSIM(port_cap->psi[i]));
 		}
 	}
 	/* cache usb2 port capabilities */
@@ -2213,6 +2223,7 @@ static void xhci_add_in_port(struct xhci_hcd *xhci, unsigned int num_ports,
 			continue;
 		}
 		hw_port->rhub = rhub;
+		hw_port->port_cap = port_cap;
 		rhub->num_ports++;
 	}
 	/* FIXME: Should we disable ports not in the Extended Capabilities? */
@@ -2303,6 +2314,11 @@ static int xhci_setup_port_arrays(struct xhci_hcd *xhci, gfp_t flags)
 	if (!xhci->ext_caps)
 		return -ENOMEM;
 
+	xhci->port_caps = kcalloc_node(cap_count, sizeof(*xhci->port_caps),
+				flags, dev_to_node(dev));
+	if (!xhci->port_caps)
+		return -ENOMEM;
+
 	offset = cap_start;
 
 	while (offset) {
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 13d8838cd552..3ecee10fdcdc 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1702,12 +1702,20 @@ struct xhci_bus_state {
  * Intel Lynx Point LP xHCI host.
  */
 #define	XHCI_MAX_REXIT_TIMEOUT_MS	20
+struct xhci_port_cap {
+	u32			*psi;	/* array of protocol speed ID entries */
+	u8			psi_count;
+	u8			psi_uid_count;
+	u8			maj_rev;
+	u8			min_rev;
+};
 
 struct xhci_port {
 	__le32 __iomem		*addr;
 	int			hw_portnum;
 	int			hcd_portnum;
 	struct xhci_hub		*rhub;
+	struct xhci_port_cap	*port_cap;
 };
 
 struct xhci_hub {
@@ -1719,9 +1727,6 @@ struct xhci_hub {
 	/* supported prococol extended capabiliy values */
 	u8			maj_rev;
 	u8			min_rev;
-	u32			*psi;	/* array of protocol speed ID entries */
-	u8			psi_count;
-	u8			psi_uid_count;
 };
 
 /* There is one xhci_hcd structure per controller */
@@ -1880,6 +1885,9 @@ struct xhci_hcd {
 	/* cached usb2 extened protocol capabilites */
 	u32                     *ext_caps;
 	unsigned int            num_ext_caps;
+	/* cached extended protocol port capabilities */
+	struct xhci_port_cap	*port_caps;
+	unsigned int		num_port_caps;
 	/* Compliance Mode Recovery Data */
 	struct timer_list	comp_mode_recovery_timer;
 	u32			port_status_u0;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [RFT PATCH] xhci: Fix memory leak when caching protocol extended capability PSI tables
  2020-01-08 15:17               ` [RFT PATCH] xhci: Fix memory leak when caching protocol extended capability PSI tables Mathias Nyman
@ 2020-01-08 15:40                 ` Greg KH
  2020-01-08 15:56                   ` Mathias Nyman
       [not found]                 ` <CGME20200211105613eucas1p27cac4202c4287a5967b2ed988779d523@eucas1p2.samsung.com>
  1 sibling, 1 reply; 21+ messages in thread
From: Greg KH @ 2020-01-08 15:40 UTC (permalink / raw)
  To: Mathias Nyman; +Cc: pmenzel, mika.westerberg, linux-usb, linux-kernel

On Wed, Jan 08, 2020 at 05:17:30PM +0200, Mathias Nyman wrote:
> xhci driver assumed that xHC controllers have at most one custom
> supported speed table (PSI) for all usb 3.x ports.
> Memory was allocated for one PSI table under the xhci hub structure.
> 
> Turns out this is not the case, some controllers have a separate
> "supported protocol capability" entry with a PSI table for each port.
> This means each usb3 port can in theory support different custom speeds.

Is there a "max" number of port capabilities that can happen?  Or this
this truely dynamic?

> +	for (i = 0; i < xhci->num_port_caps; i++) {
> +		kfree(xhci->port_caps[i].psi);
> +		xhci->port_caps[i].psi = NULL;
> +	}

Nit, no need to set to NULL here :)

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [RFT PATCH] xhci: Fix memory leak when caching protocol extended capability PSI tables
  2020-01-08 15:40                 ` Greg KH
@ 2020-01-08 15:56                   ` Mathias Nyman
  0 siblings, 0 replies; 21+ messages in thread
From: Mathias Nyman @ 2020-01-08 15:56 UTC (permalink / raw)
  To: Greg KH; +Cc: pmenzel, mika.westerberg, linux-usb, linux-kernel

On 8.1.2020 17.40, Greg KH wrote:
> On Wed, Jan 08, 2020 at 05:17:30PM +0200, Mathias Nyman wrote:
>> xhci driver assumed that xHC controllers have at most one custom
>> supported speed table (PSI) for all usb 3.x ports.
>> Memory was allocated for one PSI table under the xhci hub structure.
>>
>> Turns out this is not the case, some controllers have a separate
>> "supported protocol capability" entry with a PSI table for each port.
>> This means each usb3 port can in theory support different custom speeds.
> 
> Is there a "max" number of port capabilities that can happen?  Or this
> this truely dynamic?

Almost truly dynamic, each capability points to the next, last points to 0

But we can't have more "supported protocol capabilities" than xHC ports.
(MaxPorts value in xHC HCSPARAMS1 register)

> 
>> +	for (i = 0; i < xhci->num_port_caps; i++) {
>> +		kfree(xhci->port_caps[i].psi);
>> +		xhci->port_caps[i].psi = NULL;
>> +	}
> 
> Nit, no need to set to NULL here :)

Thanks, will remove that

-Mathias


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: BUG: KASAN: use-after-free in xhci_trb_virt_to_dma.part.24+0x1c/0x80
  2020-01-03 11:04       ` Mika Westerberg
  2020-01-07 12:09         ` Mathias Nyman
@ 2020-01-09  8:53         ` Felipe Balbi
  1 sibling, 0 replies; 21+ messages in thread
From: Felipe Balbi @ 2020-01-09  8:53 UTC (permalink / raw)
  To: Mika Westerberg, Paul Menzel; +Cc: Greg KH, Mathias Nyman, linux-usb, LKML

[-- Attachment #1: Type: text/plain, Size: 1062 bytes --]


Hi,

Mika Westerberg <mika.westerberg@linux.intel.com> writes:

> On Thu, Jan 02, 2020 at 03:10:14PM +0100, Paul Menzel wrote:
>> Mika, as you fixed the other leak, any idea, how to continue from the
>> kmemleak log below?
>> 
>> ```
>> unreferenced object 0xffff8c207a1e1408 (size 8):
>>   comm "systemd-udevd", pid 183, jiffies 4294667978 (age 752.292s)
>>   hex dump (first 8 bytes):
>>     34 01 05 00 00 00 00 00                          4.......
>>   backtrace:
>>     [<00000000aea7b46d>] xhci_mem_init+0xcfa/0xec0 [xhci_hcd]
>
> There are probably better ways for doing this but you can use objdump
> for example:
>
>   $ objdump -l --prefix-addresses -j .text --disassemble=xhci_mem_init drivers/usb/host/xhci-hcd.ko
>
> then find the offset xhci_mem_init+0xcfa. It should show you the line
> numbers as well if you have compiled your kernel with debug info. This
> should be close to the line that allocated the memory that was leaked.

addr2line helps here. So does gdb (gdb vmlinux l *(xhci_mem_init+0xcfa))

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [RFT PATCH] xhci: Fix memory leak when caching protocol extended capability PSI tables
       [not found]                 ` <CGME20200211105613eucas1p27cac4202c4287a5967b2ed988779d523@eucas1p2.samsung.com>
@ 2020-02-11 10:56                   ` Marek Szyprowski
  2020-02-11 12:23                     ` Greg KH
  0 siblings, 1 reply; 21+ messages in thread
From: Marek Szyprowski @ 2020-02-11 10:56 UTC (permalink / raw)
  To: Mathias Nyman, pmenzel
  Cc: mika.westerberg, linux-usb, greg, linux-kernel,
	'Linux Samsung SOC',
	Krzysztof Kozlowski

Hi

On 08.01.2020 16:17, Mathias Nyman wrote:
> xhci driver assumed that xHC controllers have at most one custom
> supported speed table (PSI) for all usb 3.x ports.
> Memory was allocated for one PSI table under the xhci hub structure.
>
> Turns out this is not the case, some controllers have a separate
> "supported protocol capability" entry with a PSI table for each port.
> This means each usb3 port can in theory support different custom speeds.
>
> To solve this cache all supported protocol capabilities with their PSI
> tables in an array, and add pointers to the xhci port structure so that
> every port points to its capability entry in the array.
>
> When creating the SuperSpeedPlus USB Device Capability BOS descriptor
> for the xhci USB 3.1 roothub we for now will use only data from the
> first USB 3.1 capable protocol capability entry in the array.
> This could be improved later, this patch focuses resolving
> the memory leak.
>
> Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
> Reported-by: Sajja Venkateswara Rao <VenkateswaraRao.Sajja@amd.com>
> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>

This patch landed in today's linux-next (20200211) and causes NULL 
pointer dereference during second suspend/resume cycle on Samsung 
Exynos5422-based (arm 32bit) Odroid XU3lite board:

# time rtcwake -s10 -mmem
rtcwake: wakeup from "mem" using /dev/rtc0 at Tue Feb 11 10:51:43 2020
PM: suspend entry (deep)
Filesystems sync: 0.012 seconds
Freezing user space processes ... (elapsed 0.010 seconds) done.
OOM killer disabled.
Freezing remaining freezable tasks ... (elapsed 0.002 seconds) done.
smsc95xx 1-1.1:1.0 eth0: entering SUSPEND2 mode
wake enabled for irq 153
wake enabled for irq 158
samsung-pinctrl 13400000.pinctrl: Setting external wakeup interrupt 
mask: 0xffffffe7
Disabling non-boot CPUs ...
IRQ 51: no longer affine to CPU1
IRQ 52: no longer affine to CPU2
s3c2410-wdt 101d0000.watchdog: watchdog disabled
wake disabled for irq 158
usb usb1: root hub lost power or was reset
usb usb2: root hub lost power or was reset
wake disabled for irq 153
exynos-tmu 10060000.tmu: More trip points than supported by this TMU.
exynos-tmu 10060000.tmu: 2 trip points should be configured in polling mode.
exynos-tmu 10064000.tmu: More trip points than supported by this TMU.
exynos-tmu 10064000.tmu: 2 trip points should be configured in polling mode.
exynos-tmu 10068000.tmu: More trip points than supported by this TMU.
exynos-tmu 10068000.tmu: 2 trip points should be configured in polling mode.
exynos-tmu 1006c000.tmu: More trip points than supported by this TMU.
exynos-tmu 1006c000.tmu: 2 trip points should be configured in polling mode.
exynos-tmu 100a0000.tmu: More trip points than supported by this TMU.
exynos-tmu 100a0000.tmu: 6 trip points should be configured in polling mode.
usb usb3: root hub lost power or was reset
s3c-rtc 101e0000.rtc: rtc disabled, re-enabling
usb usb4: root hub lost power or was reset
xhci-hcd xhci-hcd.8.auto: No ports on the roothubs?
PM: dpm_run_callback(): platform_pm_resume+0x0/0x44 returns -12
PM: Device xhci-hcd.8.auto failed to resume async: error -12
hub 3-0:1.0: hub_ext_port_status failed (err = -32)
hub 4-0:1.0: hub_ext_port_status failed (err = -32)
usb 1-1: reset high-speed USB device number 2 using exynos-ehci
usb 1-1.1: reset high-speed USB device number 3 using exynos-ehci
OOM killer enabled.
Restarting tasks ... done.

real    0m11.890s
user    0m0.001s
sys     0m0.679s
root@target:~# PM: suspend exit
mmc_host mmc0: Bus speed (slot 0) = 50000000Hz (slot req 400000Hz, 
actual 396825HZ div = 63)
mmc_host mmc0: Bus speed (slot 0) = 200000000Hz (slot req 200000000Hz, 
actual 200000000HZ div = 0)
mmc_host mmc0: Bus speed (slot 0) = 50000000Hz (slot req 52000000Hz, 
actual 50000000HZ div = 0)
mmc_host mmc0: Bus speed (slot 0) = 400000000Hz (slot req 200000000Hz, 
actual 200000000HZ div = 1)
smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xC1E1

root@target:~#
root@target:~# time rtcwake -s10 -mmem[   35.451572] vdd_ldo12: disabling

rtcwake: wakeup from "mem" using /dev/rtc0 at Tue Feb 11 10:52:02 2020
PM: suspend entry (deep)
Filesystems sync: 0.004 seconds
Freezing user space processes ... (elapsed 0.006 seconds) done.
OOM killer disabled.
Freezing remaining freezable tasks ... (elapsed 0.070 seconds) done.
hub 4-0:1.0: hub_ext_port_status failed (err = -32)
hub 3-0:1.0: hub_ext_port_status failed (err = -32)
8<--- cut here ---
Unable to handle kernel NULL pointer dereference at virtual address 00000014
pgd = 4c26b54b
[00000014] *pgd=00000000
Internal error: Oops: 17 [#1] PREEMPT SMP ARM
Modules linked in:
CPU: 3 PID: 1468 Comm: kworker/u16:23 Not tainted 
5.6.0-rc1-next-20200211 #268
Hardware name: Samsung Exynos (Flattened Device Tree)
Workqueue: events_unbound async_run_entry_fn
PC is at xhci_suspend+0x12c/0x520
LR is at 0xa6aa9898
pc : [<c0724c90>]    lr : [<a6aa9898>]    psr: 60000093
sp : ec401df8  ip : 0000001a  fp : c12e7864
r10: 00000000  r9 : ecfb87b0  r8 : ecfb8220
r7 : 00000000  r6 : 00000000  r5 : 00000004  r4 : ecfb81f0
r3 : 00007d00  r2 : 00000001  r1 : 00000001  r0 : 00000000
Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment none
Control: 10c5387d  Table: 6bd4006a  DAC: 00000051
Process kworker/u16:23 (pid: 1468, stack limit = 0x6e4b6fba)
Stack: (0xec401df8 to 0xec402000)
...
[<c0724c90>] (xhci_suspend) from [<c061b4f4>] (dpm_run_callback+0xb4/0x3fc)
[<c061b4f4>] (dpm_run_callback) from [<c061bd5c>] 
(__device_suspend+0x134/0x7e8)
[<c061bd5c>] (__device_suspend) from [<c061c42c>] (async_suspend+0x1c/0x94)
[<c061c42c>] (async_suspend) from [<c0154bd0>] 
(async_run_entry_fn+0x48/0x1b8)
[<c0154bd0>] (async_run_entry_fn) from [<c0149b38>] 
(process_one_work+0x230/0x7bc)
[<c0149b38>] (process_one_work) from [<c014a108>] (worker_thread+0x44/0x524)
[<c014a108>] (worker_thread) from [<c01511fc>] (kthread+0x130/0x164)
[<c01511fc>] (kthread) from [<c01010b4>] (ret_from_fork+0x14/0x20)
Exception stack(0xec401fb0 to 0xec401ff8)
...
---[ end trace c72caf6487666442 ]---
note: kworker/u16:23[1468] exited with preempt_count 1

Reverting it fixes the NULL pointer issue. I can provide more 
information or do some other tests. Just let me know what will help to 
fix it.

 > ...

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [RFT PATCH] xhci: Fix memory leak when caching protocol extended capability PSI tables
  2020-02-11 10:56                   ` Marek Szyprowski
@ 2020-02-11 12:23                     ` Greg KH
  2020-02-11 12:29                       ` Mathias Nyman
  0 siblings, 1 reply; 21+ messages in thread
From: Greg KH @ 2020-02-11 12:23 UTC (permalink / raw)
  To: Marek Szyprowski
  Cc: Mathias Nyman, pmenzel, mika.westerberg, linux-usb, linux-kernel,
	'Linux Samsung SOC',
	Krzysztof Kozlowski

On Tue, Feb 11, 2020 at 11:56:12AM +0100, Marek Szyprowski wrote:
> Hi
> 
> On 08.01.2020 16:17, Mathias Nyman wrote:
> > xhci driver assumed that xHC controllers have at most one custom
> > supported speed table (PSI) for all usb 3.x ports.
> > Memory was allocated for one PSI table under the xhci hub structure.
> >
> > Turns out this is not the case, some controllers have a separate
> > "supported protocol capability" entry with a PSI table for each port.
> > This means each usb3 port can in theory support different custom speeds.
> >
> > To solve this cache all supported protocol capabilities with their PSI
> > tables in an array, and add pointers to the xhci port structure so that
> > every port points to its capability entry in the array.
> >
> > When creating the SuperSpeedPlus USB Device Capability BOS descriptor
> > for the xhci USB 3.1 roothub we for now will use only data from the
> > first USB 3.1 capable protocol capability entry in the array.
> > This could be improved later, this patch focuses resolving
> > the memory leak.
> >
> > Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
> > Reported-by: Sajja Venkateswara Rao <VenkateswaraRao.Sajja@amd.com>
> > Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
> 
> This patch landed in today's linux-next (20200211) and causes NULL 
> pointer dereference during second suspend/resume cycle on Samsung 
> Exynos5422-based (arm 32bit) Odroid XU3lite board:
> 
> # time rtcwake -s10 -mmem
> rtcwake: wakeup from "mem" using /dev/rtc0 at Tue Feb 11 10:51:43 2020
> PM: suspend entry (deep)
> Filesystems sync: 0.012 seconds
> Freezing user space processes ... (elapsed 0.010 seconds) done.
> OOM killer disabled.
> Freezing remaining freezable tasks ... (elapsed 0.002 seconds) done.
> smsc95xx 1-1.1:1.0 eth0: entering SUSPEND2 mode
> wake enabled for irq 153
> wake enabled for irq 158
> samsung-pinctrl 13400000.pinctrl: Setting external wakeup interrupt 
> mask: 0xffffffe7
> Disabling non-boot CPUs ...
> IRQ 51: no longer affine to CPU1
> IRQ 52: no longer affine to CPU2
> s3c2410-wdt 101d0000.watchdog: watchdog disabled
> wake disabled for irq 158
> usb usb1: root hub lost power or was reset
> usb usb2: root hub lost power or was reset
> wake disabled for irq 153
> exynos-tmu 10060000.tmu: More trip points than supported by this TMU.
> exynos-tmu 10060000.tmu: 2 trip points should be configured in polling mode.
> exynos-tmu 10064000.tmu: More trip points than supported by this TMU.
> exynos-tmu 10064000.tmu: 2 trip points should be configured in polling mode.
> exynos-tmu 10068000.tmu: More trip points than supported by this TMU.
> exynos-tmu 10068000.tmu: 2 trip points should be configured in polling mode.
> exynos-tmu 1006c000.tmu: More trip points than supported by this TMU.
> exynos-tmu 1006c000.tmu: 2 trip points should be configured in polling mode.
> exynos-tmu 100a0000.tmu: More trip points than supported by this TMU.
> exynos-tmu 100a0000.tmu: 6 trip points should be configured in polling mode.
> usb usb3: root hub lost power or was reset
> s3c-rtc 101e0000.rtc: rtc disabled, re-enabling
> usb usb4: root hub lost power or was reset
> xhci-hcd xhci-hcd.8.auto: No ports on the roothubs?
> PM: dpm_run_callback(): platform_pm_resume+0x0/0x44 returns -12
> PM: Device xhci-hcd.8.auto failed to resume async: error -12
> hub 3-0:1.0: hub_ext_port_status failed (err = -32)
> hub 4-0:1.0: hub_ext_port_status failed (err = -32)
> usb 1-1: reset high-speed USB device number 2 using exynos-ehci
> usb 1-1.1: reset high-speed USB device number 3 using exynos-ehci
> OOM killer enabled.
> Restarting tasks ... done.
> 
> real    0m11.890s
> user    0m0.001s
> sys     0m0.679s
> root@target:~# PM: suspend exit
> mmc_host mmc0: Bus speed (slot 0) = 50000000Hz (slot req 400000Hz, 
> actual 396825HZ div = 63)
> mmc_host mmc0: Bus speed (slot 0) = 200000000Hz (slot req 200000000Hz, 
> actual 200000000HZ div = 0)
> mmc_host mmc0: Bus speed (slot 0) = 50000000Hz (slot req 52000000Hz, 
> actual 50000000HZ div = 0)
> mmc_host mmc0: Bus speed (slot 0) = 400000000Hz (slot req 200000000Hz, 
> actual 200000000HZ div = 1)
> smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xC1E1
> 
> root@target:~#
> root@target:~# time rtcwake -s10 -mmem[   35.451572] vdd_ldo12: disabling
> 
> rtcwake: wakeup from "mem" using /dev/rtc0 at Tue Feb 11 10:52:02 2020
> PM: suspend entry (deep)
> Filesystems sync: 0.004 seconds
> Freezing user space processes ... (elapsed 0.006 seconds) done.
> OOM killer disabled.
> Freezing remaining freezable tasks ... (elapsed 0.070 seconds) done.
> hub 4-0:1.0: hub_ext_port_status failed (err = -32)
> hub 3-0:1.0: hub_ext_port_status failed (err = -32)
> 8<--- cut here ---
> Unable to handle kernel NULL pointer dereference at virtual address 00000014
> pgd = 4c26b54b
> [00000014] *pgd=00000000
> Internal error: Oops: 17 [#1] PREEMPT SMP ARM
> Modules linked in:
> CPU: 3 PID: 1468 Comm: kworker/u16:23 Not tainted 
> 5.6.0-rc1-next-20200211 #268
> Hardware name: Samsung Exynos (Flattened Device Tree)
> Workqueue: events_unbound async_run_entry_fn
> PC is at xhci_suspend+0x12c/0x520
> LR is at 0xa6aa9898
> pc : [<c0724c90>]    lr : [<a6aa9898>]    psr: 60000093
> sp : ec401df8  ip : 0000001a  fp : c12e7864
> r10: 00000000  r9 : ecfb87b0  r8 : ecfb8220
> r7 : 00000000  r6 : 00000000  r5 : 00000004  r4 : ecfb81f0
> r3 : 00007d00  r2 : 00000001  r1 : 00000001  r0 : 00000000
> Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment none
> Control: 10c5387d  Table: 6bd4006a  DAC: 00000051
> Process kworker/u16:23 (pid: 1468, stack limit = 0x6e4b6fba)
> Stack: (0xec401df8 to 0xec402000)
> ...
> [<c0724c90>] (xhci_suspend) from [<c061b4f4>] (dpm_run_callback+0xb4/0x3fc)
> [<c061b4f4>] (dpm_run_callback) from [<c061bd5c>] 
> (__device_suspend+0x134/0x7e8)
> [<c061bd5c>] (__device_suspend) from [<c061c42c>] (async_suspend+0x1c/0x94)
> [<c061c42c>] (async_suspend) from [<c0154bd0>] 
> (async_run_entry_fn+0x48/0x1b8)
> [<c0154bd0>] (async_run_entry_fn) from [<c0149b38>] 
> (process_one_work+0x230/0x7bc)
> [<c0149b38>] (process_one_work) from [<c014a108>] (worker_thread+0x44/0x524)
> [<c014a108>] (worker_thread) from [<c01511fc>] (kthread+0x130/0x164)
> [<c01511fc>] (kthread) from [<c01010b4>] (ret_from_fork+0x14/0x20)
> Exception stack(0xec401fb0 to 0xec401ff8)
> ...
> ---[ end trace c72caf6487666442 ]---
> note: kworker/u16:23[1468] exited with preempt_count 1
> 
> Reverting it fixes the NULL pointer issue. I can provide more 
> information or do some other tests. Just let me know what will help to 
> fix it.
> 
>  > ...

Ugh.  Mathias, should I just revert this for now?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [RFT PATCH] xhci: Fix memory leak when caching protocol extended capability PSI tables
  2020-02-11 12:23                     ` Greg KH
@ 2020-02-11 12:29                       ` Mathias Nyman
  2020-02-11 14:08                         ` Mathias Nyman
  0 siblings, 1 reply; 21+ messages in thread
From: Mathias Nyman @ 2020-02-11 12:29 UTC (permalink / raw)
  To: Greg KH, Marek Szyprowski
  Cc: pmenzel, mika.westerberg, linux-usb, linux-kernel,
	'Linux Samsung SOC',
	Krzysztof Kozlowski

On 11.2.2020 14.23, Greg KH wrote:
> On Tue, Feb 11, 2020 at 11:56:12AM +0100, Marek Szyprowski wrote:
>> Hi
>>
>> On 08.01.2020 16:17, Mathias Nyman wrote:
>>> xhci driver assumed that xHC controllers have at most one custom
>>> supported speed table (PSI) for all usb 3.x ports.
>>> Memory was allocated for one PSI table under the xhci hub structure.
>>>
>>> Turns out this is not the case, some controllers have a separate
>>> "supported protocol capability" entry with a PSI table for each port.
>>> This means each usb3 port can in theory support different custom speeds.
>>>
>>> To solve this cache all supported protocol capabilities with their PSI
>>> tables in an array, and add pointers to the xhci port structure so that
>>> every port points to its capability entry in the array.
>>>
>>> When creating the SuperSpeedPlus USB Device Capability BOS descriptor
>>> for the xhci USB 3.1 roothub we for now will use only data from the
>>> first USB 3.1 capable protocol capability entry in the array.
>>> This could be improved later, this patch focuses resolving
>>> the memory leak.
>>>
>>> Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
>>> Reported-by: Sajja Venkateswara Rao <VenkateswaraRao.Sajja@amd.com>
>>> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
>>
>> This patch landed in today's linux-next (20200211) and causes NULL 
>> pointer dereference during second suspend/resume cycle on Samsung 
>> Exynos5422-based (arm 32bit) Odroid XU3lite board:
>>
>> # time rtcwake -s10 -mmem
>> rtcwake: wakeup from "mem" using /dev/rtc0 at Tue Feb 11 10:51:43 2020
>> PM: suspend entry (deep)
>> Filesystems sync: 0.012 seconds
>> Freezing user space processes ... (elapsed 0.010 seconds) done.
>> OOM killer disabled.
>> Freezing remaining freezable tasks ... (elapsed 0.002 seconds) done.
>> smsc95xx 1-1.1:1.0 eth0: entering SUSPEND2 mode
>> wake enabled for irq 153
>> wake enabled for irq 158
>> samsung-pinctrl 13400000.pinctrl: Setting external wakeup interrupt 
>> mask: 0xffffffe7
>> Disabling non-boot CPUs ...
>> IRQ 51: no longer affine to CPU1
>> IRQ 52: no longer affine to CPU2
>> s3c2410-wdt 101d0000.watchdog: watchdog disabled
>> wake disabled for irq 158
>> usb usb1: root hub lost power or was reset
>> usb usb2: root hub lost power or was reset
>> wake disabled for irq 153
>> exynos-tmu 10060000.tmu: More trip points than supported by this TMU.
>> exynos-tmu 10060000.tmu: 2 trip points should be configured in polling mode.
>> exynos-tmu 10064000.tmu: More trip points than supported by this TMU.
>> exynos-tmu 10064000.tmu: 2 trip points should be configured in polling mode.
>> exynos-tmu 10068000.tmu: More trip points than supported by this TMU.
>> exynos-tmu 10068000.tmu: 2 trip points should be configured in polling mode.
>> exynos-tmu 1006c000.tmu: More trip points than supported by this TMU.
>> exynos-tmu 1006c000.tmu: 2 trip points should be configured in polling mode.
>> exynos-tmu 100a0000.tmu: More trip points than supported by this TMU.
>> exynos-tmu 100a0000.tmu: 6 trip points should be configured in polling mode.
>> usb usb3: root hub lost power or was reset
>> s3c-rtc 101e0000.rtc: rtc disabled, re-enabling
>> usb usb4: root hub lost power or was reset
>> xhci-hcd xhci-hcd.8.auto: No ports on the roothubs?
>> PM: dpm_run_callback(): platform_pm_resume+0x0/0x44 returns -12
>> PM: Device xhci-hcd.8.auto failed to resume async: error -12
>> hub 3-0:1.0: hub_ext_port_status failed (err = -32)
>> hub 4-0:1.0: hub_ext_port_status failed (err = -32)
>> usb 1-1: reset high-speed USB device number 2 using exynos-ehci
>> usb 1-1.1: reset high-speed USB device number 3 using exynos-ehci
>> OOM killer enabled.
>> Restarting tasks ... done.
>>
>> real    0m11.890s
>> user    0m0.001s
>> sys     0m0.679s
>> root@target:~# PM: suspend exit
>> mmc_host mmc0: Bus speed (slot 0) = 50000000Hz (slot req 400000Hz, 
>> actual 396825HZ div = 63)
>> mmc_host mmc0: Bus speed (slot 0) = 200000000Hz (slot req 200000000Hz, 
>> actual 200000000HZ div = 0)
>> mmc_host mmc0: Bus speed (slot 0) = 50000000Hz (slot req 52000000Hz, 
>> actual 50000000HZ div = 0)
>> mmc_host mmc0: Bus speed (slot 0) = 400000000Hz (slot req 200000000Hz, 
>> actual 200000000HZ div = 1)
>> smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xC1E1
>>
>> root@target:~#
>> root@target:~# time rtcwake -s10 -mmem[   35.451572] vdd_ldo12: disabling
>>
>> rtcwake: wakeup from "mem" using /dev/rtc0 at Tue Feb 11 10:52:02 2020
>> PM: suspend entry (deep)
>> Filesystems sync: 0.004 seconds
>> Freezing user space processes ... (elapsed 0.006 seconds) done.
>> OOM killer disabled.
>> Freezing remaining freezable tasks ... (elapsed 0.070 seconds) done.
>> hub 4-0:1.0: hub_ext_port_status failed (err = -32)
>> hub 3-0:1.0: hub_ext_port_status failed (err = -32)
>> 8<--- cut here ---
>> Unable to handle kernel NULL pointer dereference at virtual address 00000014
>> pgd = 4c26b54b
>> [00000014] *pgd=00000000
>> Internal error: Oops: 17 [#1] PREEMPT SMP ARM
>> Modules linked in:
>> CPU: 3 PID: 1468 Comm: kworker/u16:23 Not tainted 
>> 5.6.0-rc1-next-20200211 #268
>> Hardware name: Samsung Exynos (Flattened Device Tree)
>> Workqueue: events_unbound async_run_entry_fn
>> PC is at xhci_suspend+0x12c/0x520
>> LR is at 0xa6aa9898
>> pc : [<c0724c90>]    lr : [<a6aa9898>]    psr: 60000093
>> sp : ec401df8  ip : 0000001a  fp : c12e7864
>> r10: 00000000  r9 : ecfb87b0  r8 : ecfb8220
>> r7 : 00000000  r6 : 00000000  r5 : 00000004  r4 : ecfb81f0
>> r3 : 00007d00  r2 : 00000001  r1 : 00000001  r0 : 00000000
>> Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment none
>> Control: 10c5387d  Table: 6bd4006a  DAC: 00000051
>> Process kworker/u16:23 (pid: 1468, stack limit = 0x6e4b6fba)
>> Stack: (0xec401df8 to 0xec402000)
>> ...
>> [<c0724c90>] (xhci_suspend) from [<c061b4f4>] (dpm_run_callback+0xb4/0x3fc)
>> [<c061b4f4>] (dpm_run_callback) from [<c061bd5c>] 
>> (__device_suspend+0x134/0x7e8)
>> [<c061bd5c>] (__device_suspend) from [<c061c42c>] (async_suspend+0x1c/0x94)
>> [<c061c42c>] (async_suspend) from [<c0154bd0>] 
>> (async_run_entry_fn+0x48/0x1b8)
>> [<c0154bd0>] (async_run_entry_fn) from [<c0149b38>] 
>> (process_one_work+0x230/0x7bc)
>> [<c0149b38>] (process_one_work) from [<c014a108>] (worker_thread+0x44/0x524)
>> [<c014a108>] (worker_thread) from [<c01511fc>] (kthread+0x130/0x164)
>> [<c01511fc>] (kthread) from [<c01010b4>] (ret_from_fork+0x14/0x20)
>> Exception stack(0xec401fb0 to 0xec401ff8)
>> ...
>> ---[ end trace c72caf6487666442 ]---
>> note: kworker/u16:23[1468] exited with preempt_count 1
>>
>> Reverting it fixes the NULL pointer issue. I can provide more 
>> information or do some other tests. Just let me know what will help to 
>> fix it.
>>
>>  > ...
> 
> Ugh.  Mathias, should I just revert this for now?
> 

Yes, revert it.

This looks very odd, after second resume, and losing power driver
can't find any port at all.

Marek, do you still get the "xhci-hcd xhci-hcd.8.auto: No ports on the roothubs?"
message on second resume after reverting the patch?

-Mathias

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [RFT PATCH] xhci: Fix memory leak when caching protocol extended capability PSI tables
  2020-02-11 12:29                       ` Mathias Nyman
@ 2020-02-11 14:08                         ` Mathias Nyman
  2020-02-11 15:01                           ` [RFT PATCH v2] " Mathias Nyman
  0 siblings, 1 reply; 21+ messages in thread
From: Mathias Nyman @ 2020-02-11 14:08 UTC (permalink / raw)
  To: Greg KH, Marek Szyprowski
  Cc: pmenzel, mika.westerberg, linux-usb, linux-kernel,
	'Linux Samsung SOC',
	Krzysztof Kozlowski

On 11.2.2020 14.29, Mathias Nyman wrote:
> On 11.2.2020 14.23, Greg KH wrote:
>> On Tue, Feb 11, 2020 at 11:56:12AM +0100, Marek Szyprowski wrote:
>>> Hi
>>>
>>> On 08.01.2020 16:17, Mathias Nyman wrote:
>>>> xhci driver assumed that xHC controllers have at most one custom
>>>> supported speed table (PSI) for all usb 3.x ports.
>>>> Memory was allocated for one PSI table under the xhci hub structure.
>>>>
>>>> Turns out this is not the case, some controllers have a separate
>>>> "supported protocol capability" entry with a PSI table for each port.
>>>> This means each usb3 port can in theory support different custom speeds.
>>>>
>>>> To solve this cache all supported protocol capabilities with their PSI
>>>> tables in an array, and add pointers to the xhci port structure so that
>>>> every port points to its capability entry in the array.
>>>>
>>>> When creating the SuperSpeedPlus USB Device Capability BOS descriptor
>>>> for the xhci USB 3.1 roothub we for now will use only data from the
>>>> first USB 3.1 capable protocol capability entry in the array.
>>>> This could be improved later, this patch focuses resolving
>>>> the memory leak.
>>>>
>>>> Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
>>>> Reported-by: Sajja Venkateswara Rao <VenkateswaraRao.Sajja@amd.com>
>>>> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
>>>
>>> This patch landed in today's linux-next (20200211) and causes NULL 
>>> pointer dereference during second suspend/resume cycle on Samsung 
>>> Exynos5422-based (arm 32bit) Odroid XU3lite board:
>>>
>>> # time rtcwake -s10 -mmem
>>> rtcwake: wakeup from "mem" using /dev/rtc0 at Tue Feb 11 10:51:43 2020
>>> PM: suspend entry (deep)
>>> Filesystems sync: 0.012 seconds
>>> Freezing user space processes ... (elapsed 0.010 seconds) done.
>>> OOM killer disabled.
>>> Freezing remaining freezable tasks ... (elapsed 0.002 seconds) done.
>>> smsc95xx 1-1.1:1.0 eth0: entering SUSPEND2 mode
>>> wake enabled for irq 153
>>> wake enabled for irq 158
>>> samsung-pinctrl 13400000.pinctrl: Setting external wakeup interrupt 
>>> mask: 0xffffffe7
>>> Disabling non-boot CPUs ...
>>> IRQ 51: no longer affine to CPU1
>>> IRQ 52: no longer affine to CPU2
>>> s3c2410-wdt 101d0000.watchdog: watchdog disabled
>>> wake disabled for irq 158
>>> usb usb1: root hub lost power or was reset
>>> usb usb2: root hub lost power or was reset
>>> wake disabled for irq 153
>>> exynos-tmu 10060000.tmu: More trip points than supported by this TMU.
>>> exynos-tmu 10060000.tmu: 2 trip points should be configured in polling mode.
>>> exynos-tmu 10064000.tmu: More trip points than supported by this TMU.
>>> exynos-tmu 10064000.tmu: 2 trip points should be configured in polling mode.
>>> exynos-tmu 10068000.tmu: More trip points than supported by this TMU.
>>> exynos-tmu 10068000.tmu: 2 trip points should be configured in polling mode.
>>> exynos-tmu 1006c000.tmu: More trip points than supported by this TMU.
>>> exynos-tmu 1006c000.tmu: 2 trip points should be configured in polling mode.
>>> exynos-tmu 100a0000.tmu: More trip points than supported by this TMU.
>>> exynos-tmu 100a0000.tmu: 6 trip points should be configured in polling mode.
>>> usb usb3: root hub lost power or was reset
>>> s3c-rtc 101e0000.rtc: rtc disabled, re-enabling
>>> usb usb4: root hub lost power or was reset
>>> xhci-hcd xhci-hcd.8.auto: No ports on the roothubs?
>>> PM: dpm_run_callback(): platform_pm_resume+0x0/0x44 returns -12
>>> PM: Device xhci-hcd.8.auto failed to resume async: error -12
>>> hub 3-0:1.0: hub_ext_port_status failed (err = -32)
>>> hub 4-0:1.0: hub_ext_port_status failed (err = -32)
>>> usb 1-1: reset high-speed USB device number 2 using exynos-ehci
>>> usb 1-1.1: reset high-speed USB device number 3 using exynos-ehci
>>> OOM killer enabled.
>>> Restarting tasks ... done.
>>>
>>> real    0m11.890s
>>> user    0m0.001s
>>> sys     0m0.679s
>>> root@target:~# PM: suspend exit
>>> mmc_host mmc0: Bus speed (slot 0) = 50000000Hz (slot req 400000Hz, 
>>> actual 396825HZ div = 63)
>>> mmc_host mmc0: Bus speed (slot 0) = 200000000Hz (slot req 200000000Hz, 
>>> actual 200000000HZ div = 0)
>>> mmc_host mmc0: Bus speed (slot 0) = 50000000Hz (slot req 52000000Hz, 
>>> actual 50000000HZ div = 0)
>>> mmc_host mmc0: Bus speed (slot 0) = 400000000Hz (slot req 200000000Hz, 
>>> actual 200000000HZ div = 1)
>>> smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xC1E1
>>>
>>> root@target:~#
>>> root@target:~# time rtcwake -s10 -mmem[   35.451572] vdd_ldo12: disabling
>>>
>>> rtcwake: wakeup from "mem" using /dev/rtc0 at Tue Feb 11 10:52:02 2020
>>> PM: suspend entry (deep)
>>> Filesystems sync: 0.004 seconds
>>> Freezing user space processes ... (elapsed 0.006 seconds) done.
>>> OOM killer disabled.
>>> Freezing remaining freezable tasks ... (elapsed 0.070 seconds) done.
>>> hub 4-0:1.0: hub_ext_port_status failed (err = -32)
>>> hub 3-0:1.0: hub_ext_port_status failed (err = -32)
>>> 8<--- cut here ---
>>> Unable to handle kernel NULL pointer dereference at virtual address 00000014
>>> pgd = 4c26b54b
>>> [00000014] *pgd=00000000
>>> Internal error: Oops: 17 [#1] PREEMPT SMP ARM
>>> Modules linked in:
>>> CPU: 3 PID: 1468 Comm: kworker/u16:23 Not tainted 
>>> 5.6.0-rc1-next-20200211 #268
>>> Hardware name: Samsung Exynos (Flattened Device Tree)
>>> Workqueue: events_unbound async_run_entry_fn
>>> PC is at xhci_suspend+0x12c/0x520
>>> LR is at 0xa6aa9898
>>> pc : [<c0724c90>]    lr : [<a6aa9898>]    psr: 60000093
>>> sp : ec401df8  ip : 0000001a  fp : c12e7864
>>> r10: 00000000  r9 : ecfb87b0  r8 : ecfb8220
>>> r7 : 00000000  r6 : 00000000  r5 : 00000004  r4 : ecfb81f0
>>> r3 : 00007d00  r2 : 00000001  r1 : 00000001  r0 : 00000000
>>> Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment none
>>> Control: 10c5387d  Table: 6bd4006a  DAC: 00000051
>>> Process kworker/u16:23 (pid: 1468, stack limit = 0x6e4b6fba)
>>> Stack: (0xec401df8 to 0xec402000)
>>> ...
>>> [<c0724c90>] (xhci_suspend) from [<c061b4f4>] (dpm_run_callback+0xb4/0x3fc)
>>> [<c061b4f4>] (dpm_run_callback) from [<c061bd5c>] 
>>> (__device_suspend+0x134/0x7e8)
>>> [<c061bd5c>] (__device_suspend) from [<c061c42c>] (async_suspend+0x1c/0x94)
>>> [<c061c42c>] (async_suspend) from [<c0154bd0>] 
>>> (async_run_entry_fn+0x48/0x1b8)
>>> [<c0154bd0>] (async_run_entry_fn) from [<c0149b38>] 
>>> (process_one_work+0x230/0x7bc)
>>> [<c0149b38>] (process_one_work) from [<c014a108>] (worker_thread+0x44/0x524)
>>> [<c014a108>] (worker_thread) from [<c01511fc>] (kthread+0x130/0x164)
>>> [<c01511fc>] (kthread) from [<c01010b4>] (ret_from_fork+0x14/0x20)
>>> Exception stack(0xec401fb0 to 0xec401ff8)
>>> ...
>>> ---[ end trace c72caf6487666442 ]---
>>> note: kworker/u16:23[1468] exited with preempt_count 1
>>>
>>> Reverting it fixes the NULL pointer issue. I can provide more 
>>> information or do some other tests. Just let me know what will help to 
>>> fix it.
>>>
>>>  > ...
>>
>> Ugh.  Mathias, should I just revert this for now?
>>
> 
> Yes, revert it.
> 
> This looks very odd, after second resume, and losing power driver
> can't find any port at all.
> 
> Marek, do you still get the "xhci-hcd xhci-hcd.8.auto: No ports on the roothubs?"
> message on second resume after reverting the patch?
> 

Ok, I think I got it. 
Patch doesn't set xhci->num_port_caps to 0 in xhci_mem_cleanup().

Adding new ports will fail when we reinitialize xhci manually, like in this
exynos case where xhci loses power in suspend/resume cycle.  

I'll post a new version soon

-Mathias
 


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [RFT PATCH v2] xhci: Fix memory leak when caching protocol extended capability PSI tables
  2020-02-11 14:08                         ` Mathias Nyman
@ 2020-02-11 15:01                           ` Mathias Nyman
  2020-02-11 15:12                             ` Marek Szyprowski
  2020-02-13 13:33                             ` Jon Hunter
  0 siblings, 2 replies; 21+ messages in thread
From: Mathias Nyman @ 2020-02-11 15:01 UTC (permalink / raw)
  To: gregkh, m.szyprowski
  Cc: pmenzel, mika.westerberg, linux-usb, linux-kernel,
	linux-samsung-soc, krzk, Mathias Nyman, stable

xhci driver assumed that xHC controllers have at most one custom
supported speed table (PSI) for all usb 3.x ports.
Memory was allocated for one PSI table under the xhci hub structure.

Turns out this is not the case, some controllers have a separate
"supported protocol capability" entry with a PSI table for each port.
This means each usb3 roothub port can in theory support different custom
speeds.

To solve this, cache all supported protocol capabilities with their PSI
tables in an array, and add pointers to the xhci port structure so that
every port points to its capability entry in the array.

When creating the SuperSpeedPlus USB Device Capability BOS descriptor
for the xhci USB 3.1 roothub we for now will use only data from the
first USB 3.1 capable protocol capability entry in the array.
This could be improved later, this patch focuses resolving
the memory leak.

Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
Reported-by: Sajja Venkateswara Rao <VenkateswaraRao.Sajja@amd.com>
Fixes: 47189098f8be ("xhci: parse xhci protocol speed ID list for usb 3.1 usage")
Cc: stable <stable@vger.kernel.org> # v4.4+
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
---

Changes since v1:

- Clear xhci->num_port_caps in xhci_mem_cleanup()
  Otherwise we fail to add new ports and cause NULL pointer dereference at
  manual xhci re-initialization. This can happen at resume if host lost power
  during suspend.
---
 drivers/usb/host/xhci-hub.c | 25 +++++++++++-----
 drivers/usb/host/xhci-mem.c | 59 +++++++++++++++++++++++--------------
 drivers/usb/host/xhci.h     | 14 +++++++--
 3 files changed, 65 insertions(+), 33 deletions(-)

diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index 7a3a29e5e9d2..af92b2576fe9 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -55,6 +55,7 @@ static u8 usb_bos_descriptor [] = {
 static int xhci_create_usb3_bos_desc(struct xhci_hcd *xhci, char *buf,
 				     u16 wLength)
 {
+	struct xhci_port_cap *port_cap = NULL;
 	int i, ssa_count;
 	u32 temp;
 	u16 desc_size, ssp_cap_size, ssa_size = 0;
@@ -64,16 +65,24 @@ static int xhci_create_usb3_bos_desc(struct xhci_hcd *xhci, char *buf,
 	ssp_cap_size = sizeof(usb_bos_descriptor) - desc_size;
 
 	/* does xhci support USB 3.1 Enhanced SuperSpeed */
-	if (xhci->usb3_rhub.min_rev >= 0x01) {
+	for (i = 0; i < xhci->num_port_caps; i++) {
+		if (xhci->port_caps[i].maj_rev == 0x03 &&
+		    xhci->port_caps[i].min_rev >= 0x01) {
+			usb3_1 = true;
+			port_cap = &xhci->port_caps[i];
+			break;
+		}
+	}
+
+	if (usb3_1) {
 		/* does xhci provide a PSI table for SSA speed attributes? */
-		if (xhci->usb3_rhub.psi_count) {
+		if (port_cap->psi_count) {
 			/* two SSA entries for each unique PSI ID, RX and TX */
-			ssa_count = xhci->usb3_rhub.psi_uid_count * 2;
+			ssa_count = port_cap->psi_uid_count * 2;
 			ssa_size = ssa_count * sizeof(u32);
 			ssp_cap_size -= 16; /* skip copying the default SSA */
 		}
 		desc_size += ssp_cap_size;
-		usb3_1 = true;
 	}
 	memcpy(buf, &usb_bos_descriptor, min(desc_size, wLength));
 
@@ -99,7 +108,7 @@ static int xhci_create_usb3_bos_desc(struct xhci_hcd *xhci, char *buf,
 	}
 
 	/* If PSI table exists, add the custom speed attributes from it */
-	if (usb3_1 && xhci->usb3_rhub.psi_count) {
+	if (usb3_1 && port_cap->psi_count) {
 		u32 ssp_cap_base, bm_attrib, psi, psi_mant, psi_exp;
 		int offset;
 
@@ -111,7 +120,7 @@ static int xhci_create_usb3_bos_desc(struct xhci_hcd *xhci, char *buf,
 
 		/* attribute count SSAC bits 4:0 and ID count SSIC bits 8:5 */
 		bm_attrib = (ssa_count - 1) & 0x1f;
-		bm_attrib |= (xhci->usb3_rhub.psi_uid_count - 1) << 5;
+		bm_attrib |= (port_cap->psi_uid_count - 1) << 5;
 		put_unaligned_le32(bm_attrib, &buf[ssp_cap_base + 4]);
 
 		if (wLength < desc_size + ssa_size)
@@ -124,8 +133,8 @@ static int xhci_create_usb3_bos_desc(struct xhci_hcd *xhci, char *buf,
 		 * USB 3.1 requires two SSA entries (RX and TX) for every link
 		 */
 		offset = desc_size;
-		for (i = 0; i < xhci->usb3_rhub.psi_count; i++) {
-			psi = xhci->usb3_rhub.psi[i];
+		for (i = 0; i < port_cap->psi_count; i++) {
+			psi = port_cap->psi[i];
 			psi &= ~USB_SSP_SUBLINK_SPEED_RSVD;
 			psi_exp = XHCI_EXT_PORT_PSIE(psi);
 			psi_mant = XHCI_EXT_PORT_PSIM(psi);
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 0e2701649369..884c601bfa15 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -1915,17 +1915,17 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci)
 	xhci->usb3_rhub.num_ports = 0;
 	xhci->num_active_eps = 0;
 	kfree(xhci->usb2_rhub.ports);
-	kfree(xhci->usb2_rhub.psi);
 	kfree(xhci->usb3_rhub.ports);
-	kfree(xhci->usb3_rhub.psi);
 	kfree(xhci->hw_ports);
 	kfree(xhci->rh_bw);
 	kfree(xhci->ext_caps);
+	for (i = 0; i < xhci->num_port_caps; i++)
+		kfree(xhci->port_caps[i].psi);
+	kfree(xhci->port_caps);
+	xhci->num_port_caps = 0;
 
 	xhci->usb2_rhub.ports = NULL;
-	xhci->usb2_rhub.psi = NULL;
 	xhci->usb3_rhub.ports = NULL;
-	xhci->usb3_rhub.psi = NULL;
 	xhci->hw_ports = NULL;
 	xhci->rh_bw = NULL;
 	xhci->ext_caps = NULL;
@@ -2126,6 +2126,7 @@ static void xhci_add_in_port(struct xhci_hcd *xhci, unsigned int num_ports,
 	u8 major_revision, minor_revision;
 	struct xhci_hub *rhub;
 	struct device *dev = xhci_to_hcd(xhci)->self.sysdev;
+	struct xhci_port_cap *port_cap;
 
 	temp = readl(addr);
 	major_revision = XHCI_EXT_PORT_MAJOR(temp);
@@ -2160,31 +2161,39 @@ static void xhci_add_in_port(struct xhci_hcd *xhci, unsigned int num_ports,
 		/* WTF? "Valid values are ‘1’ to MaxPorts" */
 		return;
 
-	rhub->psi_count = XHCI_EXT_PORT_PSIC(temp);
-	if (rhub->psi_count) {
-		rhub->psi = kcalloc_node(rhub->psi_count, sizeof(*rhub->psi),
-				    GFP_KERNEL, dev_to_node(dev));
-		if (!rhub->psi)
-			rhub->psi_count = 0;
+	port_cap = &xhci->port_caps[xhci->num_port_caps++];
+	if (xhci->num_port_caps > max_caps)
+		return;
+
+	port_cap->maj_rev = major_revision;
+	port_cap->min_rev = minor_revision;
+	port_cap->psi_count = XHCI_EXT_PORT_PSIC(temp);
+
+	if (port_cap->psi_count) {
+		port_cap->psi = kcalloc_node(port_cap->psi_count,
+					     sizeof(*port_cap->psi),
+					     GFP_KERNEL, dev_to_node(dev));
+		if (!port_cap->psi)
+			port_cap->psi_count = 0;
 
-		rhub->psi_uid_count++;
-		for (i = 0; i < rhub->psi_count; i++) {
-			rhub->psi[i] = readl(addr + 4 + i);
+		port_cap->psi_uid_count++;
+		for (i = 0; i < port_cap->psi_count; i++) {
+			port_cap->psi[i] = readl(addr + 4 + i);
 
 			/* count unique ID values, two consecutive entries can
 			 * have the same ID if link is assymetric
 			 */
-			if (i && (XHCI_EXT_PORT_PSIV(rhub->psi[i]) !=
-				  XHCI_EXT_PORT_PSIV(rhub->psi[i - 1])))
-				rhub->psi_uid_count++;
+			if (i && (XHCI_EXT_PORT_PSIV(port_cap->psi[i]) !=
+				  XHCI_EXT_PORT_PSIV(port_cap->psi[i - 1])))
+				port_cap->psi_uid_count++;
 
 			xhci_dbg(xhci, "PSIV:%d PSIE:%d PLT:%d PFD:%d LP:%d PSIM:%d\n",
-				  XHCI_EXT_PORT_PSIV(rhub->psi[i]),
-				  XHCI_EXT_PORT_PSIE(rhub->psi[i]),
-				  XHCI_EXT_PORT_PLT(rhub->psi[i]),
-				  XHCI_EXT_PORT_PFD(rhub->psi[i]),
-				  XHCI_EXT_PORT_LP(rhub->psi[i]),
-				  XHCI_EXT_PORT_PSIM(rhub->psi[i]));
+				  XHCI_EXT_PORT_PSIV(port_cap->psi[i]),
+				  XHCI_EXT_PORT_PSIE(port_cap->psi[i]),
+				  XHCI_EXT_PORT_PLT(port_cap->psi[i]),
+				  XHCI_EXT_PORT_PFD(port_cap->psi[i]),
+				  XHCI_EXT_PORT_LP(port_cap->psi[i]),
+				  XHCI_EXT_PORT_PSIM(port_cap->psi[i]));
 		}
 	}
 	/* cache usb2 port capabilities */
@@ -2219,6 +2228,7 @@ static void xhci_add_in_port(struct xhci_hcd *xhci, unsigned int num_ports,
 			continue;
 		}
 		hw_port->rhub = rhub;
+		hw_port->port_cap = port_cap;
 		rhub->num_ports++;
 	}
 	/* FIXME: Should we disable ports not in the Extended Capabilities? */
@@ -2309,6 +2319,11 @@ static int xhci_setup_port_arrays(struct xhci_hcd *xhci, gfp_t flags)
 	if (!xhci->ext_caps)
 		return -ENOMEM;
 
+	xhci->port_caps = kcalloc_node(cap_count, sizeof(*xhci->port_caps),
+				flags, dev_to_node(dev));
+	if (!xhci->port_caps)
+		return -ENOMEM;
+
 	offset = cap_start;
 
 	while (offset) {
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 13d8838cd552..3ecee10fdcdc 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1702,12 +1702,20 @@ struct xhci_bus_state {
  * Intel Lynx Point LP xHCI host.
  */
 #define	XHCI_MAX_REXIT_TIMEOUT_MS	20
+struct xhci_port_cap {
+	u32			*psi;	/* array of protocol speed ID entries */
+	u8			psi_count;
+	u8			psi_uid_count;
+	u8			maj_rev;
+	u8			min_rev;
+};
 
 struct xhci_port {
 	__le32 __iomem		*addr;
 	int			hw_portnum;
 	int			hcd_portnum;
 	struct xhci_hub		*rhub;
+	struct xhci_port_cap	*port_cap;
 };
 
 struct xhci_hub {
@@ -1719,9 +1727,6 @@ struct xhci_hub {
 	/* supported prococol extended capabiliy values */
 	u8			maj_rev;
 	u8			min_rev;
-	u32			*psi;	/* array of protocol speed ID entries */
-	u8			psi_count;
-	u8			psi_uid_count;
 };
 
 /* There is one xhci_hcd structure per controller */
@@ -1880,6 +1885,9 @@ struct xhci_hcd {
 	/* cached usb2 extened protocol capabilites */
 	u32                     *ext_caps;
 	unsigned int            num_ext_caps;
+	/* cached extended protocol port capabilities */
+	struct xhci_port_cap	*port_caps;
+	unsigned int		num_port_caps;
 	/* Compliance Mode Recovery Data */
 	struct timer_list	comp_mode_recovery_timer;
 	u32			port_status_u0;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [RFT PATCH v2] xhci: Fix memory leak when caching protocol extended capability PSI tables
  2020-02-11 15:01                           ` [RFT PATCH v2] " Mathias Nyman
@ 2020-02-11 15:12                             ` Marek Szyprowski
  2020-02-11 16:13                               ` Greg KH
  2020-02-13 13:33                             ` Jon Hunter
  1 sibling, 1 reply; 21+ messages in thread
From: Marek Szyprowski @ 2020-02-11 15:12 UTC (permalink / raw)
  To: Mathias Nyman, gregkh
  Cc: pmenzel, mika.westerberg, linux-usb, linux-kernel,
	linux-samsung-soc, krzk, stable

Hi Mathias,

On 11.02.2020 16:01, Mathias Nyman wrote:
> xhci driver assumed that xHC controllers have at most one custom
> supported speed table (PSI) for all usb 3.x ports.
> Memory was allocated for one PSI table under the xhci hub structure.
>
> Turns out this is not the case, some controllers have a separate
> "supported protocol capability" entry with a PSI table for each port.
> This means each usb3 roothub port can in theory support different custom
> speeds.
>
> To solve this, cache all supported protocol capabilities with their PSI
> tables in an array, and add pointers to the xhci port structure so that
> every port points to its capability entry in the array.
>
> When creating the SuperSpeedPlus USB Device Capability BOS descriptor
> for the xhci USB 3.1 roothub we for now will use only data from the
> first USB 3.1 capable protocol capability entry in the array.
> This could be improved later, this patch focuses resolving
> the memory leak.
>
> Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
> Reported-by: Sajja Venkateswara Rao <VenkateswaraRao.Sajja@amd.com>
> Fixes: 47189098f8be ("xhci: parse xhci protocol speed ID list for usb 3.1 usage")
> Cc: stable <stable@vger.kernel.org> # v4.4+
> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>

Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>

> ---
>
> Changes since v1:
>
> - Clear xhci->num_port_caps in xhci_mem_cleanup()
>    Otherwise we fail to add new ports and cause NULL pointer dereference at
>    manual xhci re-initialization. This can happen at resume if host lost power
>    during suspend.
> ---
>   drivers/usb/host/xhci-hub.c | 25 +++++++++++-----
>   drivers/usb/host/xhci-mem.c | 59 +++++++++++++++++++++++--------------
>   drivers/usb/host/xhci.h     | 14 +++++++--
>   3 files changed, 65 insertions(+), 33 deletions(-)
>
> diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
> index 7a3a29e5e9d2..af92b2576fe9 100644
> --- a/drivers/usb/host/xhci-hub.c
> +++ b/drivers/usb/host/xhci-hub.c
> @@ -55,6 +55,7 @@ static u8 usb_bos_descriptor [] = {
>   static int xhci_create_usb3_bos_desc(struct xhci_hcd *xhci, char *buf,
>   				     u16 wLength)
>   {
> +	struct xhci_port_cap *port_cap = NULL;
>   	int i, ssa_count;
>   	u32 temp;
>   	u16 desc_size, ssp_cap_size, ssa_size = 0;
> @@ -64,16 +65,24 @@ static int xhci_create_usb3_bos_desc(struct xhci_hcd *xhci, char *buf,
>   	ssp_cap_size = sizeof(usb_bos_descriptor) - desc_size;
>   
>   	/* does xhci support USB 3.1 Enhanced SuperSpeed */
> -	if (xhci->usb3_rhub.min_rev >= 0x01) {
> +	for (i = 0; i < xhci->num_port_caps; i++) {
> +		if (xhci->port_caps[i].maj_rev == 0x03 &&
> +		    xhci->port_caps[i].min_rev >= 0x01) {
> +			usb3_1 = true;
> +			port_cap = &xhci->port_caps[i];
> +			break;
> +		}
> +	}
> +
> +	if (usb3_1) {
>   		/* does xhci provide a PSI table for SSA speed attributes? */
> -		if (xhci->usb3_rhub.psi_count) {
> +		if (port_cap->psi_count) {
>   			/* two SSA entries for each unique PSI ID, RX and TX */
> -			ssa_count = xhci->usb3_rhub.psi_uid_count * 2;
> +			ssa_count = port_cap->psi_uid_count * 2;
>   			ssa_size = ssa_count * sizeof(u32);
>   			ssp_cap_size -= 16; /* skip copying the default SSA */
>   		}
>   		desc_size += ssp_cap_size;
> -		usb3_1 = true;
>   	}
>   	memcpy(buf, &usb_bos_descriptor, min(desc_size, wLength));
>   
> @@ -99,7 +108,7 @@ static int xhci_create_usb3_bos_desc(struct xhci_hcd *xhci, char *buf,
>   	}
>   
>   	/* If PSI table exists, add the custom speed attributes from it */
> -	if (usb3_1 && xhci->usb3_rhub.psi_count) {
> +	if (usb3_1 && port_cap->psi_count) {
>   		u32 ssp_cap_base, bm_attrib, psi, psi_mant, psi_exp;
>   		int offset;
>   
> @@ -111,7 +120,7 @@ static int xhci_create_usb3_bos_desc(struct xhci_hcd *xhci, char *buf,
>   
>   		/* attribute count SSAC bits 4:0 and ID count SSIC bits 8:5 */
>   		bm_attrib = (ssa_count - 1) & 0x1f;
> -		bm_attrib |= (xhci->usb3_rhub.psi_uid_count - 1) << 5;
> +		bm_attrib |= (port_cap->psi_uid_count - 1) << 5;
>   		put_unaligned_le32(bm_attrib, &buf[ssp_cap_base + 4]);
>   
>   		if (wLength < desc_size + ssa_size)
> @@ -124,8 +133,8 @@ static int xhci_create_usb3_bos_desc(struct xhci_hcd *xhci, char *buf,
>   		 * USB 3.1 requires two SSA entries (RX and TX) for every link
>   		 */
>   		offset = desc_size;
> -		for (i = 0; i < xhci->usb3_rhub.psi_count; i++) {
> -			psi = xhci->usb3_rhub.psi[i];
> +		for (i = 0; i < port_cap->psi_count; i++) {
> +			psi = port_cap->psi[i];
>   			psi &= ~USB_SSP_SUBLINK_SPEED_RSVD;
>   			psi_exp = XHCI_EXT_PORT_PSIE(psi);
>   			psi_mant = XHCI_EXT_PORT_PSIM(psi);
> diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
> index 0e2701649369..884c601bfa15 100644
> --- a/drivers/usb/host/xhci-mem.c
> +++ b/drivers/usb/host/xhci-mem.c
> @@ -1915,17 +1915,17 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci)
>   	xhci->usb3_rhub.num_ports = 0;
>   	xhci->num_active_eps = 0;
>   	kfree(xhci->usb2_rhub.ports);
> -	kfree(xhci->usb2_rhub.psi);
>   	kfree(xhci->usb3_rhub.ports);
> -	kfree(xhci->usb3_rhub.psi);
>   	kfree(xhci->hw_ports);
>   	kfree(xhci->rh_bw);
>   	kfree(xhci->ext_caps);
> +	for (i = 0; i < xhci->num_port_caps; i++)
> +		kfree(xhci->port_caps[i].psi);
> +	kfree(xhci->port_caps);
> +	xhci->num_port_caps = 0;
>   
>   	xhci->usb2_rhub.ports = NULL;
> -	xhci->usb2_rhub.psi = NULL;
>   	xhci->usb3_rhub.ports = NULL;
> -	xhci->usb3_rhub.psi = NULL;
>   	xhci->hw_ports = NULL;
>   	xhci->rh_bw = NULL;
>   	xhci->ext_caps = NULL;
> @@ -2126,6 +2126,7 @@ static void xhci_add_in_port(struct xhci_hcd *xhci, unsigned int num_ports,
>   	u8 major_revision, minor_revision;
>   	struct xhci_hub *rhub;
>   	struct device *dev = xhci_to_hcd(xhci)->self.sysdev;
> +	struct xhci_port_cap *port_cap;
>   
>   	temp = readl(addr);
>   	major_revision = XHCI_EXT_PORT_MAJOR(temp);
> @@ -2160,31 +2161,39 @@ static void xhci_add_in_port(struct xhci_hcd *xhci, unsigned int num_ports,
>   		/* WTF? "Valid values are ‘1’ to MaxPorts" */
>   		return;
>   
> -	rhub->psi_count = XHCI_EXT_PORT_PSIC(temp);
> -	if (rhub->psi_count) {
> -		rhub->psi = kcalloc_node(rhub->psi_count, sizeof(*rhub->psi),
> -				    GFP_KERNEL, dev_to_node(dev));
> -		if (!rhub->psi)
> -			rhub->psi_count = 0;
> +	port_cap = &xhci->port_caps[xhci->num_port_caps++];
> +	if (xhci->num_port_caps > max_caps)
> +		return;
> +
> +	port_cap->maj_rev = major_revision;
> +	port_cap->min_rev = minor_revision;
> +	port_cap->psi_count = XHCI_EXT_PORT_PSIC(temp);
> +
> +	if (port_cap->psi_count) {
> +		port_cap->psi = kcalloc_node(port_cap->psi_count,
> +					     sizeof(*port_cap->psi),
> +					     GFP_KERNEL, dev_to_node(dev));
> +		if (!port_cap->psi)
> +			port_cap->psi_count = 0;
>   
> -		rhub->psi_uid_count++;
> -		for (i = 0; i < rhub->psi_count; i++) {
> -			rhub->psi[i] = readl(addr + 4 + i);
> +		port_cap->psi_uid_count++;
> +		for (i = 0; i < port_cap->psi_count; i++) {
> +			port_cap->psi[i] = readl(addr + 4 + i);
>   
>   			/* count unique ID values, two consecutive entries can
>   			 * have the same ID if link is assymetric
>   			 */
> -			if (i && (XHCI_EXT_PORT_PSIV(rhub->psi[i]) !=
> -				  XHCI_EXT_PORT_PSIV(rhub->psi[i - 1])))
> -				rhub->psi_uid_count++;
> +			if (i && (XHCI_EXT_PORT_PSIV(port_cap->psi[i]) !=
> +				  XHCI_EXT_PORT_PSIV(port_cap->psi[i - 1])))
> +				port_cap->psi_uid_count++;
>   
>   			xhci_dbg(xhci, "PSIV:%d PSIE:%d PLT:%d PFD:%d LP:%d PSIM:%d\n",
> -				  XHCI_EXT_PORT_PSIV(rhub->psi[i]),
> -				  XHCI_EXT_PORT_PSIE(rhub->psi[i]),
> -				  XHCI_EXT_PORT_PLT(rhub->psi[i]),
> -				  XHCI_EXT_PORT_PFD(rhub->psi[i]),
> -				  XHCI_EXT_PORT_LP(rhub->psi[i]),
> -				  XHCI_EXT_PORT_PSIM(rhub->psi[i]));
> +				  XHCI_EXT_PORT_PSIV(port_cap->psi[i]),
> +				  XHCI_EXT_PORT_PSIE(port_cap->psi[i]),
> +				  XHCI_EXT_PORT_PLT(port_cap->psi[i]),
> +				  XHCI_EXT_PORT_PFD(port_cap->psi[i]),
> +				  XHCI_EXT_PORT_LP(port_cap->psi[i]),
> +				  XHCI_EXT_PORT_PSIM(port_cap->psi[i]));
>   		}
>   	}
>   	/* cache usb2 port capabilities */
> @@ -2219,6 +2228,7 @@ static void xhci_add_in_port(struct xhci_hcd *xhci, unsigned int num_ports,
>   			continue;
>   		}
>   		hw_port->rhub = rhub;
> +		hw_port->port_cap = port_cap;
>   		rhub->num_ports++;
>   	}
>   	/* FIXME: Should we disable ports not in the Extended Capabilities? */
> @@ -2309,6 +2319,11 @@ static int xhci_setup_port_arrays(struct xhci_hcd *xhci, gfp_t flags)
>   	if (!xhci->ext_caps)
>   		return -ENOMEM;
>   
> +	xhci->port_caps = kcalloc_node(cap_count, sizeof(*xhci->port_caps),
> +				flags, dev_to_node(dev));
> +	if (!xhci->port_caps)
> +		return -ENOMEM;
> +
>   	offset = cap_start;
>   
>   	while (offset) {
> diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
> index 13d8838cd552..3ecee10fdcdc 100644
> --- a/drivers/usb/host/xhci.h
> +++ b/drivers/usb/host/xhci.h
> @@ -1702,12 +1702,20 @@ struct xhci_bus_state {
>    * Intel Lynx Point LP xHCI host.
>    */
>   #define	XHCI_MAX_REXIT_TIMEOUT_MS	20
> +struct xhci_port_cap {
> +	u32			*psi;	/* array of protocol speed ID entries */
> +	u8			psi_count;
> +	u8			psi_uid_count;
> +	u8			maj_rev;
> +	u8			min_rev;
> +};
>   
>   struct xhci_port {
>   	__le32 __iomem		*addr;
>   	int			hw_portnum;
>   	int			hcd_portnum;
>   	struct xhci_hub		*rhub;
> +	struct xhci_port_cap	*port_cap;
>   };
>   
>   struct xhci_hub {
> @@ -1719,9 +1727,6 @@ struct xhci_hub {
>   	/* supported prococol extended capabiliy values */
>   	u8			maj_rev;
>   	u8			min_rev;
> -	u32			*psi;	/* array of protocol speed ID entries */
> -	u8			psi_count;
> -	u8			psi_uid_count;
>   };
>   
>   /* There is one xhci_hcd structure per controller */
> @@ -1880,6 +1885,9 @@ struct xhci_hcd {
>   	/* cached usb2 extened protocol capabilites */
>   	u32                     *ext_caps;
>   	unsigned int            num_ext_caps;
> +	/* cached extended protocol port capabilities */
> +	struct xhci_port_cap	*port_caps;
> +	unsigned int		num_port_caps;
>   	/* Compliance Mode Recovery Data */
>   	struct timer_list	comp_mode_recovery_timer;
>   	u32			port_status_u0;

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [RFT PATCH v2] xhci: Fix memory leak when caching protocol extended capability PSI tables
  2020-02-11 15:12                             ` Marek Szyprowski
@ 2020-02-11 16:13                               ` Greg KH
  2020-02-12  9:01                                 ` Mathias Nyman
  0 siblings, 1 reply; 21+ messages in thread
From: Greg KH @ 2020-02-11 16:13 UTC (permalink / raw)
  To: Marek Szyprowski
  Cc: Mathias Nyman, pmenzel, mika.westerberg, linux-usb, linux-kernel,
	linux-samsung-soc, krzk, stable

On Tue, Feb 11, 2020 at 04:12:40PM +0100, Marek Szyprowski wrote:
> Hi Mathias,
> 
> On 11.02.2020 16:01, Mathias Nyman wrote:
> > xhci driver assumed that xHC controllers have at most one custom
> > supported speed table (PSI) for all usb 3.x ports.
> > Memory was allocated for one PSI table under the xhci hub structure.
> >
> > Turns out this is not the case, some controllers have a separate
> > "supported protocol capability" entry with a PSI table for each port.
> > This means each usb3 roothub port can in theory support different custom
> > speeds.
> >
> > To solve this, cache all supported protocol capabilities with their PSI
> > tables in an array, and add pointers to the xhci port structure so that
> > every port points to its capability entry in the array.
> >
> > When creating the SuperSpeedPlus USB Device Capability BOS descriptor
> > for the xhci USB 3.1 roothub we for now will use only data from the
> > first USB 3.1 capable protocol capability entry in the array.
> > This could be improved later, this patch focuses resolving
> > the memory leak.
> >
> > Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
> > Reported-by: Sajja Venkateswara Rao <VenkateswaraRao.Sajja@amd.com>
> > Fixes: 47189098f8be ("xhci: parse xhci protocol speed ID list for usb 3.1 usage")
> > Cc: stable <stable@vger.kernel.org> # v4.4+
> > Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
> 
> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>

Nice!

Should I revert the first and then apply this?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [RFT PATCH v2] xhci: Fix memory leak when caching protocol extended capability PSI tables
  2020-02-11 16:13                               ` Greg KH
@ 2020-02-12  9:01                                 ` Mathias Nyman
  2020-02-12 17:51                                   ` Greg KH
  0 siblings, 1 reply; 21+ messages in thread
From: Mathias Nyman @ 2020-02-12  9:01 UTC (permalink / raw)
  To: Greg KH, Marek Szyprowski
  Cc: pmenzel, mika.westerberg, linux-usb, linux-kernel,
	linux-samsung-soc, krzk, stable

On 11.2.2020 18.13, Greg KH wrote:
> On Tue, Feb 11, 2020 at 04:12:40PM +0100, Marek Szyprowski wrote:
>> Hi Mathias,
>>
>> On 11.02.2020 16:01, Mathias Nyman wrote:
>>> xhci driver assumed that xHC controllers have at most one custom
>>> supported speed table (PSI) for all usb 3.x ports.
>>> Memory was allocated for one PSI table under the xhci hub structure.
>>>
>>> Turns out this is not the case, some controllers have a separate
>>> "supported protocol capability" entry with a PSI table for each port.
>>> This means each usb3 roothub port can in theory support different custom
>>> speeds.
>>>
>>> To solve this, cache all supported protocol capabilities with their PSI
>>> tables in an array, and add pointers to the xhci port structure so that
>>> every port points to its capability entry in the array.
>>>
>>> When creating the SuperSpeedPlus USB Device Capability BOS descriptor
>>> for the xhci USB 3.1 roothub we for now will use only data from the
>>> first USB 3.1 capable protocol capability entry in the array.
>>> This could be improved later, this patch focuses resolving
>>> the memory leak.
>>>
>>> Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
>>> Reported-by: Sajja Venkateswara Rao <VenkateswaraRao.Sajja@amd.com>
>>> Fixes: 47189098f8be ("xhci: parse xhci protocol speed ID list for usb 3.1 usage")
>>> Cc: stable <stable@vger.kernel.org> # v4.4+
>>> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
>>
>> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
> 
> Nice!
> 
> Should I revert the first and then apply this?
> 

Yes, please

Thanks

-Mathias



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [RFT PATCH v2] xhci: Fix memory leak when caching protocol extended capability PSI tables
  2020-02-12  9:01                                 ` Mathias Nyman
@ 2020-02-12 17:51                                   ` Greg KH
  0 siblings, 0 replies; 21+ messages in thread
From: Greg KH @ 2020-02-12 17:51 UTC (permalink / raw)
  To: Mathias Nyman
  Cc: Marek Szyprowski, pmenzel, mika.westerberg, linux-usb,
	linux-kernel, linux-samsung-soc, krzk, stable

On Wed, Feb 12, 2020 at 11:01:52AM +0200, Mathias Nyman wrote:
> On 11.2.2020 18.13, Greg KH wrote:
> > On Tue, Feb 11, 2020 at 04:12:40PM +0100, Marek Szyprowski wrote:
> >> Hi Mathias,
> >>
> >> On 11.02.2020 16:01, Mathias Nyman wrote:
> >>> xhci driver assumed that xHC controllers have at most one custom
> >>> supported speed table (PSI) for all usb 3.x ports.
> >>> Memory was allocated for one PSI table under the xhci hub structure.
> >>>
> >>> Turns out this is not the case, some controllers have a separate
> >>> "supported protocol capability" entry with a PSI table for each port.
> >>> This means each usb3 roothub port can in theory support different custom
> >>> speeds.
> >>>
> >>> To solve this, cache all supported protocol capabilities with their PSI
> >>> tables in an array, and add pointers to the xhci port structure so that
> >>> every port points to its capability entry in the array.
> >>>
> >>> When creating the SuperSpeedPlus USB Device Capability BOS descriptor
> >>> for the xhci USB 3.1 roothub we for now will use only data from the
> >>> first USB 3.1 capable protocol capability entry in the array.
> >>> This could be improved later, this patch focuses resolving
> >>> the memory leak.
> >>>
> >>> Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
> >>> Reported-by: Sajja Venkateswara Rao <VenkateswaraRao.Sajja@amd.com>
> >>> Fixes: 47189098f8be ("xhci: parse xhci protocol speed ID list for usb 3.1 usage")
> >>> Cc: stable <stable@vger.kernel.org> # v4.4+
> >>> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
> >>
> >> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
> > 
> > Nice!
> > 
> > Should I revert the first and then apply this?
> > 
> 
> Yes, please

Now done, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [RFT PATCH v2] xhci: Fix memory leak when caching protocol extended capability PSI tables
  2020-02-11 15:01                           ` [RFT PATCH v2] " Mathias Nyman
  2020-02-11 15:12                             ` Marek Szyprowski
@ 2020-02-13 13:33                             ` Jon Hunter
  2020-02-14  7:47                               ` Mathias Nyman
  1 sibling, 1 reply; 21+ messages in thread
From: Jon Hunter @ 2020-02-13 13:33 UTC (permalink / raw)
  To: Mathias Nyman, gregkh, m.szyprowski
  Cc: pmenzel, mika.westerberg, linux-usb, linux-kernel,
	linux-samsung-soc, krzk, stable, linux-tegra


On 11/02/2020 15:01, Mathias Nyman wrote:
> xhci driver assumed that xHC controllers have at most one custom
> supported speed table (PSI) for all usb 3.x ports.
> Memory was allocated for one PSI table under the xhci hub structure.
> 
> Turns out this is not the case, some controllers have a separate
> "supported protocol capability" entry with a PSI table for each port.
> This means each usb3 roothub port can in theory support different custom
> speeds.
> 
> To solve this, cache all supported protocol capabilities with their PSI
> tables in an array, and add pointers to the xhci port structure so that
> every port points to its capability entry in the array.
> 
> When creating the SuperSpeedPlus USB Device Capability BOS descriptor
> for the xhci USB 3.1 roothub we for now will use only data from the
> first USB 3.1 capable protocol capability entry in the array.
> This could be improved later, this patch focuses resolving
> the memory leak.
> 
> Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
> Reported-by: Sajja Venkateswara Rao <VenkateswaraRao.Sajja@amd.com>
> Fixes: 47189098f8be ("xhci: parse xhci protocol speed ID list for usb 3.1 usage")
> Cc: stable <stable@vger.kernel.org> # v4.4+
> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>


Since next-20200211, we have been observing a regression exiting suspend
on our Tegra124 Jetson TK1 board. Bisect is pointing to this commit and
reverting on top of -next fixes the problem.

On exiting suspend, I am seeing the following ...

[   56.216793] tegra-xusb 70090000.usb: Firmware already loaded, Falcon state 0x20
[   56.216834] usb usb3: root hub lost power or was reset
[   56.216837] usb usb4: root hub lost power or was reset
[   56.217760] tegra-xusb 70090000.usb: No ports on the roothubs?
[   56.218257] tegra-xusb 70090000.usb: failed to resume XHCI: -12
[   56.218299] PM: dpm_run_callback(): platform_pm_resume+0x0/0x40 returns -12
[   56.218312] PM: Device 70090000.usb failed to resume: error -12
[   56.334366] hub 4-0:1.0: hub_ext_port_status failed (err = -32)
[   56.334368] hub 3-0:1.0: hub_ext_port_status failed (err = -32)

Let me know if you have any thoughts on this.

Cheers
Jon

-- 
nvpublic

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [RFT PATCH v2] xhci: Fix memory leak when caching protocol extended capability PSI tables
  2020-02-13 13:33                             ` Jon Hunter
@ 2020-02-14  7:47                               ` Mathias Nyman
  2020-02-14  8:35                                 ` Jon Hunter
  0 siblings, 1 reply; 21+ messages in thread
From: Mathias Nyman @ 2020-02-14  7:47 UTC (permalink / raw)
  To: Jon Hunter, gregkh, m.szyprowski
  Cc: pmenzel, mika.westerberg, linux-usb, linux-kernel,
	linux-samsung-soc, krzk, stable, linux-tegra

On 13.2.2020 15.33, Jon Hunter wrote:
> 
> On 11/02/2020 15:01, Mathias Nyman wrote:
>> xhci driver assumed that xHC controllers have at most one custom
>> supported speed table (PSI) for all usb 3.x ports.
>> Memory was allocated for one PSI table under the xhci hub structure.
>>
>> Turns out this is not the case, some controllers have a separate
>> "supported protocol capability" entry with a PSI table for each port.
>> This means each usb3 roothub port can in theory support different custom
>> speeds.
>>
>> To solve this, cache all supported protocol capabilities with their PSI
>> tables in an array, and add pointers to the xhci port structure so that
>> every port points to its capability entry in the array.
>>
>> When creating the SuperSpeedPlus USB Device Capability BOS descriptor
>> for the xhci USB 3.1 roothub we for now will use only data from the
>> first USB 3.1 capable protocol capability entry in the array.
>> This could be improved later, this patch focuses resolving
>> the memory leak.
>>
>> Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
>> Reported-by: Sajja Venkateswara Rao <VenkateswaraRao.Sajja@amd.com>
>> Fixes: 47189098f8be ("xhci: parse xhci protocol speed ID list for usb 3.1 usage")
>> Cc: stable <stable@vger.kernel.org> # v4.4+
>> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
> 
> 
> Since next-20200211, we have been observing a regression exiting suspend
> on our Tegra124 Jetson TK1 board. Bisect is pointing to this commit and
> reverting on top of -next fixes the problem.
> 
> On exiting suspend, I am seeing the following ...
> 
> [   56.216793] tegra-xusb 70090000.usb: Firmware already loaded, Falcon state 0x20
> [   56.216834] usb usb3: root hub lost power or was reset
> [   56.216837] usb usb4: root hub lost power or was reset
> [   56.217760] tegra-xusb 70090000.usb: No ports on the roothubs?
> [   56.218257] tegra-xusb 70090000.usb: failed to resume XHCI: -12
> [   56.218299] PM: dpm_run_callback(): platform_pm_resume+0x0/0x40 returns -12
> [   56.218312] PM: Device 70090000.usb failed to resume: error -12
> [   56.334366] hub 4-0:1.0: hub_ext_port_status failed (err = -32)
> [   56.334368] hub 3-0:1.0: hub_ext_port_status failed (err = -32)
> 
> Let me know if you have any thoughts on this.
> 
> Cheers
> Jon

This was an issue with the first version, and should be fixed in the second.

next-20200211 has the faulty version, 
next-20200213 is fixed, reverted first version and applied second.

Does next-20200213 work for you?

-Mathias

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [RFT PATCH v2] xhci: Fix memory leak when caching protocol extended capability PSI tables
  2020-02-14  7:47                               ` Mathias Nyman
@ 2020-02-14  8:35                                 ` Jon Hunter
  0 siblings, 0 replies; 21+ messages in thread
From: Jon Hunter @ 2020-02-14  8:35 UTC (permalink / raw)
  To: Mathias Nyman, gregkh, m.szyprowski
  Cc: pmenzel, mika.westerberg, linux-usb, linux-kernel,
	linux-samsung-soc, krzk, stable, linux-tegra


On 14/02/2020 07:47, Mathias Nyman wrote:
> On 13.2.2020 15.33, Jon Hunter wrote:
>>
>> On 11/02/2020 15:01, Mathias Nyman wrote:
>>> xhci driver assumed that xHC controllers have at most one custom
>>> supported speed table (PSI) for all usb 3.x ports.
>>> Memory was allocated for one PSI table under the xhci hub structure.
>>>
>>> Turns out this is not the case, some controllers have a separate
>>> "supported protocol capability" entry with a PSI table for each port.
>>> This means each usb3 roothub port can in theory support different custom
>>> speeds.
>>>
>>> To solve this, cache all supported protocol capabilities with their PSI
>>> tables in an array, and add pointers to the xhci port structure so that
>>> every port points to its capability entry in the array.
>>>
>>> When creating the SuperSpeedPlus USB Device Capability BOS descriptor
>>> for the xhci USB 3.1 roothub we for now will use only data from the
>>> first USB 3.1 capable protocol capability entry in the array.
>>> This could be improved later, this patch focuses resolving
>>> the memory leak.
>>>
>>> Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
>>> Reported-by: Sajja Venkateswara Rao <VenkateswaraRao.Sajja@amd.com>
>>> Fixes: 47189098f8be ("xhci: parse xhci protocol speed ID list for usb 3.1 usage")
>>> Cc: stable <stable@vger.kernel.org> # v4.4+
>>> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
>>
>>
>> Since next-20200211, we have been observing a regression exiting suspend
>> on our Tegra124 Jetson TK1 board. Bisect is pointing to this commit and
>> reverting on top of -next fixes the problem.
>>
>> On exiting suspend, I am seeing the following ...
>>
>> [   56.216793] tegra-xusb 70090000.usb: Firmware already loaded, Falcon state 0x20
>> [   56.216834] usb usb3: root hub lost power or was reset
>> [   56.216837] usb usb4: root hub lost power or was reset
>> [   56.217760] tegra-xusb 70090000.usb: No ports on the roothubs?
>> [   56.218257] tegra-xusb 70090000.usb: failed to resume XHCI: -12
>> [   56.218299] PM: dpm_run_callback(): platform_pm_resume+0x0/0x40 returns -12
>> [   56.218312] PM: Device 70090000.usb failed to resume: error -12
>> [   56.334366] hub 4-0:1.0: hub_ext_port_status failed (err = -32)
>> [   56.334368] hub 3-0:1.0: hub_ext_port_status failed (err = -32)
>>
>> Let me know if you have any thoughts on this.
>>
>> Cheers
>> Jon
> 
> This was an issue with the first version, and should be fixed in the second.
> 
> next-20200211 has the faulty version, 
> next-20200213 is fixed, reverted first version and applied second.
> 
> Does next-20200213 work for you?

Yes it does. Sorry I am an idiot and should have read the changes and
thread more closely!

Thanks for fixing so quickly.

Jon

-- 
nvpublic

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2020-02-14  8:35 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <95b4bdb2-962f-561e-ac14-79cd44395915@molgen.mpg.de>
     [not found] ` <20180720095410.GA11904@kroah.com>
     [not found]   ` <107dbdd1-4e45-836f-7f8f-85bc63374e4f@molgen.mpg.de>
2020-01-02 14:10     ` BUG: KASAN: use-after-free in xhci_trb_virt_to_dma.part.24+0x1c/0x80 Paul Menzel
2020-01-03 11:04       ` Mika Westerberg
2020-01-07 12:09         ` Mathias Nyman
2020-01-07 15:35           ` Paul Menzel
2020-01-08  9:34             ` Mathias Nyman
2020-01-08 15:17               ` [RFT PATCH] xhci: Fix memory leak when caching protocol extended capability PSI tables Mathias Nyman
2020-01-08 15:40                 ` Greg KH
2020-01-08 15:56                   ` Mathias Nyman
     [not found]                 ` <CGME20200211105613eucas1p27cac4202c4287a5967b2ed988779d523@eucas1p2.samsung.com>
2020-02-11 10:56                   ` Marek Szyprowski
2020-02-11 12:23                     ` Greg KH
2020-02-11 12:29                       ` Mathias Nyman
2020-02-11 14:08                         ` Mathias Nyman
2020-02-11 15:01                           ` [RFT PATCH v2] " Mathias Nyman
2020-02-11 15:12                             ` Marek Szyprowski
2020-02-11 16:13                               ` Greg KH
2020-02-12  9:01                                 ` Mathias Nyman
2020-02-12 17:51                                   ` Greg KH
2020-02-13 13:33                             ` Jon Hunter
2020-02-14  7:47                               ` Mathias Nyman
2020-02-14  8:35                                 ` Jon Hunter
2020-01-09  8:53         ` BUG: KASAN: use-after-free in xhci_trb_virt_to_dma.part.24+0x1c/0x80 Felipe Balbi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).