From patchwork Fri Apr 29 21:07:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 8985561 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7DFB59F372 for ; Fri, 29 Apr 2016 21:36:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8D4B2201CE for ; Fri, 29 Apr 2016 21:36:05 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B3ADE20166 for ; Fri, 29 Apr 2016 21:36:04 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1awG3V-0006Tv-Fi; Fri, 29 Apr 2016 21:34:33 +0000 Received: from mail-pa0-x235.google.com ([2607:f8b0:400e:c03::235]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1awG3S-0006P3-Re for linux-arm-kernel@lists.infradead.org; Fri, 29 Apr 2016 21:34:31 +0000 Received: by mail-pa0-x235.google.com with SMTP id iv1so50336338pac.2 for ; Fri, 29 Apr 2016 14:34:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=ZY8kKM9Rjn/vvXSIVl13ZcNiD1uBVyKwXVFIswksmQQ=; b=daQDTneGvPpUZiBjzR8NZcm3V/dlXV6x3H0hMbKJ2JA8pL7iOPmIAMXEbXeU0tNwoe P1fQAXOp0+zd1+DG6uCfJI4e+dD/vPmZja0Rdp+EaGiFMf6EAMkPjgvtqwohb+B8/fbU hxpPRyLUw+OowVvpXuJzi94Q5AiuzZ48sValc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ZY8kKM9Rjn/vvXSIVl13ZcNiD1uBVyKwXVFIswksmQQ=; b=f2Kv3We50KyvkmXvjS6SPpnaTghUUcxK1zQpe7vcgEI86tIgWe7pyIZgSwAxdmoxMo m21Qhnh0IABK1iGMLo+vRbQAZMnlA3aojq74yN30r1Xse+5eyZUleN3nuZ/6sZRNoPae hMbPqqA4v7JrZmLLpp3pG2EfSoN674R2Mo6BFy+qoJyvo6rzei+8cBO2JM7pgjuaHu3G Ii8BgAStbv/7JbDYiV5N1DeBzIPiEyq3YIVzrCRoY9xZ5blYxURk+a/ZDUsbCclWW6I1 0NKM2LbohUwgkF21wqtz1K7v/bHeX17ZuN5W20+yvEMO308Vzs1e0ukHnFEY/nvDvA5X Uq/A== X-Gm-Message-State: AOPr4FWSi2ozA/Ismi/fySldF65YIiTMPa4Ps1W7G/Znwv2jLgES96FnPKwTZLAWiJYmczpb X-Received: by 10.66.160.201 with SMTP id xm9mr32032476pab.68.1461965649882; Fri, 29 Apr 2016 14:34:09 -0700 (PDT) Received: from yshi-Precision-T5600.corp.ad.wrs.com (unknown-216-82.windriver.com. [147.11.216.82]) by smtp.gmail.com with ESMTPSA id m12sm25847708pfi.5.2016.04.29.14.34.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Apr 2016 14:34:09 -0700 (PDT) From: Yang Shi To: will.deacon@arm.com, catalin.marinas@arm.com Subject: [PATCH] arm64: always use STRICT_MM_TYPECHECKS Date: Fri, 29 Apr 2016 14:07:54 -0700 Message-Id: <1461964074-12544-1-git-send-email-yang.shi@linaro.org> X-Mailer: git-send-email 2.0.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160429_143430_924837_8B09FF8A X-CRM114-Status: GOOD ( 10.30 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: yang.shi@linaro.org, linaro-kernel@lists.linaro.org, Arnd Bergmann , Ard Biesheuvel , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Inspired by the counterpart of powerpc [1], which shows there is no negative effect on code generation from enabling STRICT_MM_TYPECHECKS with a modern compiler. And, Arnd's comment [2] about that patch says STRICT_MM_TYPECHECKS could be default as long as the architecture can pass structures in registers as function arguments. ARM64 can do it as long as the size of structure <= 16 bytes. All the page table value types are u64 on ARM64. The below disassembly demonstrates it, entry is pte_t type: entry = arch_make_huge_pte(entry, vma, page, writable); 0xffff00000826fc38 <+80>: and x0, x0, #0xfffffffffffffffd 0xffff00000826fc3c <+84>: mov w3, w21 0xffff00000826fc40 <+88>: mov x2, x20 0xffff00000826fc44 <+92>: mov x1, x19 0xffff00000826fc48 <+96>: orr x0, x0, #0x400 0xffff00000826fc4c <+100>: bl 0xffff00000809bcc0 [1] http://www.spinics.net/lists/linux-mm/msg105951.html [2] http://www.spinics.net/lists/linux-mm/msg105969.html Signed-off-by: Yang Shi CC: Arnd Bergmann CC: Ard Biesheuvel Acked-by: Arnd Bergmann Acked-by: Catalin Marinas --- arch/arm64/include/asm/pgtable-types.h | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/arch/arm64/include/asm/pgtable-types.h b/arch/arm64/include/asm/pgtable-types.h index 2b1bd7e..69b2fd4 100644 --- a/arch/arm64/include/asm/pgtable-types.h +++ b/arch/arm64/include/asm/pgtable-types.h @@ -27,10 +27,6 @@ typedef u64 pmdval_t; typedef u64 pudval_t; typedef u64 pgdval_t; -#undef STRICT_MM_TYPECHECKS - -#ifdef STRICT_MM_TYPECHECKS - /* * These are used to make use of C type-checking.. */ @@ -58,34 +54,6 @@ typedef struct { pteval_t pgprot; } pgprot_t; #define pgprot_val(x) ((x).pgprot) #define __pgprot(x) ((pgprot_t) { (x) } ) -#else /* !STRICT_MM_TYPECHECKS */ - -typedef pteval_t pte_t; -#define pte_val(x) (x) -#define __pte(x) (x) - -#if CONFIG_PGTABLE_LEVELS > 2 -typedef pmdval_t pmd_t; -#define pmd_val(x) (x) -#define __pmd(x) (x) -#endif - -#if CONFIG_PGTABLE_LEVELS > 3 -typedef pudval_t pud_t; -#define pud_val(x) (x) -#define __pud(x) (x) -#endif - -typedef pgdval_t pgd_t; -#define pgd_val(x) (x) -#define __pgd(x) (x) - -typedef pteval_t pgprot_t; -#define pgprot_val(x) (x) -#define __pgprot(x) (x) - -#endif /* STRICT_MM_TYPECHECKS */ - #if CONFIG_PGTABLE_LEVELS == 2 #include #elif CONFIG_PGTABLE_LEVELS == 3