Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 177629
b: refs/heads/master
c: 478c5ff
h: refs/heads/master
i:
  177627: 76fef14
v: v3
  • Loading branch information
Wu Fengguang authored and Andi Kleen committed Dec 16, 2009
1 parent 33e01fe commit e2046ea
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1a9b5b7fe0c5dad8a635288882d36785dea742f9
refs/heads/master: 478c5ffc0b50527bd2390f2daa46cc16276b8413
10 changes: 10 additions & 0 deletions trunk/Documentation/vm/hwpoison.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,16 @@ Only handle memory failures to pages associated with the file system defined
by block device major/minor. -1U is the wildcard value.
This should be only used for testing with artificial injection.


corrupt-filter-flags-mask
corrupt-filter-flags-value

When specified, only poison pages if ((page_flags & mask) == value).
This allows stress testing of many kinds of pages. The page_flags
are the same as in /proc/kpageflags. The flag bits are defined in
include/linux/kernel-page-flags.h and documented in
Documentation/vm/pagemap.txt

Architecture specific MCE injector

x86 has mce-inject, mce-test
Expand Down
1 change: 1 addition & 0 deletions trunk/mm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ config MEMORY_FAILURE
config HWPOISON_INJECT
tristate "Poison pages injector"
depends on MEMORY_FAILURE && DEBUG_KERNEL
select PROC_PAGE_MONITOR

config NOMMU_INITIAL_TRIM_EXCESS
int "Turn on mmap() excess space trimming before booting"
Expand Down
10 changes: 10 additions & 0 deletions trunk/mm/hwpoison-inject.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,16 @@ static int pfn_inject_init(void)
if (!dentry)
goto fail;

dentry = debugfs_create_u64("corrupt-filter-flags-mask", 0600,
hwpoison_dir, &hwpoison_filter_flags_mask);
if (!dentry)
goto fail;

dentry = debugfs_create_u64("corrupt-filter-flags-value", 0600,
hwpoison_dir, &hwpoison_filter_flags_value);
if (!dentry)
goto fail;

return 0;
fail:
pfn_inject_exit();
Expand Down
2 changes: 2 additions & 0 deletions trunk/mm/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,3 +255,5 @@ extern int hwpoison_filter(struct page *p);

extern u32 hwpoison_filter_dev_major;
extern u32 hwpoison_filter_dev_minor;
extern u64 hwpoison_filter_flags_mask;
extern u64 hwpoison_filter_flags_value;
20 changes: 20 additions & 0 deletions trunk/mm/memory-failure.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/page-flags.h>
#include <linux/kernel-page-flags.h>
#include <linux/sched.h>
#include <linux/ksm.h>
#include <linux/rmap.h>
Expand All @@ -50,8 +51,12 @@ atomic_long_t mce_bad_pages __read_mostly = ATOMIC_LONG_INIT(0);

u32 hwpoison_filter_dev_major = ~0U;
u32 hwpoison_filter_dev_minor = ~0U;
u64 hwpoison_filter_flags_mask;
u64 hwpoison_filter_flags_value;
EXPORT_SYMBOL_GPL(hwpoison_filter_dev_major);
EXPORT_SYMBOL_GPL(hwpoison_filter_dev_minor);
EXPORT_SYMBOL_GPL(hwpoison_filter_flags_mask);
EXPORT_SYMBOL_GPL(hwpoison_filter_flags_value);

static int hwpoison_filter_dev(struct page *p)
{
Expand Down Expand Up @@ -83,11 +88,26 @@ static int hwpoison_filter_dev(struct page *p)
return 0;
}

static int hwpoison_filter_flags(struct page *p)
{
if (!hwpoison_filter_flags_mask)
return 0;

if ((stable_page_flags(p) & hwpoison_filter_flags_mask) ==
hwpoison_filter_flags_value)
return 0;
else
return -EINVAL;
}

int hwpoison_filter(struct page *p)
{
if (hwpoison_filter_dev(p))
return -EINVAL;

if (hwpoison_filter_flags(p))
return -EINVAL;

return 0;
}
EXPORT_SYMBOL_GPL(hwpoison_filter);
Expand Down

0 comments on commit e2046ea

Please sign in to comment.