From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.5 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, NICE_REPLY_A,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15B96C433DF for ; Wed, 12 Aug 2020 08:25:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A7CB420774 for ; Wed, 12 Aug 2020 08:25:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="cldNR2Vi" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A7CB420774 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 23D806B00CC; Wed, 12 Aug 2020 04:25:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1F2598D0001; Wed, 12 Aug 2020 04:25:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0DF466B00CF; Wed, 12 Aug 2020 04:25:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0163.hostedemail.com [216.40.44.163]) by kanga.kvack.org (Postfix) with ESMTP id E9C8C6B00CC for ; Wed, 12 Aug 2020 04:25:54 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id AB7548248047 for ; Wed, 12 Aug 2020 08:25:54 +0000 (UTC) X-FDA: 77141233428.06.bird80_051317226fea Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin06.hostedemail.com (Postfix) with ESMTP id 4349110044A37 for ; Wed, 12 Aug 2020 08:25:50 +0000 (UTC) X-HE-Tag: bird80_051317226fea X-Filterd-Recvd-Size: 6645 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf31.hostedemail.com (Postfix) with ESMTP for ; Wed, 12 Aug 2020 08:25:49 +0000 (UTC) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 07C878TX113530; Wed, 12 Aug 2020 04:25:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=XXl4uESg4yZpGjEtRQm+BKa6av55p6yglVNuYhf/pVk=; b=cldNR2ViKu32vYQoPYzYhi1ukktQMElLED7GpHmzxKtGrQgLlkl5drE60o0A70AyeLA0 gazR8wTfybo276NIqi2c9jv8/4XkDhTqMnSepCKp+gUPRVNkOiOrm7/c+swu+HnGVsoM 0nS2g9U+lwVXzxmUARXsiTHcmt6BFZOvFPG2F6DIETpAY7Y2ATN7TvOqkWaU/YtdS9w2 esbXLvuZiqfGDf41c8ap9UJBhX0LwolHYwskp0LMa5BWd4JYkeonofXVzbSRQyvJJ9jN 9NO7Z1W1maFvII8aBw060EoiAn7a+mwnCgBeO4gexpp6aoRMNm/Hxtm9eUsphOG+BHpP AA== Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 32uya7krdk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Aug 2020 04:25:42 -0400 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 07C8GXSZ028134; Wed, 12 Aug 2020 08:25:39 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma04ams.nl.ibm.com with ESMTP id 32skp846jp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Aug 2020 08:25:39 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 07C8PbPb28311982 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Aug 2020 08:25:37 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 60DF7A4053; Wed, 12 Aug 2020 08:25:37 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3D53AA404D; Wed, 12 Aug 2020 08:25:36 +0000 (GMT) Received: from [9.85.71.109] (unknown [9.85.71.109]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 12 Aug 2020 08:25:36 +0000 (GMT) Subject: Re: [PATCH 02/16] debug_vm_pgtable/ppc64: Avoid setting top bits in radom value To: Anshuman Khandual , linux-mm@kvack.org, akpm@linux-foundation.org Cc: mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org References: <20200812063358.369514-1-aneesh.kumar@linux.ibm.com> <20200812063358.369514-2-aneesh.kumar@linux.ibm.com> From: "Aneesh Kumar K.V" Message-ID: Date: Wed, 12 Aug 2020 13:55:35 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-08-12_01:2020-08-11,2020-08-12 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 spamscore=0 priorityscore=1501 mlxlogscore=999 impostorscore=0 malwarescore=0 phishscore=0 clxscore=1015 mlxscore=0 bulkscore=0 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008120058 X-Rspamd-Queue-Id: 4349110044A37 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 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: On 8/12/20 1:42 PM, Anshuman Khandual wrote: > > > On 08/12/2020 12:03 PM, Aneesh Kumar K.V wrote: >> ppc64 use bit 62 to indicate a pte entry (_PAGE_PTE). Avoid setting that bit in >> random value. >> >> Signed-off-by: Aneesh Kumar K.V >> --- >> mm/debug_vm_pgtable.c | 5 ++++- >> 1 file changed, 4 insertions(+), 1 deletion(-) >> >> diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c >> index 086309fb9b6f..4c32063a8acf 100644 >> --- a/mm/debug_vm_pgtable.c >> +++ b/mm/debug_vm_pgtable.c >> @@ -45,9 +45,12 @@ >> * pxx_clear() because of how dynamic page table folding works on s390. So >> * while loading up the entries do not change the lower 4 bits. It does not >> * have affect any other platform. >> + * >> + * Also avoid the 62nd bit on ppc64 that is used to mark a pte entry. >> */ > > Please move and fold the above line with the existing paragraph. > >> #define S390_MASK_BITS 4 >> -#define RANDOM_ORVALUE GENMASK(BITS_PER_LONG - 1, S390_MASK_BITS) >> +#define PPC_MASK_BITS 2 > > s/PPC/PPC64/ > >> +#define RANDOM_ORVALUE GENMASK(BITS_PER_LONG - 1 - PPC_MASK_BITS, S390_MASK_BITS) >> #define RANDOM_NZVALUE GENMASK(7, 0) >> >> static void __init pte_basic_tests(unsigned long pfn, pgprot_t prot) >> > > With this change, RANDOM_ORVALUE will be (0x3ffffffffffffff0) which discards > both bit 63 and 62. If only bit 62 is to be avoided for ppc64 the mask should > be (0xbffffffffffffff0) instead. The following change on this patch should do > the trick. > > diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c > index eb059fef89c2..1499181fb0e9 100644 > --- a/mm/debug_vm_pgtable.c > +++ b/mm/debug_vm_pgtable.c > @@ -45,13 +45,13 @@ > * entry type. But these bits might affect the ability to clear entries with > * pxx_clear() because of how dynamic page table folding works on s390. So > * while loading up the entries do not change the lower 4 bits. It does not > - * have affect any other platform. > - * > - * Also avoid the 62nd bit on ppc64 that is used to mark a pte entry. > + * have affect any other platform. Also avoid the 62nd bit on ppc64 that is > + * used to mark a pte entry. > */ > -#define S390_MASK_BITS 4 > -#define PPC_MASK_BITS 2 > -#define RANDOM_ORVALUE GENMASK(BITS_PER_LONG - 1 - PPC_MASK_BITS, S390_MASK_BITS) > +#define S390_SKIP_MASK GENMASK(3, 0) > +#define PPC64_SKIP_MASK GENMASK(62, 62) > +#define ARCH_SKIP_MASK (S390_SKIP_MASK | PPC64_SKIP_MASK) > +#define RANDOM_ORVALUE (GENMASK(BITS_PER_LONG - 1, 0) & ~ARCH_SKIP_MASK) > #define RANDOM_NZVALUE GENMASK(7, 0) > > static void __init pte_basic_tests(unsigned long pfn, pgprot_t prot) > I will switch to this. -aneesh