From: Christoph Hellwig <hch@infradead.org>
To: Jason Wang <jasowang@redhat.com>
Cc: mst@redhat.com, kvm@vger.kernel.org,
virtualization@lists.linux-foundation.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
James Bottomley <James.Bottomley@HansenPartnership.com>,
Andrea Arcangeli <aarcange@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Darren Hart <dvhart@infradead.org>
Subject: Re: [PATCH RFC] vhost: don't use kmap() to log dirty pages
Date: Tue, 7 May 2019 08:47:53 -0700 [thread overview]
Message-ID: <20190507154753.GA8809@infradead.org> (raw)
In-Reply-To: <1557195809-12373-1-git-send-email-jasowang@redhat.com>
On Mon, May 06, 2019 at 10:23:29PM -0400, Jason Wang wrote:
> Note: there're archs (few non popular ones) that don't implement
> futex helper, we can't log dirty pages. We can fix them on top or
> simply disable LOG_ALL features of vhost.
That means vhost now has to depend on HAVE_FUTEX_CMPXCHG to make
sure we have a working implementation.
> #include <linux/sched/signal.h>
> #include <linux/interval_tree_generic.h>
> #include <linux/nospec.h>
> +#include <asm/futex.h>
Also please include the futex maintainers to make sure they are fine
with this first usage of <asm/futex.h> outside of kernel/futex.c.
> +static int set_bit_to_user(int nr, u32 __user *addr)
> {
> unsigned long log = (unsigned long)addr;
> struct page *page;
> + u32 old_log;
> int r;
>
> r = get_user_pages_fast(log, 1, 1, &page);
> if (r < 0)
> return r;
> BUG_ON(r != 1);
> +
> + r = futex_atomic_cmpxchg_inatomic(&old_log, addr, 0, 0);
> + if (r < 0)
> + return r;
> +
> + old_log |= 1 << nr;
> + r = put_user(old_log, addr);
> + if (r < 0)
> + return r;
And this just looks odd to me. Why do we need the futex call to
replace a 0 value with 0? Why does it still duplicate the
put_user? This doesn't look like actually working code to me.
Also don't we need a pagefault_disable() around
futex_atomic_cmpxchg_inatomic?
next prev parent reply other threads:[~2019-05-07 15:48 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-07 2:23 [PATCH RFC] vhost: don't use kmap() to log dirty pages Jason Wang
2019-05-07 15:47 ` Christoph Hellwig [this message]
2019-05-08 3:43 ` Jason Wang
2019-05-08 3:43 ` Jason Wang
2019-05-07 15:47 ` Christoph Hellwig
2019-05-08 4:12 ` Michael S. Tsirkin
2019-05-08 4:12 ` Michael S. Tsirkin
2019-05-08 4:28 ` Jason Wang
2019-05-08 4:28 ` Jason Wang
-- strict thread matches above, loose matches on Subject: below --
2019-05-07 2:23 Jason Wang
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=20190507154753.GA8809@infradead.org \
--to=hch@infradead.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=aarcange@redhat.com \
--cc=dvhart@infradead.org \
--cc=jasowang@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=virtualization@lists.linux-foundation.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.