Skip to contentSkip to conversation

core kernel fixes

GIT PULL Ingo Molnar 1 participant 1 message Apr 3, 2016

Subsystems (4)
lore
Share & tools
lore

Ingo Molnar

author maintainer
#0 lore raw

Linus,

Please pull the latest core-urgent-for-linus git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git core-urgent-for-linus

# HEAD: 353def94606fda16d9ae1761b4b0583286481ec5 MAINTAINERS: Update my email address

This contains the nohz/atomic cleanup/fix for the fetch_or() ugliness you noted during the original nohz pull request, plus there's also misc fixes:

- fix liblockdep build bug
- fix uapi header build bug
- print more lockdep hash collision info to help debug recent reports of hash collisions
- update MAINTAINERS email address

Thanks,

Ingo

------------------>
Alfredo Alvarez Fernandez (1):
locking/lockdep: Print chain_key collision information

Denys Vlasenko (1):
uapi/linux/stddef.h: Provide __always_inline to userspace headers

Frederic Weisbecker (3):
locking/atomic: Introduce atomic_fetch_or() timers/nohz: Convert tick dependency mask to atomic_t locking/atomic, sched: Unexport fetch_or()

Masami Hiramatsu (1):
MAINTAINERS: Update my email address

Sedat Dilek (1):
tools/lib/lockdep: Fix unsupported 'basename -s' in run_tests.sh

 MAINTAINERS                    |  2 +-
 include/linux/atomic.h         | 34 +++++++++---------
 include/linux/sched.h          |  4 +--
 include/uapi/linux/stddef.h    |  4 +++
 kernel/locking/lockdep.c       | 79 ++++++++++++++++++++++++++++++++++++++++--
 kernel/sched/core.c            | 18 ++++++++++
 kernel/time/tick-sched.c       | 61 ++++++++++++++++----------------
 kernel/time/tick-sched.h       |  2 +-
 tools/lib/lockdep/run_tests.sh | 12 ++++---
 9 files changed, 158 insertions(+), 58 deletions(-)
MAINTAINERS +1 -1
index 378ebfff2d1f..ed121a5b9319 100644
@@ -6402,7 +6402,7 @@ KPROBES
 M:	Ananth N Mavinakayanahalli <[email protected]>
 M:	Anil S Keshavamurthy <[email protected]>
 M:	"David S. Miller" <[email protected]>
-M:	Masami Hiramatsu <[email protected]>
+M:	Masami Hiramatsu <[email protected]>
 S:	Maintained
 F:	Documentation/kprobes.txt
 F:	include/linux/kprobes.h
include/linux/atomic.h +17 -17
index df4f369254c0..506c3531832e 100644
@@ -559,25 +559,25 @@ static inline int atomic_dec_if_positive(atomic_t *v)
 #endif
 
 /**
- * fetch_or - perform *ptr |= mask and return old value of *ptr
- * @ptr: pointer to value
- * @mask: mask to OR on the value
- *
- * cmpxchg based fetch_or, macro so it works for different integer types
+ * atomic_fetch_or - perform *p |= mask and return old value of *p
+ * @p: pointer to atomic_t
+ * @mask: mask to OR on the atomic_t
  */
-#ifndef fetch_or
-#define fetch_or(ptr, mask)						\
-({	typeof(*(ptr)) __old, __val = *(ptr);				\
-	for (;;) {							\
-		__old = cmpxchg((ptr), __val, __val | (mask));		\
-		if (__old == __val)					\
-			break;						\
-		__val = __old;						\
-	}								\
-	__old;								\
-})
-#endif
+#ifndef atomic_fetch_or
+static inline int atomic_fetch_or(atomic_t *p, int mask)
+{
+	int old, val = atomic_read(p);
+
+	for (;;) {
+		old = atomic_cmpxchg(p, val, val | mask);
+		if (old == val)
+			break;
+		val = old;
+	}
 
+	return old;
+}
+#endif
 
 #ifdef CONFIG_GENERIC_ATOMIC64
 #include <asm-generic/atomic64.h>
