From patchwork Tue Dec 18 09:41:32 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: 10735275 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 D0241924 for ; Tue, 18 Dec 2018 09:42:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BDFAF2A59D for ; Tue, 18 Dec 2018 09:42:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AEC802A5AA; Tue, 18 Dec 2018 09:42:05 +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 7C8B62A59D for ; Tue, 18 Dec 2018 09:42:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AA4008E0004; Tue, 18 Dec 2018 04:42:03 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A52A18E0001; Tue, 18 Dec 2018 04:42:03 -0500 (EST) 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 942818E0004; Tue, 18 Dec 2018 04:42:03 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by kanga.kvack.org (Postfix) with ESMTP id 555278E0001 for ; Tue, 18 Dec 2018 04:42:03 -0500 (EST) Received: by mail-pf1-f199.google.com with SMTP id p9so14691056pfj.3 for ; Tue, 18 Dec 2018 01:42:03 -0800 (PST) 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:mime-version:content-transfer-encoding:message-id; bh=QI9xKSHNzo2XOy7tqqouxdFdK2EQ24g82x0aRM0KPy0=; b=ImqOFhLwrVoGrEqe5x7CGIB6tUSUcUmNfB4yUqTvNPHduuIGr8TFYM6Ab0N2lrfhw9 ihwThqiWkST8EhmN6+7ggXhMTG3tpFWBFGntvojokg9zn5g1L9w8DGhVsxHjmhuQ4s0a cNaqPztgP8BTReq3ei8xlEy90jw1wsp4LUPG5y2lTrbSPpYeS2TSzQuF/vQ2LUf4cK4y BiuJsahQca+ld8egq8D/ODaSA7DwcPNrgb1S9Q7Dw6X9/CUEKD7S0Lz99uSvT9FIGWro aVz9s44ZBmQI+AjD07Rf6wZIbDpQqhi3zJ1E8kTExg990/dpbRjYIid0X0jlUGhWtZuD qqqg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.156.1 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: AA+aEWawEynMwWo//lakB8/NNmyu9RmXjkkHeMBxU3Jaqt9Kxjq98Ls5 bcZKGECtu4d9QVb68iJUPko2BOBhz71sO0ckIW/xxmNWTqzISx7409FA7+zc+jQP/Kqxh4iTYmI pq2+aM7tXl4PvYHafMPbom5/JWy54Isp2tXCGi3XjIGpX/l/gNfhQsL5+TUmb8+cI1A== X-Received: by 2002:a17:902:be0e:: with SMTP id r14mr14736444pls.124.1545126122986; Tue, 18 Dec 2018 01:42:02 -0800 (PST) X-Google-Smtp-Source: AFSGD/WKiqqiObqP/1u16hu47LF0s2GBDnBoj0+zLHDRMBvCB1ViHK3Uf0O9BCtOhDePpaw/ynV2 X-Received: by 2002:a17:902:be0e:: with SMTP id r14mr14736397pls.124.1545126121732; Tue, 18 Dec 2018 01:42:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545126121; cv=none; d=google.com; s=arc-20160816; b=kSPGZoZ6498S1EMd4I0py9g/S548rC0ixnHq48QroTAA8jT3dHB2d5TaXnXbT9FzPJ riAcFze6Ce6Zu8IfPSCgoIHTY7rYM3mAQsTIgIgTa0Y4r+MIuWtgV4xxcmpRlvt+KqbD n3ci8D/uvV1GkuRDqXJ0xd3cCLEgzKHpnwsylPbDriB6UemWlcmDshOBqA9+KlCBjhwI 1oeDtKYiRiGBxr+qTCovbPp9iK1loWqkTcpM59afNtvQhM+2vF7P2qNYC0D8aRDteo2e cgAv6vuaCALwoSqRynyalr5NBsvR6HLJXGZ5gsFU8TeUTb2Khlnr90popQxwS53wuZZE 1MGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:content-transfer-encoding:mime-version:date:subject:cc :to:from; bh=QI9xKSHNzo2XOy7tqqouxdFdK2EQ24g82x0aRM0KPy0=; b=MdShQ5Og3PSov51IXgR9dIx7u6HUgK1mIbpyI//YTS+eQikHJ1lCeEJfunNrGCO+O8 2vjIY9cIU4bhikloSKb3QAp4FYPdniAXCs9ERnsKw4CD/72HR7MRN4v5UcKBaOnkA7pz 1su3MLz+oKosWiAxG6mlL6ge6a9ad/1QtUTdfn/Vb26UyOoMbbjDa1cO48Bk5lYDbEHK T1KWu3ltRjG35+AWTdN9ntwkSFTAg6En7GG9i7h1HJ4a68ces4Ql1ET3dCyNdF1Asr3G sDWC0oNW1camKHYEeDwdFZN/Rde5uvy05xEjV7A/BYdXfYSoesFTTArAUweWClowvEMj M8uQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.156.1 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 (mx0a-001b2d01.pphosted.com. [148.163.156.1]) by mx.google.com with ESMTPS id g33si13441804pgm.426.2018.12.18.01.42.01 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Dec 2018 01:42:01 -0800 (PST) Received-SPF: pass (google.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.156.1 as permitted sender) client-ip=148.163.156.1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.156.1 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 (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wBI9ddls118415 for ; Tue, 18 Dec 2018 04:42:01 -0500 Received: from e31.co.us.ibm.com (e31.co.us.ibm.com [32.97.110.149]) by mx0a-001b2d01.pphosted.com with ESMTP id 2pevdt5uck-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 18 Dec 2018 04:42:01 -0500 Received: from localhost by e31.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 18 Dec 2018 09:42:00 -0000 Received: from b03cxnp08025.gho.boulder.ibm.com (9.17.130.17) by e31.co.us.ibm.com (192.168.1.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 18 Dec 2018 09:41:57 -0000 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wBI9ftsW27132062 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 18 Dec 2018 09:41:56 GMT Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DDD506E04C; Tue, 18 Dec 2018 09:41:55 +0000 (GMT) Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6A2036E050; Tue, 18 Dec 2018 09:41:52 +0000 (GMT) Received: from skywalker.ibmuc.com (unknown [9.85.88.39]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP; Tue, 18 Dec 2018 09:41:51 +0000 (GMT) From: "Aneesh Kumar K.V" To: npiggin@gmail.com, benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au, akpm@linux-foundation.org, x86@kernel.org Cc: linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org, "Aneesh Kumar K.V" Subject: [PATCH V4 0/5] NestMMU pte upgrade workaround for mprotect Date: Tue, 18 Dec 2018 15:11:32 +0530 X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 18121809-8235-0000-0000-00000E3A49E3 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00010242; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000271; SDB=6.01133443; UDB=6.00589233; IPR=6.00913618; MB=3.00024731; MTD=3.00000008; XFM=3.00000015; UTC=2018-12-18 09:41:59 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18121809-8236-0000-0000-000043BF9984 Message-Id: <20181218094137.13732-1-aneesh.kumar@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-12-18_04:,, 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=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=369 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812180086 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 We can upgrade pte access (R -> RW transition) via mprotect. We need to make sure we follow the recommended pte update sequence as outlined in commit bd5050e38aec ("powerpc/mm/radix: Change pte relax sequence to handle nest MMU hang") for such updates. This patch series do that. Changes from V3: * Build fix for x86 Changes from V2: * Update commit message for patch 4 * use radix tlb flush routines directly. Changes from V1: * Restrict ths only for R->RW upgrade. We don't need to do this for Autonuma * Restrict this only for radix translation mode. Aneesh Kumar K.V (5): mm: Update ptep_modify_prot_start/commit to take vm_area_struct as arg mm: update ptep_modify_prot_commit to take old pte value as arg arch/powerpc/mm: Nest MMU workaround for mprotect RW upgrade. mm/hugetlb: Add prot_modify_start/commit sequence for hugetlb update arch/powerpc/mm/hugetlb: NestMMU workaround for hugetlb mprotect RW upgrade arch/powerpc/include/asm/book3s/64/hugetlb.h | 12 +++++++++ arch/powerpc/include/asm/book3s/64/pgtable.h | 18 +++++++++++++ arch/powerpc/include/asm/book3s/64/radix.h | 4 +++ arch/powerpc/mm/hugetlbpage-hash64.c | 27 ++++++++++++++++++++ arch/powerpc/mm/hugetlbpage-radix.c | 17 ++++++++++++ arch/powerpc/mm/pgtable-book3s64.c | 27 ++++++++++++++++++++ arch/powerpc/mm/pgtable-radix.c | 18 +++++++++++++ arch/s390/include/asm/pgtable.h | 5 ++-- arch/s390/mm/pgtable.c | 8 +++--- arch/x86/include/asm/paravirt.h | 13 +++++----- arch/x86/include/asm/paravirt_types.h | 5 ++-- arch/x86/xen/mmu.h | 4 +-- arch/x86/xen/mmu_pv.c | 8 +++--- fs/proc/task_mmu.c | 8 +++--- include/asm-generic/pgtable.h | 18 ++++++------- include/linux/hugetlb.h | 20 +++++++++++++++ mm/hugetlb.c | 8 +++--- mm/memory.c | 8 +++--- mm/mprotect.c | 6 ++--- 19 files changed, 193 insertions(+), 41 deletions(-)