linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Mohamed Alzayat <alzayat@mpi-sws.org>,
	Peter Zijlstra <peterz@infradead.org>,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
Cc: linux-mm@kvack.org
Subject: Re: Potential bug in soft-dirty bits (with test case)
Date: Mon, 30 Nov 2020 12:51:59 +0100	[thread overview]
Message-ID: <2e60ad6d-7bdf-e19e-4ad9-6942f76088d3@suse.cz> (raw)
In-Reply-To: <CA+32v5wCAQ9O+7sioyTroqBqG=MfvZzErVFbcE2EbbwEP0=ZZA@mail.gmail.com>

On 11/30/20 11:37 AM, Mohamed Alzayat wrote:
> On Fri, Nov 27, 2020 at 5:40 PM Vlastimil Babka <vbabka@suse.cz> wrote:
>>
>> On 11/25/20 3:15 PM, Mohamed Alzayat wrote:
>> > Hi Everyone,
>> >
>> > I have noticed a change in the synchrony of updating the soft-dirty
>> > bits in recent kernel versions (5.6+). More precisely, up to kernel
>> > v5.5, the soft-dirty bits as parsed from /proc/pid/pagemap accurately
>> > capture the dirtied pages. Recently, I started testing on kernels v5.6
>> > - v5.9, and I noticed that the soft-dirty bits are not immediately
>> > updated.
>> >
>> > I have prepared a short test that repeatedly causes at least one
>> > memory page to be dirtied, then scans /proc/pid/pagemap counting the
>> > soft-dirty bits. The test fails if this count is zero. In my
>> > observation, this test fails once in every 10-20 trials. The test
>> > defaults to 100 trials and can be found at
>> > https://gitlab.mpi-sws.org/-/snippets/1696
>> >
>> > Is this non-synchronous propagation of soft dirty bits intended? If
>>
>> AFAIK, not. The tracking is done by write-protecting the pages to cause a page
>> fault, so it should be quite synchronous update of page table entries, and
>> reading pagemap is a page table walk of those very entries.
>>
>> But as you have the test, it should be possible to git bisect it? Just do enough
>> trials to be sure enough that no fail means indeed a "good" kernel.
> 
> Thanks for confirming, Vlastimil!
> 
> The first bad commit is: 0758cd8304942292e95a0f750c374533db378b32
> asm-generic/tlb: avoid potential double flush
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0758cd8304942292e95a0f750c374533db378b32
> 
> Reverting this commit solves the problem, but this might not be the
> right way of fixing it.

Thanks for bisecting! Let's CC people involved in that commit. All important 
should be in the quoted conversation above.

Vlastimil

> 
>>
>> > yes, is there a way to force the soft-dirty bits to be propagated to
>> > the page map entries immediately, or is there an alternative interface
>> > that has the synchronous behavior?
>> >
>> > Thanks in advance,
>> > Mohamed Alzayat
>> >
>>
>>
> 



  reply	other threads:[~2020-11-30 11:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-25 14:15 Mohamed Alzayat
2020-11-27 16:40 ` Vlastimil Babka
2020-11-30 10:37   ` Mohamed Alzayat
2020-11-30 11:51     ` Vlastimil Babka [this message]
2020-11-30 12:02       ` Peter Zijlstra
2020-11-30 12:50         ` Will Deacon
2021-04-20 18:32           ` Mohamed Alzayat

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=2e60ad6d-7bdf-e19e-4ad9-6942f76088d3@suse.cz \
    --to=vbabka@suse.cz \
    --cc=alzayat@mpi-sws.org \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=linux-mm@kvack.org \
    --cc=peterz@infradead.org \
    /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