From patchwork Wed Dec 5 03:09:26 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: 10712913 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 8BF8A13BF for ; Wed, 5 Dec 2018 03:09:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 72C602BA2D for ; Wed, 5 Dec 2018 03:09:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 667B32BA4A; Wed, 5 Dec 2018 03:09:49 +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 E01BA2BA2D for ; Wed, 5 Dec 2018 03:09:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 378326B721D; Tue, 4 Dec 2018 22:09:47 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 325E86B721E; Tue, 4 Dec 2018 22:09:47 -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 1EE0F6B721F; Tue, 4 Dec 2018 22:09:47 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by kanga.kvack.org (Postfix) with ESMTP id BB9EC6B721D for ; Tue, 4 Dec 2018 22:09:46 -0500 (EST) Received: by mail-ed1-f72.google.com with SMTP id v4so8922574edm.18 for ; Tue, 04 Dec 2018 19:09:46 -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=zEHV0HLi3ZeW3swzPj2XbNv56HESR2OWKAoVUolBRZU=; b=CJDNwJxRY+3c1S6/ONPUwdfJ7LHE4laLh50sSre+R9t4UKq1/qNg6eq3GxmDftsioK hflXKRBc7G261X+XcgwZrjOtSNgyDP/Ffy4AFycT9xpbKb1DkucidissKjMhD62IRDUZ 19cSuSJzZAF1oqzbvTL4YkSeSHljOs/ZfzGreDE/VLNbUWPU0vIBz1BqUoTHplNCu/S5 q8my50Ras2V7J3Lc9lfytFyLIOUosg4FmAlV/EQAjIbTzcF/N3zrP1aL46D34JzB3VtF cyirEHZ5aO1D+ut/K3kr2Y4pxWPV+xQlQO7sI5mNf5gIOi1MjsYrz7GDDMHjpO00+VSY K1yA== 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: AA+aEWYYEH+gNcSDJNJgDTLQcI6HlqDUhCqEkSxphTO+L3nHwdMxkXqx 0lB574dSdWXkW4QWtFYJ9SWGOuc1ubsi+zuSFwjtdzrNheHJ+y8RHG/E4rMZUjns2Vk7awwmVC0 8jmmzX5ZFcpMFWCAxAoqx9xQrHdA3Z6U5JYI4LooigfSsjnMmFvPOpzlq1y/9LFkWAA== X-Received: by 2002:a50:bb08:: with SMTP id y8mr20184866ede.10.1543979386151; Tue, 04 Dec 2018 19:09:46 -0800 (PST) X-Google-Smtp-Source: AFSGD/UPAB+oEBjpn36rQfWlX9FUSQYKROgYyPom2qWcpqtClYfKNBpE6Nac+f64ICvfwnWC7YTH X-Received: by 2002:a50:bb08:: with SMTP id y8mr20184822ede.10.1543979384733; Tue, 04 Dec 2018 19:09:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543979384; cv=none; d=google.com; s=arc-20160816; b=bzXRAPCaRn/mKyIZFtZpqD/rcibTESPSRuqLEo3GVOQSsDqxgSZ696RdKsnJWh9nN5 mnF5PGUT2HRj0lW1Az4zRdqzJO3gvC8ueId3Na+LCSjXaPAXlf8vcKo9kXG9sXeI4nXY EroTo1dNU3gMGaewc33pUjvq2v5Gvh/NpPDtrk1SLonFAYshHDI+CPCg7/IgAZHNqyLK WFNu8Nze/sA09WtwSwB07l4M/hEFRl9HIi8lxoLIuDmInxq1cAbFj46t1fWoqvRglmNt nJemTyHzZGZWdRN0a2fUgqegTe2QNfjWplX9NAF4k6XCKagfh0hb24Npft/6TsBSK/yz vUmg== 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=zEHV0HLi3ZeW3swzPj2XbNv56HESR2OWKAoVUolBRZU=; b=KzNbtYYP4IyDrW56TwKpBG0NnRo96ToZnvsHn6BgSHxCqA3/F4+XbqSTqy2WKr0krJ luIMQIG2RKVw5INi0FkGDt6b4UUetVm6vtkm2xMh2Z9V4ApQjTpbdIIa+fzJkwsSqvSo 83WGAWYrqoc2Iy6f6mqbPTW67S18lTp9uXnbxgv4Ubv4FOegiVKh7TsPQSstnkk/M6XR h1CNhjZl4Hdu8R3q/9Sf3q8otkY8Zj66Xv9hOQ/0x6cRJ9PAHEKDVhdDDSRMDGDkH9P7 N7QYhJSqCzLp0BoQc3yReEFKlaesoedbKR4PJpjthla0p3v1oy7hDNYh5stNvo+NbecZ O9MA== 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 e5si3430169edi.171.2018.12.04.19.09.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Dec 2018 19:09:44 -0800 (PST) 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 (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wB534nGP040466 for ; Tue, 4 Dec 2018 22:09:43 -0500 Received: from e11.ny.us.ibm.com (e11.ny.us.ibm.com [129.33.205.201]) by mx0b-001b2d01.pphosted.com with ESMTP id 2p65p1hxd0-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 04 Dec 2018 22:09:43 -0500 Received: from localhost by e11.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 5 Dec 2018 03:09:42 -0000 Received: from b01cxnp23033.gho.pok.ibm.com (9.57.198.28) by e11.ny.us.ibm.com (146.89.104.198) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 5 Dec 2018 03:09:38 -0000 Received: from b01ledav004.gho.pok.ibm.com (b01ledav004.gho.pok.ibm.com [9.57.199.109]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wB539b9617760366 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 5 Dec 2018 03:09:37 GMT Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 23BF4112061; Wed, 5 Dec 2018 03:09:37 +0000 (GMT) Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2F281112063; Wed, 5 Dec 2018 03:09:34 +0000 (GMT) Received: from skywalker.ibmuc.com (unknown [9.85.73.253]) by b01ledav004.gho.pok.ibm.com (Postfix) with ESMTP; Wed, 5 Dec 2018 03:09:33 +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 Cc: linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org, "Aneesh Kumar K.V" Subject: [PATCH V3 0/5] NestMMU pte upgrade workaround for mprotect Date: Wed, 5 Dec 2018 08:39:26 +0530 X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 18120503-2213-0000-0000-00000324B7F1 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00010173; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000270; SDB=6.01127133; UDB=6.00585424; IPR=6.00907266; MB=3.00024450; MTD=3.00000008; XFM=3.00000015; UTC=2018-12-05 03:09:40 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18120503-2214-0000-0000-00005C7D7B0F Message-Id: <20181205030931.12037-1-aneesh.kumar@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-12-04_10:,, 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=355 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812050027 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 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-radix.c | 17 ++++++++++++ arch/powerpc/mm/hugetlbpage.c | 29 ++++++++++++++++++++ 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 | 9 ++++-- fs/proc/task_mmu.c | 8 ++++-- include/asm-generic/pgtable.h | 10 +++---- include/linux/hugetlb.h | 20 ++++++++++++++ mm/hugetlb.c | 8 ++++-- mm/memory.c | 8 +++--- mm/mprotect.c | 6 ++-- 16 files changed, 181 insertions(+), 26 deletions(-)