From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753078AbdBPCNL (ORCPT ); Wed, 15 Feb 2017 21:13:11 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:46037 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753039AbdBPCNI (ORCPT ); Wed, 15 Feb 2017 21:13:08 -0500 Subject: Re: [PATCH 2/2] powerpc/mm/autonuma: Switch ppc64 to its own implementeation of saved write To: Andrew Morton References: <1486609259-6796-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> <1486609259-6796-2-git-send-email-aneesh.kumar@linux.vnet.ibm.com> <20170215134627.315dd734bd0000393a680cc9@linux-foundation.org> Cc: Rik van Riel , Mel Gorman , paulus@ozlabs.org, benh@kernel.crashing.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org From: "Aneesh Kumar K.V" Date: Thu, 16 Feb 2017 07:42:46 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <20170215134627.315dd734bd0000393a680cc9@linux-foundation.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17021602-0028-0000-0000-0000070F757C X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006624; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000203; SDB=6.00822552; UDB=6.00402418; IPR=6.00600003; BA=6.00005143; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00014299; XFM=3.00000011; UTC=2017-02-16 02:12:55 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17021602-0029-0000-0000-0000339D083A Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-02-15_14:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1702160019 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thursday 16 February 2017 03:16 AM, Andrew Morton wrote: > On Thu, 9 Feb 2017 08:30:59 +0530 "Aneesh Kumar K.V" wrote: > >> With this our protnone becomes a present pte with READ/WRITE/EXEC bit cleared. >> By default we also set _PAGE_PRIVILEGED on such pte. This is now used to help >> us identify a protnone pte that as saved write bit. For such pte, we will clear >> the _PAGE_PRIVILEGED bit. The pte still remain non-accessible from both user >> and kernel. > I don't see how these patches differ from the ones which are presently > in -mm. > > It helps to have a [0/n] email for a patch series and to put a version > number in there as well. > >> +#define pte_mk_savedwrite pte_mk_savedwrite >> +static inline pte_t pte_mk_savedwrite(pte_t pte) >> +{ >> + /* >> + * Used by Autonuma subsystem to preserve the write bit >> + * while marking the pte PROT_NONE. Only allow this >> + * on PROT_NONE pte >> + */ >> + VM_BUG_ON((pte_raw(pte) & cpu_to_be64(_PAGE_PRESENT | _PAGE_RWX | _PAGE_PRIVILEGED)) != >> + cpu_to_be64(_PAGE_PRESENT | _PAGE_PRIVILEGED)); >> + return __pte(pte_val(pte) & ~_PAGE_PRIVILEGED); >> +} >> + >> +#define pte_savedwrite pte_savedwrite >> +static inline bool pte_savedwrite(pte_t pte) >> +{ >> + /* >> + * Saved write ptes are prot none ptes that doesn't have >> + * privileged bit sit. We mark prot none as one which has >> + * present and pviliged bit set and RWX cleared. To mark >> + * protnone which used to have _PAGE_WRITE set we clear >> + * the privileged bit. >> + */ >> + return !(pte_raw(pte) & cpu_to_be64(_PAGE_RWX | _PAGE_PRIVILEGED)); >> +} >> + >> static inline pte_t pte_mkdevmap(pte_t pte) >> { >> return __pte(pte_val(pte) | _PAGE_SPECIAL|_PAGE_DEVMAP); > arch/powerpc/include/asm/book3s/64/pgtable.h doesn't have > pte_mkdevmap(). What tree are you patching here? > > I did post a V2 of this for which you replied https://lkml.kernel.org/r/20170214162008.bd592c747fc5e167c10ce7b8@linux-foundation.org I actually found the issue with this patch. I will be sending V3 after more testing. -aneesh