From patchwork Fri Jul 3 01:19:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 11640531 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 53BDA13B6 for ; Fri, 3 Jul 2020 01:20:17 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1F67E20737 for ; Fri, 3 Jul 2020 01:20:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ix7QrYTk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1F67E20737 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1F7408D002E; Thu, 2 Jul 2020 21:20:16 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 155B68D0021; Thu, 2 Jul 2020 21:20:16 -0400 (EDT) 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 F365B8D002E; Thu, 2 Jul 2020 21:20:15 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0120.hostedemail.com [216.40.44.120]) by kanga.kvack.org (Postfix) with ESMTP id D62C28D0021 for ; Thu, 2 Jul 2020 21:20:15 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 995874DC7 for ; Fri, 3 Jul 2020 01:20:15 +0000 (UTC) X-FDA: 76995008790.07.coach44_091010626e8d Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin07.hostedemail.com (Postfix) with ESMTP id 71B801803F9B4 for ; Fri, 3 Jul 2020 01:20:15 +0000 (UTC) X-Spam-Summary: 1,0,0,5f1adb39b77d0099,d41d8cd98f00b204,npiggin@gmail.com,,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1311:1314:1345:1359:1431:1437:1515:1534:1540:1711:1714:1730:1747:1777:1792:2393:2559:2562:3138:3139:3140:3141:3142:3350:3865:3867:3871:4321:5007:6261:6653:7514:7903:9413:10004:11026:11657:11658:11914:12043:12297:12438:12517:12519:12555:12895:13069:13311:13357:13894:14096:14181:14384:14394:14687:14721:21080:21444:21451:21627:21666:30054,0,RBL:209.85.214.196:@gmail.com:.lbl8.mailshell.net-62.50.0.100 66.100.201.100;04yfxo9efjwjtze3ar38ph3qk7nahyckiijomcmai14xehiq7aejjh33ecg9jxo.qitxkh6a1bez3876c5nf4imot4q4kzg84d4r4yg5pc8xeraq7ce1khtcuymtnuu.o-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: coach44_091010626e8d X-Filterd-Recvd-Size: 3768 Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by imf46.hostedemail.com (Postfix) with ESMTP for ; Fri, 3 Jul 2020 01:20:14 +0000 (UTC) Received: by mail-pl1-f196.google.com with SMTP id bj10so6765013plb.11 for ; Thu, 02 Jul 2020 18:20:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Pmg18ZVtz+aHnPcYNR/ar+KZfsU0xgw5dZN9uFapXrc=; b=ix7QrYTkhbDElBDQK97dD1ZIli7OvLW/q7YCa37dgxZSpEvoqvj/NxJqsufWECEq3S XSXfix0vvdAjZrZo/tEINlw/lEf9zvilReHVhtnVH+m30hJKBgbcMQkV1J0aWFUbb5KI mVn4lAk/ruolbBf+cVKfHymLp1+q2DDJ4S7C48wPGgVaHq3Z4QHjZkA9OxLHA3sEivvx 3wHYXv0G89NH3Ct7j7NZBHWcqBJ+tG9nSD8QDzP8Y5oJVWCgxwSKjpHutopLdgqblx73 lKyGbJUndXKYW4TSufT1Ci6JX1PVnu/D7zg9L0k8Wh1+WQDpqcqPHRe0ZH7oOYNzjvr5 5I+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Pmg18ZVtz+aHnPcYNR/ar+KZfsU0xgw5dZN9uFapXrc=; b=KhNLmSTm/m/kumC3FgvCb5GVhKe88rtVaF2VheecVYCem4DquGAWPJ4cdg8n176w/h 2IXO1FHdBVVNKPnDUo8VX5oSEKZKgOyudtOj7BddTbwVTqlB88ATww5UQPhxEo8uKLkA aJCSzLdlGu9nItP22y6JSanO6adnKx/RdRNInbEDo4mR3Rg6zwHoBuj5biX49KD2q034 LFZJjq2rBkWHdzrvTbO5Xs7dKLIR42t3ECRIvxUgEM2vhtXHYSAfDXzYxEHhRe8MG/Uw WJfM4+RsArcDXmiIKXp0ULf9vgggE5EcY0yLuJa4qtrxHk1iXo8eN+LsZlxeKqH6nAOV ssHA== X-Gm-Message-State: AOAM530XeXhBnv0nmoD69FUHqCIxGJid51Fg7QFKx7cmMMw0wduCMC9g 7q/0tZzJ6t9Fh3rjgI9Ro78= X-Google-Smtp-Source: ABdhPJycoMHaJ6keUkaICJE+J9qDkLH3KGkWOscF7Ui+Q5MY7bumj4st46Jo8k4jaioh/RUFY3o5GQ== X-Received: by 2002:a17:90b:405:: with SMTP id v5mr10594146pjz.226.1593739213943; Thu, 02 Jul 2020 18:20:13 -0700 (PDT) Received: from bobo.ozlabs.ibm.com (61-68-186-125.tpgi.com.au. [61.68.186.125]) by smtp.gmail.com with ESMTPSA id v186sm10094222pfv.141.2020.07.02.18.20.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jul 2020 18:20:13 -0700 (PDT) From: Nicholas Piggin To: linuxppc-dev@lists.ozlabs.org Cc: Nicholas Piggin , kvm-ppc@vger.kernel.org, linux-mm@kvack.org, linux-api@vger.kernel.org Subject: [PATCH v2 1/3] powerpc: remove stale calc_vm_prot_bits comment Date: Fri, 3 Jul 2020 11:19:56 +1000 Message-Id: <20200703011958.1166620-2-npiggin@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200703011958.1166620-1-npiggin@gmail.com> References: <20200703011958.1166620-1-npiggin@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 71B801803F9B4 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000015, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This comment is wrong, we wouldn't use calc_vm_prot_bits here because we are being called by calc_vm_prot_bits to modify its behaviour. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/mman.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/arch/powerpc/include/asm/mman.h b/arch/powerpc/include/asm/mman.h index d610c2e07b28..4ba303ea27f5 100644 --- a/arch/powerpc/include/asm/mman.h +++ b/arch/powerpc/include/asm/mman.h @@ -13,10 +13,6 @@ #include #include -/* - * This file is included by linux/mman.h, so we can't use cacl_vm_prot_bits() - * here. How important is the optimization? - */ static inline unsigned long arch_calc_vm_prot_bits(unsigned long prot, unsigned long pkey) { From patchwork Fri Jul 3 01:19:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 11640533 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 15DF913B6 for ; Fri, 3 Jul 2020 01:20:21 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BBAF120737 for ; Fri, 3 Jul 2020 01:20:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="T//0vyPn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BBAF120737 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D63AE8D0033; Thu, 2 Jul 2020 21:20:19 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id CECF88D0021; Thu, 2 Jul 2020 21:20:19 -0400 (EDT) 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 BB5ED8D0033; Thu, 2 Jul 2020 21:20:19 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0085.hostedemail.com [216.40.44.85]) by kanga.kvack.org (Postfix) with ESMTP id A030E8D0021 for ; Thu, 2 Jul 2020 21:20:19 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 5E5E74DDA for ; Fri, 3 Jul 2020 01:20:19 +0000 (UTC) X-FDA: 76995008958.15.back17_180518126e8d Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin15.hostedemail.com (Postfix) with ESMTP id 2E9111814B0C8 for ; Fri, 3 Jul 2020 01:20:19 +0000 (UTC) X-Spam-Summary: 1,0,0,deb03382d5fa969a,d41d8cd98f00b204,npiggin@gmail.com,,RULES_HIT:4:41:69:355:379:541:800:960:966:968:973:988:989:1042:1260:1311:1314:1345:1359:1431:1437:1515:1605:1730:1747:1777:1792:1801:1981:2194:2196:2198:2199:2200:2201:2393:2538:2553:2559:2562:2639:2693:2731:2899:2901:2903:2904:2909:2915:2924:2926:3138:3139:3140:3141:3142:3865:3866:3867:3868:3870:3871:3872:3874:4250:4321:4385:4605:5007:6261:6653:7514:7875:7903:8603:8784:9389:9413:9592:10004:11026:11232:11473:11657:11658:11914:12043:12049:12296:12297:12438:12517:12519:12555:12895:12986:13141:13230:13894:13972:14096:14394:14687:21080:21433:21444:21451:21627:21666:21772:21990:30012:30016:30054:30056:30067:30069:30090,0,RBL:209.85.216.66:@gmail.com:.lbl8.mailshell.net-66.100.201.100 62.50.0.100;04y8hyi8ex83drnakjahbye9s74j9yccnmewf9iz3u174yruxgiradrr3chujax.x76rfwgpr7dxd84pwfc16jy46snwgzejzmxzw3qp3mwa3whscgt54h9goeatp5z.q-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,Do mainCach X-HE-Tag: back17_180518126e8d X-Filterd-Recvd-Size: 16875 Received: from mail-pj1-f66.google.com (mail-pj1-f66.google.com [209.85.216.66]) by imf29.hostedemail.com (Postfix) with ESMTP for ; Fri, 3 Jul 2020 01:20:18 +0000 (UTC) Received: by mail-pj1-f66.google.com with SMTP id f16so2867344pjt.0 for ; Thu, 02 Jul 2020 18:20:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iSlr7AKnIgAB8760fWJ0BlcAusROwRagjWXPFnp9RMU=; b=T//0vyPno1F30cCtBOWn3ltdit5piv07M5U0M6oDgUl9h0dYiajQCJcDMjLR8nLc9i jVcDrBbNb+EMnbXhC2fxxwkSgpJLqLpienbaL3dsu7M5YSDL8JOmf6gUQjnssWQzfesF cY6Px/1ZUW6ckaeRmBKo+KNsczWCKj3WGG6aRgiLChjtkvxJeD+bnFgghlT/Hu6tjGtS iOXGiz3reXc/C7L/CEL8xbJkPucN5b7O/bm9y9hej4J7jk+V6JZfNKipg8WyE0QnLr8L V4NShNSJf2E8rgcqBqLQM9GZQNKH2lSycnvZxvAICUbC4/wyVB5IaGyk8xkHo3OlRe9K J4/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iSlr7AKnIgAB8760fWJ0BlcAusROwRagjWXPFnp9RMU=; b=XiTdI2xOJ3AvutqFlT7s3VtOQyXKTD+UqjLLeEA9JrzaSbe1BVLqpPGfwo8ubb7mr8 ALvvU6QdEP6Wni4kwU7EEsez7jpD/Bvcevws9cC3k7zNpMUribw/LHx4xjLyLtsa1Mkr lQcS7j1OIs97fupxZIS6ecDWoPl98XdXW/mVueLKgLXB73ZGbeXd8/9L9TNJLp0HeNOc vz3gxZKCltHvLM857O1LOAE0fADL+s1OjlefTaL8dkBBGgPtkiellN/ICisaiuz7AzTs dvG8ST3X5/Nur99hrhDgo2VRMIiYBw030Jp2EVr0bJszwnKJ5wPBmw4Pl41wyTuh1RGc mEDw== X-Gm-Message-State: AOAM531ckizMDiAjcp/kPxSgM/ZiPdGO2PWdZyG6JhOMo1Eknd1FJe1y O395qGi2yZ7CYNIS4lRfYNo= X-Google-Smtp-Source: ABdhPJx/Ci9eW617nxpITWY7E/TD9wgQ6pi1HTIUkQzVe2/k8ptvW8dUwNA4CbAsp5DqvFXZILBTjQ== X-Received: by 2002:a17:90a:c58e:: with SMTP id l14mr34423548pjt.67.1593739217563; Thu, 02 Jul 2020 18:20:17 -0700 (PDT) Received: from bobo.ozlabs.ibm.com (61-68-186-125.tpgi.com.au. [61.68.186.125]) by smtp.gmail.com with ESMTPSA id v186sm10094222pfv.141.2020.07.02.18.20.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jul 2020 18:20:17 -0700 (PDT) From: Nicholas Piggin To: linuxppc-dev@lists.ozlabs.org Cc: Nicholas Piggin , kvm-ppc@vger.kernel.org, linux-mm@kvack.org, linux-api@vger.kernel.org Subject: [PATCH v2 2/3] powerpc/64s: remove PROT_SAO support Date: Fri, 3 Jul 2020 11:19:57 +1000 Message-Id: <20200703011958.1166620-3-npiggin@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200703011958.1166620-1-npiggin@gmail.com> References: <20200703011958.1166620-1-npiggin@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 2E9111814B0C8 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 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: ISA v3.1 does not support the SAO storage control attribute required to implement PROT_SAO. PROT_SAO was used by specialised system software (Lx86) that has been discontinued for about 7 years, and is not thought to be used elsewhere, so removal should not cause problems. We rather remove it than keep support for older processors, because live migrating guest partitions to newer processors may not be possible if SAO is in use (or worse allowed with silent races). - PROT_SAO stays in the uapi header so code using it would still build. - arch_validate_prot() is removed, the generic version rejects PROT_SAO so applications would get a failure at mmap() time. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/book3s/64/pgtable.h | 8 ++-- arch/powerpc/include/asm/cputable.h | 10 ++--- arch/powerpc/include/asm/kvm_book3s_64.h | 5 ++- arch/powerpc/include/asm/mman.h | 26 ++---------- arch/powerpc/include/asm/nohash/64/pgtable.h | 2 - arch/powerpc/include/uapi/asm/mman.h | 2 +- arch/powerpc/kernel/dt_cpu_ftrs.c | 2 +- arch/powerpc/mm/book3s64/hash_utils.c | 2 - include/linux/mm.h | 2 - include/trace/events/mmflags.h | 2 - mm/ksm.c | 4 -- tools/testing/selftests/powerpc/mm/.gitignore | 1 - tools/testing/selftests/powerpc/mm/Makefile | 4 +- tools/testing/selftests/powerpc/mm/prot_sao.c | 42 ------------------- 14 files changed, 20 insertions(+), 92 deletions(-) delete mode 100644 tools/testing/selftests/powerpc/mm/prot_sao.c diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h index 25c3cb8272c0..8e9aca96143b 100644 --- a/arch/powerpc/include/asm/book3s/64/pgtable.h +++ b/arch/powerpc/include/asm/book3s/64/pgtable.h @@ -20,9 +20,13 @@ #define _PAGE_RW (_PAGE_READ | _PAGE_WRITE) #define _PAGE_RWX (_PAGE_READ | _PAGE_WRITE | _PAGE_EXEC) #define _PAGE_PRIVILEGED 0x00008 /* kernel access only */ -#define _PAGE_SAO 0x00010 /* Strong access order */ + +#define _PAGE_CACHE_CTL 0x00030 /* Bits for the folowing cache modes */ + /* No bits set is normal cacheable memory */ + /* 0x00010 unused, is SAO bit on radix POWER9 */ #define _PAGE_NON_IDEMPOTENT 0x00020 /* non idempotent memory */ #define _PAGE_TOLERANT 0x00030 /* tolerant memory, cache inhibited */ + #define _PAGE_DIRTY 0x00080 /* C: page changed */ #define _PAGE_ACCESSED 0x00100 /* R: page referenced */ /* @@ -825,8 +829,6 @@ static inline void __set_pte_at(struct mm_struct *mm, unsigned long addr, return hash__set_pte_at(mm, addr, ptep, pte, percpu); } -#define _PAGE_CACHE_CTL (_PAGE_SAO | _PAGE_NON_IDEMPOTENT | _PAGE_TOLERANT) - #define pgprot_noncached pgprot_noncached static inline pgprot_t pgprot_noncached(pgprot_t prot) { diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h index bac2252c839e..87284750535d 100644 --- a/arch/powerpc/include/asm/cputable.h +++ b/arch/powerpc/include/asm/cputable.h @@ -191,7 +191,7 @@ static inline void cpu_feature_keys_init(void) { } #define CPU_FTR_SPURR LONG_ASM_CONST(0x0000000001000000) #define CPU_FTR_DSCR LONG_ASM_CONST(0x0000000002000000) #define CPU_FTR_VSX LONG_ASM_CONST(0x0000000004000000) -#define CPU_FTR_SAO LONG_ASM_CONST(0x0000000008000000) +// Free LONG_ASM_CONST(0x0000000008000000) #define CPU_FTR_CP_USE_DCBTZ LONG_ASM_CONST(0x0000000010000000) #define CPU_FTR_UNALIGNED_LD_STD LONG_ASM_CONST(0x0000000020000000) #define CPU_FTR_ASYM_SMT LONG_ASM_CONST(0x0000000040000000) @@ -435,7 +435,7 @@ static inline void cpu_feature_keys_init(void) { } CPU_FTR_MMCRA | CPU_FTR_SMT | \ CPU_FTR_COHERENT_ICACHE | \ CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \ - CPU_FTR_DSCR | CPU_FTR_SAO | CPU_FTR_ASYM_SMT | \ + CPU_FTR_DSCR | CPU_FTR_ASYM_SMT | \ CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \ CPU_FTR_CFAR | CPU_FTR_HVMODE | \ CPU_FTR_VMX_COPY | CPU_FTR_HAS_PPR | CPU_FTR_DABRX | CPU_FTR_PKEY) @@ -444,7 +444,7 @@ static inline void cpu_feature_keys_init(void) { } CPU_FTR_MMCRA | CPU_FTR_SMT | \ CPU_FTR_COHERENT_ICACHE | \ CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \ - CPU_FTR_DSCR | CPU_FTR_SAO | \ + CPU_FTR_DSCR | \ CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \ CPU_FTR_CFAR | CPU_FTR_HVMODE | CPU_FTR_VMX_COPY | \ CPU_FTR_DBELL | CPU_FTR_HAS_PPR | CPU_FTR_DAWR | \ @@ -455,7 +455,7 @@ static inline void cpu_feature_keys_init(void) { } CPU_FTR_MMCRA | CPU_FTR_SMT | \ CPU_FTR_COHERENT_ICACHE | \ CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \ - CPU_FTR_DSCR | CPU_FTR_SAO | \ + CPU_FTR_DSCR | \ CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \ CPU_FTR_CFAR | CPU_FTR_HVMODE | CPU_FTR_VMX_COPY | \ CPU_FTR_DBELL | CPU_FTR_HAS_PPR | CPU_FTR_ARCH_207S | \ @@ -473,7 +473,7 @@ static inline void cpu_feature_keys_init(void) { } CPU_FTR_MMCRA | CPU_FTR_SMT | \ CPU_FTR_COHERENT_ICACHE | \ CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \ - CPU_FTR_DSCR | CPU_FTR_SAO | \ + CPU_FTR_DSCR | \ CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \ CPU_FTR_CFAR | CPU_FTR_HVMODE | CPU_FTR_VMX_COPY | \ CPU_FTR_DBELL | CPU_FTR_HAS_PPR | CPU_FTR_ARCH_207S | \ diff --git a/arch/powerpc/include/asm/kvm_book3s_64.h b/arch/powerpc/include/asm/kvm_book3s_64.h index 9bb9bb370b53..fac39ff659d4 100644 --- a/arch/powerpc/include/asm/kvm_book3s_64.h +++ b/arch/powerpc/include/asm/kvm_book3s_64.h @@ -398,9 +398,10 @@ static inline bool hpte_cache_flags_ok(unsigned long hptel, bool is_ci) { unsigned int wimg = hptel & HPTE_R_WIMG; - /* Handle SAO */ + /* Handle SAO for POWER7,8,9 */ if (wimg == (HPTE_R_W | HPTE_R_I | HPTE_R_M) && - cpu_has_feature(CPU_FTR_ARCH_206)) + cpu_has_feature(CPU_FTR_ARCH_206) && + !cpu_has_feature(CPU_FTR_ARCH_31)) wimg = HPTE_R_M; if (!is_ci) diff --git a/arch/powerpc/include/asm/mman.h b/arch/powerpc/include/asm/mman.h index 4ba303ea27f5..7c07728af300 100644 --- a/arch/powerpc/include/asm/mman.h +++ b/arch/powerpc/include/asm/mman.h @@ -13,38 +13,20 @@ #include #include +#ifdef CONFIG_PPC_MEM_KEYS static inline unsigned long arch_calc_vm_prot_bits(unsigned long prot, unsigned long pkey) { -#ifdef CONFIG_PPC_MEM_KEYS - return (((prot & PROT_SAO) ? VM_SAO : 0) | pkey_to_vmflag_bits(pkey)); -#else - return ((prot & PROT_SAO) ? VM_SAO : 0); -#endif + return pkey_to_vmflag_bits(pkey); } #define arch_calc_vm_prot_bits(prot, pkey) arch_calc_vm_prot_bits(prot, pkey) static inline pgprot_t arch_vm_get_page_prot(unsigned long vm_flags) { -#ifdef CONFIG_PPC_MEM_KEYS - return (vm_flags & VM_SAO) ? - __pgprot(_PAGE_SAO | vmflag_to_pte_pkey_bits(vm_flags)) : - __pgprot(0 | vmflag_to_pte_pkey_bits(vm_flags)); -#else - return (vm_flags & VM_SAO) ? __pgprot(_PAGE_SAO) : __pgprot(0); -#endif + return __pgprot(vmflag_to_pte_pkey_bits(vm_flags)); } #define arch_vm_get_page_prot(vm_flags) arch_vm_get_page_prot(vm_flags) - -static inline bool arch_validate_prot(unsigned long prot, unsigned long addr) -{ - if (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_SEM | PROT_SAO)) - return false; - if ((prot & PROT_SAO) && !cpu_has_feature(CPU_FTR_SAO)) - return false; - return true; -} -#define arch_validate_prot arch_validate_prot +#endif #endif /* CONFIG_PPC64 */ #endif /* _ASM_POWERPC_MMAN_H */ diff --git a/arch/powerpc/include/asm/nohash/64/pgtable.h b/arch/powerpc/include/asm/nohash/64/pgtable.h index 6cb8aa357191..59ee9fa4ae09 100644 --- a/arch/powerpc/include/asm/nohash/64/pgtable.h +++ b/arch/powerpc/include/asm/nohash/64/pgtable.h @@ -82,8 +82,6 @@ */ #include -#define _PAGE_SAO 0 - #define PTE_RPN_MASK (~((1UL << PTE_RPN_SHIFT) - 1)) /* diff --git a/arch/powerpc/include/uapi/asm/mman.h b/arch/powerpc/include/uapi/asm/mman.h index c0c737215b00..3a700351feca 100644 --- a/arch/powerpc/include/uapi/asm/mman.h +++ b/arch/powerpc/include/uapi/asm/mman.h @@ -11,7 +11,7 @@ #include -#define PROT_SAO 0x10 /* Strong Access Ordering */ +#define PROT_SAO 0x10 /* Unsupported since v5.9 */ #define MAP_RENAME MAP_ANONYMOUS /* In SunOS terminology */ #define MAP_NORESERVE 0x40 /* don't reserve swap pages */ diff --git a/arch/powerpc/kernel/dt_cpu_ftrs.c b/arch/powerpc/kernel/dt_cpu_ftrs.c index 3a409517c031..41412c198e70 100644 --- a/arch/powerpc/kernel/dt_cpu_ftrs.c +++ b/arch/powerpc/kernel/dt_cpu_ftrs.c @@ -622,7 +622,7 @@ static struct dt_cpu_feature_match __initdata {"processor-control-facility-v3", feat_enable_dbell, CPU_FTR_DBELL}, {"processor-utilization-of-resources-register", feat_enable_purr, 0}, {"no-execute", feat_enable, 0}, - {"strong-access-ordering", feat_enable, CPU_FTR_SAO}, + /* strong-access-ordering is unused */ {"cache-inhibited-large-page", feat_enable_large_ci, 0}, {"coprocessor-icswx", feat_enable, 0}, {"hypervisor-virtualization-interrupt", feat_enable_hvi, 0}, diff --git a/arch/powerpc/mm/book3s64/hash_utils.c b/arch/powerpc/mm/book3s64/hash_utils.c index 468169e33c86..e35d8dae4f84 100644 --- a/arch/powerpc/mm/book3s64/hash_utils.c +++ b/arch/powerpc/mm/book3s64/hash_utils.c @@ -232,8 +232,6 @@ unsigned long htab_convert_pte_flags(unsigned long pteflags) rflags |= HPTE_R_I; else if ((pteflags & _PAGE_CACHE_CTL) == _PAGE_NON_IDEMPOTENT) rflags |= (HPTE_R_I | HPTE_R_G); - else if ((pteflags & _PAGE_CACHE_CTL) == _PAGE_SAO) - rflags |= (HPTE_R_W | HPTE_R_I | HPTE_R_M); else /* * Add memory coherence if cache inhibited is not set diff --git a/include/linux/mm.h b/include/linux/mm.h index dc7b87310c10..6c8333d6c991 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -317,8 +317,6 @@ extern unsigned int kobjsize(const void *objp); #if defined(CONFIG_X86) # define VM_PAT VM_ARCH_1 /* PAT reserves whole VMA at once (x86) */ -#elif defined(CONFIG_PPC) -# define VM_SAO VM_ARCH_1 /* Strong Access Ordering (powerpc) */ #elif defined(CONFIG_PARISC) # define VM_GROWSUP VM_ARCH_1 #elif defined(CONFIG_IA64) diff --git a/include/trace/events/mmflags.h b/include/trace/events/mmflags.h index 5fb752034386..939092dbcb8b 100644 --- a/include/trace/events/mmflags.h +++ b/include/trace/events/mmflags.h @@ -114,8 +114,6 @@ IF_HAVE_PG_IDLE(PG_idle, "idle" ) #if defined(CONFIG_X86) #define __VM_ARCH_SPECIFIC_1 {VM_PAT, "pat" } -#elif defined(CONFIG_PPC) -#define __VM_ARCH_SPECIFIC_1 {VM_SAO, "sao" } #elif defined(CONFIG_PARISC) || defined(CONFIG_IA64) #define __VM_ARCH_SPECIFIC_1 {VM_GROWSUP, "growsup" } #elif !defined(CONFIG_MMU) diff --git a/mm/ksm.c b/mm/ksm.c index 4102034cd55a..d1cfa18689b5 100644 --- a/mm/ksm.c +++ b/mm/ksm.c @@ -2452,10 +2452,6 @@ int ksm_madvise(struct vm_area_struct *vma, unsigned long start, if (vma_is_dax(vma)) return 0; -#ifdef VM_SAO - if (*vm_flags & VM_SAO) - return 0; -#endif #ifdef VM_SPARC_ADI if (*vm_flags & VM_SPARC_ADI) return 0; diff --git a/tools/testing/selftests/powerpc/mm/.gitignore b/tools/testing/selftests/powerpc/mm/.gitignore index 2ca523255b1b..ff296c94f627 100644 --- a/tools/testing/selftests/powerpc/mm/.gitignore +++ b/tools/testing/selftests/powerpc/mm/.gitignore @@ -2,7 +2,6 @@ hugetlb_vs_thp_test subpage_prot tempfile -prot_sao segv_errors wild_bctr large_vm_fork_separation diff --git a/tools/testing/selftests/powerpc/mm/Makefile b/tools/testing/selftests/powerpc/mm/Makefile index b9103c4bb414..9b8a7b3069c5 100644 --- a/tools/testing/selftests/powerpc/mm/Makefile +++ b/tools/testing/selftests/powerpc/mm/Makefile @@ -2,7 +2,7 @@ noarg: $(MAKE) -C ../ -TEST_GEN_PROGS := hugetlb_vs_thp_test subpage_prot prot_sao segv_errors wild_bctr \ +TEST_GEN_PROGS := hugetlb_vs_thp_test subpage_prot segv_errors wild_bctr \ large_vm_fork_separation bad_accesses TEST_GEN_PROGS_EXTENDED := tlbie_test TEST_GEN_FILES := tempfile @@ -12,8 +12,6 @@ include ../../lib.mk $(TEST_GEN_PROGS): ../harness.c -$(OUTPUT)/prot_sao: ../utils.c - $(OUTPUT)/wild_bctr: CFLAGS += -m64 $(OUTPUT)/large_vm_fork_separation: CFLAGS += -m64 $(OUTPUT)/bad_accesses: CFLAGS += -m64 diff --git a/tools/testing/selftests/powerpc/mm/prot_sao.c b/tools/testing/selftests/powerpc/mm/prot_sao.c deleted file mode 100644 index e2eed65b7735..000000000000 --- a/tools/testing/selftests/powerpc/mm/prot_sao.c +++ /dev/null @@ -1,42 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Copyright 2016, Michael Ellerman, IBM Corp. - */ - -#include -#include -#include -#include - -#include - -#include "utils.h" - -#define SIZE (64 * 1024) - -int test_prot_sao(void) -{ - char *p; - - /* 2.06 or later should support SAO */ - SKIP_IF(!have_hwcap(PPC_FEATURE_ARCH_2_06)); - - /* - * Ensure we can ask for PROT_SAO. - * We can't really verify that it does the right thing, but at least we - * confirm the kernel will accept it. - */ - p = mmap(NULL, SIZE, PROT_READ | PROT_WRITE | PROT_SAO, - MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); - FAIL_IF(p == MAP_FAILED); - - /* Write to the mapping, to at least cause a fault */ - memset(p, 0xaa, SIZE); - - return 0; -} - -int main(void) -{ - return test_harness(test_prot_sao, "prot-sao"); -} From patchwork Fri Jul 3 01:19:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 11640535 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2DC716C1 for ; Fri, 3 Jul 2020 01:20:24 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id EE69820737 for ; Fri, 3 Jul 2020 01:20:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XvguNpRZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EE69820737 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E004E8D0036; Thu, 2 Jul 2020 21:20:22 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id D89208D0021; Thu, 2 Jul 2020 21:20:22 -0400 (EDT) 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 C52DD8D0036; Thu, 2 Jul 2020 21:20:22 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0246.hostedemail.com [216.40.44.246]) by kanga.kvack.org (Postfix) with ESMTP id AA0A78D0021 for ; Thu, 2 Jul 2020 21:20:22 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 7627E52D0 for ; Fri, 3 Jul 2020 01:20:22 +0000 (UTC) X-FDA: 76995009084.17.walk96_1d0941326e8d Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin17.hostedemail.com (Postfix) with ESMTP id 53831180D0184 for ; Fri, 3 Jul 2020 01:20:22 +0000 (UTC) X-Spam-Summary: 1,0,0,ef48f05a8fa774fb,d41d8cd98f00b204,npiggin@gmail.com,,RULES_HIT:41:355:379:541:800:960:968:973:988:989:1042:1260:1311:1314:1345:1359:1437:1515:1535:1542:1711:1730:1747:1777:1792:2198:2199:2393:2559:2562:2901:3138:3139:3140:3141:3142:3352:3865:3866:3867:3868:3870:3871:3872:3874:4321:4605:5007:6261:6653:7514:7901:7903:7904:8660:9413:10004:11026:11232:11473:11658:11914:12043:12296:12297:12438:12517:12519:12555:12895:13148:13161:13229:13230:13894:14093:14096:14181:14394:14687:14721:21080:21212:21444:21451:21627:21666:21772:21795:21939:21990:30051:30054,0,RBL:209.85.216.65:@gmail.com:.lbl8.mailshell.net-62.50.0.100 66.100.201.100;04ygdhj6g3iynu7zkg94tsx1x7ew1yceipb8u1y6b8o44dtajpc6gda7icdtd41.js19n51to3pdefcert3agbhoeinzr5xtg8q9r7eg3n4puxcsf9hppozs8dnqk1w.c-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:22,LUA_SUMMARY:none X-HE-Tag: walk96_1d0941326e8d X-Filterd-Recvd-Size: 5127 Received: from mail-pj1-f65.google.com (mail-pj1-f65.google.com [209.85.216.65]) by imf29.hostedemail.com (Postfix) with ESMTP for ; Fri, 3 Jul 2020 01:20:21 +0000 (UTC) Received: by mail-pj1-f65.google.com with SMTP id c1so5995299pja.5 for ; Thu, 02 Jul 2020 18:20:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=o8LwC+qktyP8ZqLNY6wHCDbWY3Ky3sWMv7KAmaONrVU=; b=XvguNpRZTZP/h71d93R73VBOlM08LPuaeOBlneU63ne/L7GLBObyffyWirquXwzInf 59t68Sik6FbFSfnqXHjB9LmnXjakPzB8VDLhS/RbAAziGzaIv+Sncs0FV3mfuwzt7AFX gLIt/5rvF/ONaC+jkxf2MHxcxslGczknFLwtC238Vw3nzbqnGFqV8b/1ZJa8Y8QQIItG 9Q/OubfWO1HtogwuIrDelys65tKh+KSZwYhYusdsiQpYyLUqDXDGhCJ8eqvU0LILRmeB jRgxPziUKmXugrRCu8qc6vh58u4756iZfl8/VXOQRfMPFab7InZAUaLJIz7aueuRVuYF x2bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=o8LwC+qktyP8ZqLNY6wHCDbWY3Ky3sWMv7KAmaONrVU=; b=LQU6CrN9xlGAd3AFhsT3A3VvssdE7Czo5AX0ShRvV1hbMIT/nUCKs7Of+XSr7KSYCI QC8nn7rb3TTHm6c6kbGMJ/0RxCLX/nVwcpX1GZVryF/Sysb233PysiFnyqAk17RZtxfZ UXPdSaQZiIbOa1Z6d6PynlRFSFSAW3BFiUoB6KnXUW6BeFHD/Rch2Hzdtktm4fe6MUrD YeZLRNAJIFg6HIh4OTsxoSL3TMT9VlhjhiACVzL6HSUKU4c65ZISmsoMMB4kvzPpJVT6 4vQ19UWl0Qj3792rqlIfIml36gV1Vs9jeFi5JQlPkYnkniLIj4NrR5cxuMyxtn+4Ajvr WbSA== X-Gm-Message-State: AOAM53320PJCpZO29ax0kZtWlLPmLPGK05iDpnJ5Xqpfl6qJgU9/2Gwy lrCYs9sYdIldxioc4VB2vTrDju8Z X-Google-Smtp-Source: ABdhPJzjRaAlp7XO//YM/8n2zmmXsVRaggi4uCA028UZFvDs8+H+qXrObFXTvNH00boHgly3COvZYw== X-Received: by 2002:a17:90a:e618:: with SMTP id j24mr4699964pjy.41.1593739221038; Thu, 02 Jul 2020 18:20:21 -0700 (PDT) Received: from bobo.ozlabs.ibm.com (61-68-186-125.tpgi.com.au. [61.68.186.125]) by smtp.gmail.com with ESMTPSA id v186sm10094222pfv.141.2020.07.02.18.20.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jul 2020 18:20:20 -0700 (PDT) From: Nicholas Piggin To: linuxppc-dev@lists.ozlabs.org Cc: Nicholas Piggin , kvm-ppc@vger.kernel.org, linux-mm@kvack.org, linux-api@vger.kernel.org Subject: [PATCH v2 3/3] powerpc/64s/hash: disable subpage_prot syscall by default Date: Fri, 3 Jul 2020 11:19:58 +1000 Message-Id: <20200703011958.1166620-4-npiggin@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200703011958.1166620-1-npiggin@gmail.com> References: <20200703011958.1166620-1-npiggin@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 53831180D0184 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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: The subpage_prot syscall was added for specialised system software (Lx86) that has been discontinued for about 7 years, and is not thought to be used elsewhere, so disable it by default. Signed-off-by: Nicholas Piggin --- arch/powerpc/Kconfig | 7 +++++-- arch/powerpc/configs/powernv_defconfig | 1 - arch/powerpc/configs/pseries_defconfig | 1 - 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 9fa23eb320ff..04c6ca17661a 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -833,13 +833,16 @@ config FORCE_MAX_ZONEORDER this in mind when choosing a value for this option. config PPC_SUBPAGE_PROT - bool "Support setting protections for 4k subpages" + bool "Support setting protections for 4k subpages (subpage_prot syscall)" + default n depends on PPC_BOOK3S_64 && PPC_64K_PAGES help - This option adds support for a system call to allow user programs + This option adds support for system call to allow user programs to set access permissions (read/write, readonly, or no access) on the 4k subpages of each 64k page. + If unsure, say N here. + config PPC_COPRO_BASE bool diff --git a/arch/powerpc/configs/powernv_defconfig b/arch/powerpc/configs/powernv_defconfig index 2de9aadf0f50..afc0dd73a1e6 100644 --- a/arch/powerpc/configs/powernv_defconfig +++ b/arch/powerpc/configs/powernv_defconfig @@ -64,7 +64,6 @@ CONFIG_HWPOISON_INJECT=m CONFIG_TRANSPARENT_HUGEPAGE=y CONFIG_DEFERRED_STRUCT_PAGE_INIT=y CONFIG_PPC_64K_PAGES=y -CONFIG_PPC_SUBPAGE_PROT=y CONFIG_SCHED_SMT=y CONFIG_PM=y CONFIG_HOTPLUG_PCI=y diff --git a/arch/powerpc/configs/pseries_defconfig b/arch/powerpc/configs/pseries_defconfig index dfa4a726333b..894e8d85fb48 100644 --- a/arch/powerpc/configs/pseries_defconfig +++ b/arch/powerpc/configs/pseries_defconfig @@ -57,7 +57,6 @@ CONFIG_MEMORY_HOTREMOVE=y CONFIG_KSM=y CONFIG_TRANSPARENT_HUGEPAGE=y CONFIG_PPC_64K_PAGES=y -CONFIG_PPC_SUBPAGE_PROT=y CONFIG_SCHED_SMT=y CONFIG_HOTPLUG_PCI=y CONFIG_HOTPLUG_PCI_RPA=m