Commit a78d904
committed
KVM: x86: Move "KVM no-APIC vCPU" key management into local APIC code
Move incrementing and decrementing of kvm_has_noapic_vcpu into
kvm_create_lapic() and kvm_free_lapic() respectively to fix a benign bug
where KVM fails to decrement the count if vCPU creation ultimately fails,
e.g. due to a memory allocation failing.
Note, the bug is benign as kvm_has_noapic_vcpu is used purely to optimize
lapic_in_kernel() checks, and that optimization is quite dubious. That,
and practically speaking no setup that cares at all about performance runs
with a userspace local APIC.
Reported-by: Li RongQing <lirongqing@baidu.com>
Cc: Maxim Levitsky <mlevitsk@redhat.com>
Reviewed-by: Xu Yilun <yilun.xu@linux.intel.com>
Link: https://lore.kernel.org/r/20240209222047.394389-2-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>1 parent 0ec3d6d commit a78d904
2 files changed
Lines changed: 29 additions & 27 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
127 | 130 | | |
128 | 131 | | |
129 | 132 | | |
| |||
2466 | 2469 | | |
2467 | 2470 | | |
2468 | 2471 | | |
2469 | | - | |
| 2472 | + | |
| 2473 | + | |
2470 | 2474 | | |
| 2475 | + | |
2471 | 2476 | | |
2472 | 2477 | | |
2473 | 2478 | | |
| |||
2809 | 2814 | | |
2810 | 2815 | | |
2811 | 2816 | | |
| 2817 | + | |
| 2818 | + | |
| 2819 | + | |
| 2820 | + | |
| 2821 | + | |
2812 | 2822 | | |
2813 | 2823 | | |
2814 | 2824 | | |
| |||
2844 | 2854 | | |
2845 | 2855 | | |
2846 | 2856 | | |
| 2857 | + | |
| 2858 | + | |
| 2859 | + | |
| 2860 | + | |
| 2861 | + | |
| 2862 | + | |
| 2863 | + | |
| 2864 | + | |
| 2865 | + | |
| 2866 | + | |
| 2867 | + | |
| 2868 | + | |
| 2869 | + | |
| 2870 | + | |
| 2871 | + | |
2847 | 2872 | | |
2848 | 2873 | | |
2849 | 2874 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12046 | 12046 | | |
12047 | 12047 | | |
12048 | 12048 | | |
12049 | | - | |
12050 | | - | |
12051 | | - | |
12052 | | - | |
12053 | | - | |
12054 | | - | |
12055 | | - | |
12056 | | - | |
12057 | | - | |
12058 | | - | |
12059 | | - | |
12060 | | - | |
12061 | | - | |
12062 | | - | |
12063 | | - | |
12064 | | - | |
12065 | | - | |
12066 | | - | |
12067 | | - | |
12068 | | - | |
12069 | | - | |
| 12049 | + | |
| 12050 | + | |
| 12051 | + | |
12070 | 12052 | | |
12071 | 12053 | | |
12072 | 12054 | | |
| |||
12187 | 12169 | | |
12188 | 12170 | | |
12189 | 12171 | | |
12190 | | - | |
12191 | | - | |
12192 | 12172 | | |
12193 | 12173 | | |
12194 | 12174 | | |
| |||
12465 | 12445 | | |
12466 | 12446 | | |
12467 | 12447 | | |
12468 | | - | |
12469 | | - | |
12470 | | - | |
12471 | 12448 | | |
12472 | 12449 | | |
12473 | 12450 | | |
| |||
0 commit comments