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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 345A6C4332F for ; Fri, 25 Nov 2022 18:42:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A2DB56B0074; Fri, 25 Nov 2022 13:42:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9DCFA6B0075; Fri, 25 Nov 2022 13:42:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8A5176B0078; Fri, 25 Nov 2022 13:42:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 7AC2F6B0074 for ; Fri, 25 Nov 2022 13:42:42 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id BDE2D120B3D for ; Fri, 25 Nov 2022 18:42:41 +0000 (UTC) X-FDA: 80172835722.16.D48861C Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf27.hostedemail.com (Postfix) with ESMTP id 18F5840014 for ; Fri, 25 Nov 2022 18:42:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669401760; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=oualrKRDDf0lFn/7Xv9q0zEvBMrRXi9BI43GVn40pF4=; b=jMIdQ72+tX/SwVURh5lDmOWcLimL7Udd13b9ouofolFcPCZyQxUJjIwCRt7/s5A9yi5ROM HXgihOc138xHo8RWdParxOh6+FCrxk5eJ7xNQwGVEqisNgDwcTqJ4aTAUky+8djX50c2Cn PyErjmnGSb7bfVFgCL2h9ZcAyYY24CQ= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-662-gtm70FOJNSyPjzP4XaIk2g-1; Fri, 25 Nov 2022 13:42:39 -0500 X-MC-Unique: gtm70FOJNSyPjzP4XaIk2g-1 Received: by mail-qv1-f70.google.com with SMTP id nh17-20020a056214391100b004bb6c16bd4dso4316491qvb.17 for ; Fri, 25 Nov 2022 10:42:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=oualrKRDDf0lFn/7Xv9q0zEvBMrRXi9BI43GVn40pF4=; b=DVQBtDAmIBa2a8tyH5mUFu/Ct3R/Z/pyiz4JSAyGTcYHOaESx0QqHKs5UU2aIzMH6a 9Eaic6GXANspbYyabzaYxDbtckokmSqBxAjBQHh+8EFrtGBKkbBfltlfGgpYSSLVhwB0 zzgwtqEne1CgbnNZWysFvq6YmgnsRdGoc87Cfyd919gRp/Z4KpVHrA1+p/hDSHb1kYUF m6DEuUpi+Dv4eNxkBxC0eOAs5A1y+vEcnOu1z4zygX/NxJMrqjdfZ0wWvanUpZj2bgeG 27FtLU21zoFvM/hdeBFpFs/349egaFE0AxK2nwIbgQY240kcUAX1oMIFww4lFvpAmPYL 21tg== X-Gm-Message-State: ANoB5pmxBRLStONGKYUhcrrcq5x1PA4MON6kXCJiyKFMgZznri24ZwQl iDZZFejtqZJYbBW86/j/eA08yzeQ1nrGmqdpLJ2JGE9y6G27Oc3bIzn7CQuH6Ou1dnUwMka+iVJ yTHYsbxmzSKw= X-Received: by 2002:a0c:c3ca:0:b0:4bb:93b8:ef1c with SMTP id p10-20020a0cc3ca000000b004bb93b8ef1cmr26142588qvi.103.1669401758110; Fri, 25 Nov 2022 10:42:38 -0800 (PST) X-Google-Smtp-Source: AA0mqf7i65clZj7lCw/dYMc+dXk3OnMDFGdYdSo5GonSQ2rsAw6malshv/ckO5F4O0oDweedDgFMIw== X-Received: by 2002:a0c:c3ca:0:b0:4bb:93b8:ef1c with SMTP id p10-20020a0cc3ca000000b004bb93b8ef1cmr26142561qvi.103.1669401757856; Fri, 25 Nov 2022 10:42:37 -0800 (PST) Received: from x1n (bras-base-aurron9127w-grc-46-70-31-27-79.dsl.bell.ca. [70.31.27.79]) by smtp.gmail.com with ESMTPSA id br7-20020a05620a460700b006faa2c0100bsm3205819qkb.110.2022.11.25.10.42.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Nov 2022 10:42:37 -0800 (PST) Date: Fri, 25 Nov 2022 13:42:36 -0500 From: Peter Xu To: hev Cc: Anatoly Pugachev , Thorsten Leemhuis , Sparc kernel list , linux-mm Subject: Re: Test case for "mm/thp: carry over dirty bit when thp splits on pmd" Message-ID: References: MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669401761; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=oualrKRDDf0lFn/7Xv9q0zEvBMrRXi9BI43GVn40pF4=; b=f8buUw+lC4TGktwS+7fvDyFD6ZfIAZGpUaqH0EfbfaxUNLeI1NYtUcEYhc1hpxOausxJRI 80duB3EJcrRiMu8I/0lakwgZyi8tWwt7g2mbDW+v5+VM7xaO6a9HH/kkCZkgBnuKPVQ/kq Nk+vi7qX0h1YvP4EeiBXuK2IflAVbXg= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=jMIdQ72+; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf27.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1669401761; a=rsa-sha256; cv=none; b=iBBNtUn6yf7w78cYcn99w3HRZ1pnSY04Q0yFiCTYA6ALJZ56TCLZYMDh2I4wBDHFIESwbj rGpf7udlhN1wg6PLuQb2RDNHI9TWiL6dC8YX75zWgWHkzoZJtDgX49O/Onr+ulRuRsvu97 ZdaSGwSFG+qOVCxuoHEDqhDRlbXDoKs= X-Rspam-User: Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=jMIdQ72+; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf27.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com X-Stat-Signature: o9fkrew6sd1ok5qthqwtbbeemof5sxrz X-Rspamd-Queue-Id: 18F5840014 X-Rspamd-Server: rspam08 X-HE-Tag: 1669401760-166826 X-Bogosity: Ham, tests=bogofilter, spamicity=0.004968, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Nov 25, 2022 at 07:38:36PM +0800, hev wrote: > On Tue, Nov 22, 2022 at 2:55 AM Peter Xu wrote: > > > > Hi, Anatoly (or/and Hev), > > > > On Wed, Nov 16, 2022 at 01:45:15PM +0300, Anatoly Pugachev wrote: > > > On Wed, Nov 16, 2022 at 11:49 AM hev wrote: > > > > > > > > Hello Peter, > > > > > > > > I see a random crash issue on the LoongArch system, that is caused by > > > > commit 0ccf7f1 ("mm/thp: carry over dirty bit when thp splits on > > > > pmd"). > > > > > > > > Now, the thing is already resolved. The root cause is arch's mkdirty > > > > is set hardware writable bit in unconditional. That breaks > > > > write-protect and then breaks COW. > > > > > > > > Here is a simple and fast testcase (It may be helpful for sparc64): > > > > https://gist.github.com/heiher/72919fae6b53f04cac606a9631100506 > > > > (assertion: c sum == 0) > > > > > > Just tried on my sparc64 VM - fixed vs old (non-patched) kernels... > > > > > > fixed kernel (6.1.0-rc5) running ./a.out: > > > mator@ttip:~$ ./a.out > > > c sum: 0 > > > p sum: 35184372088832 > > > c sum: 0 > > > p sum: 35184372088832 > > > c sum: 0 > > > p sum: 35184372088832 > > > c sum: 0 > > > p sum: 35184372088832 > > > c sum: 0 > > > p sum: 35184372088832 > > > ... > > > > > > old (non-patched) kernel (6.1.0-rc4) : > > > mator@ttip:~$ ./a.out > > > c sum: 35150012350464 > > > p sum: 35184372088832 > > > c sum: 35150012350464 > > > p sum: 35184372088832 > > > ... > > > > I've got another patch attached that might be nicer to fix this same > > problem for both archs but without dropping the dirty bit, could you help > > check whether it works? > > The tesecase PASSED with this patch and without: > * "Partly revert "mm/thp: carry over dirty bit when thp splits on pmd" > * "LoongArch: Set _PAGE_DIRTY only if _PAGE_WRITE is set in > {pmd,pte}_mkdirty()" My fault to not have noticed that the partly revert patch already landed 6.1-rc5, so it'll need to be another patch upon it. I'll post a formal patch. Thanks Hev. -- Peter Xu