From: Stefan Hajnoczi <stefanha@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
Juan Quintela <quintela@redhat.com>,
qemu-devel@nongnu.org, rth@redhat.com
Subject: Re: [Qemu-devel] [RFC 1/6] bitmap: add atomic set functions
Date: Mon, 1 Dec 2014 13:52:36 +0000 [thread overview]
Message-ID: <20141201135236.GA6744@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <54775481.9020605@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 689 bytes --]
On Thu, Nov 27, 2014 at 05:42:41PM +0100, Paolo Bonzini wrote:
>
>
> On 27/11/2014 13:29, Stefan Hajnoczi wrote:
> > +void bitmap_set_atomic(unsigned long *map, long start, long nr)
> > +{
> > + unsigned long *p = map + BIT_WORD(start);
> > + const long size = start + nr;
> > + int bits_to_set = BITS_PER_LONG - (start % BITS_PER_LONG);
> > + unsigned long mask_to_set = BITMAP_FIRST_WORD_MASK(start);
> > +
> > + while (nr - bits_to_set >= 0) {
> > + atomic_or(p, mask_to_set);
>
> atomic_or is unnecessary while mask_to_set is ~0UL. I think not even a
> smp_wmb() is necessary.
Okay, I can split this into the ~0UL case and the atomic case.
[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2014-12-01 13:52 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-27 12:29 [Qemu-devel] [RFC 0/6] memory: make dirty_memory[] accesses atomic Stefan Hajnoczi
2014-11-27 12:29 ` [Qemu-devel] [RFC 1/6] bitmap: add atomic set functions Stefan Hajnoczi
2014-11-27 16:42 ` Paolo Bonzini
2014-12-01 13:52 ` Stefan Hajnoczi [this message]
2014-11-27 12:29 ` [Qemu-devel] [RFC 2/6] bitmap: add atomic test and clear Stefan Hajnoczi
2014-11-27 16:43 ` Paolo Bonzini
2014-12-01 13:53 ` Stefan Hajnoczi
2014-11-27 12:29 ` [Qemu-devel] [RFC 3/6] memory: use atomic ops for setting dirty memory bits Stefan Hajnoczi
2014-11-27 12:29 ` [Qemu-devel] [RFC 4/6] migration: move dirty bitmap sync to ram_addr.h Stefan Hajnoczi
2014-11-27 16:29 ` Dr. David Alan Gilbert
2014-12-01 14:01 ` Stefan Hajnoczi
2014-12-01 14:49 ` Dr. David Alan Gilbert
2014-11-27 12:29 ` [Qemu-devel] [RFC 5/6] memory: replace cpu_physical_memory_reset_dirty() with test-and-clear Stefan Hajnoczi
2014-11-27 12:29 ` [Qemu-devel] [RFC 6/6] memory: make cpu_physical_memory_sync_dirty_bitmap() fully atomic Stefan Hajnoczi
2014-11-27 13:21 ` [Qemu-devel] [RFC 0/6] memory: make dirty_memory[] accesses atomic Peter Maydell
2014-11-28 12:44 ` Stefan Hajnoczi
2015-03-23 11:09 ` Paolo Bonzini
2015-03-24 16:48 ` Stefan Hajnoczi
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=20141201135236.GA6744@stefanha-thinkpad.redhat.com \
--to=stefanha@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=rth@redhat.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;
as well as URLs for NNTP newsgroup(s).