Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1455862 > unrolled thread

[PATCH 01/10] fault injection: fix a few documentation errors

Started byVegard Nossum <vegard.nossum@oracle.com>
First post2016-08-03 17:20 +0200
Last post2016-08-03 20:20 +0200
Articles 4 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 01/10] fault injection: fix a few documentation errors Vegard Nossum <vegard.nossum@oracle.com> - 2016-08-03 17:20 +0200
    [PATCH 05/10] fault injection: mutex_trylock() fault injection Vegard Nossum <vegard.nossum@oracle.com> - 2016-08-03 17:20 +0200
      Re: [PATCH 05/10] fault injection: mutex_trylock() fault injection kbuild test robot <lkp@intel.com> - 2016-08-03 18:10 +0200
      Re: [PATCH 05/10] fault injection: mutex_trylock() fault injection kbuild test robot <lkp@intel.com> - 2016-08-03 20:20 +0200

#1455862 — [PATCH 01/10] fault injection: fix a few documentation errors

FromVegard Nossum <vegard.nossum@oracle.com>
Date2016-08-03 17:20 +0200
Subject[PATCH 01/10] fault injection: fix a few documentation errors
Message-ID<s267D-4aR-3@gated-at.bofh.it>
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
---
 Documentation/fault-injection/fault-injection.txt | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Documentation/fault-injection/fault-injection.txt b/Documentation/fault-injection/fault-injection.txt
index 415484f..2ef8531 100644
--- a/Documentation/fault-injection/fault-injection.txt
+++ b/Documentation/fault-injection/fault-injection.txt
@@ -102,15 +102,15 @@ configuration of fault-injection capabilities.
 - /sys/kernel/debug/fail_page_alloc/ignore-gfp-highmem:
 
 	Format: { 'Y' | 'N' }
-	default is 'N', setting it to 'Y' won't inject failures into
+	default is 'Y', setting it to 'N' will also inject failures into
 	highmem/user allocations.
 
 - /sys/kernel/debug/failslab/ignore-gfp-wait:
 - /sys/kernel/debug/fail_page_alloc/ignore-gfp-wait:
 
 	Format: { 'Y' | 'N' }
-	default is 'N', setting it to 'Y' will inject failures
-	only into non-sleep allocations (GFP_ATOMIC allocations).
+	default is 'Y', setting it to 'N' will also inject failures into
+	allocations that may sleep (non-GFP_ATOMIC allocations).
 
 - /sys/kernel/debug/fail_page_alloc/min-order:
 
@@ -141,7 +141,7 @@ o #include <linux/fault-inject.h>
 
 o define the fault attributes
 
-  DECLARE_FAULT_INJECTION(name);
+  DECLARE_FAULT_ATTR(name);
 
   Please see the definition of struct fault_attr in fault-inject.h
   for details.
-- 
1.9.1

[toc] | [next] | [standalone]


#1455863 — [PATCH 05/10] fault injection: mutex_trylock() fault injection

FromVegard Nossum <vegard.nossum@oracle.com>
Date2016-08-03 17:20 +0200
Subject[PATCH 05/10] fault injection: mutex_trylock() fault injection
Message-ID<s267E-4aR-43@gated-at.bofh.it>
In reply to#1455862
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
---
 kernel/locking/mutex.c | 32 ++++++++++++++++++++++++++++++++
 lib/Kconfig.debug      |  6 ++++++
 2 files changed, 38 insertions(+)

diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c
index a70b90d..0651ca6 100644
--- a/kernel/locking/mutex.c
+++ b/kernel/locking/mutex.c
@@ -17,6 +17,7 @@
  *
  * Also see Documentation/locking/mutex-design.txt.
  */
+#include <linux/fault-inject.h>
 #include <linux/mutex.h>
 #include <linux/ww_mutex.h>
 #include <linux/sched.h>
@@ -887,6 +888,34 @@ static inline int __mutex_trylock_slowpath(atomic_t *lock_count)
 	return prev == 1;
 }
 
