From patchwork Mon Feb 22 17:46:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 62614 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp1381726lbl; Mon, 22 Feb 2016 09:48:19 -0800 (PST) X-Received: by 10.66.248.198 with SMTP id yo6mr39598099pac.54.1456163299523; Mon, 22 Feb 2016 09:48:19 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id z5si41020935pfi.34.2016.02.22.09.48.19 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Feb 2016 09:48:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@linaro.org 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 1aXuZC-0003eF-7z; Mon, 22 Feb 2016 17:46:38 +0000 Received: from mail-wm0-x22c.google.com ([2a00:1450:400c:c09::22c]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aXuZ9-0003Xc-3m for linux-arm-kernel@lists.infradead.org; Mon, 22 Feb 2016 17:46:35 +0000 Received: by mail-wm0-x22c.google.com with SMTP id g62so185135091wme.1 for ; Mon, 22 Feb 2016 09:46:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=WkcPHdGHlw21b5EPnhe4sl0MaR3payCQSNp/TMNuCbw=; b=LAMXf/SyBbH2r4xABrHyGeHykQNwHrkVwBEKBi9l6yREcgvHs4N/zjXIaVRZRJonXL A59S6nL4yV7+nw6cE6EK5jA5yeIQ8to6gGAQT1qZB1dWVwTsZbZ1iSo+AN20yCD0rokG tfhsZMQF4kQsdffK6BJBc2rFTnBaNbxbq6UnY= 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=WkcPHdGHlw21b5EPnhe4sl0MaR3payCQSNp/TMNuCbw=; b=Qc0u35AWagUsKzoL5qTGEFgQPF+jBC+EKwufSRq0KfGZhgKmb6wOlcq1ptokrpVzh2 5Fy5n0sQIU9aV3aL6uUoC2c/q6N5nX5UZt4insfEcQEsdld50mHFFHQVhVeSfiXRyhhk VY824x8udiZ3nYXWaCnuH8FfkbL60AqLP7Sjo6NPcNW2dHhe0nWxN396YODzRbb4XJnP L3c//dMvngv8BPIREt9T52pW1YC8rR6WoWHq4rFvCmuONLuQGbaavdpyx2FgtlzNVJxG nZqKDjecOz1kswA4qzs0Kg6PCLNLcLOMa8Hpf2UmN8ws+vXz4nVHFQqrNybXF62VFWFx f/VQ== X-Gm-Message-State: AG10YOTysNe9F52qNWbtwjg5EnwGDSibRzpDmX92XXjer3zpA8V4nxIrGMQP/Fr4N4yg3hSs X-Received: by 10.194.47.237 with SMTP id g13mr29436420wjn.142.1456163173399; Mon, 22 Feb 2016 09:46:13 -0800 (PST) Received: from localhost.localdomain ([195.55.142.58]) by smtp.gmail.com with ESMTPSA id v1sm25561611wjf.49.2016.02.22.09.46.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 22 Feb 2016 09:46:12 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, will.deacon@arm.com Subject: [PATCH 1/2] arm64: mm: only perform memstart_addr sanity check if DEBUG_VM Date: Mon, 22 Feb 2016 18:46:03 +0100 Message-Id: <1456163164-23251-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.5.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160222_094635_314115_3CD219A5 X-CRM114-Status: UNSURE ( 9.98 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:400c:c09:0:0:0:22c listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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: mark.rutland@arm.com, Ard Biesheuvel MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org Checking whether memstart_addr has been assigned every time it is referenced adds a branch instruction that may hurt performance if the reference in question occurs on a hot path. So only perform the check if CONFIG_DEBUG_VM=y. Signed-off-by: Ard Biesheuvel --- arch/arm64/include/asm/memory.h | 4 ++++ 1 file changed, 4 insertions(+) -- 2.5.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h index 68e7d96b9ed3..771d0b506e4b 100644 --- a/arch/arm64/include/asm/memory.h +++ b/arch/arm64/include/asm/memory.h @@ -134,7 +134,11 @@ extern phys_addr_t memstart_addr; /* PHYS_OFFSET - the physical address of the start of memory. */ +#ifndef CONFIG_DEBUG_VM +#define PHYS_OFFSET ({ memstart_addr; }) +#else #define PHYS_OFFSET ({ BUG_ON(memstart_addr & 1); memstart_addr; }) +#endif /* the virtual base of the kernel image (minus TEXT_OFFSET) */ extern u64 kimage_vaddr;