public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
To: Gregory Haskins <ghaskins-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: [PATCH 1/2] KVM: Remove arch specific components from	the general code
Date: Thu, 26 Jul 2007 10:04:54 -0500	[thread overview]
Message-ID: <46A8B816.7080303@codemonkey.ws> (raw)
In-Reply-To: <20070726145204.4847.53350.stgit-sLgBBP33vUGnsjUZhwzVf9HuzzzSOjJt@public.gmane.org>

Gregory Haskins wrote:
> Signed-off-by: Gregory Haskins <ghaskins-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
> ---
>
>  drivers/kvm/kvm.h      |   31 -----
>  drivers/kvm/kvm_main.c |   26 +---
>  drivers/kvm/kvm_svm.h  |    3 
>  drivers/kvm/svm.c      |  322 +++++++++++++++++++++++++-----------------------
>  drivers/kvm/vmx.c      |  236 +++++++++++++++++++++--------------
>  5 files changed, 320 insertions(+), 298 deletions(-)
>  
>  struct kvm_vcpu {
> +	int valid;
>  	struct kvm *kvm;
>  	int vcpu_id;
> -	union {
> -		struct vmcs *vmcs;
> -		struct vcpu_svm *svm;
> -	};
> +	void *_priv;
>   

How are you planning on going about switching to container_of()?  Commit 
this, commit Rusty's stuff, then commit a fix or commit Rusty's stuff, 
then update your patch set?

>  static void svm_inject_gp(struct kvm_vcpu *vcpu, unsigned error_code)
>  {
> -	vcpu->svm->vmcb->control.event_inj = 	SVM_EVTINJ_VALID |
> +	svm(vcpu)->vmcb->control.event_inj = 	SVM_EVTINJ_VALID |
>  						SVM_EVTINJ_VALID_ERR |
>  						SVM_EVTINJ_TYPE_EXEPT |
>  						GP_VECTOR;
> -	vcpu->svm->vmcb->control.event_inj_err = error_code;
> +	svm(vcpu)->vmcb->control.event_inj_err = error_code;
>  }

I'm willing to concede on using the name "svm()" here although I think 
it's a terrible function name but I really think it's important to store 
a reference to this instead of using it as if it's an lvalue.  So I 
would change this to:

struct vcpu_svm *svm = svm(vcpu);

svm->vmcb->control.event_inj =   ....;

I think this is much easier to grok than having svm(vcpu) calls all over 
the place as psuedo-lvalues.

Regards,

Anthony Liguori


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/

  parent reply	other threads:[~2007-07-26 15:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-26 14:51 [PATCH 0/2] Arch cleanup v3 Gregory Haskins
     [not found] ` <20070726144602.4847.64724.stgit-sLgBBP33vUGnsjUZhwzVf9HuzzzSOjJt@public.gmane.org>
2007-07-26 14:52   ` [PATCH 1/2] KVM: Remove arch specific components from the general code Gregory Haskins
     [not found]     ` <20070726145204.4847.53350.stgit-sLgBBP33vUGnsjUZhwzVf9HuzzzSOjJt@public.gmane.org>
2007-07-26 15:04       ` Anthony Liguori [this message]
     [not found]         ` <46A8B816.7080303-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
2007-07-26 15:10           ` Avi Kivity
2007-07-26 17:44           ` Paul Turner
2007-07-26 23:54           ` Rusty Russell
2007-07-26 14:52   ` [PATCH 2/2] KVM: Protect race-condition between VMCS and current_vmcs on VMX hardware Gregory Haskins
     [not found]     ` <20070726145210.4847.90637.stgit-sLgBBP33vUGnsjUZhwzVf9HuzzzSOjJt@public.gmane.org>
2007-07-26 15:03       ` Avi Kivity
  -- strict thread matches above, loose matches on Subject: below --
2007-07-26 15:18 [PATCH 1/2] KVM: Remove arch specific components from the general code Gregory Haskins
2007-07-27 12:13 [PATCH 0/2] Arch cleanup v5 Gregory Haskins
     [not found] ` <20070727121250.9876.36599.stgit-sLgBBP33vUGnsjUZhwzVf9HuzzzSOjJt@public.gmane.org>
2007-07-27 12:13   ` [PATCH 1/2] KVM: Remove arch specific components from the general code Gregory Haskins
     [not found]     ` <20070727121309.9876.76020.stgit-sLgBBP33vUGnsjUZhwzVf9HuzzzSOjJt@public.gmane.org>
2007-07-29  7:48       ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46A8B816.7080303@codemonkey.ws \
    --to=anthony-rdkfgonbjusknkdkm+me6a@public.gmane.org \
    --cc=ghaskins-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox