x86/hvm: Introduce *save_one() functions
PATCH v4 1/2 x86/hvm: Introduce *save_one() functions
This patch introduces save_one() functions. They will be called in the *save() so we can extract data for a single instance.
---
Changes since V3:
- Rb to the lateste staging version
- Split the patch into 2 patches.
--- xen/arch/x86/cpu/mcheck/vmce.c | 16 ++- xen/arch/x86/hvm/hvm.c | 279 ++++++++++++++++++++++------------------- xen/arch/x86/hvm/mtrr.c | 51 ++++---- xen/arch/x86/hvm/viridian.c | 13 +- 4 files changed, 200 insertions(+), 159 deletions(-)
xen/arch/x86/cpu/mcheck/vmce.c +10 -6
@@ -349,6 +349,14 @@ int vmce_wrmsr(uint32_t msr, uint64_t val)return ret; } +void vmce_save_vcpu_ctxt_one (struct vcpu *v,struct hvm_vmce_vcpu *ctxt) +{ + ctxt->caps = v->arch.vmce.mcg_cap; + ctxt->mci_ctl2_bank0 = v->arch.vmce.bank[0 ].mci_ctl2; + ctxt->mci_ctl2_bank1 = v->arch.vmce.bank[1 ].mci_ctl2; + ctxt->mcg_ext_ctl = v->arch.vmce.mcg_ext_ctl; +} +static int vmce_save_vcpu_ctxt (struct domain *d,hvm_domain_context_t *h) {struct vcpu *v;
@@ -356,13 +364,9 @@ static int vmce_save_vcpu_ctxt(struct domain *d, hvm_domain_context_t *h) for_each_vcpu ( d, v ) { -struct hvm_vmce_vcpu ctxt = { - .caps = v->arch.vmce.mcg_cap, - .mci_ctl2_bank0 = v->arch.vmce.bank[0 ].mci_ctl2, - .mci_ctl2_bank1 = v->arch.vmce.bank[1 ].mci_ctl2, - .mcg_ext_ctl = v->arch.vmce.mcg_ext_ctl, - }; +struct hvm_vmce_vcpu ctxt; +vmce_save_vcpu_ctxt_one (v, &ctxt); err =hvm_save_entry (VMCE_VCPU , v->vcpu_id, h, &ctxt);if ( err )break ;
xen/arch/x86/hvm/hvm.c +153 -126
331 lines not on this page · raw message
xen/arch/x86/hvm/mtrr.c +28 -23
64 lines not on this page · raw message
xen/arch/x86/hvm/viridian.c +9 -4
@@ -1028,6 +1028,12 @@ static int viridian_load_domain_ctxt(struct domain *d, hvm_domain_context_t *h)HVM_REGISTER_SAVE_RESTORE (VIRIDIAN_DOMAIN , viridian_save_domain_ctxt, viridian_load_domain_ctxt,1 ,HVMSR_PER_DOM ); +void viridian_save_vcpu_ctxt_one (struct vcpu *v,struct hvm_viridian_vcpu_context *ctxt) +{ + ctxt->vp_assist_msr = v->arch.hvm_vcpu.viridian.vp_assist.msr.raw; + ctxt->vp_assist_pending = v->arch.hvm_vcpu.viridian.vp_assist.pending; +} +static int viridian_save_vcpu_ctxt (struct domain *d,hvm_domain_context_t *h) {struct vcpu *v;
@@ -1036,10 +1042,9 @@ static int viridian_save_vcpu_ctxt(struct domain *d, hvm_domain_context_t *h)return 0 ;for_each_vcpu ( d, v ) { -struct hvm_viridian_vcpu_context ctxt = { - .vp_assist_msr = v->arch.hvm_vcpu.viridian.vp_assist.msr.raw, - .vp_assist_pending = v->arch.hvm_vcpu.viridian.vp_assist.pending, - }; +struct hvm_viridian_vcpu_context ctxt; + +viridian_save_vcpu_ctxt_one (v, &ctxt);if (hvm_save_entry (VIRIDIAN_VCPU , v->vcpu_id, h, &ctxt) !=0 )return 1 ;
Signature · 7 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v4 2/2 x86/domctl: Don't pause the whole domain if only getting vcpu state
This patch adds a vcpu param for all the *save() fucntions. The *save() functions now handle only one instance. The for_each loop is transferred to the caller.
---
Changes since V3:
- Rb to the lateste staging version
- Moved the for_each() loop to the caller.
NOTE: tested with xen/tools/misc/xen-hvmctx
--- tools/tests/vhpet/emul.h | 3 +- tools/tests/vhpet/main.c | 8 ++- xen/arch/x86/cpu/mcheck/vmce.c | 16 ++---- xen/arch/x86/hvm/hpet.c | 3 +- xen/arch/x86/hvm/hvm.c | 122 +++++++++++++++++++---------------------- xen/arch/x86/hvm/i8254.c | 3 +- xen/arch/x86/hvm/irq.c | 9 ++- xen/arch/x86/hvm/mtrr.c | 14 ++--- xen/arch/x86/hvm/pmtimer.c | 3 +- xen/arch/x86/hvm/rtc.c | 3 +- xen/arch/x86/hvm/save.c | 115 ++++++++++++++++++++++++++++---------- xen/arch/x86/hvm/vioapic.c | 3 +- xen/arch/x86/hvm/viridian.c | 18 +++--- xen/arch/x86/hvm/vlapic.c | 28 ++++------ xen/arch/x86/hvm/vpic.c | 3 +- xen/include/asm-x86/hvm/save.h | 3 +- 16 files changed, 199 insertions(+), 155 deletions(-)
tools/tests/vhpet/emul.h +2 -1
@@ -296,7 +296,8 @@ struct hvm_hw_hpet };typedef int (*hvm_save_handler )(struct domain *d, -hvm_domain_context_t *h); +hvm_domain_context_t *h, +struct vcpu *vcpu);typedef int (*hvm_load_handler )(struct domain *d,hvm_domain_context_t *h);
tools/tests/vhpet/main.c +7 -1
@@ -177,7 +177,13 @@ void __init hvm_register_savevm(uint16_t typecode,int do_save (uint16_t typecode,struct domain *d,hvm_domain_context_t *h) { -return hvm_sr_handlers[typecode].save (d, h); +struct vcpu *v; + + for_each_vcpu ( d, v ) + { + hvm_sr_handlers[typecode].save (d, h, v); + } +return 0 ; }int do_load (uint16_t typecode,struct domain *d,hvm_domain_context_t *h)
xen/arch/x86/cpu/mcheck/vmce.c +5 -11
@@ -357,20 +357,14 @@ void vmce_save_vcpu_ctxt_one(struct vcpu *v, struct hvm_vmce_vcpu *ctxt) ctxt->mcg_ext_ctl = v->arch.vmce.mcg_ext_ctl; } -static int vmce_save_vcpu_ctxt (struct domain *d,hvm_domain_context_t *h) +static int vmce_save_vcpu_ctxt (struct domain *d,hvm_domain_context_t *h, +struct vcpu *v) { -struct vcpu *v;int err =0 ; +struct hvm_vmce_vcpu ctxt; - for_each_vcpu ( d, v ) - { -struct hvm_vmce_vcpu ctxt; - -vmce_save_vcpu_ctxt_one (v, &ctxt); - err =hvm_save_entry (VMCE_VCPU , v->vcpu_id, h, &ctxt); -if ( err ) -break ; - } +vmce_save_vcpu_ctxt_one (v, &ctxt); + err =hvm_save_entry (VMCE_VCPU , v->vcpu_id, h, &ctxt);return err; }
xen/arch/x86/hvm/hpet.c +2 -1
@@ -509,7 +509,8 @@ static const struct hvm_mmio_ops hpet_mmio_ops = { }; -static int hpet_save (struct domain *d,hvm_domain_context_t *h) +static int hpet_save (struct domain *d,hvm_domain_context_t *h, +struct vcpu *vcpu) {HPETState *hp =domain_vhpet (d);struct vcpu *v =pt_global_vcpu_target (d);
xen/arch/x86/hvm/hvm.c +56 -66
178 lines not on this page · raw message
xen/arch/x86/hvm/i8254.c +2 -1
@@ -390,7 +390,8 @@ void pit_stop_channel0_irq(PITState *pit)spin_unlock (&pit->lock); } -static int pit_save (struct domain *d,hvm_domain_context_t *h) +static int pit_save (struct domain *d,hvm_domain_context_t *h, +struct vcpu *v) {PITState *pit =domain_vpit (d);int rc;
xen/arch/x86/hvm/irq.c +6 -3
@@ -610,7 +610,8 @@ static int __init dump_irq_info_key_init(void) }__initcall (dump_irq_info_key_init); -static int irq_save_pci (struct domain *d,hvm_domain_context_t *h) +static int irq_save_pci (struct domain *d,hvm_domain_context_t *h, +struct vcpu *v) {struct hvm_irq *hvm_irq =hvm_domain_irq (d);unsigned int asserted, pdev, pintx;
@@ -642,7 +643,8 @@ static int irq_save_pci(struct domain *d, hvm_domain_context_t *h)return rc; } -static int irq_save_isa (struct domain *d,hvm_domain_context_t *h) +static int irq_save_isa (struct domain *d,hvm_domain_context_t *h, +struct vcpu *v) {struct hvm_irq *hvm_irq =hvm_domain_irq (d);
@@ -650,7 +652,8 @@ static int irq_save_isa(struct domain *d, hvm_domain_context_t *h)return (hvm_save_entry (ISA_IRQ ,0 , h, &hvm_irq->isa_irq) ); } -static int irq_save_link (struct domain *d,hvm_domain_context_t *h) +static int irq_save_link (struct domain *d,hvm_domain_context_t *h, +struct vcpu *v) {struct hvm_irq *hvm_irq =hvm_domain_irq (d);
xen/arch/x86/hvm/mtrr.c +6 -8
@@ -693,18 +693,16 @@ void hvm_save_mtrr_msr_one(struct vcpu *v, struct hvm_hw_mtrr *hw_mtrr) } -static int hvm_save_mtrr_msr (struct domain *d,hvm_domain_context_t *h) +static int hvm_save_mtrr_msr (struct domain *d,hvm_domain_context_t *h, +struct vcpu *v) { -struct vcpu *v;struct hvm_hw_mtrr hw_mtrr;/* save mtrr&pat */ -for_each_vcpu (d, v) - { -hvm_save_mtrr_msr_one (v, &hw_mtrr); +hvm_save_mtrr_msr_one (v, &hw_mtrr); + +if (hvm_save_entry (MTRR , v->vcpu_id, h, &hw_mtrr) !=0 ) +return 1 ; -if (hvm_save_entry (MTRR , v->vcpu_id, h, &hw_mtrr) !=0 ) -return 1 ; - }return 0 ; }
xen/arch/x86/hvm/pmtimer.c +2 -1
@@ -249,7 +249,8 @@ static int handle_pmt_io(return X86EMUL_OKAY ; } -static int acpi_save (struct domain *d,hvm_domain_context_t *h) +static int acpi_save (struct domain *d,hvm_domain_context_t *h, +struct vcpu *v) {struct hvm_hw_acpi *acpi = &d->arch.hvm_domain.acpi;PMTState *s = &d->arch.hvm_domain.pl_time->vpmt;
xen/arch/x86/hvm/rtc.c +2 -1
@@ -737,7 +737,8 @@ void rtc_migrate_timers(struct vcpu *v) }/* Save RTC hardware state */ -static int rtc_save (struct domain *d,hvm_domain_context_t *h) +static int rtc_save (struct domain *d,hvm_domain_context_t *h, +struct vcpu *v) {RTCState *s =domain_vrtc (d);int rc;
xen/arch/x86/hvm/save.c +85 -30
158 lines not on this page · raw message
xen/arch/x86/hvm/vioapic.c +2 -1
@@ -569,7 +569,8 @@ int vioapic_get_trigger_mode(const struct domain *d, unsigned int gsi)return vioapic->redirtbl[pin].fields.trig_mode; } -static int ioapic_save (struct domain *d,hvm_domain_context_t *h) +static int ioapic_save (struct domain *d,hvm_domain_context_t *h, +struct vcpu *v) {struct hvm_vioapic *s;
xen/arch/x86/hvm/viridian.c +8 -10
@@ -992,7 +992,8 @@ out:return HVM_HCALL_completed; } -static int viridian_save_domain_ctxt (struct domain *d,hvm_domain_context_t *h) +static int viridian_save_domain_ctxt (struct domain *d,hvm_domain_context_t *h, +struct vcpu *v) {struct hvm_viridian_domain_context ctxt = { .time_ref_count = d->arch.hvm_domain.viridian.time_ref_count.val,
@@ -1034,21 +1035,18 @@ void viridian_save_vcpu_ctxt_one(struct vcpu *v, struct hvm_viridian_vcpu_contex ctxt->vp_assist_pending = v->arch.hvm_vcpu.viridian.vp_assist.pending; } -static int viridian_save_vcpu_ctxt (struct domain *d,hvm_domain_context_t *h) +static int viridian_save_vcpu_ctxt (struct domain *d,hvm_domain_context_t *h, +struct vcpu *v) { -struct vcpu *v; +struct hvm_viridian_vcpu_context ctxt;if ( !is_viridian_domain (d) )return 0 ; -for_each_vcpu ( d, v ) { -struct hvm_viridian_vcpu_context ctxt; +viridian_save_vcpu_ctxt_one (v, &ctxt); -viridian_save_vcpu_ctxt_one (v, &ctxt); - -if (hvm_save_entry (VIRIDIAN_VCPU , v->vcpu_id, h, &ctxt) !=0 ) -return 1 ; - } +if (hvm_save_entry (VIRIDIAN_VCPU , v->vcpu_id, h, &ctxt) !=0 ) +return 1 ;return 0 ; }
xen/arch/x86/hvm/vlapic.c +10 -18
@@ -1435,43 +1435,35 @@ static void lapic_rearm(struct vlapic *s) s->timer_last_update = s->pt.last_plt_gtime; } -static int lapic_save_hidden (struct domain *d,hvm_domain_context_t *h) +static int lapic_save_hidden (struct domain *d,hvm_domain_context_t *h, +struct vcpu *v) { -struct vcpu *v;struct vlapic *s;int rc =0 ;if ( !has_vlapic (d) )return 0 ; - for_each_vcpu ( d, v ) - { - s =vcpu_vlapic (v); -if ( (rc =hvm_save_entry (LAPIC , v->vcpu_id, h, &s->hw)) !=0 ) -break ; - } + s =vcpu_vlapic (v); + rc =hvm_save_entry (LAPIC , v->vcpu_id, h, &s->hw);return rc; } -static int lapic_save_regs (struct domain *d,hvm_domain_context_t *h) +static int lapic_save_regs (struct domain *d,hvm_domain_context_t *h, +struct vcpu *v) { -struct vcpu *v;struct vlapic *s;int rc =0 ;if ( !has_vlapic (d) )return 0 ; - for_each_vcpu ( d, v ) - { -if ( hvm_funcs.sync_pir_to_irr ) - hvm_funcs.sync_pir_to_irr (v); +if ( hvm_funcs.sync_pir_to_irr ) + hvm_funcs.sync_pir_to_irr (v); - s =vcpu_vlapic (v); -if ( (rc =hvm_save_entry (LAPIC_REGS , v->vcpu_id, h, s->regs)) !=0 ) -break ; - } + s =vcpu_vlapic (v); + rc =hvm_save_entry (LAPIC_REGS , v->vcpu_id, h, s->regs);return rc; }
xen/arch/x86/hvm/vpic.c +2 -1
@@ -371,7 +371,8 @@ static int vpic_intercept_elcr_io(return X86EMUL_OKAY ; } -static int vpic_save (struct domain *d,hvm_domain_context_t *h) +static int vpic_save (struct domain *d,hvm_domain_context_t *h, +struct vcpu *v) {struct hvm_hw_vpic *s;int i;
xen/include/asm-x86/hvm/save.h +2 -1
@@ -96,7 +96,8 @@ static inline uint16_t hvm_load_instance(struct hvm_domain_context *h)* the load handler will be called once for each instance found when * restoring. Both return non-zero on error. */ typedef int (*hvm_save_handler ) (struct domain *d, -hvm_domain_context_t *h); +hvm_domain_context_t *h, +struct vcpu *v);typedef int (*hvm_load_handler ) (struct domain *d,hvm_domain_context_t *h);
Signature · 7 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v4 2/2] x86/domctl: Don't pause the whole domain if only getting vcpu state
Quoted 19 lines
Quoted 1 line
Quoted 1 line · On 07.05.18 at 10:24, <[email protected]> wrote:
xen/arch/x86/cpu/mcheck/vmce.c +3
-6@@ -357,20 +357,14 @@ void vmce_save_vcpu_ctxt_one(struct vcpu *v, struct hvm_vmce_vcpu *ctxt) ctxt->mcg_ext_ctl = v->arch.vmce.mcg_ext_ctl; } -static int vmce_save_vcpu_ctxt (struct domain *d,hvm_domain_context_t *h) +static int vmce_save_vcpu_ctxt (struct domain *d,hvm_domain_context_t *h, +struct vcpu *v) { -struct vcpu *v;int err =0 ; +struct hvm_vmce_vcpu ctxt; - for_each_vcpu ( d, v ) - { -struct hvm_vmce_vcpu ctxt; -
xen/arch/x86/cpu/mcheck/vmce.c void vmce_save_vcpu_ctxt_one(struct vcpu *v, struct hvm_vmce_vcpu *ctxt) · line 370
Quoted 10 lines
xen/arch/x86/cpu/mcheck/vmce.c +2
-5-vmce_save_vcpu_ctxt_one (v, &ctxt); - err =hvm_save_entry (VMCE_VCPU , v->vcpu_id, h, &ctxt); -if ( err ) -break ; - } +vmce_save_vcpu_ctxt_one (v, &ctxt); + err =hvm_save_entry (VMCE_VCPU , v->vcpu_id, h, &ctxt);return err; }
At the example of this one: The idea of breaking out the patch introducing the _one() functions was to avoid restructuring in this patch like what you do here. Any such change not strictly fitting under the title of this patch should be broken out. There may be multiple steps involved here.
As it stands, the function is now no longer meaningfully different from vmce_save_vcpu_ctxt_one(), and this pattern recurs. Such redundancy is undesirable. Together with you now passing v and d (when just v would suffice) I think you want to further re-structure how handling of save/restore happens, such that no stub functions like the one here remain. IOW after having introduced the _one() functions, a second transformation would be expected to eliminate the original ones, with (as you do here) the loop moving into the caller.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v4 2/2] x86/domctl: Don't pause the whole domain if only getting vcpu state
Quoted 36 lines
Quoted 20 lines
Quoted 2 lines · On 17.05.18 at 18:04, <[email protected]> wrote:
Quoted 1 line · On 07.05.18 at 10:24, <[email protected]> wrote:
xen/arch/x86/cpu/mcheck/vmce.c +3
-6@@ -357,20 +357,14 @@ void vmce_save_vcpu_ctxt_one(struct vcpu *v, struct hvm_vmce_vcpu *ctxt) ctxt->mcg_ext_ctl = v->arch.vmce.mcg_ext_ctl; } -static int vmce_save_vcpu_ctxt (struct domain *d,hvm_domain_context_t *h) +static int vmce_save_vcpu_ctxt (struct domain *d,hvm_domain_context_t *h, +struct vcpu *v) { -struct vcpu *v;int err =0 ; +struct hvm_vmce_vcpu ctxt; - for_each_vcpu ( d, v ) - { -struct hvm_vmce_vcpu ctxt; -xen/arch/x86/cpu/mcheck/vmce.c void vmce_save_vcpu_ctxt_one(struct vcpu *v, struct hvm_vmce_vcpu *ctxt) · line 370
Quoted 10 lines
xen/arch/x86/cpu/mcheck/vmce.c +2
-5-vmce_save_vcpu_ctxt_one (v, &ctxt); - err =hvm_save_entry (VMCE_VCPU , v->vcpu_id, h, &ctxt); -if ( err ) -break ; - } +vmce_save_vcpu_ctxt_one (v, &ctxt); + err =hvm_save_entry (VMCE_VCPU , v->vcpu_id, h, &ctxt);return err; }At the example of this one: The idea of breaking out the patch introducing the
_one()functions was to avoid restructuring in this patch like what you do here. Any such change not strictly fitting under the title of this patch should be broken out. There may be multiple steps involved here.
Quoted 8 lines
As it stands, the function is now no longer meaningfully different from
vmce_save_vcpu_ctxt_one(), and this pattern recurs. Such redundancy is undesirable. Together with you now passing v and d (when just v would suffice) I think you want to further re-structure how handling of save/restore happens, such that no stub functions like the one here remain. IOW after having introduced the_one()functions, a second transformation would be expected to eliminate the original ones, with (as you do here) the loop moving into the caller.
I think I should further clarify this reply of mine: The goal of the transformation should be that in the end we continue to have a single load and a single save function for every save type. These should be referenced by HVM_REGISTER_SAVE_RESTORE() or whatever clone of it may turn out necessary (note how its uses currently specify HVMSR_PER_VCPU, which may in the end no longer be necessary). That will also make the asymmetry go away that the save functions currently iterate over all vCPU-s, while the load functions don't (it'll presumably remain to be that way for multi-instance types where it's not the vCPU that is determining the instance, like the PIC).
Ideally save functions would further match load ones by the caller specifying the instance. Suitable unique return values may need to be used to signal the caller when to end the iteration. For example, the functions could return a "next instance" indicator. (I think you agree that this is an unavoidable difference to the load functions, where the instance comes with the load record.)
In any event, just to re-iterate - the final patch under this title should preferably not have a need to touch any of the save functions; all of this should be done in prereq changes. That'll then allow to focus on just the specific bit of new behavior you want when reviewing this (presumably last) patch of the series.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 07.05.18 at 10:24, <[email protected]> wrote:
This patch introduces
save_one()functions. They will be called in the*save()so we can extract data for a single instance.
Mostly fine, but please split up into one patch per save type.
xen/arch/x86/cpu/mcheck/vmce.c int vmce_wrmsr(uint32_t msr, uint64_t val) · line 352
Quoted 7 lines
xen/arch/x86/cpu/mcheck/vmce.c +1
-0@@ -349,6 +349,14 @@ int vmce_wrmsr(uint32_t msr, uint64_t val)return ret; } +void vmce_save_vcpu_ctxt_one (struct vcpu *v,struct hvm_vmce_vcpu *ctxt)
static (also elsewhere)
xen/arch/x86/cpu/mcheck/vmce.c HVM_REGISTER_SAVE_RESTORE(CPU, hvm_save_cpu_ctxt, hvm_load_cpu_ctxt, · line 1187
Quoted 5 lines
xen/arch/x86/cpu/mcheck/vmce.c +1
-0@@ -1173,6 +1184,18 @@ HVM_REGISTER_SAVE_RESTORE(CPU, hvm_save_cpu_ctxt, hvm_load_cpu_ctxt, save_area) + \ xstate_ctxt_size(xcr0)) +void hvm_save_cpu_xsave_states_one (struct vcpu *v,struct hvm_hw_cpu_xsave **ctx,hvm_domain_context_t *h)
This is inconsistent with the others: Why the extra indirection for ctx? And why the passing of h?
xen/arch/x86/cpu/mcheck/vmce.c HVM_REGISTER_SAVE_RESTORE(CPU, hvm_save_cpu_ctxt, hvm_load_cpu_ctxt, · line 1192
Quoted 5 lines
xen/arch/x86/cpu/mcheck/vmce.c +5
-0+{ +unsigned int size =HVM_CPU_XSAVE_SIZE (v->arch.xcr0_accum); +struct hvm_hw_cpu_xsave *ctxt = * ctx; + + h->cur += size;
This belongs in the caller afaict.
xen/arch/x86/cpu/mcheck/vmce.c static const uint32_t msrs_to_send[] = { · line 1361
Quoted 5 lines
xen/arch/x86/cpu/mcheck/vmce.c +1
-0@@ -1339,6 +1358,39 @@ static const uint32_t msrs_to_send[] = { };static unsigned int __read_mostly msr_count_max =ARRAY_SIZE (msrs_to_send); +int hvm_save_cpu_msrs_one (struct vcpu *v,struct hvm_msr **ctx,hvm_domain_context_t *h)
Same as above; I can't even spot where you use h in this function.
xen/arch/x86/cpu/mcheck/vmce.c static const uint32_t msrs_to_send[] = {
Quoted 7 lines
xen/arch/x86/cpu/mcheck/vmce.c +0
-2static int hvm_save_mtrr_msr (struct domain *d,hvm_domain_context_t *h) { -int i;struct vcpu *v;struct hvm_hw_mtrr hw_mtrr; -struct mtrr_state *mtrr_state;/* save mtrr&pat */
Please take the opportunity and add a blank line after the declarations.
Quoted 16 lines
xen/arch/x86/hvm/viridian.c +6
-0@@ -1028,6 +1028,12 @@ static int viridian_load_domain_ctxt(struct domain *d, hvm_domain_context_t *h)HVM_REGISTER_SAVE_RESTORE (VIRIDIAN_DOMAIN , viridian_save_domain_ctxt, viridian_load_domain_ctxt,1 ,HVMSR_PER_DOM ); +void viridian_save_vcpu_ctxt_one (struct vcpu *v,struct hvm_viridian_vcpu_context *ctxt) +{ + ctxt->vp_assist_msr = v->arch.hvm_vcpu.viridian.vp_assist.msr.raw; + ctxt->vp_assist_pending = v->arch.hvm_vcpu.viridian.vp_assist.pending; +} +static int viridian_save_vcpu_ctxt (struct domain *d,hvm_domain_context_t *h) {struct vcpu *v;
xen/arch/x86/hvm/viridian.c static int viridian_save_vcpu_ctxt(struct domain *d, hvm_domain_context_t *h) · line 1047
Quoted 10 lines
xen/arch/x86/hvm/viridian.c +3
-4@@ -1036,10 +1042,9 @@ static int viridian_save_vcpu_ctxt(struct domain *d, hvm_domain_context_t *h)return 0 ;for_each_vcpu ( d, v ) { -struct hvm_viridian_vcpu_context ctxt = { - .vp_assist_msr = v->arch.hvm_vcpu.viridian.vp_assist.msr.raw, - .vp_assist_pending = v->arch.hvm_vcpu.viridian.vp_assist.pending, - }; +struct hvm_viridian_vcpu_context ctxt; + +viridian_save_vcpu_ctxt_one (v, &ctxt);
There is a reason ctxt has an initializer: You're now leaking 7 bytes of hypervisor stack data (through the _pad[] array).
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel