All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fengguang Wu <fengguang.wu@intel.com>
To: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Andi Kleen <andi.kleen@intel.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Tony Luck <tony.luck@intel.com>, Rik van Riel <riel@redhat.com>,
	Jun'ichi Nomura <j-nomura@ce.jp.nec.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] HWPOISON: report sticky EIO for poisoned file
Date: Thu, 23 Aug 2012 17:22:11 +0800	[thread overview]
Message-ID: <20120823092211.GB12745@localhost> (raw)
In-Reply-To: <1345648655-4497-3-git-send-email-n-horiguchi@ah.jp.nec.com>

On Wed, Aug 22, 2012 at 11:17:34AM -0400, Naoya Horiguchi wrote:
> From: Wu Fengguang <fengguang.wu@intel.com>
> 
> This makes the EIO reports on write(), fsync(), or the NFS close()
> sticky enough. The only way to get rid of it may be
> 
> 	echo 3 > /proc/sys/vm/drop_caches

That's no longer valid with your next patch. If I understand it right,
the EIO will only go away after truncate. So it may also need to
update comments in memory-failure.c and Documentation/vm/hwpoison.txt

> Note that the impacted process will only be killed if it mapped the page.
> XXX
> via read()/write()/fsync() instead of memory mapped reads/writes, simply
> because it's very hard to find them.
 
Please remove the above scratched texts.

> Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
> ---
>  include/linux/pagemap.h | 13 +++++++++++++
>  mm/filemap.c            | 11 +++++++++++
>  mm/memory-failure.c     |  2 +-
>  3 files changed, 25 insertions(+), 1 deletion(-)
> 
> diff --git v3.6-rc1.orig/include/linux/pagemap.h v3.6-rc1/include/linux/pagemap.h
> index e42c762..4d8d821 100644
> --- v3.6-rc1.orig/include/linux/pagemap.h
> +++ v3.6-rc1/include/linux/pagemap.h
> @@ -24,6 +24,7 @@ enum mapping_flags {
>  	AS_ENOSPC	= __GFP_BITS_SHIFT + 1,	/* ENOSPC on async write */
>  	AS_MM_ALL_LOCKS	= __GFP_BITS_SHIFT + 2,	/* under mm_take_all_locks() */
>  	AS_UNEVICTABLE	= __GFP_BITS_SHIFT + 3,	/* e.g., ramdisk, SHM_LOCK */
> +	AS_HWPOISON	= __GFP_BITS_SHIFT + 4,	/* hardware memory corruption */
>  };
>  
>  static inline void mapping_set_error(struct address_space *mapping, int error)
> @@ -53,6 +54,18 @@ static inline int mapping_unevictable(struct address_space *mapping)
>  	return !!mapping;
>  }
>  
> +#ifdef CONFIG_MEMORY_FAILURE
> +static inline int mapping_hwpoison(struct address_space *mapping)
> +{
> +	return test_bit(AS_HWPOISON, &mapping->flags);
> +}
> +#else
> +static inline int mapping_hwpoison(struct address_space *mapping)
> +{
> +	return 0;
> +}
> +#endif
> +
>  static inline gfp_t mapping_gfp_mask(struct address_space * mapping)
>  {
>  	return (__force gfp_t)mapping->flags & __GFP_BITS_MASK;
> diff --git v3.6-rc1.orig/mm/filemap.c v3.6-rc1/mm/filemap.c
> index fa5ca30..8bdaf57 100644
> --- v3.6-rc1.orig/mm/filemap.c
> +++ v3.6-rc1/mm/filemap.c
> @@ -297,6 +297,8 @@ int filemap_fdatawait_range(struct address_space *mapping, loff_t start_byte,
>  		ret = -ENOSPC;
>  	if (test_and_clear_bit(AS_EIO, &mapping->flags))
>  		ret = -EIO;
> +	if (mapping_hwpoison(mapping))
> +		ret = -EIO;
>  
>  	return ret;
>  }
> @@ -447,6 +449,15 @@ int add_to_page_cache_locked(struct page *page, struct address_space *mapping,
>  	VM_BUG_ON(!PageLocked(page));
>  	VM_BUG_ON(PageSwapBacked(page));
>  
> +	/*
> +	 * Hardware corrupted page will be removed from mapping,
> +	 * so we want to deny (possibly) reloading the old data.
> +	 */
> +	if (unlikely(mapping_hwpoison(mapping))) {
> +		error = -EIO;
> +		goto out;
> +	}
> +
>  	error = mem_cgroup_cache_charge(page, current->mm,
>  					gfp_mask & GFP_RECLAIM_MASK);
>  	if (error)
> diff --git v3.6-rc1.orig/mm/memory-failure.c v3.6-rc1/mm/memory-failure.c
> index 79dfb2f..a1e7e00 100644
> --- v3.6-rc1.orig/mm/memory-failure.c
> +++ v3.6-rc1/mm/memory-failure.c
> @@ -652,7 +652,7 @@ static int me_pagecache_dirty(struct page *p, unsigned long pfn)
>  		 * the first EIO, but we're not worse than other parts
>  		 * of the kernel.
>  		 */
> -		mapping_set_error(mapping, EIO);
> +		set_bit(AS_HWPOISON, &mapping->flags);
>  	}
>  
>  	return me_pagecache_clean(p, pfn);
> -- 
> 1.7.11.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Fengguang Wu <fengguang.wu@intel.com>
To: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Andi Kleen <andi.kleen@intel.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Tony Luck <tony.luck@intel.com>, Rik van Riel <riel@redhat.com>,
	"Jun'ichi Nomura" <j-nomura@ce.jp.nec.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] HWPOISON: report sticky EIO for poisoned file
