From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BF56C64E8A for ; Mon, 30 Nov 2020 10:37:47 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2D65D20708 for ; Mon, 30 Nov 2020 10:37:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mpi-sws.org header.i=@mpi-sws.org header.b="dhar2GvO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2D65D20708 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=mpi-sws.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 371888D0002; Mon, 30 Nov 2020 05:37:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3217C8D0001; Mon, 30 Nov 2020 05:37:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 210688D0002; Mon, 30 Nov 2020 05:37:45 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0171.hostedemail.com [216.40.44.171]) by kanga.kvack.org (Postfix) with ESMTP id 07D1B8D0001 for ; Mon, 30 Nov 2020 05:37:45 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id C12DE1EE6 for ; Mon, 30 Nov 2020 10:37:44 +0000 (UTC) X-FDA: 77540733648.21.grass13_01095b3273a1 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin21.hostedemail.com (Postfix) with ESMTP id B0330180445F6 for ; Mon, 30 Nov 2020 10:37:44 +0000 (UTC) X-HE-Tag: grass13_01095b3273a1 X-Filterd-Recvd-Size: 5232 Received: from jupiter.mpi-klsb.mpg.de (jupiter.mpi-klsb.mpg.de [139.19.86.15]) by imf26.hostedemail.com (Postfix) with ESMTP for ; Mon, 30 Nov 2020 10:37:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mpi-sws.org ; s=mail201904; h=Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To :References:MIME-Version:sender:reply-to:content-transfer-encoding:content-id :content-description:resent-date:resent-from:resent-sender:resent-to: resent-cc:resent-message-id:list-id:list-help:list-unsubscribe:list-subscribe :list-post:list-owner:list-archive; bh=S2xztu7t+bBgZSuNaJuXe5fp5RLcGPAKYQgDIES/S2M=; b=dhar2GvOBLxtBB9O2jInsL3Dm0 3m4w7+zf+QUjSDLYptpoON4TUY4g89kXpF/Pw/prnBuPKtKfJhytEzxZyswmfVaf99y9m7z52oj0C xB1rKo3bKWMTB2cXCHDA9n4UKW9DW6UfBxwTn47OzlR9N+8IvmNb5dNJthAoQXQui5BU=; Received: from srv-00-62.mpi-klsb.mpg.de ([139.19.86.27]:37452 helo=max.mpi-klsb.mpg.de) by jupiter.mpi-klsb.mpg.de (envelope-from ) with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) id 1kjgYr-0008GI-K9 for linux-mm@kvack.org; Mon, 30 Nov 2020 11:37:41 +0100 Received: from mail-oi1-f169.google.com ([209.85.167.169]:46279) by max.mpi-klsb.mpg.de (envelope-from ) with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) id 1kjgYr-0007YW-9n for linux-mm@kvack.org; Mon, 30 Nov 2020 11:37:37 +0100 Received: by mail-oi1-f169.google.com with SMTP id w15so13596814oie.13 for ; Mon, 30 Nov 2020 02:37:37 -0800 (PST) X-Gm-Message-State: AOAM5327/lWQDhg9kTmeynrR9SYxKTfzCVbQR27GK7PZglKgVm5nbENE YrtpZRUafTdHIvodHMzpmlb++B+ywjZj3UtQLOU= X-Google-Smtp-Source: ABdhPJzvf6NsdyQXhobTzSuX8ZL5xq+zkF5OmRCDljALC0+ClELcKEF91YJHamGoTpHOCg/Gl0xzT13C+bh2c6riLIk= X-Received: by 2002:aca:3205:: with SMTP id y5mr13699778oiy.162.1606732656046; Mon, 30 Nov 2020 02:37:36 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Mohamed Alzayat Date: Mon, 30 Nov 2020 11:37:25 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Potential bug in soft-dirty bits (with test case) To: Vlastimil Babka Cc: linux-mm@kvack.org Content-Type: text/plain; charset="UTF-8" X-RSPAMD-Score: -0.3 (/) X-RSPAMD-Report: Action: no action Symbol: RCVD_VIA_SMTP_AUTH(0.00) Symbol: ARC_NA(0.00) Symbol: FROM_HAS_DN(0.00) Symbol: TO_DN_SOME(0.00) Symbol: R_SPF_ALLOW(-0.20) Symbol: MIME_GOOD(-0.10) Symbol: PREVIOUSLY_DELIVERED(0.00) Symbol: DMARC_NA(0.00) Symbol: RCVD_COUNT_THREE(0.00) Symbol: TO_MATCH_ENVRCPT_SOME(0.00) Symbol: RCPT_COUNT_TWO(0.00) Symbol: NEURAL_HAM(-0.00) Symbol: FROM_EQ_ENVFROM(0.00) Symbol: R_DKIM_NA(0.00) Symbol: MIME_TRACE(0.00) Symbol: ASN(0.00) Symbol: RCVD_TLS_ALL(0.00) Message-ID: CA+32v5wCAQ9O+7sioyTroqBqG=MfvZzErVFbcE2EbbwEP0=ZZA@mail.gmail.com X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Nov 27, 2020 at 5:40 PM Vlastimil Babka 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. > > > 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 > > > >