Re: [EXTERNAL] [tip: x86/apic] x86/io_apic: Cleanup trigger/polarity helpers

From: Tom Lendacky
Date: Tue Nov 10 2020 - 17:00:38 EST


On 11/10/20 3:30 PM, David Woodhouse wrote:
>
>
> On 10 November 2020 21:01:17 GMT, Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
>> On Tue, Nov 10 2020 at 19:21, David Woodhouse wrote:
>>
>>> On 10 November 2020 18:56:17 GMT, Thomas Gleixner
>> <tglx@xxxxxxxxxxxxx> wrote:
>>>> On Tue, Nov 10 2020 at 18:50, Thomas Gleixner wrote:
>>>>> On Tue, Nov 10 2020 at 16:33, David Woodhouse wrote:
>>>>>> If I could get post-5.5 kernels to boot at all with the AMD IOMMU
>>>>>> enabled, I'd have a go at throwing that together now...
>>>>>
>>>>> It can share the dmar domain code. Let me frob something.
>>>>
>>>> Not much to share there and I can't access my AMD machine at the
>>>> moment. Something like the untested below should work.
>>>
>>> Does it even need its own irqdomain? Can it not just allocate
>> directly
>>> from the vector domain then program its own register directly based
>> on
>>> the irq_cfg?
>>
>> It uses pci_enable_msi() and I have no clue about that piece of
>> hardware
>> and whether that is actually required or not. If it is, then it needs a
>> domain because that's what pci_enable_msi() uses.
>
> I'd be kind of surprised if it is required, but testing on qemu is obviously not going to cut it. Tom?

Was just in the process of testing it... I still get a warning. Here's
the new backtrace:

