From: Ingo Molnar <mingo@elte.hu>
To: Avi Kivity <avi@redhat.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Pekka Enberg <penberg@kernel.org>,
Sasha Levin <levinsasha928@gmail.com>,
john@jfloren.net, kvm@vger.kernel.org, asias.hejun@gmail.com,
gorcunov@gmail.com, prasadjoshi124@gmail.com,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Subject: Re: [PATCH 4/6] kvm tools: Add rwlock wrapper
Date: Sun, 29 May 2011 09:35:50 +0200 [thread overview]
Message-ID: <20110529073550.GA21254@elte.hu> (raw)
In-Reply-To: <4DE1EA93.6040401@redhat.com>
* Avi Kivity <avi@redhat.com> wrote:
> On 05/28/2011 09:32 PM, Ingo Molnar wrote:
> >* Avi Kivity<avi@redhat.com> wrote:
> >
> >> > So if you set a notification signal via fcntl(F_SETOWN) on the
> >> > scheduler context switch event fd, the user-space RCU code will
> >> > get a signal on every context switch.
> >>
> >> Context switches are completely uninteresting for userspace rcu:
> >>
> >> rcu_read_lock();
> >> ---> context switch
> >>
> >> have we learned anything from that? no. User code is always
> >> preemptible and migratable. If rcu_read_lock() prevented migration
> >> somehow, then we'd know that a context switch means we've started a
> >> grace period for this thread. But it doesn't, so we don't.
> >
> >Well, in the next mail i mentioned that we can do migration events as
> >well, which would be useful: instead of having to keep track of
> >nr_tasks RCU grace periods we could simplify it down to nr_cpus.
>
> I don't see how a migration event helps. It is completely
> transparent from the task's point of view.
It's not transparent at all if you index RCU data structures by the
current CPU index, which the kernel implementation does.
Doing that has the advantage of being much more cache-compressed than
the TID index, and also having better worst-case grace period latency
properties than a TID index.
> > But if we indexed by the TID then we wouldnt need any scheduler
> > bindings at all - this is the simpler approach.
>
> Yes, and it maps 1:1 to the kernel implementation (cpu = task).
No, the kernel indexes grace period tracking (and the
write-completion queues) by CPU index.
> >> What's needed are explicit notifications about grace periods. For
> >> the vcpu threads, calling KVM_VCPU_RUN seems like a good point.
> >> For I/O threads, completion of processing of an event is also a
> >> good point.
> >
> > Grace period notifications are needed too, obviously.
>
> I'd think they're sufficient, no? Is something else needed?
I think you are missing the fact that in the kernel we index RCU data
structures by CPU number:
static void rcu_preempt_qs(int cpu)
{
struct rcu_data *rdp = &per_cpu(rcu_preempt_data, cpu);
...
static void rcu_preempt_note_context_switch(int cpu)
{
struct task_struct *t = current;
unsigned long flags;
struct rcu_data *rdp;
struct rcu_node *rnp;
if (t->rcu_read_lock_nesting &&
(t->rcu_read_unlock_special & RCU_READ_UNLOCK_BLOCKED) == 0) {
/* Possibly blocking in an RCU read-side critical section. */
rdp = per_cpu_ptr(rcu_preempt_state.rda, cpu);
...
Which could be changed over to be per task in user-space by treating
the TID as a 'virtual CPU' equivalent.
This probably lengthens worst-case rcu_sync() latencies rather
significantly though - possibly turning urcu into a
stop_machine_run() equivalent in the worst-case. (but i could be
wrong about this last bit)
Thanks,
Ingo
next prev parent reply other threads:[~2011-05-29 7:36 UTC|newest]
Thread overview: 82+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-26 14:25 [PATCH 1/6] kvm tools: Prevent double assignment of guest memory info Sasha Levin
2011-05-26 14:25 ` [PATCH 2/6] kvm tools: Exit VCPU thread only when SIGKVMEXIT is received Sasha Levin
2011-05-26 14:25 ` [PATCH 3/6] kvm tools: Protect IRQ allocations by a mutex Sasha Levin
2011-05-26 14:25 ` [PATCH 4/6] kvm tools: Add rwlock wrapper Sasha Levin
2011-05-26 16:02 ` Pekka Enberg
2011-05-26 16:19 ` Sasha Levin
2011-05-26 18:05 ` Ingo Molnar
2011-05-26 18:11 ` Avi Kivity
2011-05-26 18:21 ` Pekka Enberg
2011-05-26 18:57 ` Sasha Levin
2011-05-26 23:09 ` Mathieu Desnoyers
2011-05-27 10:19 ` Sasha Levin
2011-05-27 10:36 ` Ingo Molnar
2011-05-27 15:52 ` Sasha Levin
2011-05-27 17:10 ` Ingo Molnar
2011-05-27 20:19 ` Sasha Levin
2011-05-28 15:24 ` Ingo Molnar
2011-05-28 16:44 ` Paul E. McKenney
2011-05-28 19:45 ` Sasha Levin
2011-05-29 6:47 ` Avi Kivity
2011-05-29 7:19 ` Ingo Molnar
2011-05-29 15:31 ` Paul E. McKenney
2011-05-29 15:51 ` Paul E. McKenney
2011-05-29 19:54 ` Ingo Molnar
2011-05-30 3:12 ` Paul E. McKenney
2011-05-29 16:22 ` Sasha Levin
2011-05-27 13:14 ` Mathieu Desnoyers
2011-05-29 17:01 ` RCU red-black tree (was: Re: [PATCH 4/6] kvm tools: Add rwlock wrapper) Mathieu Desnoyers
2011-05-29 17:48 ` Sasha Levin
2011-05-30 2:54 ` Mathieu Desnoyers
2011-05-30 6:07 ` Sasha Levin
2011-05-30 11:30 ` Mathieu Desnoyers
2011-05-30 17:38 ` Mathieu Desnoyers
2011-05-30 17:50 ` Mathieu Desnoyers
2011-05-30 17:52 ` Sasha Levin
2011-05-30 18:57 ` Mathieu Desnoyers
2011-05-30 19:11 ` Sasha Levin
2011-05-31 13:05 ` Sasha Levin
2011-05-31 13:09 ` Ingo Molnar
2011-05-31 13:20 ` Sasha Levin
2011-05-31 15:25 ` Ingo Molnar
2011-05-31 19:09 ` Prasad Joshi
2011-05-31 19:31 ` Ingo Molnar
2011-06-02 14:55 ` Mathieu Desnoyers
2011-05-30 3:38 ` Paul E. McKenney
2011-05-30 11:18 ` Mathieu Desnoyers
2011-05-26 20:25 ` [PATCH 4/6] kvm tools: Add rwlock wrapper Ingo Molnar
2011-05-26 23:05 ` Mathieu Desnoyers
2011-05-27 0:58 ` Paul E. McKenney
2011-05-27 9:12 ` Ingo Molnar
2011-05-27 12:48 ` Mathieu Desnoyers
2011-05-27 13:19 ` Ingo Molnar
2011-05-27 13:29 ` Mathieu Desnoyers
2011-05-27 13:36 ` Ingo Molnar
2011-05-27 17:22 ` Paul E. McKenney
2011-05-27 10:25 ` Ingo Molnar
2011-05-27 11:07 ` Ingo Molnar
2011-05-27 11:10 ` Ingo Molnar
2011-05-27 11:24 ` Ingo Molnar
2011-05-27 14:18 ` Mathieu Desnoyers
2011-05-27 14:11 ` Mathieu Desnoyers
2011-05-28 18:12 ` Avi Kivity
2011-05-28 18:32 ` Ingo Molnar
2011-05-29 6:41 ` Avi Kivity
2011-05-29 7:35 ` Ingo Molnar [this message]
2011-05-29 7:54 ` Avi Kivity
2011-05-29 12:37 ` Ingo Molnar
2011-05-29 12:48 ` Avi Kivity
2011-05-29 14:27 ` Ingo Molnar
2011-05-29 15:00 ` Avi Kivity
2011-05-29 15:38 ` Paul E. McKenney
2011-05-29 19:33 ` Ingo Molnar
2011-05-30 3:07 ` Paul E. McKenney
2011-05-30 8:12 ` Ingo Molnar
2011-05-27 13:22 ` Mathieu Desnoyers
2011-05-27 13:31 ` Ingo Molnar
2011-05-28 18:14 ` Avi Kivity
2011-05-27 13:07 ` Ingo Molnar
2011-05-26 14:25 ` [PATCH 5/6] kvm tools: Protect MMIO tree by rwsem Sasha Levin
2011-05-26 14:25 ` [PATCH 6/6] kvm tools: Protect IOPORT " Sasha Levin
2011-05-26 16:01 ` Pekka Enberg
2011-05-26 16:19 ` Sasha Levin
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=20110529073550.GA21254@elte.hu \
--to=mingo@elte.hu \
--cc=asias.hejun@gmail.com \
--cc=avi@redhat.com \
--cc=gorcunov@gmail.com \
--cc=john@jfloren.net \
--cc=kvm@vger.kernel.org \
--cc=levinsasha928@gmail.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=penberg@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