mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Daniel Wagner <daniel.wagner@bmw-carit.de>,
	linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org,
	Marcelo Tosatti <mtosatti@redhat.com>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Paul Gortmaker <paul.gortmaker@windriver.com>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH v3 2/4] KVM: use simple waitqueue for vcpu->wq
Date: Tue, 20 Oct 2015 18:06:09 +0200	[thread overview]
Message-ID: <20151020160609.GH17308@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <56266074.8050707@redhat.com>

On Tue, Oct 20, 2015 at 05:40:36PM +0200, Paolo Bonzini wrote:
> 
> 
> On 20/10/2015 16:00, Peter Zijlstra wrote:
> >> > -		prepare_to_wait(&vcpu->wq, &wait, TASK_INTERRUPTIBLE);
> >> > +		prepare_to_swait(&vcpu->wq, &wait, TASK_INTERRUPTIBLE);
> >> >  
> >> >  		if (kvm_vcpu_check_block(vcpu) < 0)
> >> >  			break;
> >> > @@ -2028,7 +2027,7 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu)
> >> >  		schedule();
> >> >  	}
> >> >  
> >> > -	finish_wait(&vcpu->wq, &wait);
> >> > +	finish_swait(&vcpu->wq, &wait);
> >> >  	cur = ktime_get();
> >> >  
> >> >  out:
> > Should we not take this opportunity to get rid of these open-coded wait
> > loops?
> 
> I find them way more readable than a 6-argument __wait_event...

I could introduce wait_event_idle_cmd() and be at 3 if you think that
helps.

#define __wait_event_idle_cmd(wq, cond, cmd) \
	___wait_event(wq, cond, TASK_IDLE, 0, 0, cmd)

etc..

Its that awkward waited variable that makes it hard to use the 'regular'
2 parameter thing. Although you could of course do horrible things like:

	__wait_event_idle(vcpu->wq, ({
		bool done = kvm_cpu_check_block(vcpu) < 0;
		if (!done)
			waited = true;
		done;
	}));


  reply	other threads:[~2015-10-20 16:06 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-20  7:28 [PATCH v3 0/4] Simple wait queue support Daniel Wagner
2015-10-20  7:28 ` [PATCH v3 1/4] wait.[ch]: Introduce the simple waitqueue (swait) implementation Daniel Wagner
2015-10-26 12:04   ` Boqun Feng
2015-10-26 12:28     ` Peter Zijlstra
2015-10-26 12:59     ` Daniel Wagner
2015-10-26 13:26       ` Peter Zijlstra
2015-10-26 14:19         ` Boqun Feng
2015-11-04 10:33   ` Thomas Gleixner
2015-11-04 12:12     ` Daniel Wagner
2015-11-18 10:33     ` Peter Zijlstra
2015-11-18 15:07       ` Thomas Gleixner
2015-10-20  7:28 ` [PATCH v3 2/4] KVM: use simple waitqueue for vcpu->wq Daniel Wagner
2015-10-20 13:11   ` Paolo Bonzini
2015-10-20 14:00   ` Peter Zijlstra
2015-10-20 15:40     ` Paolo Bonzini
2015-10-20 16:06       ` Peter Zijlstra [this message]
2015-10-21  8:55     ` Paul Mackerras
2015-10-21  9:05       ` Peter Zijlstra
2015-10-21  9:10     ` Paul Mackerras
2015-10-21  9:24     ` Paul Mackerras
2015-10-21 11:13       ` Peter Zijlstra
2015-10-23 11:51         ` Daniel Wagner
2015-10-20  7:28 ` [PATCH v3 3/4] rcu: Do not call rcu_nocb_gp_cleanup() while holding rnp->lock Daniel Wagner
2015-10-20  7:28 ` [PATCH v3 4/4] rcu: use simple wait queues where possible in rcutree Daniel Wagner
2015-10-25 20:10 ` [PATCH v3 0/4] Simple wait queue support Paul E. McKenney
2015-10-26  6:34   ` Daniel Wagner

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=20151020160609.GH17308@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=daniel.wagner@bmw-carit.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=paul.gortmaker@windriver.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=tglx@linutronix.de \
    /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

Powered by JetHome