linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Wagner <daniel.wagner@bmw-carit.de>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: <linux-kernel@vger.kernel.org>, <linux-rt-users@vger.kernel.org>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	Paul Gortmaker <paul.gortmaker@windriver.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Subject: Re: [PATCH v3 1/4] wait.[ch]: Introduce the simple waitqueue (swait) implementation
Date: Wed, 4 Nov 2015 13:12:44 +0100	[thread overview]
Message-ID: <5639F63C.9040609@bmw-carit.de> (raw)
In-Reply-To: <alpine.DEB.2.11.1511041124530.4032@nanos>

On 11/04/2015 11:33 AM, Thomas Gleixner wrote:
> On Tue, 20 Oct 2015, Daniel Wagner wrote:
>> +
>> +extern void swake_up(struct swait_queue_head *q);
>> +extern void swake_up_all(struct swait_queue_head *q);
>> +extern void swake_up_locked(struct swait_queue_head *q);
> 
> I intentionally named these functions swait_wake* in my initial
> implementation for two reasons:
> 
>   - typoing wake_up vs. swake_up only emits a compiler warning and does
>     not break the build

I played a bit around on this and came up with the patch below. The type
check results in an error.
    
>   - I really prefer new infrastructure to have a consistent prefix
>     which reflects the "subsystem". That's simpler to read and simpler
>     to grep for.
> 
>> +extern void __prepare_to_swait(struct swait_queue_head *q, struct swait_queue *wait);
>> +extern void prepare_to_swait(struct swait_queue_head *q, struct swait_queue *wait, int state);
>> +extern long prepare_to_swait_event(struct swait_queue_head *q, struct swait_queue *wait, int state);
>> +
>> +extern void __finish_swait(struct swait_queue_head *q, struct swait_queue *wait);
>> +extern void finish_swait(struct swait_queue_head *q, struct swait_queue *wait);
> 
> Can we please go with the original names?
> 
> swait_prepare()
> swait_prepare_locked()
> swait_finish()
> swait_finish_locked()
> 
> Hmm?

I defer to Peter :)

>> +#define swait_event(wq, condition)					\
> 
> Here we have the same swait vs. wait problem as above. So either we
> come up with a slightly different name or have an explicit type check
> in __swait_event event.

What about something like this:

diff --git a/include/linux/swait.h b/include/linux/swait.h
index c1f9c62..f59369d 100644
--- a/include/linux/swait.h
+++ b/include/linux/swait.h
@@ -6,6 +6,9 @@
 #include <linux/spinlock.h>
 #include <asm/current.h>
 
+#define compiletime_assert_same_type(a, b) \
+       compiletime_assert(__same_type(a, b), "Need to match correct type");
+
 /*
  * Simple wait queues
  *
@@ -66,6 +69,7 @@ extern void __init_swait_queue_head(struct swait_queue_head *q, const char *name
 #define init_swait_queue_head(q)                               \
        do {                                                    \
                static struct lock_class_key __key;             \
+               compiletime_assert_same_type(struct swait_queue_head *, q); \
                __init_swait_queue_head((q), #q, &__key);       \
        } while (0)
 

  reply	other threads:[~2015-11-04 12:12 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 [this message]
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
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=5639F63C.9040609@bmw-carit.de \
    --to=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=peterz@infradead.org \
    --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;
as well as URLs for NNTP newsgroup(s).