From: Minchan Kim <minchan@kernel.org>
To: Andrea Arcangeli <aarcange@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
kernel-team <kernel-team@lge.com>,
Nadav Amit <nadav.amit@gmail.com>,
Mel Gorman <mgorman@techsingularity.net>,
Hugh Dickins <hughd@google.com>
Subject: Re: [PATCH v2 4/4] mm: fix KSM data corruption
Date: Wed, 2 Aug 2017 09:58:39 +0900 [thread overview]
Message-ID: <20170802005839.GD6388@bbox> (raw)
In-Reply-To: <20170801193341.GA24406@redhat.com>
Hi Andrea,
On Tue, Aug 01, 2017 at 09:33:41PM +0200, Andrea Arcangeli wrote:
> Hello,
>
> On Tue, Aug 01, 2017 at 02:56:17PM +0900, Minchan Kim wrote:
> > CPU0 CPU1 CPU2 CPU3
> > ---- ---- ---- ----
> > Write the same
> > value on page
> >
> > [cache PTE as
> > dirty in TLB]
> >
> > MADV_FREE
> > pte_mkclean()
> >
> > 4 > clear_refs
> > pte_wrprotect()
> >
> > write_protect_page()
> > [ success, no flush ]
> >
> > pages_indentical()
> > [ ok ]
> >
> > Write to page
> > different value
> >
> > [Ok, using stale
> > PTE]
> >
> > replace_page()
> >
> > Later, CPU1, CPU2 and CPU3 would flush the TLB, but that is too late. CPU0
> > already wrote on the page, but KSM ignored this write, and it got lost.
> > "
> >
> > In above scenario, MADV_FREE is fixed by changing TLB batching API
> > including [set|clear]_tlb_flush_pending. Remained thing is soft-dirty part.
> >
> > This patch changes soft-dirty uses TLB batching API instead of flush_tlb_mm
> > and KSM checks pending TLB flush by using mm_tlb_flush_pending so that
> > it will flush TLB to avoid data lost if there are other parallel threads
> > pending TLB flush.
> >
> > [1] http://lkml.kernel.org/r/BD3A0EBE-ECF4-41D4-87FA-C755EA9AB6BD@gmail.com
> >
> > Note:
> > I failed to reproduce this problem through Nadav's test program which
> > need to tune timing in my system speed so didn't confirm it work.
> > Nadav, Could you test this patch on your test machine?
>
> Reviewed-by: Andrea Arcangeli <aarcange@redhat.com>
Thanks for the review!
--
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: Minchan Kim <minchan@kernel.org>
To: Andrea Arcangeli <aarcange@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
kernel-team <kernel-team@lge.com>,
Nadav Amit <nadav.amit@gmail.com>,
Mel Gorman <mgorman@techsingularity.net>,
Hugh Dickins <hughd@google.com>
Subject: Re: [PATCH v2 4/4] mm: fix KSM data corruption
Date: Wed, 2 Aug 2017 09:58:39 +0900 [thread overview]
Message-ID: <20170802005839.GD6388@bbox> (raw)
In-Reply-To: <20170801193341.GA24406@redhat.com>
Hi Andrea,
On Tue, Aug 01, 2017 at 09:33:41PM +0200, Andrea Arcangeli wrote:
> Hello,
>
> On Tue, Aug 01, 2017 at 02:56:17PM +0900, Minchan Kim wrote:
> > CPU0 CPU1 CPU2 CPU3
> > ---- ---- ---- ----
> > Write the same
> > value on page
> >
> > [cache PTE as
> > dirty in TLB]
> >
> > MADV_FREE
> > pte_mkclean()
> >
> > 4 > clear_refs
> > pte_wrprotect()
> >
> > write_protect_page()
> > [ success, no flush ]
> >
> > pages_indentical()
> > [ ok ]
> >
> > Write to page
> > different value
> >
> > [Ok, using stale
> > PTE]
> >
> > replace_page()
> >
> > Later, CPU1, CPU2 and CPU3 would flush the TLB, but that is too late. CPU0
> > already wrote on the page, but KSM ignored this write, and it got lost.
> > "
> >
> > In above scenario, MADV_FREE is fixed by changing TLB batching API
> > including [set|clear]_tlb_flush_pending. Remained thing is soft-dirty part.
> >
> > This patch changes soft-dirty uses TLB batching API instead of flush_tlb_mm
> > and KSM checks pending TLB flush by using mm_tlb_flush_pending so that
> > it will flush TLB to avoid data lost if there are other parallel threads
> > pending TLB flush.
> >
> > [1] http://lkml.kernel.org/r/BD3A0EBE-ECF4-41D4-87FA-C755EA9AB6BD@gmail.com
> >
> > Note:
> > I failed to reproduce this problem through Nadav's test program which
> > need to tune timing in my system speed so didn't confirm it work.
> > Nadav, Could you test this patch on your test machine?
>
> Reviewed-by: Andrea Arcangeli <aarcange@redhat.com>
Thanks for the review!
next prev parent reply other threads:[~2017-08-02 0:58 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-01 5:56 [PATCH v2 0/4] fix several TLB batch races Minchan Kim
2017-08-01 5:56 ` Minchan Kim
2017-08-01 5:56 ` [PATCH v2 1/4] mm: refactoring TLB gathering API Minchan Kim
2017-08-01 5:56 ` Minchan Kim
2017-08-01 10:30 ` Mel Gorman
2017-08-01 10:30 ` Mel Gorman
2017-08-02 0:46 ` Nadav Amit
2017-08-02 0:46 ` Nadav Amit
2017-08-02 0:53 ` Minchan Kim
2017-08-02 0:53 ` Minchan Kim
2017-08-02 0:53 ` Minchan Kim
2017-08-02 0:56 ` Minchan Kim
2017-08-02 0:56 ` Minchan Kim
2017-08-01 5:56 ` [PATCH v2 2/4] mm: make tlb_flush_pending global Minchan Kim
2017-08-01 5:56 ` Minchan Kim
2017-08-01 10:31 ` Mel Gorman
2017-08-01 10:31 ` Mel Gorman
2017-08-01 5:56 ` [PATCH v2 3/4] mm: fix MADV_[FREE|DONTNEED] TLB flush miss problem Minchan Kim
2017-08-01 5:56 ` Minchan Kim
2017-08-01 10:59 ` Mel Gorman
2017-08-01 10:59 ` Mel Gorman
2017-08-01 5:56 ` [PATCH v2 4/4] mm: fix KSM data corruption Minchan Kim
2017-08-01 5:56 ` Minchan Kim
2017-08-01 19:21 ` Nadav Amit
2017-08-01 19:21 ` Nadav Amit
2017-08-02 0:58 ` Minchan Kim
2017-08-02 0:58 ` Minchan Kim
2017-08-01 19:33 ` Andrea Arcangeli
2017-08-01 19:33 ` Andrea Arcangeli
2017-08-02 0:58 ` Minchan Kim [this message]
2017-08-02 0:58 ` Minchan Kim
2017-08-01 22:29 ` [PATCH v2 0/4] fix several TLB batch races Andrew Morton
2017-08-01 22:29 ` Andrew Morton
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=20170802005839.GD6388@bbox \
--to=minchan@kernel.org \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=hughd@google.com \
--cc=kernel-team@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=nadav.amit@gmail.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.