From patchwork Sun Aug 20 10:20:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 110480 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp25714qge; Sun, 20 Aug 2017 03:21:33 -0700 (PDT) X-Received: by 10.98.133.156 with SMTP id m28mr1222646pfk.208.1503224493149; Sun, 20 Aug 2017 03:21:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503224493; cv=none; d=google.com; s=arc-20160816; b=tst/m24OvAnPebzGBmXe2ZyOBwY9Y9bsghnalB4XCrj2n5WCYb9WyUNpJMy90n6Ud5 /2BBSAj92eX/i2eKuYjEkMX3sw0BKnVHNOhO1674bEKkcrR3at8VHiL/AZ0zXoB0lr9R v0uLBLKIEjUuHBI383MdfiAuhFJAuoQZtATUupFPRpc4QnrXryIlZylf/NvmMpcH9PTA OWcaL8l9h12rctUlydAhIh1/nmF19uVAmxMiBW9LvKHhuj16L/ACA4hF8hekc2fu0vFF iF6pSYgLk7UVDGCR6y5QRd3Po/by/uVSHlRYZjA8+NO5xk8GBuPQLoP8LuOqDfgDl5lh uXDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:arc-authentication-results; bh=zeeHApmtVHNQx5BWhDn1gasYR2SeKBK1Z9qqYU7rR54=; b=Y1fmlTdG1rUPz8+2g73IfFw1Yj2NkiAKpABTzzHz7RZi8MawJGhpkqF8rR4cMXgHvq Tbp7eko4zWYikGdcqeyIh4Z2W2NkvrKeeofaXN4+tPTnXqecmPaQEO6kg2MXT4oziv+O cMB4UxYV2igk7MGIwTIDR7JOE/38h8n9AJgmZHiDaRx7Au+xMZ71A8tWhHylgcYnezBs eMPwkJ2goHCHQfKtpxL4mnIvF6tXfopJ20x2kEntT3SfvqwkhBwsajd9wGSoVZ42wAZr Ko07t5RP/TIJ5OJ22C9JdIQSQ22b63HqEMN1Hh/WId24U21y0wxYYvbb6TW8CAGr3EdQ D7bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@CAVIUMNETWORKS.onmicrosoft.com header.s=selector1-cavium-com header.b=HF13dTNa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o13si808979pfh.46.2017.08.20.03.21.32; Sun, 20 Aug 2017 03:21:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@CAVIUMNETWORKS.onmicrosoft.com header.s=selector1-cavium-com header.b=HF13dTNa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752717AbdHTKVa (ORCPT + 26 others); Sun, 20 Aug 2017 06:21:30 -0400 Received: from mail-bl2nam02on0051.outbound.protection.outlook.com ([104.47.38.51]:4286 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752588AbdHTKV3 (ORCPT ); Sun, 20 Aug 2017 06:21:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=zeeHApmtVHNQx5BWhDn1gasYR2SeKBK1Z9qqYU7rR54=; b=HF13dTNa7hZ0MZ7v1ZAC+8uHRiDL5Y6Cfqo16IeDoBiZnQxhnjfTq60K5lT0dEgoJRSY/4OjB4IOIlztTvXr7vP2GQAT2+/VwT0PoSEXRlE/Lil4R+x6+exE5GGfYouatbfUd+OGqWBSTgmVT8TErOtaW5lOikegqtK6bFP9pqE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@cavium.com; Received: from localhost (88.148.44.91) by CY1PR07MB2120.namprd07.prod.outlook.com (10.164.73.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1362.18; Sun, 20 Aug 2017 10:21:24 +0000 From: Yury Norov To: Catalin Marinas , Pratyush Anand Cc: Yury Norov , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] arm64: introduce separated bits for mm_context_t flags Date: Sun, 20 Aug 2017 13:20:47 +0300 Message-Id: <20170820102048.7537-2-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170820102048.7537-1-ynorov@caviumnetworks.com> References: <20170820102048.7537-1-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [88.148.44.91] X-ClientProxiedBy: HE1PR06CA0145.eurprd06.prod.outlook.com (10.170.251.32) To CY1PR07MB2120.namprd07.prod.outlook.com (10.164.73.158) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bdbdc44c-7f1b-405c-bca7-08d4e7b536bf X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:CY1PR07MB2120; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2120; 3:qg5L98GPhfZm3ghsSn1hN+Rd5lu77xnEZ6GfwM62JrpKSuCwuJ9abXXkovnvmgvH1/+4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2Sp6rBT9AYVDHwwPgCYonN7b7NNilzhgzsFEU1hDWuokRadn6r8N+7uUACeh4tSCQtsNLx3P6ha7kmrqG/GiMG/3xmUiuedX7So/+uFW9Ffas0E8z+WjDJzT+9QYBFrhirN98OVIYdjiDvRTdsj6r/akjodgh4RC6v1ijdfUdvH/Md1GfLfXHePCcmfpmoxL/nezLDYnOfCMDAuok/+fz3fQ/4yoyBMivAyY9ZtPfpbWj/ZB+Hti8oliHljE1l1TdquC5MULRZaDt6+pFQxtm0doAXhmsCkd0RysAI7Cv6L2YMfawjfVeDTAU3VlxqrUCdmxmrhW6ZZZJIdInJ5K1+40x4fU/yh1MAy3gO+iY81O8C5w42omK3qNgvVog=; 4:H5+X8eCGGsdbSY6mRRJwMXOe81NcXHRa+CBng6nyhu1LbSHDkI+qJI+O0YAHskK0e3ImPMkm2xMay2WQ6R3vle3CeZDyNi+J1NtSiOVVpfnJ2K4ToxFKutydbHmPo++JO1Fdb1VAQuq+e2PF3VWQyHB+Vqb85mLhTvLyMiZfFovSVTGkWi+4K3RktOyh3wA1ksG9VGNW8WvFu+7EndL66nV05d8H60ERxAzhoXvQSpi5kS+gfcx9qUrlAtv5QLSi X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(3002001)(100000703101)(100105400095)(93006095)(10201501046)(6041248)(20161123555025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123560025)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY1PR07MB2120; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY1PR07MB2120; X-Forefront-PRVS: 040513D301 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(7370300001)(6009001)(6069001)(199003)(189002)(36756003)(50986999)(106356001)(6486002)(42882006)(76506005)(76176999)(2950100002)(42186005)(33646002)(105586002)(6496005)(6666003)(6306002)(53936002)(47776003)(48376002)(66066001)(50466002)(101416001)(305945005)(7350300001)(7736002)(575784001)(5660300001)(4326008)(50226002)(81166006)(8676002)(81156014)(3846002)(6116002)(72206003)(2906002)(478600001)(966005)(25786009)(97736004)(68736007)(5003940100001)(1076002)(189998001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR07MB2120; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2120; 23:ejSbK5Po28ahttTq9oqV+57giWJ6ffQhc7FUG/k4wEUdXk5GFR2SzupS+N0E5nf3oDZuoReFKBDzz/BdI1V3onsLKN+WCIVscez01OBpNO/T/JL+cfy3Ytjp6UChIPyih85g1NAyVPMBI9DtPb285Rx8wiHAwqw1u8u8QywpHbYVEhgNpH/OrwV3FHrZQ4p2QTE//BH2bnZJsLU0GKEzUwg8Jd/ZnrLZTT6PG/qnY4Xvf83HowRMdNhTCTvCxhZMQvAyPuvHJcHKZXa10O00JyGoDfLnQe7VdevPiYmrIb63rZcxn17Y19DPe+PwTOKciNbPYjTHhiO8mYvtildo5/lfnO1dChlYxm0XUstFIgYB1KlJItrpG2j/DnDzwsHOSB0G1G3RuqkbhaLb5jioC7zwtRsSSt4vjblemrUqQdDofAiXM+YYT7am0D1+Tn0L8zISmnB2qQyaWZmU7+XPIlvd5mPRYZCMfLPTiV5rNiRWJ8RaHCAy/dJEKVT8oue5wD7D2GMJxTpVA/dzcJkXr6CY6Yk0IKT04ihHnrKmMeLuy5sk+/mloAX9flHsMinKOMUiJVlvxgkflYt22K4GnpFIxmBXUXwy5Ud7jNvOzEnSaHw8s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IiA==; 24:2BGwLM2+ULb69voF+hxq6+3j1Gw15bsknv7KhfQ9yW/SfStp9kQjFcxClk+tPROplFSXHPV5u3HZNOZxujSEKLFM9gt+cAnsx9ChcI6W9Mk=; 7:+RLBIjUQJAjHK0dYEWP+Bu1wyMp8X5k5p+N3MC/MXKLlYpp4dfB5RuzvO9EacvTMO4jsZvngXaNhUEpxQXpHV4wmiLieNBG08h6vTpsKUgzFJqttUO9m9jOJLkMz3ImzfiCle/3g8Yl8PX6F+kld54hOQFpbs4Y/Z+P/WN8VVude9B/qQ3u/6+UreoyMUSqPjZbUdXDWl4NdPtADQQTmF7mLzynM6JlEcI09hN9E/Po= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Aug 2017 10:21:24.6745 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2120 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently mm->context.flags field uses thread_info flags which is not the best idea for many reasons. For example, mm_context_t doesn't need most of thread_info flags. And it would be difficult to add new mm-related flag if needed because it may easily interfere with TIF ones. To deal with it, the new MMCF_AARCH32 flag is introduced for mm_context_t->flags, where MMCF prefix stands for mm_context_t flags. Also, mm_context_t flag doesn't require atomicity and ordering of the access, so using set/clear_bit() is replaced with simple masks. RFC: https://lkml.org/lkml/2017/7/31/454 v1: - changed the MMCF_AARCH32 bit number from 0x1 to 0x0 and added comment v2: - using set/clear_bit() is replaced with simple masks. Signed-off-by: Yury Norov --- arch/arm64/include/asm/elf.h | 4 ++-- arch/arm64/include/asm/mmu.h | 2 ++ arch/arm64/kernel/probes/uprobes.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) -- 2.11.0 diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h index 3288c2b36731..517b9ff0456c 100644 --- a/arch/arm64/include/asm/elf.h +++ b/arch/arm64/include/asm/elf.h @@ -139,7 +139,7 @@ typedef struct user_fpsimd_state elf_fpregset_t; #define SET_PERSONALITY(ex) \ ({ \ - clear_bit(TIF_32BIT, ¤t->mm->context.flags); \ + current->mm->context.flags = 0; \ clear_thread_flag(TIF_32BIT); \ current->personality &= ~READ_IMPLIES_EXEC; \ }) @@ -195,7 +195,7 @@ typedef compat_elf_greg_t compat_elf_gregset_t[COMPAT_ELF_NGREG]; */ #define COMPAT_SET_PERSONALITY(ex) \ ({ \ - set_bit(TIF_32BIT, ¤t->mm->context.flags); \ + current->mm->context.flags = MMCF_AARCH32; \ set_thread_flag(TIF_32BIT); \ }) #define COMPAT_ARCH_DLINFO diff --git a/arch/arm64/include/asm/mmu.h b/arch/arm64/include/asm/mmu.h index 5468c834b072..e4c474c6501e 100644 --- a/arch/arm64/include/asm/mmu.h +++ b/arch/arm64/include/asm/mmu.h @@ -16,6 +16,8 @@ #ifndef __ASM_MMU_H #define __ASM_MMU_H +#define MMCF_AARCH32 0x1 /* MM hosts AArch32 executables */ + typedef struct { atomic64_t id; void *vdso; diff --git a/arch/arm64/kernel/probes/uprobes.c b/arch/arm64/kernel/probes/uprobes.c index 26c998534dca..636ca0119c0e 100644 --- a/arch/arm64/kernel/probes/uprobes.c +++ b/arch/arm64/kernel/probes/uprobes.c @@ -40,7 +40,7 @@ int arch_uprobe_analyze_insn(struct arch_uprobe *auprobe, struct mm_struct *mm, probe_opcode_t insn; /* TODO: Currently we do not support AARCH32 instruction probing */ - if (test_bit(TIF_32BIT, &mm->context.flags)) + if (mm->context.flags & MMCF_AARCH32) return -ENOTSUPP; else if (!IS_ALIGNED(addr, AARCH64_INSN_SIZE)) return -EINVAL;