+#ifdef CONFIG_FAIL_MUTEX
+DECLARE_FAULT_ATTR(fail_mutex);
+
+static int __init setup_fail_mutex(char *str)
+{
+	return setup_fault_attr(&fail_mutex, str);
+}
+__setup("fail_mutex=", setup_fail_mutex);
+
+static int __init fail_mutex_debugfs(void)
+{
+	struct dentry *dir = fault_create_debugfs_attr("fail_mutex",
+		NULL, &fail_mutex);
+	return PTR_ERR_OR_ZERO(dir);
+}
+late_initcall(fail_mutex_debugfs);
+
+static inline bool should_fail_mutex(struct mutex *lock)
+{
+	return should_fail(&fail_mutex, 1);
+}
+#else
+static inline bool should_fail_mutex(struct mutex *lock)
+{
+	return false;
+}
+#endif
+
 /**
  * mutex_trylock - try to acquire the mutex, without waiting
  * @lock: the mutex to be acquired
@@ -905,6 +934,9 @@ int __sched mutex_trylock(struct mutex *lock)
 {
 	int ret;
 
+	if (should_fail_mutex(lock))
+		return 0;
+
 	ret = __mutex_fastpath_trylock(&lock->count, __mutex_trylock_slowpath);
 	if (ret)
 		mutex_set_owner(lock);
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 5896b6f..0043e66 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -1657,6 +1657,12 @@ config FAIL_FUTEX
 	help
 	  Provide fault-injection capability for futexes.
 
+config FAIL_MUTEX
+	bool "Fault-injection capability for mutexes"
+	depends on FAULT_INJECTION
+	help
+	  Provide fault-injection capability for mutex_trylock().
+
 config FAULT_INJECTION_DEBUG_FS
 	bool "Debugfs entries for fault-injection capabilities"
 	depends on FAULT_INJECTION && SYSFS && DEBUG_FS
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1455878 — Re: [PATCH 05/10] fault injection: mutex_trylock() fault injection

Fromkbuild test robot <lkp@intel.com>
Date2016-08-03 18:10 +0200
SubjectRe: [PATCH 05/10] fault injection: mutex_trylock() fault injection
Message-ID<s26U1-4HD-9@gated-at.bofh.it>
In reply to#1455863

[Multipart message — attachments visible in raw view] — view raw

Hi Vegard,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.7 next-20160803]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Vegard-Nossum/fault-injection-fix-a-few-documentation-errors/20160803-233940
config: x86_64-randconfig-x015-201631 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   In file included from kernel/locking/mutex.c:20:0:
>> include/linux/fault-inject.h:67:15: error: unknown type name 'bool'
    static inline bool should_failslab(struct kmem_cache *s, gfp_t gfpflags)
                  ^~~~
>> include/linux/fault-inject.h:67:58: error: unknown type name 'gfp_t'
    static inline bool should_failslab(struct kmem_cache *s, gfp_t gfpflags)
                                                             ^~~~~

vim +/bool +67 include/linux/fault-inject.h

6ff1cb35 Akinobu Mita           2006-12-08  61  
6ff1cb35 Akinobu Mita           2006-12-08  62  #endif /* CONFIG_FAULT_INJECTION */
6ff1cb35 Akinobu Mita           2006-12-08  63  
773ff60e Akinobu Mita           2008-12-23  64  #ifdef CONFIG_FAILSLAB
fab9963a Jesper Dangaard Brouer 2016-03-15  65  extern bool should_failslab(struct kmem_cache *s, gfp_t gfpflags);
773ff60e Akinobu Mita           2008-12-23  66  #else
fab9963a Jesper Dangaard Brouer 2016-03-15 @67  static inline bool should_failslab(struct kmem_cache *s, gfp_t gfpflags)
773ff60e Akinobu Mita           2008-12-23  68  {
773ff60e Akinobu Mita           2008-12-23  69  	return false;
773ff60e Akinobu Mita           2008-12-23  70  }

:::::: The code at line 67 was first introduced by commit
:::::: fab9963a69dbd71304357dbfe4ec5345f14cebdd mm: fault-inject take over bootstrap kmem_cache check

:::::: TO: Jesper Dangaard Brouer <brouer@redhat.com>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[toc] | [prev] | [next] | [standalone]


#1455946 — Re: [PATCH 05/10] fault injection: mutex_trylock() fault injection

Fromkbuild test robot <lkp@intel.com>
Date2016-08-03 20:20 +0200
SubjectRe: [PATCH 05/10] fault injection: mutex_trylock() fault injection
Message-ID<s28VP-65K-13@gated-at.bofh.it>
In reply to#1455863

[Multipart message — attachments visible in raw view] — view raw

Hi Vegard,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.7 next-20160803]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Vegard-Nossum/fault-injection-fix-a-few-documentation-errors/20160803-233940
config: openrisc-or1ksim_defconfig (attached as .config)
compiler: or32-linux-gcc (GCC) 4.5.1-or32-1.0rc1
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=openrisc 

All errors (new ones prefixed by >>):

   In file included from kernel/locking/mutex.c:20:0:
>> include/linux/fault-inject.h:67:20: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'should_failslab'

vim +67 include/linux/fault-inject.h

6ff1cb35 Akinobu Mita           2006-12-08  61  
6ff1cb35 Akinobu Mita           2006-12-08  62  #endif /* CONFIG_FAULT_INJECTION */
6ff1cb35 Akinobu Mita           2006-12-08  63  
773ff60e Akinobu Mita           2008-12-23  64  #ifdef CONFIG_FAILSLAB
fab9963a Jesper Dangaard Brouer 2016-03-15  65  extern bool should_failslab(struct kmem_cache *s, gfp_t gfpflags);
773ff60e Akinobu Mita           2008-12-23  66  #else
fab9963a Jesper Dangaard Brouer 2016-03-15 @67  static inline bool should_failslab(struct kmem_cache *s, gfp_t gfpflags)
773ff60e Akinobu Mita           2008-12-23  68  {
773ff60e Akinobu Mita           2008-12-23  69  	return false;
773ff60e Akinobu Mita           2008-12-23  70  }

:::::: The code at line 67 was first introduced by commit
:::::: fab9963a69dbd71304357dbfe4ec5345f14cebdd mm: fault-inject take over bootstrap kmem_cache check

:::::: TO: Jesper Dangaard Brouer <brouer@redhat.com>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web