From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932657AbcISGAk (ORCPT ); Mon, 19 Sep 2016 02:00:40 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:53672 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752725AbcISGA1 (ORCPT ); Mon, 19 Sep 2016 02:00:27 -0400 From: "Aneesh Kumar K.V" To: Christophe Leroy , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Scott Wood Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH RESEND] powerpc: fix usage of _PAGE_RO in hugepage In-Reply-To: <20160916070227.DC69C1A2463@localhost.localdomain> References: <20160916070227.DC69C1A2463@localhost.localdomain> Date: Mon, 19 Sep 2016 11:30:12 +0530 MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16091906-0024-0000-0000-00001499EFF1 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00005783; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000185; SDB=6.00759047; UDB=6.00360657; IPR=6.00533198; BA=6.00004734; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00012708; XFM=3.00000011; UTC=2016-09-19 06:00:19 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16091906-0025-0000-0000-0000449A08E8 Message-Id: <87k2e8xwcz.fsf@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-09-19_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609020000 definitions=main-1609190087 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Christophe Leroy writes: > On some CPUs like the 8xx, _PAGE_RW hence _PAGE_WRITE is defined > as 0 and _PAGE_RO has to be set when a page is not writable > > _PAGE_RO is defined by default in pte-common.h, however BOOK3S/64 > doesn't include that file so _PAGE_RO has to be defined explicitly > in book3s/64/pgtable.h > > fixes: a7b9f671f2d14 ("powerpc32: adds handling of _PAGE_RO") > Signed-off-by: Christophe Leroy > --- > This patch was initially part of the v1 serie of patchs for providing > hugepage support to the 8xx. As suggested by Aneesh, that serie has > been splited to focus only on hugepage implementation for 8xx. > This patch is a fix and is independant of 8xx hugepage implementation, > allthough it is required to have hugepage support working properly on > the 8xx. > > arch/powerpc/include/asm/book3s/64/pgtable.h | 2 ++ > arch/powerpc/mm/hugetlbpage.c | 2 ++ > 2 files changed, 4 insertions(+) > > diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h > index 8ec8be9..9fd77f8 100644 > --- a/arch/powerpc/include/asm/book3s/64/pgtable.h > +++ b/arch/powerpc/include/asm/book3s/64/pgtable.h > @@ -6,6 +6,8 @@ > */ > #define _PAGE_BIT_SWAP_TYPE 0 > > +#define _PAGE_RO 0 > + > #define _PAGE_EXEC 0x00001 /* execute permission */ > #define _PAGE_WRITE 0x00002 /* write access allowed */ > #define _PAGE_READ 0x00004 /* read access allowed */ > diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c > index 7372ee1..8a512b1 100644 > --- a/arch/powerpc/mm/hugetlbpage.c > +++ b/arch/powerpc/mm/hugetlbpage.c > @@ -1021,6 +1021,8 @@ int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr, > mask = _PAGE_PRESENT | _PAGE_READ; > if (write) > mask |= _PAGE_WRITE; > + else > + mask |= _PAGE_RO; > > if ((pte_val(pte) & mask) != mask) > return 0; > -- Can you add the commit message also as code comment ?. It is confusing to find that we do mask = _PAGE_READ and then mask |= _PAGE_RO. Otherwise Reviewed-by: Aneesh Kumar K.V -aneesh