[ 15.581115] WARNING: CPU: 6 PID: 1 at arch/x86/kernel/apic/apic.c:2527 __irq_msi_compose_msg+0x9f/0xb0
[ 15.581115] Modules linked in:
[ 15.581115] CPU: 6 PID: 1 Comm: swapper/0 Not tainted 5.10.0-rc3-sos-custom #1
[ 15.581115] Hardware name: AMD Corporation ETHANOL_X/ETHANOL_X, BIOS REX1006G 01/25/2020
[ 15.581115] RIP: 0010:__irq_msi_compose_msg+0x9f/0xb0
[ 15.581115] Code: 01 00 74 1e 3d ff 7f 00 00 77 1f 0f b7 16 c1 e8 08 83 e0 7f c1 e0 05 66 81 e2 1f f0 09 d0 66 89 06 c3 3d ff 00 00 00 77 01 c3 <0f> 0b c3 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 0f 1f 44 00 00
[ 15.581115] RSP: 0018:ffffc900000c7c18 EFLAGS: 00010012
[ 15.581115] RAX: 0000000000000100 RBX: 0000000000000000 RCX: 0000000000000000
[ 15.581115] RDX: 0000000000000000 RSI: ffffc900000c7c20 RDI: ffff8881088341c0
[ 15.581115] RBP: ffff8881599e0428 R08: 0000000000000000 R09: ffffffffffffffff
[ 15.581115] R10: 0000000000000003 R11: 0000000000000004 R12: ffff8881088341c0
[ 15.581115] R13: 0000000000000000 R14: 0000000000000004 R15: ffff888108834180
[ 15.581115] FS: 0000000000000000(0000) GS:ffff88900d380000(0000) knlGS:0000000000000000
[ 15.581115] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 15.581115] CR2: 0000000000000000 CR3: 000000015240a000 CR4: 0000000000350ee0
[ 15.581115] Call Trace:
[ 15.581115] irq_msi_update_msg+0x4d/0x80
[ 15.581115] msi_set_affinity+0x160/0x190
[ 15.581115] irq_do_set_affinity+0x52/0x190
[ 15.581115] irq_setup_affinity+0xd7/0x170
[ 15.581115] irq_startup+0x5d/0xf0
[ 15.581115] __setup_irq+0x6b9/0x700
[ 15.581115] request_threaded_irq+0xf8/0x160
[ 15.581115] ? irq_remapping_alloc+0x4d0/0x4d0
[ 15.581115] ? e820__memblock_setup+0x7d/0x7d
[ 15.581115] iommu_init_msi+0x60/0x190
[ 15.581115] state_next+0x39d/0x665
[ 15.581115] ? e820__memblock_setup+0x7d/0x7d
[ 15.581115] iommu_go_to_state+0x24/0x28
[ 15.581115] amd_iommu_init+0x11/0x46
[ 15.581115] pci_iommu_init+0x16/0x3f
[ 15.581115] do_one_initcall+0x44/0x1d0
[ 15.581115] kernel_init_freeable+0x1e7/0x249
[ 15.581115] ? rest_init+0xb4/0xb4
[ 15.581115] kernel_init+0xa/0x10c
[ 15.581115] ret_from_fork+0x22/0x30
[ 15.581115] CPU: 6 PID: 1 Comm: swapper/0 Not tainted 5.10.0-rc3-sos-custom #1
[ 15.581115] Hardware name: AMD Corporation ETHANOL_X/ETHANOL_X, BIOS REX1006G 01/25/2020
[ 15.581115] Call Trace:
[ 15.581115] dump_stack+0x6d/0x88
[ 15.581115] __warn.cold+0x24/0x3d
[ 15.581115] ? __irq_msi_compose_msg+0x9f/0xb0
[ 15.581115] report_bug+0xd1/0x100
[ 15.581115] handle_bug+0x35/0x80
[ 15.581115] exc_invalid_op+0x14/0x70
[ 15.581115] asm_exc_invalid_op+0x12/0x20
[ 15.581115] RIP: 0010:__irq_msi_compose_msg+0x9f/0xb0
[ 15.581115] Code: 01 00 74 1e 3d ff 7f 00 00 77 1f 0f b7 16 c1 e8 08 83 e0 7f c1 e0 05 66 81 e2 1f f0 09 d0 66 89 06 c3 3d ff 00 00 00 77 01 c3 <0f> 0b c3 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 0f 1f 44 00 00
[ 15.581115] RSP: 0018:ffffc900000c7c18 EFLAGS: 00010012
[ 15.581115] RAX: 0000000000000100 RBX: 0000000000000000 RCX: 0000000000000000
[ 15.581115] RDX: 0000000000000000 RSI: ffffc900000c7c20 RDI: ffff8881088341c0
[ 15.581115] RBP: ffff8881599e0428 R08: 0000000000000000 R09: ffffffffffffffff
[ 15.581115] R10: 0000000000000003 R11: 0000000000000004 R12: ffff8881088341c0
[ 15.581115] R13: 0000000000000000 R14: 0000000000000004 R15: ffff888108834180
[ 15.581115] irq_msi_update_msg+0x4d/0x80
[ 15.581115] msi_set_affinity+0x160/0x190
[ 15.581115] irq_do_set_affinity+0x52/0x190
[ 15.581115] irq_setup_affinity+0xd7/0x170
[ 15.581115] irq_startup+0x5d/0xf0
[ 15.581115] __setup_irq+0x6b9/0x700
[ 15.581115] request_threaded_irq+0xf8/0x160
[ 15.581115] ? irq_remapping_alloc+0x4d0/0x4d0
[ 15.581115] ? e820__memblock_setup+0x7d/0x7d
[ 15.581115] iommu_init_msi+0x60/0x190
[ 15.581115] state_next+0x39d/0x665
[ 15.581115] ? e820__memblock_setup+0x7d/0x7d
[ 15.581115] iommu_go_to_state+0x24/0x28
[ 15.581115] amd_iommu_init+0x11/0x46
[ 15.581115] pci_iommu_init+0x16/0x3f
[ 15.581115] do_one_initcall+0x44/0x1d0
[ 15.581115] kernel_init_freeable+0x1e7/0x249
[ 15.581115] ? rest_init+0xb4/0xb4
[ 15.581115] kernel_init+0xa/0x10c
[ 15.581115] ret_from_fork+0x22/0x30
[ 15.581115] ---[ end trace 05c9465e30ba6a20 ]---


Thanks,
Tom

>