All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Gortmaker <paul.gortmaker@windriver.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: <rostedt@goodmis.org>, <tglx@linutronix.de>,
	<paulmck@linux.vnet.ibm.com>, <linux-rt-users@vger.kernel.org>
Subject: Re: [PATCH 1/2] list_bl.h: make list head locking RT safe
Date: Fri, 21 Jun 2013 11:25:28 -0400	[thread overview]
Message-ID: <20130621152528.GB19624@windriver.com> (raw)
In-Reply-To: <20130621122305.GC21228@linutronix.de>

[Re: [PATCH 1/2] list_bl.h: make list head locking RT safe] On 21/06/2013 (Fri 14:23) Sebastian Andrzej Siewior wrote:

> * Paul Gortmaker | 2013-06-10 17:36:48 [-0400]:
> 
> >--- a/include/linux/list_bl.h
> >+++ b/include/linux/list_bl.h
> >@@ -17,7 +18,7 @@
> >  * some fast and compact auxiliary data.
> >  */
> > 
> >-#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
> >+#if (defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)) && !defined(CONFIG_PREEMPT_RT_BASE)
> > #define LIST_BL_LOCKMASK	1UL
> > #else
> > #define LIST_BL_LOCKMASK	0UL
> 
> On RT we don't have the lock mask anymore and those LIST_BL_BUG_ON()
> check don't do anything. It would be nice if you could check if the lock
> in that given entry is taken or not.
> 
> All in all it looks good.

I guess the easiest way to make use of the existing checks is to
simply set/clear the bit inside the lock.  That will allow the
existing code to check if the list got smashed by something.

If the incremental patch below is what you had in mind, then I'll
resend a v2 with this change incorporated.

Thanks,
Paul.
--


diff --git a/include/linux/list_bl.h b/include/linux/list_bl.h
index 64ba33b..a3ff8d7 100644
--- a/include/linux/list_bl.h
+++ b/include/linux/list_bl.h
@@ -18,7 +18,7 @@
  * some fast and compact auxiliary data.
  */
 
-#if (defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)) && !defined(CONFIG_PREEMPT_RT_BASE)
+#if (defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK))
 #define LIST_BL_LOCKMASK	1UL
 #else
 #define LIST_BL_LOCKMASK	0UL
@@ -131,6 +131,7 @@ static inline void hlist_bl_lock(struct hlist_bl_head *b)
 	bit_spin_lock(0, (unsigned long *)b);
 #else
 	raw_spin_lock(&b->lock);
+	__set_bit(0, (unsigned long *)b);
 #endif
 }
 
@@ -139,6 +140,7 @@ static inline void hlist_bl_unlock(struct hlist_bl_head *b)
 #ifndef CONFIG_PREEMPT_RT_BASE
 	__bit_spin_unlock(0, (unsigned long *)b);
 #else
+	__clear_bit(0, (unsigned long *)b);
 	raw_spin_unlock(&b->lock);
 #endif
 }

  reply	other threads:[~2013-06-21 15:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-10 21:36 [PATCH 0/2] Avoid more bit_spin_lock usage on RT kernels Paul Gortmaker
2013-06-10 21:36 ` [PATCH 1/2] list_bl.h: make list head locking RT safe Paul Gortmaker
2013-06-21 12:23   ` Sebastian Andrzej Siewior
2013-06-21 15:25     ` Paul Gortmaker [this message]
2013-06-21 15:36       ` Sebastian Andrzej Siewior
2013-06-21 19:07         ` [PATCH v2] " Paul Gortmaker
2013-06-28 11:23           ` Sebastian Andrzej Siewior
2013-06-10 21:36 ` [PATCH 2/2] list_bl: make list head lock a raw lock Paul Gortmaker
2013-06-10 21:56 ` [PATCH 0/2] Avoid more bit_spin_lock usage on RT kernels Paul E. McKenney

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=20130621152528.GB19624@windriver.com \
    --to=paul.gortmaker@windriver.com \
    --cc=bigeasy@linutronix.de \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=rostedt@goodmis.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 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.