Message ID | 20211109023906.1091208-1-ricarkol@google.com (mailing list archive) |
---|---|
Headers | show |
Series | KVM: selftests: aarch64: Test userspace IRQ injection | expand |
On Mon, Nov 08, 2021 at 06:38:49PM -0800, Ricardo Koller wrote: > This series adds a new test, aarch64/vgic-irq, that validates the injection of > different types of IRQs from userspace using various methods and configurations > (when applicable): > > Intid Method | | Configuration > | | > IRQ_LINE | | > SGI LEVEL_INFO | | > PPI x IRQFD | x | level-sensitive x EOIR + DIR > SPI ISPENDR | | edge-triggered EOIR only > bogus ISACTIVER | | > | | > > vgic-irq is implemented by having a single vcpu started in any of the 4 (2x2) > configurations above. The guest then "asks" userspace to inject all intids of > a given IRQ type using each applicable method via a GUEST_SYNC call. The > applicable methods and intids for a given configuration are specified in tables > like this one: > > /* edge-triggered */ > static struct kvm_inject_desc inject_edge_fns[] = { > /* sgi ppi spi */ > { KVM_IRQ_LINE, false, false, true }, > { IRQFD, false, false, true }, > { ISPENDR, true, false, true }, > }; > > Based on the (example) table above, a guest running in an edge-triggered > configuration will try injecting SGIs and SPIs. The specific methods are also > given in the table, e.g.: SGIs are injected from userspace by writing into the > ISPENDR register. > > This test also adds some extra edge tests like: IRQ preemption, restoring > active IRQs, trying to inject bogus intid's (e.g., above the configured KVM > nr_irqs). > > Note that vgic-irq is currently limited to a single vcpu, GICv3, and does not > test the vITS (no MSIs). > > - Commits 1-3 add some GICv3 library functions on the guest side, e.g.: set the > priority of an IRQ. > - Commits 4-5 add some vGICv3 library functions on the userspace side, e.g.: a > wrapper for KVM_IRQ_LINE. > - Commit 6 adds the basic version of this test: inject an SPI using > KVM_IRQ_LINE. > - Commits 7-17 add other IRQs types, methods and configurations. > Hi Ricardo, I didn't review this in detail, but it looks good and quite thorough. Out of curiosity did thoroughness come from attempting to get coverage on KVM code? I.e were you running some sort of code coverage tool on KVM with these tests? Unfortunately I probably won't have a chance to look much closer than the scan I just did, so FWIW For the series Acked-by: Andrew Jones <drjones@redhat.com> Thanks, drew
On Tue, Nov 23, 2021 at 03:25:24PM +0100, Andrew Jones wrote: > On Mon, Nov 08, 2021 at 06:38:49PM -0800, Ricardo Koller wrote: > > This series adds a new test, aarch64/vgic-irq, that validates the injection of > > different types of IRQs from userspace using various methods and configurations > > (when applicable): > > > > Intid Method | | Configuration > > | | > > IRQ_LINE | | > > SGI LEVEL_INFO | | > > PPI x IRQFD | x | level-sensitive x EOIR + DIR > > SPI ISPENDR | | edge-triggered EOIR only > > bogus ISACTIVER | | > > | | > > > > vgic-irq is implemented by having a single vcpu started in any of the 4 (2x2) > > configurations above. The guest then "asks" userspace to inject all intids of > > a given IRQ type using each applicable method via a GUEST_SYNC call. The > > applicable methods and intids for a given configuration are specified in tables > > like this one: > > > > /* edge-triggered */ > > static struct kvm_inject_desc inject_edge_fns[] = { > > /* sgi ppi spi */ > > { KVM_IRQ_LINE, false, false, true }, > > { IRQFD, false, false, true }, > > { ISPENDR, true, false, true }, > > }; > > > > Based on the (example) table above, a guest running in an edge-triggered > > configuration will try injecting SGIs and SPIs. The specific methods are also > > given in the table, e.g.: SGIs are injected from userspace by writing into the > > ISPENDR register. > > > > This test also adds some extra edge tests like: IRQ preemption, restoring > > active IRQs, trying to inject bogus intid's (e.g., above the configured KVM > > nr_irqs). > > > > Note that vgic-irq is currently limited to a single vcpu, GICv3, and does not > > test the vITS (no MSIs). > > > > - Commits 1-3 add some GICv3 library functions on the guest side, e.g.: set the > > priority of an IRQ. > > - Commits 4-5 add some vGICv3 library functions on the userspace side, e.g.: a > > wrapper for KVM_IRQ_LINE. > > - Commit 6 adds the basic version of this test: inject an SPI using > > KVM_IRQ_LINE. > > - Commits 7-17 add other IRQs types, methods and configurations. > > > > Hi Ricardo, > > I didn't review this in detail, but it looks good and quite thorough. Thanks Andrew! > Out > of curiosity did thoroughness come from attempting to get coverage on KVM > code? Yes, that was the main reason. Although, keep in mind that there are a lot of features not covered, like routing and the ITS. > I.e were you running some sort of code coverage tool on KVM with > these tests? No, not really. It would be nice to know how much coverage (and distribution) we are getting from all tests (selftests and KUT) at the moment and maybe use that to decide on future tests. > > Unfortunately I probably won't have a chance to look much closer than the > scan I just did, so FWIW > > For the series > > Acked-by: Andrew Jones <drjones@redhat.com> > > Thanks, > drew > Thanks, Ricardo
On Mon, 8 Nov 2021 18:38:49 -0800, Ricardo Koller wrote: > This series adds a new test, aarch64/vgic-irq, that validates the injection of > different types of IRQs from userspace using various methods and configurations > (when applicable): > > Intid Method | | Configuration > | | > IRQ_LINE | | > SGI LEVEL_INFO | | > PPI x IRQFD | x | level-sensitive x EOIR + DIR > SPI ISPENDR | | edge-triggered EOIR only > bogus ISACTIVER | | > | | > > [...] Applied to next, thanks! [01/17] KVM: selftests: aarch64: move gic_v3.h to shared headers commit: 33a1ca736e74839d08948973d30f6def820b8b14 [02/17] KVM: selftests: aarch64: add function for accessing GICv3 dist and redist registers commit: 745068367ccbf33d69cf4acf7b1a3d5478978e8e [03/17] KVM: selftests: aarch64: add GICv3 register accessor library functions commit: 17ce617bf76a7c1d3b553ed01607706434b9ed59 [04/17] KVM: selftests: add kvm_irq_line library function commit: 227895ed6d03b46fa619614a41a3b8e1074d6151 [05/17] KVM: selftests: aarch64: add vGIC library functions to deal with vIRQ state commit: e95def3a904dea467309bbe382a9032d301ba9cd [06/17] KVM: selftests: aarch64: add vgic_irq to test userspace IRQ injection commit: 50b020cdb7f72077e16133f1d88c9359cf415a53 [07/17] KVM: selftests: aarch64: abstract the injection functions in vgic_irq commit: e1cb399eed1eda29568b17bdb75d16cee1fc3da4 [08/17] KVM: selftests: aarch64: cmdline arg to set number of IRQs in vgic_irq test commit: e5410ee2806d74a749fa39ca6fdb73be2f88611f [09/17] KVM: selftests: aarch64: cmdline arg to set EOI mode in vgic_irq commit: 8a35b2877d9a15fa885cea744f1e578e035856fe [10/17] KVM: selftests: aarch64: add preemption tests in vgic_irq commit: 0ad3ff4a6adc4922808ef8b2f91880c25195f509 [11/17] KVM: selftests: aarch64: level-sensitive interrupts tests in vgic_irq commit: 92f2cc4aa7964d4d13681eeb38582bb989b01b98 [12/17] KVM: selftests: aarch64: add tests for LEVEL_INFO in vgic_irq commit: 6830fa915912587a7aa304bade01b366cf0b9214 [13/17] KVM: selftests: aarch64: add test_inject_fail to vgic_irq commit: 90f50acac9ee9f81192098c22b2cbf2491a40263 [14/17] KVM: selftests: add IRQ GSI routing library functions commit: 88209c104e9b3e95502c0e924fb1cd8bd5a01d82 [15/17] KVM: selftests: aarch64: add tests for IRQFD in vgic_irq commit: 6a5a47188caca7be4bbe28cdb31d5df09868ed5c [16/17] KVM: selftests: aarch64: add ISPENDR write tests in vgic_irq commit: bebd8f3f869361e0249efe423ba76a0d991ce3e6 [17/17] KVM: selftests: aarch64: add test for restoring active IRQs commit: 728fcc46d2c2292d1ac73f3491b8f4332066fdad Cheers, M.