From patchwork Wed Jul 25 16:18:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aneesh Kumar K.V" X-Patchwork-Id: 10544283 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 34225139A for ; Wed, 25 Jul 2018 16:19:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2365C2A409 for ; Wed, 25 Jul 2018 16:19:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 177DF2A5BD; Wed, 25 Jul 2018 16:19:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9A9912A409 for ; Wed, 25 Jul 2018 16:19:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CF6B36B0008; Wed, 25 Jul 2018 12:19:23 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id C56776B000C; Wed, 25 Jul 2018 12:19:23 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A2FFD6B000A; Wed, 25 Jul 2018 12:19:23 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-oi0-f71.google.com (mail-oi0-f71.google.com [209.85.218.71]) by kanga.kvack.org (Postfix) with ESMTP id 766546B0007 for ; Wed, 25 Jul 2018 12:19:23 -0400 (EDT) Received: by mail-oi0-f71.google.com with SMTP id l26-v6so7875480oii.14 for ; Wed, 25 Jul 2018 09:19:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:in-reply-to:references:message-id; bh=V+sygEGKvXvFhpgglgEjm9Z8dmbThvVv1SQ3brsosoA=; b=ughr2TUInATvj0kjIcFJlJODduAj0q3ySLoEBgbiJcPZdLFxo6AvduM12JsjWPEgBH 5czFZQOQOLVxHtXR+1+rVfULpDLW/zWxZBncsxePiYk0j2bscAmQ9x5/Reu2O0D+q4A1 Ru8WSQJblErx2pqVd4wNtbVpt6rz5fg/t4s74WaVHX54FLAa0IaW4RXsovuwkcpBtVxw FlHsrL83v1LAa8z0jV7eMEd0D1t9huuYrR/tUEehu+Tjkof0cdljgCMSN3JULrv+F2pY J512VhkhiFcHVKc0kg8sc9BatIhETc9slidxSDwAn1FrxTzDVxFi+xhWKSsTQX05Wpds VKTw== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com X-Gm-Message-State: AOUpUlGbn/qy6bNboFRvgtLlYSiP9miE8YAM32umelvtytDAaYlGXwuh Rb9J6w56jpOkVisayUluK/nMo4oZL+Fpmp7HPXxvQz76Txekz+K7MVSDeVvfX3HCTFqa4Rd8MA0 gJnPdxMqreIBuHi4sGdXwx+rNfkVRS63Tbyz5MYf4kQ1GRFc17Ylji1fWQ6e/ZU90eg== X-Received: by 2002:aca:3254:: with SMTP id y81-v6mr3818580oiy.317.1532535563257; Wed, 25 Jul 2018 09:19:23 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeeBMroUavN55hKvVZCIyqjOKk07lc/XcdyN32sV2wsujxUwMA8vjKYiMthfMoWo5s6WBIG X-Received: by 2002:aca:3254:: with SMTP id y81-v6mr3818533oiy.317.1532535562557; Wed, 25 Jul 2018 09:19:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532535562; cv=none; d=google.com; s=arc-20160816; b=fsCHjlMGUfj6fKLS8pqwC6QS1a0KlvozZjiFUYw/n5aPhW4uc49hyQiNxOkgRoStSF Ugu8h6BpL0Pay8+udGm9QF2HYCKTZpFePw9trXsba+fTE6gJMGyTFqCbooSRQtJIFYgn tzBSh1n888PX5ee76bGtqd1Qy6UfaGsXukhCVWdN+q+xIzIVOJnpo8m9+VoGNJeAv+8F RWY0M0QrhXvYSMDiK+RicWd2QBBWfxKLlKC3lSROUwI8I6mZv5k23IicGrwpw0aXL1vh I0HUQ9qG1az9eOXwlyWDU1basj0jCB9Bx3jq1jK1uaYuOhfEC+0ZX7+5qcA6lscuxvev eOaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:references:in-reply-to:date:subject:cc:to:from :arc-authentication-results; bh=V+sygEGKvXvFhpgglgEjm9Z8dmbThvVv1SQ3brsosoA=; b=cFWsRaqcuXWq2XlBP33UQSh1cOOirKnTIM+VUGZtWhSqpp5ttWhfZ6seHil/k5zMgE dotD9vganmcckFA5bN9X9O8MzD1sDJEevkXOpy9kf1arSJjwPoH8oRXLnhWL6fc0Q49u AR8BG/XawAdiLBes6j7eAukY43/ePXcXjCW14ThCqZPR7RyWH3tbNGXNfA/ovSkI8gr1 J7qT7uDMUszfxgi10/LUPi0/7AQSvvsk5y6xjQG4X4chVZcOZ1ZVq0AYPDhqxNoYCK0+ SPaktC0FUAxAk3UE/TiuSEmOlRfRqol2iQczRyI0R/5hJQJYobmX2mv1mzIhRsPjx0RE D+1Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com. [148.163.158.5]) by mx.google.com with ESMTPS id r133-v6si9519786oib.112.2018.07.25.09.19.22 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Jul 2018 09:19:22 -0700 (PDT) Received-SPF: pass (google.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.158.5 as permitted sender) client-ip=148.163.158.5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w6PGE4ro097813 for ; Wed, 25 Jul 2018 12:19:21 -0400 Received: from e13.ny.us.ibm.com (e13.ny.us.ibm.com [129.33.205.203]) by mx0a-001b2d01.pphosted.com with ESMTP id 2kevhe890s-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 25 Jul 2018 12:19:21 -0400 Received: from localhost by e13.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 25 Jul 2018 12:19:20 -0400 Received: from b01cxnp22036.gho.pok.ibm.com (9.57.198.26) by e13.ny.us.ibm.com (146.89.104.200) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 25 Jul 2018 12:19:17 -0400 Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w6PGJGSK5112084 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 25 Jul 2018 16:19:16 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2EC33AE060; Wed, 25 Jul 2018 12:18:31 -0400 (EDT) Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7A295AE05C; Wed, 25 Jul 2018 12:18:28 -0400 (EDT) Received: from skywalker.ibmmodules.com (unknown [9.199.35.55]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP; Wed, 25 Jul 2018 12:18:28 -0400 (EDT) From: "Aneesh Kumar K.V" To: npiggin@gmail.com, benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au, Naoya Horiguchi Cc: linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org, "Aneesh Kumar K.V" Subject: [PATCH V2 2/6] powerpc/mm/hugetlb/book3s: add _PAGE_PRESENT to hugepd pointer. Date: Wed, 25 Jul 2018 21:48:59 +0530 X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180725161903.31257-1-aneesh.kumar@linux.ibm.com> References: <20180725161903.31257-1-aneesh.kumar@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18072516-0064-0000-0000-0000032F86F5 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009425; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000266; SDB=6.01065989; UDB=6.00547631; IPR=6.00843848; MB=3.00022321; MTD=3.00000008; XFM=3.00000015; UTC=2018-07-25 16:19:19 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18072516-0065-0000-0000-00003A114C63 Message-Id: <20180725161903.31257-2-aneesh.kumar@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-07-25_03:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807250174 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP This make hugetlb directory pointer similar to other page able entries. A hugepd entry is identified by lack of _PAGE_PTE bit set and directory size stored in HUGEPD_SHIFT_MASK. We update that to also look at _PAGE_PRESENT Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/hash-4k.h | 2 +- arch/powerpc/include/asm/book3s/64/hugetlb.h | 3 +++ arch/powerpc/mm/hugetlbpage.c | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/include/asm/book3s/64/hash-4k.h b/arch/powerpc/include/asm/book3s/64/hash-4k.h index 9a3798660cef..15bc16b1dc9c 100644 --- a/arch/powerpc/include/asm/book3s/64/hash-4k.h +++ b/arch/powerpc/include/asm/book3s/64/hash-4k.h @@ -66,7 +66,7 @@ static inline int hash__hugepd_ok(hugepd_t hpd) * if it is not a pte and have hugepd shift mask * set, then it is a hugepd directory pointer */ - if (!(hpdval & _PAGE_PTE) && + if (!(hpdval & _PAGE_PTE) && (hpdval & _PAGE_PRESENT) && ((hpdval & HUGEPD_SHIFT_MASK) != 0)) return true; return false; diff --git a/arch/powerpc/include/asm/book3s/64/hugetlb.h b/arch/powerpc/include/asm/book3s/64/hugetlb.h index 50888388a359..5b0177733994 100644 --- a/arch/powerpc/include/asm/book3s/64/hugetlb.h +++ b/arch/powerpc/include/asm/book3s/64/hugetlb.h @@ -39,4 +39,7 @@ static inline bool gigantic_page_supported(void) } #endif +/* hugepd entry valid bit */ +#define HUGEPD_VAL_BITS (0x8000000000000000UL) + #endif diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c index f425b5b37d58..7ae5e4bfd318 100644 --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c @@ -95,7 +95,7 @@ static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp, break; else { #ifdef CONFIG_PPC_BOOK3S_64 - *hpdp = __hugepd(__pa(new) | + *hpdp = __hugepd(__pa(new) | HUGEPD_VAL_BITS | (shift_to_mmu_psize(pshift) << 2)); #elif defined(CONFIG_PPC_8xx) *hpdp = __hugepd(__pa(new) | _PMD_USER |