Message ID | 20240302145210.65919-1-puranjay12@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-89465-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp511356dyc; Sat, 2 Mar 2024 06:52:53 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVXKEIJYJp4oIjfXDd6IH2SkBD3ZzWDriuUN1MivZ3gZ+hbG358UDIpS3v6DwqmO+j2b1qUBXYI7j/U1BAGrEiqiroeSQ== X-Google-Smtp-Source: AGHT+IEtk8UnkrkwGZOvIAgUhtNpF5zeopOZK7o4vUh7bE9/RqBW+125pyYYW83MieB9W8ixigkI X-Received: by 2002:a05:6a20:72a9:b0:1a0:901f:f64f with SMTP id o41-20020a056a2072a900b001a0901ff64fmr4905264pzk.28.1709391172803; Sat, 02 Mar 2024 06:52:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709391172; cv=pass; d=google.com; s=arc-20160816; b=rGYtMNMhV2Os+x4T6kdkJoClfbLd2cSVs/uz1+pecZVRjcfHIu188CTnKqPEYjgCWL 3yA2J+7mdTkueAEZj9ruHs8IMjt6bxnVDBt4xtGuPjdC6IjwhoSubLfqiD8qL+ou85xI pdclMMVqPvAt3KefEIHyzDZMNymHGDJM/iqV/N8qAJ3Ov0pu+Of4veDyz1OkDBpYMxWg rjAFCe2dYv5MV1H5ZLkM5IKqc09mqDXmn8MVh1y6+UspSDW7lQFfcFgnxFRZnCmnu1Mn 2PkD+jdIPNLam8DTytSv+2ATzzGkjx8cCTGZ3o594ljyZtfdImm1vEUtYLoRGKNJVOEj uLbQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=Q/ES2FJW4PaZ/LjH5h1eFhluoaUopAjREsxQYkJ4pLs=; fh=d0hsiVKYDGy9g5jEpp2tPWLBQXNoIrXLctgo0IkecCE=; b=Z1bBBZ7uOJCEGl4T2PIGVtj3oVhr9VgOIeZDW2Z8RwM41WXNhNbKaRukG5y0OsmR4p sLKTtJ8kYK+p3CkAqYgo4Kc4eRkC49oJUcQYgXhFq1fNDUPj6jUI3uG4mqmGEeKCIIE2 Tet0xMNo9hJCQPOJ20untxmp7RR+bv+f5eUgfX0/PnGwSMjXQBfKFTArsZvAysTljg5q jtFif6a008G1TreVDEHS7zeuV3msTEClNDcI9p3tmAq4vLmFXiu1l8+EwkIY0nsrXbUQ ndCYveqSGSj1ER2Xqlbf3i9IQ84LDJltXS9fY6zmgbt71S6hGlEE/DRVdzT8pVV24xTE hicQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=BFEbfMiN; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-89465-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89465-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id nd10-20020a17090b4cca00b0029b40c473fcsi100698pjb.90.2024.03.02.06.52.52 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Mar 2024 06:52:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-89465-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=BFEbfMiN; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-89465-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89465-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 65A4AB236A3 for <ouuuleilei@gmail.com>; Sat, 2 Mar 2024 14:52:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3187317C77; Sat, 2 Mar 2024 14:52:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BFEbfMiN" Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0A17423A6 for <linux-kernel@vger.kernel.org>; Sat, 2 Mar 2024 14:52:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709391151; cv=none; b=Zjr9eW7R6OxDP/SOvgnowwGuNjhvf23ZuWIMf80tM3FnZQjjpKALtTNtBne8dWoQVyU9+AYQqeZ+s/bGdZf3V5FiaarS86N0GB9A0kKhfv6WBwpDBeSsfthn3OCGWqM1dzl5gMuPiuY6Ba9ddPqgoo98bKGwk34IqJBVYyGV0XI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709391151; c=relaxed/simple; bh=Ef+N4vGlqlUybLHJPcdwa+UvNP8PKIs+Su40x32riHc=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=prTDx2IPuPVyFVU8YhwVVNW8KzOcpxIXZadc/E8ZrUK3i9eW+NGNmxUSFKiEtWBjxlRBBX0y0e758m5kvYuHlCstlXQkCHaTf4rsu4+jZl1T9EAu1WQaVZN54ogV9Gm6agP/q0Lt7FCCIVuJNerBEU1XYFKv4+JjbN6KeRbkQp4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=BFEbfMiN; arc=none smtp.client-ip=209.85.221.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-33e1878e357so1158343f8f.3 for <linux-kernel@vger.kernel.org>; Sat, 02 Mar 2024 06:52:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709391148; x=1709995948; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Q/ES2FJW4PaZ/LjH5h1eFhluoaUopAjREsxQYkJ4pLs=; b=BFEbfMiNTg06ruIKknCk72Svv74Ra0YjvuZfQa1gpMP1xF7Ssmrli8Wbgo2MA9dtUW /KvmhGoEL50BWesqyoI45Rr8rM9UThLvXA8xrMs1DqkU2dqU4S2Op7bFRQ8DP7tYfGJe 9kUvJGJrtRjjUfUpp7UKY4x1JA8whuXH4rye+6FuHBEQsGKRRjgZYWe2wSw0rYQLHOAC Kyqvc8INz2piCQgIWUG/9uOGkRTFZHEDY7LVeZpn11lDAKcH/lWzlWtF77YWl1/cqTOO 9udKD0czFSD3nUf+jyu8BTs1VdHWkC3RIX4RDTy85lQA5g4R0N5g6aW5CwJosgRrCcHQ Q7JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709391148; x=1709995948; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Q/ES2FJW4PaZ/LjH5h1eFhluoaUopAjREsxQYkJ4pLs=; b=YV9NBrfJjpdxHcFkH9XUk/jOuRghnhsxAPexMCVlvW9RmauLQqy9LjEWHJJXKXxjJn crayWAp6WCIkj8jr71cXHY1rqloXRhR3crkBzVfhvvnMiB9zhI3Uc+grSXSUIUcmxI20 Qe+pp1EkkQoHxPxeMtZCgPHpXBaA8f8klrERitBMPPZc1dIKAfx9z2ZxZMsvl5EqUjeZ 37i7Wi5msF3huOHIZvgxpAOppnlINNkqDBDYQgXZM/C1+j4u4at/q3dYvkhUL9l6Agyh Xob6gYoflGNRDVBTxT74/XAhlP7zHmJHmW6HsC0z7ybXLV8IF0DN/frtd5WBnKnO8GbJ OD2w== X-Forwarded-Encrypted: i=1; AJvYcCUPg3/q4CJiNXcQ03Z0TapfGNLt8h1LKCSBftH34aA4d160M+ZSVhddEpQHlGBodhl1woVfIiDyPzFWLta6/tIQQkOqeKF0Ut71ZHkn X-Gm-Message-State: AOJu0Yy3IS0nTPkla88Xc/kUk6j5Cx8W4aGmIcOkucK6KD9mwjgxMFt4 ms0ajrP20sJba4faq2dlaHMf/J0f5s5GBb7vrnmou+1aQXed3ltE X-Received: by 2002:adf:9d83:0:b0:33d:d7be:3bec with SMTP id p3-20020adf9d83000000b0033dd7be3becmr3254953wre.58.1709391148038; Sat, 02 Mar 2024 06:52:28 -0800 (PST) Received: from localhost (54-240-197-231.amazon.com. [54.240.197.231]) by smtp.gmail.com with ESMTPSA id by1-20020a056000098100b0033e22341942sm4085502wrb.78.2024.03.02.06.52.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 02 Mar 2024 06:52:27 -0800 (PST) From: Puranjay Mohan <puranjay12@gmail.com> To: catalin.marinas@arm.com, will@kernel.org, anshuman.khandual@arm.com, mark.rutland@arm.com, ardb@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: puranjay12@gmail.com Subject: [PATCH] arm64: head: remove unnecessary instructions from __relocate_kernel Date: Sat, 2 Mar 2024 14:52:10 +0000 Message-Id: <20240302145210.65919-1-puranjay12@gmail.com> X-Mailer: git-send-email 2.40.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792426558496728807 X-GMAIL-MSGID: 1792426558496728807 |
Series |
arm64: head: remove unnecessary instructions from __relocate_kernel
|
|
Commit Message
Puranjay Mohan
March 2, 2024, 2:52 p.m. UTC
Formerly, we had to access the RELA and RELR tables via the kernel
mapping that was being relocated, and so deriving the start and end
addresses was done by loading __rela_offset in x9 and then adding the
actual virtual offset of the kernel to it.
d7bea550279d ("arm64: head: use relative references to the RELA and RELR
tables") changed this to load the entries via the ID map as we map the
entire kernel image via the ID map.
The two instructions for finding the actual virtual offset were left by
that commit, so remove them now as they are unnecessary and add runtime
overhead.
Fixes: d7bea550279d ("arm64: head: use relative references to the RELA and RELR tables")
Signed-off-by: Puranjay Mohan <puranjay12@gmail.com>
---
arch/arm64/kernel/head.S | 2 --
1 file changed, 2 deletions(-)
base-commit: 5ad3cb0ed525b80c7f66c32b49a68c1f3510bec9
Comments
On Sat, Mar 02, 2024 at 02:52:10PM +0000, Puranjay Mohan wrote: > Formerly, we had to access the RELA and RELR tables via the kernel > mapping that was being relocated, and so deriving the start and end > addresses was done by loading __rela_offset in x9 and then adding the > actual virtual offset of the kernel to it. > > d7bea550279d ("arm64: head: use relative references to the RELA and RELR > tables") changed this to load the entries via the ID map as we map the > entire kernel image via the ID map. > > The two instructions for finding the actual virtual offset were left by > that commit, so remove them now as they are unnecessary and add runtime > overhead. These instructions are already gone in linux-next; they're removed by commit: 734958ef0b5497b1 ("arm64: head: move relocation handling to C code") .. so this patch isn't necessary. > Fixes: d7bea550279d ("arm64: head: use relative references to the RELA and RELR tables") As a heads-up for future patches, while this would be a cleanup it is not a fix, and wouldn't need a fixes tag. Mark. > Signed-off-by: Puranjay Mohan <puranjay12@gmail.com> > --- > arch/arm64/kernel/head.S | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S > index cab7f91949d8..90db196f7c19 100644 > --- a/arch/arm64/kernel/head.S > +++ b/arch/arm64/kernel/head.S > @@ -787,8 +787,6 @@ SYM_FUNC_START_LOCAL(__relocate_kernel) > */ > adr_l x9, __rela_start > adr_l x10, __rela_end > - mov_q x11, KIMAGE_VADDR // default virtual offset > - add x11, x11, x23 // actual virtual offset > > 0: cmp x9, x10 > b.hs 1f > > base-commit: 5ad3cb0ed525b80c7f66c32b49a68c1f3510bec9 > -- > 2.42.0 >
diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S index cab7f91949d8..90db196f7c19 100644 --- a/arch/arm64/kernel/head.S +++ b/arch/arm64/kernel/head.S @@ -787,8 +787,6 @@ SYM_FUNC_START_LOCAL(__relocate_kernel) */ adr_l x9, __rela_start adr_l x10, __rela_end - mov_q x11, KIMAGE_VADDR // default virtual offset - add x11, x11, x23 // actual virtual offset 0: cmp x9, x10 b.hs 1f