Date: Thu, 23 Aug 2012 17:22:11 +0800	[thread overview]
Message-ID: <20120823092211.GB12745@localhost> (raw)
In-Reply-To: <1345648655-4497-3-git-send-email-n-horiguchi@ah.jp.nec.com>

On Wed, Aug 22, 2012 at 11:17:34AM -0400, Naoya Horiguchi wrote:
> From: Wu Fengguang <fengguang.wu@intel.com>
> 
> This makes the EIO reports on write(), fsync(), or the NFS close()
> sticky enough. The only way to get rid of it may be
> 
> 	echo 3 > /proc/sys/vm/drop_caches

That's no longer valid with your next patch. If I understand it right,
the EIO will only go away after truncate. So it may also need to
update comments in memory-failure.c and Documentation/vm/hwpoison.txt

> Note that the impacted process will only be killed if it mapped the page.
> XXX
> via read()/write()/fsync() instead of memory mapped reads/writes, simply
> because it's very hard to find them.
 
Please remove the above scratched texts.

> Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
> ---
>  include/linux/pagemap.h | 13 +++++++++++++
>  mm/filemap.c            | 11 +++++++++++
>  mm/memory-failure.c     |  2 +-
>  3 files changed, 25 insertions(+), 1 deletion(-)
> 
> diff --git v3.6-rc1.orig/include/linux/pagemap.h v3.6-rc1/include/linux/pagemap.h
> index e42c762..4d8d821 100644
> --- v3.6-rc1.orig/include/linux/pagemap.h
> +++ v3.6-rc1/include/linux/pagemap.h
> @@ -24,6 +24,7 @@ enum mapping_flags {
>  	AS_ENOSPC	= __GFP_BITS_SHIFT + 1,	/* ENOSPC on async write */
>  	AS_MM_ALL_LOCKS	= __GFP_BITS_SHIFT + 2,	/* under mm_take_all_locks() */
>  	AS_UNEVICTABLE	= __GFP_BITS_SHIFT + 3,	/* e.g., ramdisk, SHM_LOCK */
> +	AS_HWPOISON	= __GFP_BITS_SHIFT + 4,	/* hardware memory corruption */
>  };
>  
>  static inline void mapping_set_error(struct address_space *mapping, int error)
> @@ -53,6 +54,18 @@ static inline int mapping_unevictable(struct address_space *mapping)
>  	return !!mapping;
>  }
>  
> +#ifdef CONFIG_MEMORY_FAILURE
> +static inline int mapping_hwpoison(struct address_space *mapping)
> +{
> +	return test_bit(AS_HWPOISON, &mapping->flags);
> +}
> +#else
> +static inline int mapping_hwpoison(struct address_space *mapping)
> +{
> +	return 0;
> +}
> +#endif
> +
>  static inline gfp_t mapping_gfp_mask(struct address_space * mapping)
>  {
>  	return (__force gfp_t)mapping->flags & __GFP_BITS_MASK;
> diff --git v3.6-rc1.orig/mm/filemap.c v3.6-rc1/mm/filemap.c
> index fa5ca30..8bdaf57 100644
> --- v3.6-rc1.orig/mm/filemap.c
> +++ v3.6-rc1/mm/filemap.c
> @@ -297,6 +297,8 @@ int filemap_fdatawait_range(struct address_space *mapping, loff_t start_byte,
>  		ret = -ENOSPC;
>  	if (test_and_clear_bit(AS_EIO, &mapping->flags))
>  		ret = -EIO;
> +	if (mapping_hwpoison(mapping))
> +		ret = -EIO;
>  
>  	return ret;
>  }
> @@ -447,6 +449,15 @@ int add_to_page_cache_locked(struct page *page, struct address_space *mapping,
>  	VM_BUG_ON(!PageLocked(page));
>  	VM_BUG_ON(PageSwapBacked(page));
>  
> +	/*
> +	 * Hardware corrupted page will be removed from mapping,
> +	 * so we want to deny (possibly) reloading the old data.
> +	 */
> +	if (unlikely(mapping_hwpoison(mapping))) {
> +		error = -EIO;
> +		goto out;
> +	}
> +
>  	error = mem_cgroup_cache_charge(page, current->mm,
>  					gfp_mask & GFP_RECLAIM_MASK);
>  	if (error)
> diff --git v3.6-rc1.orig/mm/memory-failure.c v3.6-rc1/mm/memory-failure.c
> index 79dfb2f..a1e7e00 100644
> --- v3.6-rc1.orig/mm/memory-failure.c
> +++ v3.6-rc1/mm/memory-failure.c
> @@ -652,7 +652,7 @@ static int me_pagecache_dirty(struct page *p, unsigned long pfn)
>  		 * the first EIO, but we're not worse than other parts
>  		 * of the kernel.
>  		 */
> -		mapping_set_error(mapping, EIO);
> +		set_bit(AS_HWPOISON, &mapping->flags);
>  	}
>  
>  	return me_pagecache_clean(p, pfn);
> -- 
> 1.7.11.4

  reply	other threads:[~2012-08-23  9:22 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-22 15:17 [PATCH 0/3 v2] HWPOISON: improve dirty pagecache error reporting Naoya Horiguchi
2012-08-22 15:17 ` Naoya Horiguchi
2012-08-22 15:17 ` [PATCH 1/3] HWPOISON: fix action_result() to print out dirty/clean Naoya Horiguchi
2012-08-22 15:17   ` Naoya Horiguchi
2012-08-23  9:33   ` Fengguang Wu
2012-08-23  9:33     ` Fengguang Wu
2012-08-23 20:31     ` Naoya Horiguchi
2012-08-23 20:31       ` Naoya Horiguchi
2012-08-22 15:17 ` [PATCH 2/3] HWPOISON: report sticky EIO for poisoned file Naoya Horiguchi
2012-08-22 15:17   ` Naoya Horiguchi
2012-08-23  9:22   ` Fengguang Wu [this message]
2012-08-23  9:22     ` Fengguang Wu
2012-08-23 20:31     ` Naoya Horiguchi
2012-08-23 20:31       ` Naoya Horiguchi
2012-08-22 15:17 ` [PATCH 3/3] HWPOISON: prevent inode cache removal to keep AS_HWPOISON sticky Naoya Horiguchi
2012-08-22 15:17   ` Naoya Horiguchi
2012-08-23  9:11   ` Fengguang Wu
2012-08-23  9:11     ` Fengguang Wu
2012-08-23 20:31     ` Naoya Horiguchi
2012-08-23 20:31       ` Naoya Horiguchi
2012-08-24 21:52       ` Naoya Horiguchi
2012-08-24 21:52         ` Naoya Horiguchi
2012-08-24  1:31   ` Dave Chinner
2012-08-24  1:31     ` Dave Chinner
2012-08-24  2:39     ` Naoya Horiguchi
2012-08-24  2:39       ` Naoya Horiguchi
2012-08-24  4:39       ` Dave Chinner
2012-08-24  4:39         ` Dave Chinner
2012-08-24 17:24         ` Naoya Horiguchi
2012-08-24 17:24           ` Naoya Horiguchi
2012-08-26 22:26           ` Dave Chinner
2012-08-26 22:26             ` Dave Chinner
2012-08-27 22:05             ` Naoya Horiguchi
2012-08-27 22:05               ` Naoya Horiguchi
2012-08-29  2:59               ` Dave Chinner
2012-08-29  2:59                 ` Dave Chinner
2012-08-29  5:32                 ` Jun'ichi Nomura
2012-08-29  5:32                   ` Jun'ichi Nomura
2012-09-03  0:39                   ` Dave Chinner
2012-09-03  0:39                     ` Dave Chinner
2012-08-22 20:22 ` [PATCH 0/3 v2] HWPOISON: improve dirty pagecache error reporting Andi Kleen
2012-08-22 20:22   ` Andi Kleen
2012-08-22 21:14   ` Naoya Horiguchi
2012-08-22 21:14     ` Naoya Horiguchi

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=20120823092211.GB12745@localhost \
    --to=fengguang.wu@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi.kleen@intel.com \
    --cc=j-nomura@ce.jp.nec.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=riel@redhat.com \
    --cc=tony.luck@intel.com \
    /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.