Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp98815pxy; Fri, 30 Apr 2021 01:00:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4o3ExTLhaeIf3R0WP7dPMpOzs9hIbkk9Cg+RMg5+UMUQ76wX0cmLbscvWbAyv9dm1rrem X-Received: by 2002:a05:6402:100d:: with SMTP id c13mr4117773edu.195.1619769599994; Fri, 30 Apr 2021 00:59:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619769599; cv=none; d=google.com; s=arc-20160816; b=ctsIOKiv/P3pjhaxtAT1lIs6nUcaBZLPv1gQrkW0dGRorFrcNdY4ufOs5LBgLzs+WZ laMqDi6S+UNcI3wGCzIpFC37f7urkHExIt3AHprlWekxqjQ5+9R/iQajfqBvkrWeIVsk /oyQqP9lH36eM+MKAaXAgALTZdXxgtfxp9E/hLA2I66gm+94eW9aVnDmEmV0ZkGK2dUg Y1jJmyqjFGd3vKMDzgajC/DlPMYycHJZz3uVl6Zg3aB0uLKOEbYXMs1s3l+iiO6lKQjm R6oU7elw5sluUB8267bk6x4dYbFkTLaaLiB0ZsPuzfw+Xsb+0PFu19M0ZdC5NBK1rsTF O66w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=8E9W/zXFP0iybF5XoBES92V5uXSv4X3uFaHDrf+UAwc=; b=MJrmSR+ZmKM7yj4Pf+TpRkD8Qmi9j47w9QSLf5Y7WJCH4zV4QqRfpyvQoft+p4J3l6 kn48mDT16DuCsCjJ43vwfZjJMIHba+jj1hfq3oCKYvhMdlj9VlmCX4AielKJ6rfnJ0a8 QBBIhylcri+AWKtwNAIt/QkE4LrdiWeqjzpHcbmf/SOtPJdgg68Ter1rvNMEiTn7CUrl J+f9isDTqmFXhOtQtysvZTm74KadeFUN7Q4dY/PsZ4xAOH2KU5kkB/Vn57xC2qEFbmpg dSMkvzAWWf29avbeXILQmZ9gJCSgG0HFfKHR4efNtzC5TOwASHKSZYf4dBt3cGi/cgRE oh4w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h4si1121687ede.481.2021.04.30.00.59.36; Fri, 30 Apr 2021 00:59:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230506AbhD3H5Y (ORCPT + 99 others); Fri, 30 Apr 2021 03:57:24 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:17828 "EHLO szxga07-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230316AbhD3H5V (ORCPT ); Fri, 30 Apr 2021 03:57:21 -0400 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4FWl4T0Y5czBtGb; Fri, 30 Apr 2021 15:54:01 +0800 (CST) Received: from huawei.com (10.175.113.32) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.498.0; Fri, 30 Apr 2021 15:56:22 +0800 From: Nanyong Sun To: , , CC: , , , , , Subject: [PATCH -next 2/4] riscv: mm: make pmd_bad() check leaf condition Date: Fri, 30 Apr 2021 16:28:48 +0800 Message-ID: <20210430082850.462609-3-sunnanyong@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210430082850.462609-1-sunnanyong@huawei.com> References: <20210430082850.462609-1-sunnanyong@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.113.32] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In the definition in Documentation/vm/arch_pgtable_helpers.rst, pmd_bad() means test a non-table mapped PMD, so it should also return true when it is a leaf page. Signed-off-by: Nanyong Sun --- arch/riscv/include/asm/pgtable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h index f489e412f..f7fc47c58 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h @@ -160,7 +160,7 @@ static inline int pmd_none(pmd_t pmd) static inline int pmd_bad(pmd_t pmd) { - return !pmd_present(pmd); + return !pmd_present(pmd) || (pmd_val(pmd) & _PAGE_LEAF); } #define pmd_leaf pmd_leaf -- 2.25.1