From patchwork Wed Jan 26 18:36:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pasha Tatashin X-Patchwork-Id: 12725594 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 77521C28CF5 for ; Wed, 26 Jan 2022 18:36:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EDC876B0071; Wed, 26 Jan 2022 13:36:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E8A1F6B0073; Wed, 26 Jan 2022 13:36:41 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D2C316B0075; Wed, 26 Jan 2022 13:36:41 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0145.hostedemail.com [216.40.44.145]) by kanga.kvack.org (Postfix) with ESMTP id BBC7F6B0071 for ; Wed, 26 Jan 2022 13:36:41 -0500 (EST) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 5DB75181CB2C5 for ; Wed, 26 Jan 2022 18:36:41 +0000 (UTC) X-FDA: 79073294202.13.5FB2F44 Received: from mail-qv1-f47.google.com (mail-qv1-f47.google.com [209.85.219.47]) by imf08.hostedemail.com (Postfix) with ESMTP id 61A03160038 for ; Wed, 26 Jan 2022 18:36:40 +0000 (UTC) Received: by mail-qv1-f47.google.com with SMTP id g11so643726qvu.3 for ; Wed, 26 Jan 2022 10:36:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=a4jxpLDSedySyiIRtZviJmX3NEbTJyD67N5MQRypTW4=; b=h4xkZoFvH7iJDfUXQm8znpFEc6PC4s+tPROBi0jwbzFdezVF74R3DKaPnWdHLdOtoc vlMKDt3P48E110Jh7Anz+LurpmyWB0G52b6QQ1EaRtDaL1nhcqg04hES0HdEtmqvBxSJ 2c799pa2UtMjpZlRATILhE8KJyjmZVH7VQ05PDArfwetmSwAPYO7mXnQwony0pjCCny0 tu9U2t0OfPWoqAaMSdCnCUm9uVOrJUVtaqVD+7Wk3buw+IBNSO+FAr7Zq8CukabBp7+w hEC4Mf98vxoxOlZNSig54sbYNmpaKk1uEfetnfov5Ttpc29zRvWDY1Q5Wuv8bWglzYHb EMKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=a4jxpLDSedySyiIRtZviJmX3NEbTJyD67N5MQRypTW4=; b=ARPEjk9+99ZoiUh/HmbU2laNwG19PsoJljZXTmNxOkAqa02jTPY9eAw/YAeWbai1ZG I/Ap8we45Q+qn6/0Hw4DYg9CyOYfGmkD5bErJgejNyR7rd94on/oXS/kqm3ZEqUYSl5c qhLgvR8x6RfGzars+YZAKqlHpHBhxNu5M1jaf9R9V+tqJBRWc8ZqiOhzUC8pTIcHLD5f 1aVVNTH9543Zdt/ktmzhKkC1gY0J4GX2JkMVxa9DmijLRa3FuMJBQIWLGUDgHGp0gmPj F9p52UAEZc0FwjPnfJPc/T3IuUP2M+LbrldyKsVww6p6eHH0ExdDuzf6tKs4lwmdGRI1 pWZQ== X-Gm-Message-State: AOAM532DGRFoBUfBE9LuhTZVm/z9xvGuT+LsxUvDh/SudkklXeNJwdKU 5IEe2wrrhiC1l+2PZME+xZLQDA== X-Google-Smtp-Source: ABdhPJz5AdoQSF76RU52VZ6gwOZf8Oqw8CGR3SV0rJAznxxoLsdi7kYebbkAsr0hK4EkKj/v6JtwEQ== X-Received: by 2002:a05:6214:4014:: with SMTP id kd20mr12158585qvb.84.1643222199674; Wed, 26 Jan 2022 10:36:39 -0800 (PST) Received: from soleen.c.googlers.com.com (189.216.85.34.bc.googleusercontent.com. [34.85.216.189]) by smtp.gmail.com with ESMTPSA id h9sm26226qkp.75.2022.01.26.10.36.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jan 2022 10:36:39 -0800 (PST) From: Pasha Tatashin To: pasha.tatashin@soleen.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, rientjes@google.com, pjt@google.com, weixugc@google.com, gthelen@google.com, mingo@redhat.com, will@kernel.org, rppt@kernel.org, dave.hansen@linux.intel.com, hpa@zytor.com, aneesh.kumar@linux.ibm.com, jirislaby@kernel.org, songmuchun@bytedance.com, qydwhotmail@gmail.com, hughd@google.com, ziy@nvidia.com, anshuman.khandual@arm.com Subject: [PATCH v4 0/4] page table check fixes and cleanups Date: Wed, 26 Jan 2022 18:36:33 +0000 Message-Id: <20220126183637.1840960-1-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog MIME-Version: 1.0 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 61A03160038 X-Rspam-User: nil Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=soleen.com header.s=google header.b=h4xkZoFv; dmarc=none; spf=pass (imf08.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.219.47 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com X-Stat-Signature: 4yctwube3udr8t7yfqqeyedpizchcqao X-HE-Tag: 1643222200-803207 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000020, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Changelog: v4: - Addressed review comments from David Rientjes - Added Acks. v3: - Resolved a regression introduced in previous version, where page collapse in khugepaged would cause crash on boot. - Addressed comments from Anshuman Khandual regarding commit log. v2: - Addressed simplification comments from Wei Xu - Added Review-by/Tested-by's from Zi Yan and Wei Xu Two fixes: mm/debug_vm_pgtable: remove pte entry from the page table - remove a pte entry from the page table at the end of debug_vm_pgtable pte test mm/khugepaged: unify collapse pmd clear, flush and free mm/page_table_check: check entries at pmd levels - check pmd level in page_table_check for PTE regular entries prior to freeing. repro.c: https://gist.github.com/soleen/fdcd501d5df103976245fe84e9535087 config: https://gist.github.com/soleen/8a56f923c2fea9ce9c75b4e2517d4162 qemu_script: https://gist.github.com/soleen/f4be4795826b7ab1a51ae659582e179c base image: https://storage.googleapis.com/syzkaller/wheezy.img https://storage.googleapis.com/syzkaller/wheezy.img.key Small cleanup: mm/page_table_check: use unsigned long for page counters and cleanup Previous versions: v1: https://lore.kernel.org/all/20220120042513.1648831-1-pasha.tatashin@soleen.com v2: https://lore.kernel.org/all/20220120191250.2671557-1-pasha.tatashin@soleen.com v3: https://lore.kernel.org/all/20220126060514.1574935-1-pasha.tatashin@soleen.com Pasha Tatashin (4): mm/debug_vm_pgtable: remove pte entry from the page table mm/page_table_check: use unsigned long for page counters and cleanup mm/khugepaged: unify collapse pmd clear, flush and free mm/page_table_check: check entries at pmd levels include/linux/page_table_check.h | 18 ++++++++++ mm/debug_vm_pgtable.c | 2 ++ mm/khugepaged.c | 37 ++++++++++++--------- mm/page_table_check.c | 56 ++++++++++++++++---------------- 4 files changed, 69 insertions(+), 44 deletions(-)