Commit 63d28a2
committed
KVM: x86/mmu: simplify kvm_tdp_mmu_map flow when guest has to retry
A removed SPTE is never present, hence the "if" in kvm_tdp_mmu_map
only fails in the exact same conditions that the earlier loop
tested in order to issue a "break". So, instead of checking twice the
condition (upper level SPTEs could not be created or was frozen), just
exit the loop with a goto---the usual poor-man C replacement for RAII
early returns.
While at it, do not use the "ret" variable for return values of
functions that do not return a RET_PF_* enum. This is clearer
and also makes it possible to initialize ret to RET_PF_RETRY.
Suggested-by: Robert Hoo <robert.hu@linux.intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>1 parent c4b33d2 commit 63d28a2
1 file changed
+19
-21
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1159 | 1159 | | |
1160 | 1160 | | |
1161 | 1161 | | |
1162 | | - | |
| 1162 | + | |
1163 | 1163 | | |
1164 | 1164 | | |
1165 | 1165 | | |
| |||
1168 | 1168 | | |
1169 | 1169 | | |
1170 | 1170 | | |
| 1171 | + | |
| 1172 | + | |
1171 | 1173 | | |
1172 | 1174 | | |
1173 | 1175 | | |
1174 | 1176 | | |
1175 | 1177 | | |
1176 | 1178 | | |
1177 | | - | |
1178 | | - | |
1179 | | - | |
1180 | | - | |
1181 | | - | |
1182 | 1179 | | |
1183 | 1180 | | |
1184 | 1181 | | |
1185 | 1182 | | |
1186 | 1183 | | |
1187 | | - | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
1188 | 1190 | | |
1189 | 1191 | | |
1190 | 1192 | | |
| |||
1196 | 1198 | | |
1197 | 1199 | | |
1198 | 1200 | | |
1199 | | - | |
| 1201 | + | |
1200 | 1202 | | |
1201 | | - | |
| 1203 | + | |
1202 | 1204 | | |
1203 | | - | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
1204 | 1210 | | |
1205 | | - | |
| 1211 | + | |
1206 | 1212 | | |
1207 | 1213 | | |
1208 | 1214 | | |
| |||
1213 | 1219 | | |
1214 | 1220 | | |
1215 | 1221 | | |
1216 | | - | |
1217 | | - | |
1218 | | - | |
1219 | | - | |
1220 | | - | |
1221 | | - | |
1222 | | - | |
1223 | | - | |
1224 | | - | |
1225 | 1222 | | |
1226 | | - | |
1227 | 1223 | | |
| 1224 | + | |
| 1225 | + | |
1228 | 1226 | | |
1229 | 1227 | | |
1230 | 1228 | | |
| |||
0 commit comments