Message ID | 20221117075602.2904324-1-liushixin2@huawei.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp257852wrr; Wed, 16 Nov 2022 23:22:35 -0800 (PST) X-Google-Smtp-Source: AA0mqf5w9ohqtYA7iPTioKhyAivzioLTXIDerIojZKFirm+w80tTcdHMbj6QNnBZSLWHS+GdCF9K X-Received: by 2002:a17:906:3b88:b0:7ae:83:5be7 with SMTP id u8-20020a1709063b8800b007ae00835be7mr1069933ejf.139.1668669755649; Wed, 16 Nov 2022 23:22:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668669755; cv=none; d=google.com; s=arc-20160816; b=FYK4gfCrfutTqGc1buUs7bbKWjhZeQ4oLi56rfFpuaCpBsBLSh5kkFUHNXq/nLW0Zm XpHh1OfQQ3R6KWiuqDg6QdjbAnGzbKVdQ4NEkcwKL4FRtmhnRCKBwIEsItgywbwqO48m xbhSDvGqGmccY/yWl2mXrPjw/7aUx4cNPNAnK4oVIH1aTTOzZMKyYdn1EhMQti4R63hO a6pt9hUi2YoqVw8AM3dxharTNcnZzgo2XvEta1hp5iDzexwLmU8/t9LRa+uvyji4WpJA vMXNlyjOHb4tYX17/28MWRZOGmCwTMrniduJorBkM/EVnwe2nPPCcG8RpZTSb4UuBqz9 1dUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=AqbUBXWAdzjTJ1zDyQCM07CIw3Dydd6EXo7KK88XUE8=; b=y17mLxlfbkxPLvbNb3wYwhgSJeOCp8miNsMZNBHPoAk6xNAGnpOM8jjgunCblHRuVo fMRC+nPedsr8uVrz479Pjo4s4tzR4qmDee8e85lW6tFnlfse6AdgW6RdyBHBwg/4ocdU noFUZe7GcHVqMbzGf+iIwiGmpwPUhPREcBXPAYUi7OxKpxkDxVf9ebzGbwCmkT6hk6Va gdXZHlDij8pJCE/cttkk+vFVEaSwR80/dw2x4Nnm5izCZ5C+mAeWdxI1pSPdSX5W/Nao i7cUXsJwVKcfWLi6drrxtz4UqXgCMsx3ihx8aaZqBN9Wufi0H6EN834PyYYLNTxx+Ahj wkjA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hp32-20020a1709073e2000b007ae8d01144dsi17026067ejc.717.2022.11.16.23.22.12; Wed, 16 Nov 2022 23:22:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239128AbiKQHIy (ORCPT <rfc822;just.gull.subs@gmail.com> + 99 others); Thu, 17 Nov 2022 02:08:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238973AbiKQHIp (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 17 Nov 2022 02:08:45 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AF9F1DF1A for <linux-kernel@vger.kernel.org>; Wed, 16 Nov 2022 23:08:44 -0800 (PST) Received: from dggpemm500024.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4NCWGM1754zHvyV; Thu, 17 Nov 2022 15:08:11 +0800 (CST) Received: from dggpemm100009.china.huawei.com (7.185.36.113) by dggpemm500024.china.huawei.com (7.185.36.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 17 Nov 2022 15:08:26 +0800 Received: from huawei.com (10.175.113.32) by dggpemm100009.china.huawei.com (7.185.36.113) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 17 Nov 2022 15:08:25 +0800 From: Liu Shixin <liushixin2@huawei.com> To: Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will@kernel.org>, Denys Vlasenko <dvlasenk@redhat.com>, Kefeng Wang <wangkefeng.wang@huawei.com>, Anshuman Khandual <anshuman.khandual@arm.com>, David Hildenbrand <dhildenb@redhat.com>, Rafael Aquini <raquini@redhat.com>, Pasha Tatashin <pasha.tatashin@soleen.com> CC: <linux-arm-kernel@lists.infradead.org>, <linux-kernel@vger.kernel.org>, Liu Shixin <liushixin2@huawei.com> Subject: [PATCH v2 0/2] arm64: fix two bug about page table check Date: Thu, 17 Nov 2022 15:56:00 +0800 Message-ID: <20221117075602.2904324-1-liushixin2@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm100009.china.huawei.com (7.185.36.113) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749727057743421853?= X-GMAIL-MSGID: =?utf-8?q?1749727057743421853?= |
Series |
arm64: fix two bug about page table check
|
|
Message
Liu Shixin
Nov. 17, 2022, 7:56 a.m. UTC
Denys Vlasenko has reported two bug about page table check on arm64. On arm64, pmd_present() contains non-leaf pmd and invalid pmd too. When collapse hugepage, the pmd is non-leaf and should skip the check. Use pmd_leaf() instead of pmd_present(). When split hugepage, the pmd will be marked as invalid and then populate. So we should decrease file_map_count when invalid pmd and then increase when populate the pmd. Add pmd_valid() check. v1->v2: Update comment and optimize the code by moving p?d_valid() at first place suggested by Mark. Liu Shixin (2): arm64/mm: fix incorrect file_map_count for non-leaf pmd/pud arm64/mm: fix incorrect file_map_count for invalid pmd/pud arch/arm64/include/asm/pgtable.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Comments
On Thu, 17 Nov 2022 15:56:00 +0800, Liu Shixin wrote: > Denys Vlasenko has reported two bug about page table check on arm64. > On arm64, pmd_present() contains non-leaf pmd and invalid pmd too. > > When collapse hugepage, the pmd is non-leaf and should skip the check. > Use pmd_leaf() instead of pmd_present(). > > When split hugepage, the pmd will be marked as invalid and then populate. > So we should decrease file_map_count when invalid pmd and then increase > when populate the pmd. Add pmd_valid() check. > > [...] Applied to arm64 (for-next/fixes), thanks! [1/2] arm64/mm: fix incorrect file_map_count for non-leaf pmd/pud https://git.kernel.org/arm64/c/5b47348fc0b1 I only merged the first patch in this series as Will had some questions on the second patch (it does seem weird that the pud and pmd functions are different w.r.t. the p*d_user() checks).