Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1689736rwb; Wed, 16 Nov 2022 23:59:18 -0800 (PST) X-Google-Smtp-Source: AA0mqf4s02zqf47xKMQA+gIrVjBOkw5z4f+BnXydfGkzdyyOERm5/4TuiZOjhGnyC4MKS1InOa9z X-Received: by 2002:a17:906:60d0:b0:78d:3f87:1725 with SMTP id f16-20020a17090660d000b0078d3f871725mr1136038ejk.492.1668671957940; Wed, 16 Nov 2022 23:59:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668671957; cv=none; d=google.com; s=arc-20160816; b=rhLV/A48i3qob7yEOzus+na2xTIAdntSswCSPrIsX17jhOB4YX7EwdOZSc/kXJMJng xMSZ9SLPe+lPdS1twxvqCQQJIxTFOIET9TNhydN7EWo+488B4ss9lmIJ0KId8RDQ9GWc 0YPDv5ZhWeACG5m6nCTAM7ciCgQtpwk+hjWpdwqBvPhdo/7ujqEHqj9ejfe0tUtblmFH ucixMgadPEM/mzEYlV44rDtwvyfvpurwtCD820o4x9/ltQTLimdNVN71gptJCiX526LF DZ0+h0VM1O6NvJ9TC0fSIaLXB6zUfWEKefYslutjafMzN7s7ELzuTQuOM2C0Kv0mt7N9 zGCg== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cs12-20020a170906dc8c00b0078d805901b1si34711ejc.489.2022.11.16.23.58.53; Wed, 16 Nov 2022 23:59:17 -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 + 91 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 ); 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 ; 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 To: Catalin Marinas , Will Deacon , Denys Vlasenko , Kefeng Wang , Anshuman Khandual , David Hildenbrand , Rafael Aquini , Pasha Tatashin CC: , , Liu Shixin 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: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.25.1