[PATCH v3 8/9] x86/HVM: skip offline vCPU-s when dumping VMCBs/VMCSes

Jan Beulich posted 9 patches 3 years, 2 months ago
There is a newer version of this series
[PATCH v3 8/9] x86/HVM: skip offline vCPU-s when dumping VMCBs/VMCSes
Posted by Jan Beulich 3 years, 2 months ago
There's not really any register state associated with offline vCPU-s, so
avoid spamming the log with largely useless information while still
leaving an indication of the fact.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
v2: New.

--- a/xen/arch/x86/hvm/svm/vmcb.c
+++ b/xen/arch/x86/hvm/svm/vmcb.c
@@ -242,6 +242,11 @@ static void vmcb_dump(unsigned char ch)
         printk("\n>>> Domain %d <<<\n", d->domain_id);
         for_each_vcpu ( d, v )
         {
+            if ( test_bit(_VPF_down, &v->pause_flags) )
+            {
+                printk("\tVCPU %u: offline\n", v->vcpu_id);
+                continue;
+            }
             printk("\tVCPU %d\n", v->vcpu_id);
             svm_vmcb_dump("key_handler", v->arch.hvm.svm.vmcb);
         }
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -2133,6 +2133,11 @@ static void vmcs_dump(unsigned char ch)
         printk("\n>>> Domain %d <<<\n", d->domain_id);
         for_each_vcpu ( d, v )
         {
+            if ( test_bit(_VPF_down, &v->pause_flags) )
+            {
+                printk("\tVCPU %u: offline\n", v->vcpu_id);
+                continue;
+            }
             printk("\tVCPU %d\n", v->vcpu_id);
             vmcs_dump_vcpu(v);
         }


Re: [PATCH v3 8/9] x86/HVM: skip offline vCPU-s when dumping VMCBs/VMCSes
Posted by Roger Pau Monné 3 years, 2 months ago
On Tue, Sep 21, 2021 at 09:20:32AM +0200, Jan Beulich wrote:
> There's not really any register state associated with offline vCPU-s, so
> avoid spamming the log with largely useless information while still
> leaving an indication of the fact.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>

Is the state cleared when the vCPU is brought down? Or else it might
be interesting to print such state for debug purposes.

Thanks, Roger.

Re: [PATCH v3 8/9] x86/HVM: skip offline vCPU-s when dumping VMCBs/VMCSes
Posted by Jan Beulich 3 years, 2 months ago
On 23.09.2021 10:23, Roger Pau Monné wrote:
> On Tue, Sep 21, 2021 at 09:20:32AM +0200, Jan Beulich wrote:
>> There's not really any register state associated with offline vCPU-s, so
>> avoid spamming the log with largely useless information while still
>> leaving an indication of the fact.
>>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>

Thanks.

> Is the state cleared when the vCPU is brought down? Or else it might
> be interesting to print such state for debug purposes.

Hmm, if that's considered to be potentially useful, then we'd need a
key different from VPF_down. HLT would leave state in place, and the
INIT/SIPI sequence would clobber prior state also only on the 2nd
step. v->is_initialised may be an option, but gets cleared by INIT,
not SIPI. Any other ideas?

Jan


Re: [PATCH v3 8/9] x86/HVM: skip offline vCPU-s when dumping VMCBs/VMCSes
Posted by Roger Pau Monné 3 years, 2 months ago
On Thu, Sep 23, 2021 at 01:27:30PM +0200, Jan Beulich wrote:
> On 23.09.2021 10:23, Roger Pau Monné wrote:
> > On Tue, Sep 21, 2021 at 09:20:32AM +0200, Jan Beulich wrote:
> >> There's not really any register state associated with offline vCPU-s, so
> >> avoid spamming the log with largely useless information while still
> >> leaving an indication of the fact.
> >>
> >> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> > 
> > Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
> 
> Thanks.
> 
> > Is the state cleared when the vCPU is brought down? Or else it might
> > be interesting to print such state for debug purposes.
> 
> Hmm, if that's considered to be potentially useful, then we'd need a
> key different from VPF_down. HLT would leave state in place, and the
> INIT/SIPI sequence would clobber prior state also only on the 2nd
> step. v->is_initialised may be an option, but gets cleared by INIT,
> not SIPI. Any other ideas?

Well, I guess it's close enough. I also wonder whether we should do
something similar for PV, where it might even make more sense as you
can upload a vCPU state in that case when the vCPU is down.

Thanks, Roger.