include/linux/sched.h +2 -2
index 60bba7e032dc..52c4847b05e2 100644
@@ -720,7 +720,7 @@ struct signal_struct {
 	struct task_cputime cputime_expires;
 
 #ifdef CONFIG_NO_HZ_FULL
-	unsigned long tick_dep_mask;
+	atomic_t tick_dep_mask;
 #endif
 
 	struct list_head cpu_timers[3];
@@ -1549,7 +1549,7 @@ struct task_struct {
 #endif
 
 #ifdef CONFIG_NO_HZ_FULL
-	unsigned long tick_dep_mask;
+	atomic_t tick_dep_mask;
 #endif
 	unsigned long nvcsw, nivcsw; /* context switch counts */
 	u64 start_time;		/* monotonic time in nsec */
include/uapi/linux/stddef.h +4 -0
index aa9f10428743..621fa8ac4425 100644
@@ -1 +1,5 @@
 #include <linux/compiler.h>
+
+#ifndef __always_inline
+#define __always_inline inline
+#endif
kernel/locking/lockdep.c +77 -2

97 lines not on this page · raw message

kernel/sched/core.c +18 -0
index d8465eeab8b3..8b489fcac37b 100644
@@ -321,6 +321,24 @@ static inline void init_hrtick(void)
 }
 #endif	/* CONFIG_SCHED_HRTICK */
 
+/*
+ * cmpxchg based fetch_or, macro so it works for different integer types
+ */
+#define fetch_or(ptr, mask)						\
+	({								\
+		typeof(ptr) _ptr = (ptr);				\
+		typeof(mask) _mask = (mask);				\
+		typeof(*_ptr) _old, _val = *_ptr;			\
+									\
+		for (;;) {						\
+			_old = cmpxchg(_ptr, _val, _val | _mask);	\
+			if (_old == _val)				\
+				break;					\
+			_val = _old;					\
+		}							\
+	_old;								\
+})
+
 #if defined(CONFIG_SMP) && defined(TIF_POLLING_NRFLAG)
 /*
  * Atomically set TIF_NEED_RESCHED and test for TIF_POLLING_NRFLAG,
kernel/time/tick-sched.c +30 -31

141 lines not on this page · raw message

kernel/time/tick-sched.h +1 -1
index eb4e32566a83..bf38226e5c17 100644
@@ -60,7 +60,7 @@ struct tick_sched {
 	u64				next_timer;
 	ktime_t				idle_expires;
 	int				do_timer_last;
-	unsigned long			tick_dep_mask;
+	atomic_t			tick_dep_mask;
 };
 
 extern struct tick_sched *tick_get_tick_sched(int cpu);
tools/lib/lockdep/run_tests.sh +8 -4
index 5334ad9d39b7..1069d96248c1 100755
@@ -3,7 +3,7 @@
 make &> /dev/null
 
 for i in `ls tests/*.c`; do
-	testname=$(basename -s .c "$i")
+	testname=$(basename "$i" .c)
 	gcc -o tests/$testname -pthread -lpthread $i liblockdep.a -Iinclude -D__USE_LIBLOCKDEP &> /dev/null
 	echo -ne "$testname... "
 	if [ $(timeout 1 ./tests/$testname | wc -l) -gt 0 ]; then
@@ -11,11 +11,13 @@ for i in `ls tests/*.c`; do
 	else
 		echo "FAILED!"
 	fi
-	rm tests/$testname
+	if [ -f "tests/$testname" ]; then
+		rm tests/$testname
+	fi
 done
 
 for i in `ls tests/*.c`; do
-	testname=$(basename -s .c "$i")
+	testname=$(basename "$i" .c)
 	gcc -o tests/$testname -pthread -lpthread -Iinclude $i &> /dev/null
 	echo -ne "(PRELOAD) $testname... "
 	if [ $(timeout 1 ./lockdep ./tests/$testname | wc -l) -gt 0 ]; then
@@ -23,5 +25,7 @@ for i in `ls tests/*.c`; do
 	else
 		echo "FAILED!"
 	fi
-	rm tests/$testname
+	if [ -f "tests/$testname" ]; then
+		rm tests/$testname
+	fi
 done