From patchwork Fri Jan 3 14:17:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 13925608 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EBB28E77188 for ; Fri, 3 Jan 2025 14:18:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=zTAw1smFzrydikZ+y39MT7MZcpidM2nnRic/AqJRTGI=; b=HgOGXuI6PtiLf1 m65+WcfYdmiXkyJxzn39dVXDfGEgTwxV+pWx/LHYwy6hVHFPdXMovR7y12l3U/kR9Hcgrs9z0LsWl X09hkrvKZyVzRB0fRrJ2ZjRmUStjaGxv5emhaLIb1Y/Ihkdr2dB2O0yLzXRdV9SknOtbYPQeL+E1n wSrdMw1XG41zAivo6+J6995d7wkdROaAeebVwl1L7mdBiudzpnTNa/3DEKYI6c6f+ARQCOWE+Vl6y 5aAyQsNSxVuJIuY65v3iiWgYoJ9PehHZruXN5I+EI9PmoQzRIaLbaA+HxUAgC8qQZNjhpXhgnf7BQ UoUtP8gWB0+D8+OXMzWw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tTiVP-0000000D5IK-0nqr; Fri, 03 Jan 2025 14:18:27 +0000 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tTiVM-0000000D5Hp-3BYN for linux-riscv@lists.infradead.org; Fri, 03 Jan 2025 14:18:26 +0000 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-385eed29d17so5880583f8f.0 for ; Fri, 03 Jan 2025 06:18:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1735913902; x=1736518702; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=tBy9PE8TWuZDv2fRcvS0TjEzuOQDtwvmfnwH0FPbUik=; b=uC91AHRrG4jR/BwBDqRWlVrj/nwKSKLDOwpdB632dmfO1YlkjwWRbqRw3fhURGCX3V 7QwftxkHXGDZH2miAsUo24JlBJ9dOOTZWXXeYKUYlOm8ck74zXmajSqgCES1xmCabzqb QA4LqyDGwIc60Kfh2TX450iRZZz74NxHkFWKcGRkBDJFlA7ZTR2Q6QRPs0h08N9O56Fs IABpD0tDd3dLm5UjCdkPHS4/iEAD6xaDwLJgtOZyKsNVamnSN+pG0RFQKI8+Tj1cZlgA xuom66/GBrBskTHw4yFW0eTV0oDRcAclJEXzl2OTyJk4XyltObAiChZJ4vIyP8pQo+kk Bg9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735913902; x=1736518702; 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=tBy9PE8TWuZDv2fRcvS0TjEzuOQDtwvmfnwH0FPbUik=; b=jSp33WsgnogqbH3RUSYStMTdPtSFBJVpGPpV7tUzKq3QE5Bs3Mi3xXc4Pf64cgKyer 2DsPWACgjaAs+q1wFUJ7Ics24lpiHpqBmKizI4hQfG8rS4iXdNAlAwwCkDd6wtADkZD9 0hpeofXAkjjOTLo84dCj5So97Ig3E4mIRwYqa9iOXGKZjw9BqNUEXfylxrDZOtkAeVSo 3jNtmB3U91hf0F+K2qyPTouphOpJSwssqEzURRViy/PrqhxLZ4t8RrtdmihjlNIQrDry CIDW0DSuNbuHdo71jRMlwkJQ/U1AyO0GXmdl6PtqvM0f+fgT2jJzrK2fAutnpbJ0/X7O Dzsg== X-Forwarded-Encrypted: i=1; AJvYcCX2hvy8Pr+8XEOLzt+8xz0sI3NEMuDZx6ipkNQgpi1SVn5fKL53N2fV4nDsjn2g0DHYXO/3cdV9GWeYFA==@lists.infradead.org X-Gm-Message-State: AOJu0YwEtMT1y0QDFEmCVcJO9PO3hJgi2lJuVhWAWE1CamjH1r3k7f5r 6xgN5Tc0cSVc0dH0QPTxbM6n1/mipJOYLT/FgxqXg+X0oEHdp8IttAT3pr5boB8= X-Gm-Gg: ASbGnculE1/7Sxp4YdgPNOu2qT30tUkWXDmbCDqvO7yyYLkfmE3qJURneUNBv/b0Vgm 2DMFCkLPydS62ByTAExfkLWqdFMWDoz8tWUCnibk+XbeemLp3jQenJSOfVH9gRSkd3O2a499PBr Tpj5JHTfRyHjp00kPCdxO51TkxL1LamQKJ1WvffWJIqatcXPzvWrytdVvCNmACRtyklnQ2GfxDb RIu2VN0hSHpVrp+3nWjZwkQCApyDIlK/IoylJC6VkTAztItSkyGKO/Cgw== X-Google-Smtp-Source: AGHT+IEun2+E1U+TFbIHehM21Z0MjItj4zYwFpux1RYNvw5R3ZYIGoDopmCYq7/CItWQSTlaIPV1Bg== X-Received: by 2002:a5d:47c8:0:b0:385:f470:c2e1 with SMTP id ffacd0b85a97d-38a221e2f49mr41252194f8f.2.1735913902182; Fri, 03 Jan 2025 06:18:22 -0800 (PST) Received: from carbon-x1.. ([2a01:e0a:e17:9700:16d2:7456:6634:9626]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a1c8acafesm40675693f8f.98.2025.01.03.06.18.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2025 06:18:21 -0800 (PST) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Paul Walmsley , Palmer Dabbelt , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Alexandre Ghiti Subject: [PATCH] riscv: use local label names instead of global ones in assembly Date: Fri, 3 Jan 2025 15:17:58 +0100 Message-ID: <20250103141814.508865-1-cleger@rivosinc.com> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250103_061825_064617_8E76A659 X-CRM114-Status: UNSURE ( 9.70 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Local labels should be prefix by '.L' or they'll be exported in the symbol table. Additionally, this messes up the backtrace by displaying an incorrect symbol: ... [ 12.751810] [] _copy_from_user+0x28/0xc2 [ 12.752035] [] handle_misaligned_load+0x1ca/0x2fc [ 12.752310] [] do_trap_load_misaligned+0x24/0xee [ 12.752596] [] _new_vmalloc_restore_context_a0+0xc2/0xce After: ... [ 10.243916] [] _copy_from_user+0x28/0xc2 [ 10.244026] [] handle_misaligned_load+0x1ca/0x2fc [ 10.244150] [] do_trap_load_misaligned+0x24/0xee [ 10.244268] [] handle_exception+0x146/0x152 Signed-off-by: Clément Léger Reviewed-by: Alexandre Ghiti --- arch/riscv/kernel/entry.S | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/arch/riscv/kernel/entry.S b/arch/riscv/kernel/entry.S index c200d329d4bd..216581835eb0 100644 --- a/arch/riscv/kernel/entry.S +++ b/arch/riscv/kernel/entry.S @@ -23,21 +23,21 @@ REG_S a0, TASK_TI_A0(tp) csrr a0, CSR_CAUSE /* Exclude IRQs */ - blt a0, zero, _new_vmalloc_restore_context_a0 + blt a0, zero, .Lnew_vmalloc_restore_context_a0 REG_S a1, TASK_TI_A1(tp) /* Only check new_vmalloc if we are in page/protection fault */ li a1, EXC_LOAD_PAGE_FAULT - beq a0, a1, _new_vmalloc_kernel_address + beq a0, a1, .Lnew_vmalloc_kernel_address li a1, EXC_STORE_PAGE_FAULT - beq a0, a1, _new_vmalloc_kernel_address + beq a0, a1, .Lnew_vmalloc_kernel_address li a1, EXC_INST_PAGE_FAULT - bne a0, a1, _new_vmalloc_restore_context_a1 + bne a0, a1, .Lnew_vmalloc_restore_context_a1 -_new_vmalloc_kernel_address: +.Lnew_vmalloc_kernel_address: /* Is it a kernel address? */ csrr a0, CSR_TVAL - bge a0, zero, _new_vmalloc_restore_context_a1 + bge a0, zero, .Lnew_vmalloc_restore_context_a1 /* Check if a new vmalloc mapping appeared that could explain the trap */ REG_S a2, TASK_TI_A2(tp) @@ -69,7 +69,7 @@ _new_vmalloc_kernel_address: /* Check the value of new_vmalloc for this cpu */ REG_L a2, 0(a0) and a2, a2, a1 - beq a2, zero, _new_vmalloc_restore_context + beq a2, zero, .Lnew_vmalloc_restore_context /* Atomically reset the current cpu bit in new_vmalloc */ amoxor.d a0, a1, (a0) @@ -83,11 +83,11 @@ _new_vmalloc_kernel_address: csrw CSR_SCRATCH, x0 sret -_new_vmalloc_restore_context: +.Lnew_vmalloc_restore_context: REG_L a2, TASK_TI_A2(tp) -_new_vmalloc_restore_context_a1: +.Lnew_vmalloc_restore_context_a1: REG_L a1, TASK_TI_A1(tp) -_new_vmalloc_restore_context_a0: +.Lnew_vmalloc_restore_context_a0: REG_L a0, TASK_TI_A0(tp) .endm