From: Joerg Roedel <joro@8bytes.org>
To: Prasad Joshi <prasadjoshi124@gmail.com>
Cc: kvm@vger.kernel.org
Subject: Re: Always false condition in rmap_add
Date: Thu, 11 Nov 2010 22:09:32 +0100 [thread overview]
Message-ID: <20101111210931.GF5193@8bytes.org> (raw)
In-Reply-To: <AANLkTinK7r=SY8-jcQXTZKbVSLdWEk2K4A8B8yuJ68_o@mail.gmail.com>
On Thu, Nov 11, 2010 at 06:38:47PM +0000, Prasad Joshi wrote:
> Hello All,
>
> I have question on code of rmap_add
>
> Here is the code of the function
>
> 613 static int rmap_add(struct kvm_vcpu *vcpu, u64 *spte, gfn_t gfn)
> 614 {
>
> 624 rmapp = gfn_to_rmap(vcpu->kvm, gfn, sp->role.level);
> 625 if (!*rmapp) {
> 626 rmap_printk("rmap_add: %p %llx 0->1\n", spte, *spte);
> 627 *rmapp = (unsigned long)spte;
> 628 } else if (!(*rmapp & 1)) {
> 629 rmap_printk("rmap_add: %p %llx 1->many\n", spte, *spte);
> 630 desc = mmu_alloc_rmap_desc(vcpu);
> 631 desc->sptes[0] = (u64 *)*rmapp;
> 632 desc->sptes[1] = spte;
> 633 *rmapp = (unsigned long)desc | 1;
> 634 ++count;
> 635 } else {
>
> The line 628 checks whether the last bit of the rmapp is 1.
> If it is one then line 633 assigns a new value to rmapp with and sets
> the last bit to 1.
No, line 628 checks if the last bit is not 1, so the check works.
Joerg
prev parent reply other threads:[~2010-11-11 21:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <AANLkTikhBHe9JEDgY0Jhh86VvoOjV9+KDXB4S6+2_vqV@mail.gmail.com>
2010-11-11 18:38 ` Always false condition in rmap_add Prasad Joshi
2010-11-11 21:09 ` Joerg Roedel [this message]
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=20101111210931.GF5193@8bytes.org \
--to=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=prasadjoshi124@gmail.com \
/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