From: Wu Fengguang <fengguang.wu@intel.com>
To: Minchan Kim <minchan.kim@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>,
Andi Kleen <ak@linux.intel.com>, Ingo Molnar <mingo@elte.hu>,
Mel Gorman <mel@csn.ul.ie>, Thomas Gleixner <tglx@linutronix.de>,
"H. Peter Anvin" <hpa@zytor.com>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Nick Piggin <npiggin@suse.de>,
Hugh Dickins <hugh.dickins@tiscali.co.uk>,
Andi Kleen <andi@firstfloor.org>,
"riel@redhat.com" <riel@redhat.com>,
"chris.mason@oracle.com" <chris.mason@oracle.com>,
"linux-mm@kvack.org" <linux-mm@kvack.org>
Subject: Re: [PATCH 09/22] HWPOISON: Handle hardware poisoned pages in try_to_unmap
Date: Wed, 17 Jun 2009 22:12:37 +0800 [thread overview]
Message-ID: <20090617141237.GA8528@localhost> (raw)
In-Reply-To: <28c262360906170708u467f9324qf218c0c6f5fa434f@mail.gmail.com>
On Wed, Jun 17, 2009 at 10:08:13PM +0800, Minchan Kim wrote:
> On Wed, Jun 17, 2009 at 11:03 PM, Wu Fengguang<fengguang.wu@intel.com> wrote:
> > On Wed, Jun 17, 2009 at 09:43:29PM +0800, Minchan Kim wrote:
> >> On Wed, Jun 17, 2009 at 10:37 PM, Wu Fengguang<fengguang.wu@intel.com> wrote:
> >> > On Wed, Jun 17, 2009 at 09:27:36PM +0800, Minchan Kim wrote:
> >> >> On Wed, Jun 17, 2009 at 4:23 PM, Wu Fengguang<fengguang.wu@intel.com> wrote:
> >> >> > On Wed, Jun 17, 2009 at 08:28:26AM +0800, Minchan Kim wrote:
> >> >> >> On Tue, 16 Jun 2009 21:49:44 +0800
> >> >> >> Wu Fengguang <fengguang.wu@intel.com> wrote:
> >> >> >>
> >> >> >> > On Tue, Jun 16, 2009 at 08:03:08AM +0800, Minchan Kim wrote:
> >> >> >> > > On Mon, 15 Jun 2009 23:26:12 +0800
> >> >> >> > > Wu Fengguang <fengguang.wu@intel.com> wrote:
> >> >> >> > >
> >> >> >> > > > On Mon, Jun 15, 2009 at 09:09:03PM +0800, Minchan Kim wrote:
> >> >> >> > > > > On Mon, Jun 15, 2009 at 11:45 AM, Wu Fengguang<fengguang.wu@intel.com> wrote:
> >> >> >> > > > > > From: Andi Kleen <ak@linux.intel.com>
> >> >> >> > > > > >
> >> >> >> > > > > > When a page has the poison bit set replace the PTE with a poison entry.
> >> >> >> > > > > > This causes the right error handling to be done later when a process runs
> >> >> >> > > > > > into it.
> >> >> >> > > > > >
> >> >> >> > > > > > Also add a new flag to not do that (needed for the memory-failure handler
> >> >> >> > > > > > later)
> >> >> >> > > > > >
> >> >> >> > > > > > Reviewed-by: Wu Fengguang <fengguang.wu@intel.com>
> >> >> >> > > > > > Signed-off-by: Andi Kleen <ak@linux.intel.com>
> >> >> >> > > > > >
> >> >> >> > > > > > ---
> >> >> >> > > > > > A include/linux/rmap.h | A A 1 +
> >> >> >> > > > > > A mm/rmap.c A A A A A A | A A 9 ++++++++-
> >> >> >> > > > > > A 2 files changed, 9 insertions(+), 1 deletion(-)
> >> >> >> > > > > >
> >> >> >> > > > > > --- sound-2.6.orig/mm/rmap.c
> >> >> >> > > > > > +++ sound-2.6/mm/rmap.c
> >> >> >> > > > > > @@ -958,7 +958,14 @@ static int try_to_unmap_one(struct page
> >> >> >> > > > > > A A A A /* Update high watermark before we lower rss */
> >> >> >> > > > > > A A A A update_hiwater_rss(mm);
> >> >> >> > > > > >
> >> >> >> > > > > > - A A A if (PageAnon(page)) {
> >> >> >> > > > > > + A A A if (PageHWPoison(page) && !(flags & TTU_IGNORE_HWPOISON)) {
> >> >> >> > > > > > + A A A A A A A if (PageAnon(page))
> >> >> >> > > > > > + A A A A A A A A A A A dec_mm_counter(mm, anon_rss);
> >> >> >> > > > > > + A A A A A A A else if (!is_migration_entry(pte_to_swp_entry(*pte)))
> >> >> >> > > > >
> >> >> >> > > > > Isn't it straightforward to use !is_hwpoison_entry ?
> >> >> >> > > >
> >> >> >> > > > Good catch! A It looks like a redundant check: the
> >> >> >> > > > page_check_address() at the beginning of the function guarantees that
> >> >> >> > > > !is_migration_entry() or !is_migration_entry() tests will all be TRUE.
> >> >> >> > > > So let's do this?
> >> >> >> > > It seems you expand my sight :)
> >> >> >> > >
> >> >> >> > > I don't know migration well.
> >> >> >> > > How page_check_address guarantee it's not migration entry ?
> >> >> >> >
> >> >> >> > page_check_address() calls pte_present() which returns the
> >> >> >> > (_PAGE_PRESENT | _PAGE_PROTNONE) bits. While x86-64 defines
> >> >> >> >
> >> >> >> > #define __swp_entry(type, offset) A A A ((swp_entry_t) { \
> >> >> >> > A A A A A A A A A A A A A A A A A A A A A ((type) << (_PAGE_BIT_PRESENT + 1)) \
> >> >> >> > A A A A A A A A A A A A A A A A A A A A A | ((offset) << SWP_OFFSET_SHIFT) })
> >> >> >> >
> >> >> >> > where SWP_OFFSET_SHIFT is defined to the bigger one of
> >> >> >> > max(_PAGE_BIT_PROTNONE + 1, _PAGE_BIT_FILE + 1) = max(8+1, 6+1) = 9.
> >> >> >> >
> >> >> >> > So __swp_entry(type, offset) := (type << 1) | (offset << 9)
> >> >> >> >
> >> >> >> > We know that the swap type is 5 bits. So the bit 0 _PAGE_PRESENT and bit 8
> >> >> >> > _PAGE_PROTNONE will all be zero for swap entries.
> >> >> >> >
> >> >> >>
> >> >> >> Thanks for kind explanation :)
> >> >> >
> >> >> > You are welcome~
> >> >> >
> >> >> >> >
> >> >> >> > > In addtion, If the page is poison while we are going to
> >> >> >> > > migration((PAGE_MIGRATION && migration) == TRUE), we should decrease
> >> >> >> > > file_rss ?
> >> >> >> >
> >> >> >> > It will die on trying to migrate the poisoned page so we don't care
> >> >> >> > the accounting. But normally the poisoned page shall already be
> >> >> >>
> >> >> >>
> >> >> >> Okay. then, how about this ?
> >> >> >> We should not increase file_rss on trying to migrate the poisoned page
> >> >> >>
> >> >> >> - A A A A A A A else if (!is_migration_entry(pte_to_swp_entry(*pte)))
> >> >> >> + A A A A A A A else if (!(PAGE_MIGRATION && migration))
> >> >> >
> >> >> > This is good if we are going to stop the hwpoison page from being
> >> >> > consumed by move_to_new_page(), but I highly doubt we'll ever add
> >> >> > PageHWPoison() checks into the migration code.
> >> >> >
> >> >> > Because this race window is small enough:
> >> >> >
> >> >> > A A A A TestSetPageHWPoison(p);
> >> >> > A A A A A A A A A A A A A A A A A lock_page(page);
> >> >> > A A A A A A A A A A A A A A A A A try_to_unmap(page, TTU_MIGRATION|...);
> >> >> > A A A A lock_page_nosync(p);
> >> >> >
> >> >> > such small race windows can be found all over the kernel, it's just
> >> >> > insane to try to fix any of them.
> >> >>
> >> >> Sorry for too late response.
> >> >>
> >> >> I see your point.
> >> >> My opinion is that at least we must be notified when such situation happen.
> >> >> So I think it would be better to add some warning to fix up it when it
> >> >> happen even thought A it is small race window.
> >> >
> >> > Notification is also pointless here: we'll die hard on
> >> > accessing/consuming the poisoned page anyway :(
> >>
> >> My intention wasn't to recover it.
> >
> > Yes, that's not the point.
> >
> >> It just add something like WARN_ON.
> >> You said it is small window enough. but I think it can happen more
> >> hight probability in migration-workload.(At a moment, I don't know
> >> what kinds of app)
> >> For such case, If we can hear reporting of warning, at that time we
> >> can consider migration handling for HWPoison.
> >
> > The point is, any page can go corrupted any time. We don't need to add
> > 1000 PageHWPoison() tests in the kernel like this. We don't aim for
> > 100% protection, that's impossible. I'd be very contented if ever it
> > can reach 80% coverage :)
>
> Okay.
> If it is your goal, I also think migration portion of all is very small.
> Thanks for kind reply for my boring discussion.
>
> Reviewed-by : Minchan Kim <minchan.kim@gmail.com>
Thank you, I'll add comments to clearly state that goal and its rational :)
--
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>
next prev parent reply other threads:[~2009-06-17 14:12 UTC|newest]
Thread overview: 79+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-15 2:45 [PATCH 00/22] HWPOISON: Intro (v5) Wu Fengguang
2009-06-15 2:45 ` [PATCH 01/22] HWPOISON: Add page flag for poisoned pages Wu Fengguang
2009-06-15 2:45 ` [PATCH 02/22] HWPOISON: Export some rmap vma locking to outside world Wu Fengguang
2009-06-15 2:45 ` [PATCH 03/22] HWPOISON: Add support for poison swap entries v2 Wu Fengguang
2009-06-15 2:45 ` [PATCH 04/22] HWPOISON: Add new SIGBUS error codes for hardware poison signals Wu Fengguang
2009-06-15 2:45 ` [PATCH 05/22] HWPOISON: Add basic support for poisoned pages in fault handler v3 Wu Fengguang
2009-06-15 2:45 ` [PATCH 06/22] HWPOISON: x86: Add VM_FAULT_HWPOISON handling to x86 page fault handler v2 Wu Fengguang
2009-06-15 2:45 ` [PATCH 07/22] HWPOISON: define VM_FAULT_HWPOISON to 0 when feature is disabled Wu Fengguang
2009-06-15 2:45 ` [PATCH 08/22] HWPOISON: Use bitmask/action code for try_to_unmap behaviour Wu Fengguang
2009-06-15 2:45 ` [PATCH 09/22] HWPOISON: Handle hardware poisoned pages in try_to_unmap Wu Fengguang
2009-06-15 13:09 ` Minchan Kim
2009-06-15 15:26 ` Wu Fengguang
2009-06-16 0:03 ` Minchan Kim
2009-06-16 13:49 ` Wu Fengguang
2009-06-17 0:28 ` Minchan Kim
2009-06-17 7:23 ` Wu Fengguang
2009-06-17 13:27 ` Minchan Kim
2009-06-17 13:37 ` Wu Fengguang
2009-06-17 13:43 ` Minchan Kim
2009-06-17 14:03 ` Wu Fengguang
2009-06-17 14:08 ` Minchan Kim
2009-06-17 14:12 ` Wu Fengguang [this message]
[not found] ` <28c262360906170644w65c08a8y2d2805fb08045804@mail.gmail.com>
[not found] ` <20090617135543.GA8079@localhost>
[not found] ` <28c262360906170703h3363b68dp74471358f647921e@mail.gmail.com>
2009-06-18 12:14 ` Wu Fengguang
2009-06-18 13:31 ` Minchan Kim
2009-06-19 1:58 ` Wu Fengguang
2009-06-15 2:45 ` [PATCH 10/22] HWPOISON: check and isolate corrupted free pages v2 Wu Fengguang
2009-06-15 9:41 ` KAMEZAWA Hiroyuki
2009-06-15 10:16 ` Wu Fengguang
2009-06-15 23:52 ` KAMEZAWA Hiroyuki
2009-06-16 0:34 ` Wu Fengguang
2009-06-16 11:29 ` Hugh Dickins
2009-06-16 11:40 ` Wu Fengguang
2009-06-15 2:45 ` [PATCH 11/22] HWPOISON: Refactor truncate to allow direct truncating of page v3 Wu Fengguang
2009-06-15 2:45 ` [PATCH 12/22] HWPOISON: The high level memory error handler in the VM v7 Wu Fengguang
2009-06-15 2:45 ` [PATCH 13/22] HWPOISON: Add madvise() based injector for hardware poisoned pages v3 Wu Fengguang
2009-06-15 2:45 ` [PATCH 14/22] HWPOISON: Add simple debugfs interface to inject hwpoison on arbitary PFNs Wu Fengguang
2009-06-15 2:45 ` [PATCH 15/22] HWPOISON: early kill cleanups and fixes Wu Fengguang
2009-06-15 2:45 ` [PATCH 16/22] mm: move page flag numbers for user space to page-flags.h Wu Fengguang
2009-06-15 2:45 ` [PATCH 17/22] HWPOISON: introduce struct hwpoison_control Wu Fengguang
2009-06-15 2:45 ` [PATCH 18/22] HWPOISON: use compound head page Wu Fengguang
2009-06-15 2:45 ` [PATCH 19/22] HWPOISON: detect free buddy pages explicitly Wu Fengguang
2009-06-15 2:45 ` [PATCH 20/22] HWPOISON: collect infos that reflect the impact of the memory corruption Wu Fengguang
2009-06-15 2:45 ` [PATCH 21/22] HWPOISON: send uevent to report " Wu Fengguang
2009-06-15 6:29 ` Andi Kleen
2009-06-15 9:56 ` Wu Fengguang
2009-06-16 0:35 ` Greg KH
2009-06-15 2:45 ` [PATCH 22/22] HWPOISON: FOR TESTING: Enable memory failure code unconditionally Wu Fengguang
2009-06-15 3:18 ` [PATCH 00/22] HWPOISON: Intro (v5) Balbir Singh
2009-06-15 4:27 ` Wu Fengguang
2009-06-15 6:44 ` Nick Piggin
2009-06-15 7:09 ` Andi Kleen
2009-06-15 7:19 ` Nick Piggin
2009-06-15 12:10 ` Wu Fengguang
2009-06-15 12:25 ` Nick Piggin
2009-06-15 14:22 ` Wu Fengguang
2009-06-17 6:37 ` [RFC][PATCH] HWPOISON: only early kill processes who installed SIGBUS handler Wu Fengguang
2009-06-17 8:04 ` Nick Piggin
2009-06-17 9:55 ` Wu Fengguang
2009-06-17 10:00 ` Nick Piggin
2009-06-17 11:56 ` Wu Fengguang
2009-06-18 9:56 ` Wu Fengguang
2009-06-15 8:14 ` [PATCH 00/22] HWPOISON: Intro (v5) Nick Piggin
2009-06-15 10:09 ` Wu Fengguang
2009-06-15 10:36 ` Nick Piggin
2009-06-15 11:41 ` Wu Fengguang
2009-06-15 12:51 ` Hugh Dickins
2009-06-15 13:00 ` Alan Cox
2009-06-15 13:29 ` Andi Kleen
2009-06-15 13:28 ` H. Peter Anvin
2009-06-15 14:48 ` Alan Cox
2009-06-15 15:24 ` Andi Kleen
2009-06-15 15:28 ` Alan Cox
2009-06-15 16:19 ` Andi Kleen
2009-06-15 16:28 ` Alan Cox
2009-06-15 17:07 ` Andi Kleen
2009-06-16 19:44 ` Russ Anderson
2009-06-16 20:28 ` H. Peter Anvin
2009-06-16 20:54 ` Russ Anderson
2009-06-16 20:58 ` H. Peter Anvin
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=20090617141237.GA8528@localhost \
--to=fengguang.wu@intel.com \
--cc=a.p.zijlstra@chello.nl \
--cc=ak@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=chris.mason@oracle.com \
--cc=hpa@zytor.com \
--cc=hugh.dickins@tiscali.co.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mel@csn.ul.ie \
--cc=minchan.kim@gmail.com \
--cc=mingo@elte.hu \
--cc=npiggin@suse.de \
--cc=riel@redhat.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox