From: "Emilio G. Cota" <cota@braap.org>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2] translate-all: use bitmap helpers for PageDesc's bitmap
Date: Wed, 22 Apr 2015 17:47:25 -0400 [thread overview]
Message-ID: <20150422214725.GA22985@flamenco> (raw)
In-Reply-To: <553804DF.10900@redhat.com>
On Wed, Apr 22, 2015 at 22:30:23 +0200, Paolo Bonzini wrote:
> On 22/04/2015 18:53, Emilio G. Cota wrote:
> > @@ -1221,8 +1194,9 @@ void tb_invalidate_phys_page_fast(tb_page_addr_t start, int len)
> > return;
> > }
> > if (p->code_bitmap) {
> > - offset = start & ~TARGET_PAGE_MASK;
> > - b = p->code_bitmap[offset >> 3] >> (offset & 7);
> > + int nr = start & ~TARGET_PAGE_MASK;
>
> This should be unsigned, otherwise the compiler might not make
> BIT_WORD(nr) a simple right shift (maybe it can see that nr > 0 thanks
> to the AND, but in principle x / 32 is not the same as x >> 5 if x is
> signed).
OK. Note that all bit{map,ops} helpers take a long as the bit position,
and then do BIT_WORD() on it--I was following that convention wrt sign.
> > + int b = p->code_bitmap[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG - 1));
>
> And this should be unsigned long.
Used an int because we only care about the least significant bits (len <= 8):
> > if (b & ((1 << len) - 1)) {
> > goto do_invalidate;
> > }
But yes, an unsigned long here is more appropriate.
Thanks,
Emilio
next prev parent reply other threads:[~2015-04-22 21:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-21 6:25 [Qemu-devel] [PATCH] translate-all: use bitmap helpers for PageDesc's bitmap Emilio G. Cota
2015-04-03 0:08 ` Emilio G. Cota
2015-04-03 14:18 ` Paolo Bonzini
2015-04-22 13:13 ` Paolo Bonzini
2015-04-22 16:47 ` Emilio G. Cota
2015-04-22 16:53 ` [Qemu-devel] [PATCH v2] " Emilio G. Cota
2015-04-22 20:30 ` Paolo Bonzini
2015-04-22 21:47 ` Emilio G. Cota [this message]
2015-04-22 21:50 ` [Qemu-devel] [PATCH v3] " Emilio G. Cota
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=20150422214725.GA22985@flamenco \
--to=cota@braap.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.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.