hv: remove the theoretic infinite loop

There may the theoretic infinite loop with some code. But actually it doesn't.
This patch make these code more obvious it's not a potentially infinite loop.

Tracked-On: #861
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
This commit is contained in:
Li, Fei1
2018-11-30 16:31:16 +08:00
committed by wenlingz
parent 5d19962d73
commit 7a62154e36
6 changed files with 32 additions and 33 deletions

View File

@@ -1669,9 +1669,9 @@ static bool segment_override(uint8_t x, enum cpu_reg_name *seg)
static int decode_prefixes(struct instr_emul_vie *vie,
enum vm_cpu_mode cpu_mode, bool cs_d)
{
uint8_t x;
uint8_t x, i;
while (1) {
for (i = 0U; i < VIE_PREFIX_SIZE; i++) {
if (vie_peek(vie, &x) != 0) {
return -1;
}

View File

@@ -87,7 +87,8 @@ struct instr_emul_vie_op {
uint16_t op_flags;
};
#define VIE_INST_SIZE 15U
#define VIE_PREFIX_SIZE 4U
#define VIE_INST_SIZE 15U
struct instr_emul_vie {
uint8_t inst[VIE_INST_SIZE]; /* instruction bytes */
uint8_t num_valid; /* size of the instruction */

View File

@@ -35,8 +35,7 @@ void smp_call_function(uint64_t mask, smp_call_func_t func, void *data)
struct smp_call_info_data *smp_call;
/* wait for previous smp call complete, which may run on other cpus */
while (atomic_cmpxchg64(&smp_call_mask, 0UL, mask & INVALID_BIT_INDEX)
!= 0UL);
while (atomic_cmpxchg64(&smp_call_mask, 0UL, mask & INVALID_BIT_INDEX) != 0UL);
pcpu_id = ffs64(mask);
while (pcpu_id != INVALID_BIT_INDEX) {
bitmap_clear_nolock(pcpu_id, &mask);

View File

@@ -99,7 +99,7 @@ void do_acpi_s3(struct acrn_vm *vm, uint32_t pm1a_cnt_val,
acpi_gas_write(&(sx_data->pm1b_cnt), pm1b_cnt_val);
}
while (1) {
do {
/* polling PM1 state register to detect wether
* the Sx state enter is interrupted by wakeup event.
*/
@@ -117,10 +117,7 @@ void do_acpi_s3(struct acrn_vm *vm, uint32_t pm1a_cnt_val,
* WAK_STS(bit 15) is set if system will transition to working
* state.
*/
if ((s1 & (1U << BIT_WAK_STS)) != 0U) {
break;
}
}
} while ((s1 & (1U << BIT_WAK_STS)) == 0U);
}
void enter_s3(struct acrn_vm *vm, uint32_t pm1a_cnt_val, uint32_t pm1b_cnt_val)