From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (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 9BB29B676 for ; Mon, 6 Jan 2025 09:36:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736156172; cv=none; b=Naq2obUhdfXoCMJI9j/baTunuuJva3oCy3iecgFhUGaSE40zqpant5zeoBfANCGos/xzK/+qxOI7vJpE2znySu9Hh57sPLwGLALgUqRspul1qI1CPDXdLfmbhaJHUsab8ecFPhgF5wWRBAcjLTBr+q19mSvRoAABZ4y0I6/cgIo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736156172; c=relaxed/simple; bh=ADSi3hKlG6GlE2DIMY7z4xdGOjJG+hkKE7AKSbOflS4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=iwHD+jybCUZ3DobeaiccSmW7osaDP2PTYJOle+NOclHtkU9RUrWAM57VtbPSHR17rFpNzgAx1DreJra4k2VTp7TL//iW/m//zgtLnwBjlIxjoK29FeE+g3eKG74bWLzeAZHiLFPBnkNUih/NVZ8iHNxuddMlVbtCmBqfqmsXsSg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com; spf=pass smtp.mailfrom=rivosinc.com; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b=bqxPT1+V; arc=none smtp.client-ip=209.85.214.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b="bqxPT1+V" Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-2163dc5155fso198002605ad.0 for ; Mon, 06 Jan 2025 01:36:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1736156169; x=1736760969; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=Wj5KkPcC13AnXUqS3utkLeMnI53ntVRUgTAJ7aqMxq8=; b=bqxPT1+VNiESWQMRP6BNx7/CCo8JTnT1ZLnBCSKls4VhdFqQKzwef6DlLxSWrRzYYn nZpFO6pNIQ0DMcpMMFT8EVOKjwMV1F9Cv35PA5HF9nrgpdFujUnIDbUfhF/Wce822mF5 ZPDjICi+J0fgkccHJWEi1/UO2k6bwqMH3Aj5ceAnykRjX7S6usbLzdIEcuymMNDLAxHv MLIa1VcySZeWL5464mtxdHV9Ivh+PuGaFlFbKbbQvdvMda4k7vAgmmClZa5ZumgflkBe tPQqyzkti9GRajH1H4OzFE1xZ+fexnEXDhJjE5XAVtHyZI+q3hJKo+WREdXRgbeINWwq Db4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736156169; x=1736760969; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Wj5KkPcC13AnXUqS3utkLeMnI53ntVRUgTAJ7aqMxq8=; b=SMeofC4PvF1oie/2RjmwcWsszwzLLIiJdWy+N9YY2qWDj1mkZ6RCnU/QwTjaB+15zw i/+zqdOuxry0SvDNBLZkgMY020J6ZB1s0s/0/FcMRx2hGtF4muEKbQixkmjtG8mUGaoe Kz80y0kJYtRs4ZdYgZKXpHWZFMlZM/igbC9UOAX8/uh7qCbvtmsGVaUOwcS5EvddNl0q dOV/WnzMJT3xVo0LfVXcUd8aKSPpsiIyEi1BNUK3OVeh4p0zIUQGRzB+1iXHu6sfxBS/ MgOnjlXSXF2UMqd+KlpY7d7PnLQ8IIJrFka+yxUGsjsMwj05c05ZePGyJmglss5rOUP3 NB1w== X-Forwarded-Encrypted: i=1; AJvYcCWV/f4p+gq8sdHJg1FR20SiTC5i6lqqU8UdZ4tjS2/hJJNSdzBwlQnN0k+BlejuZXhIxh7psUWB3cG4/wI=@vger.kernel.org X-Gm-Message-State: AOJu0YxlFwO0TH4QDpBvOBpeD0LTjZFYuCucwB0IEl4exjqSdweZLmWG nvT4KDqGHmcc6UdfYaLVmCMKRePLuT4VtI19thhwtWYlL2DTzv2OJ8xI6zeJF7A= X-Gm-Gg: ASbGncuQCF6RZ12OXA5iBKPAaMalyRLZUk1D7Qp3x3ds7BSDCyXBiuOgKJzmmEKpOYt itViSBpoxaHcn+jMqZyHWo83p+1iychQSwg5pgFLvDVi0SZMtatIiJcDumdCnQceTZLtOwDES+X Gthn7Zg0fziHY3elWhlVdrHV/QuSaxXHau+HQsjCXsMzSyrradwcWowxdadHGyC7lya7/IaJSo7 6kh7a9MhEqiE+g/OcS9T9RUEm7aCFn1vXg3qYlqoI5oOuam2wM2ZwwXqyebFoSr1IhLf33HRp65 ZuqtUKBSecIdB/0Q+iYj4FadXA== X-Google-Smtp-Source: AGHT+IFky4reNPfrRJJX+sf8zAAsb/oxJWzjmHQmw4ledcTWs/2wF66vpIK3VNKQoNhfcvyK1o9A1g== X-Received: by 2002:a17:903:24e:b0:216:7761:cc49 with SMTP id d9443c01a7336-219e6f26251mr840416305ad.47.1736156168852; Mon, 06 Jan 2025 01:36:08 -0800 (PST) Received: from ?IPV6:2a01:e0a:e17:9700:16d2:7456:6634:9626? ([2a01:e0a:e17:9700:16d2:7456:6634:9626]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dc9f726bsm288201565ad.220.2025.01.06.01.36.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 06 Jan 2025 01:36:07 -0800 (PST) Message-ID: <4f78a39a-0788-49a4-9d63-777bb9d15b30@rivosinc.com> Date: Mon, 6 Jan 2025 10:35:56 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] riscv: use local label names instead of global ones in assembly To: Alexandre Ghiti , Paul Walmsley , Palmer Dabbelt , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Alexandre Ghiti References: <20250103141814.508865-1-cleger@rivosinc.com> <1fad8701-9667-487f-b356-45c6d07eeb49@ghiti.fr> Content-Language: en-US From: =?UTF-8?B?Q2zDqW1lbnQgTMOpZ2Vy?= In-Reply-To: <1fad8701-9667-487f-b356-45c6d07eeb49@ghiti.fr> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 06/01/2025 09:52, Alexandre Ghiti wrote: > Hi Clément, > > On 03/01/2025 15:17, Clément Léger wrote: >> 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 > > > Yes, I noticed this last week, thanks for looking into it. I would add a > Fixes tag and merge that in the next -rc if possible as the above > backtrace is "disturbing". Hi Alex, Yeah, I thought the Fixes tag, but since it wasn't really "breaking" anything, I left it out. I'll add it and sent a V2. Thanks Clément > > >> >> 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 >> >> --- >>   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 >>   > > > You can add: > > Reviewed-by: Alexandre Ghiti > > Thanks, > > Alex >