From: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
To: kvm-ppc@vger.kernel.org
Subject: Re: [PATCH 3/6] kvmppc: rewrite guest code - sprg0-3
Date: Thu, 21 Aug 2008 13:19:50 +0000 [thread overview]
Message-ID: <48AD6B76.7070909@linux.vnet.ibm.com> (raw)
In-Reply-To: <1219142205-12062-4-git-send-email-ehrhardt@linux.vnet.ibm.com>
Hollis Blanchard wrote:
> Some initial comments:
>
> On Tue, 2008-08-19 at 12:36 +0200, ehrhardt@linux.vnet.ibm.com wrote:
>
>> + if (rw = KVM_PPCPV_PVMEM_READ) {
>> + set_op(32, &newinst); /* lwz */
>> + set_rt(get_rt(inst), &newinst); /* set original rt */
>> + } else {
>> + set_op(36, &newinst); /* stw */
>> + set_rs(get_rs(inst), &newinst); /* set original rs */
>> + }
>>
>
> I think it's time we replaced these magic numbers (32, 36 above, but
> also in the opcode switch statements) with named constants.
>
>
Yes, but I wanted to keep it in sync with the emulation switch code here.
Once we agree on this patch series it is easy to throw a numer->name
patch on top.
Or do you want me to put a renaming patch into the paravirtualization
queue now ?
>> +int kvmppc_pvmem_rewrite_instruction(struct kvm_vcpu *vcpu)
>> +{
>> ...
>> + down_read(¤t->mm->mmap_sem);
>> + pcpage = gfn_to_page(vcpu->kvm,
>> + guest_pcaddr >> KVM_PPCPV_MAGIC_PAGE_SHIFT);
>> + up_read(¤t->mm->mmap_sem);
>> + if (pcpage = bad_page)
>> + return -EFAULT;
>> +
>> + pcmem = kmap_atomic(pcpage, KM_USER0);
>> + if (!pcmem)
>> + return -EFAULT;
>> + pcaddr = ((unsigned long)pcmem
>> + | (vcpu->arch.pc & KVM_PPCPV_MAGIC_PAGE_MASK));
>> + BUG_ON(inst != *((u32 *)pcaddr));
>> + create_instruction(pcaddr, newinst);
>> + kunmap_atomic(pcpage, KM_USER0);
>>
>
> This suffers from the same kunmap_atomic() problem you pointed out to me
> elsewhere in my own code. :) (You're passing pcpage to kunmap_atomic()
> instead of pcaddr.)
>
>
damn - stepped in my own trap ;-)
thanks for the hint - fixed
--
Grüsse / regards,
Christian Ehrhardt
IBM Linux Technology Center, Open Virtualization
next prev parent reply other threads:[~2008-08-21 13:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-19 10:36 [PATCH 3/6] kvmppc: rewrite guest code - sprg0-3 ehrhardt
2008-08-20 17:42 ` Hollis Blanchard
2008-08-21 13:19 ` Christian Ehrhardt [this message]
2008-08-21 18:54 ` Hollis Blanchard
2008-08-29 2:20 ` Liu Yu
2008-08-29 2:58 ` Liu Yu
2008-09-01 12:15 ` Christian Ehrhardt
2008-09-01 12:26 ` Christian Ehrhardt
2008-09-02 3:02 ` Liu Yu-B13201
2008-09-02 7:30 ` Christian Ehrhardt
2008-09-16 6:27 ` ehrhardt
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=48AD6B76.7070909@linux.vnet.ibm.com \
--to=ehrhardt@linux.vnet.ibm.com \
--cc=kvm-ppc@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.