From: Hollis Blanchard <hollisb-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
To: Anthony Liguori <anthony-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
kvm-ppc-devel
<kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>,
Carsten Otte <carsteno-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>,
"Zhang,
Xiantao" <xiantao.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Subject: Re: [kvm-ppc-devel] [PATCH] Split kvm_vcpu to support new archs.
Date: Fri, 19 Oct 2007 12:16:40 -0500 [thread overview]
Message-ID: <1192814200.10451.18.camel@basalt> (raw)
In-Reply-To: <4717D87E.5010000-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
On Thu, 2007-10-18 at 17:04 -0500, Anthony Liguori wrote:
> Hollis Blanchard wrote:
> >
> > I must be misunderstanding, because this seems completely backwards to
> > me. With your nesting, any time architecture code wants to access
> > architecture state (which is almost all the time), you'd *need*
> > container_of:
> >
> > void arch_func(struct kvm_vcpu *vcpu) {
> > struct arch_vcpu *arch = container_of(vcpu, arch_vcpu,
> > arch);
> > arch->gpr[3] = 0;
> > }
> >
> > In contrast, my nesting proposal would look like this:
> >
> > void arch_func(struct kvm_vcpu *vcpu) {
> > vcpu->arch.gpr[3] = 0;
> > }
> >
>
> Well, you'd probably define a to_ppc() and then do something like:
>
> void arch_func(struct kvm_vcpu *vcpu) {
> to_arch(vcpu)->gpr[3] = 0;
> }
>
> Which is exactly what's done in the vt/svm backend (see usage of
> to_svm/to_vmx).
Ah, so you're saying that once we have a "to_x86()" macro, the nesting
becomes irrelevant.
Furthermore, "to_x86()" won't even be defined when compiling shared
code, which will ensure that nobody tries to slip something in.
Finally, it means we don't have to keep the "arch" member at the end of
kvm_vcpu (though I don't think that's a big deal really).
I think I can live with that. Carsten?
[BTW, a quick glance at svm.c turns up weirdness like this:
static int rdmsr_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run)
{
u32 ecx = svm->vcpu.regs[VCPU_REGS_RCX];
u64 data;
if (svm_get_msr(&svm->vcpu, ecx, &data))
svm_inject_gp(&svm->vcpu, 0);
...
}
static void svm_inject_gp(struct kvm_vcpu *vcpu, unsigned error_code)
{
struct vcpu_svm *svm = to_svm(vcpu);
...
}
There's some unnecessary kvm_vcpu/svm_vcpu conversion going on there.]
--
Hollis Blanchard
IBM Linux Technology Center
-------------------------------------------------------------------------
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/
next prev parent reply other threads:[~2007-10-19 17:16 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-18 7:34 [PATCH] Split kvm_vcpu to support new archs Zhang, Xiantao
[not found] ` <42DFA526FC41B1429CE7279EF83C6BDC809A6A-wq7ZOvIWXbMAbVU2wMM1CrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-10-18 14:22 ` Avi Kivity
2007-10-18 20:01 ` Hollis Blanchard
2007-10-18 21:04 ` Anthony Liguori
[not found] ` <4717CA4B.7040307-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
2007-10-18 21:14 ` Hollis Blanchard
2007-10-18 21:31 ` Anthony Liguori
[not found] ` <4717D095.40708-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
2007-10-18 21:43 ` [kvm-ppc-devel] " Hollis Blanchard
2007-10-18 22:04 ` Anthony Liguori
[not found] ` <4717D87E.5010000-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
2007-10-19 17:16 ` Hollis Blanchard [this message]
2007-10-19 13:34 ` Carsten Otte
2007-10-21 6:40 ` Avi Kivity
[not found] ` <471AF450.9040202-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-10-22 19:18 ` Hollis Blanchard
2007-10-23 12:14 ` Carsten Otte
[not found] ` <471DE5B2.4030709-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
2007-10-24 11:44 ` Zhang, Xiantao
2007-10-25 2:56 ` Jerone Young
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=1192814200.10451.18.camel@basalt \
--to=hollisb-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
--cc=anthony-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org \
--cc=carsteno-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org \
--cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=xiantao.zhang-ral2JQCrhuEAvxtiuMwx3w@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