dump vcpu registers on correct vcpu

after updated cpu context get/set method, the vcpu_dumreg cmd is not
correct anymore as the registers may read from VMCS but meantime hv
shell may not be running on target vcpu.

this patch take use of smp_call_function for vcpu dumpreg and make the
dump always come from correct vcpu.

v2:
- use str pointer to get vcpu_dumpreg context instead of print out directly
  in notify handler.

Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Jason Chen CJ
2018-08-08 11:43:06 +08:00
committed by lijinxia
parent 4b03c97a5e
commit f8f49d410f
3 changed files with 115 additions and 82 deletions

View File

@@ -248,6 +248,12 @@ struct vcpu {
uint64_t reg_updated;
};
struct vcpu_dump {
struct vcpu *vcpu;
char *str;
int str_max;
};
#define is_vcpu_bsp(vcpu) ((vcpu)->vcpu_id == BOOT_CPU_ID)
/* do not update Guest RIP for next VM Enter */
static inline void vcpu_retain_rip(struct vcpu *vcpu)
@@ -289,6 +295,7 @@ int prepare_vcpu(struct vm *vm, uint16_t pcpu_id);
void request_vcpu_pre_work(struct vcpu *vcpu, uint16_t pre_work_id);
void vcpu_dumpreg(void *data);
#endif
#endif