From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qv1-f42.google.com (mail-qv1-f42.google.com [209.85.219.42]) (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 CCF7D2CA8 for ; Sat, 29 Jan 2022 00:55:53 +0000 (UTC) Received: by mail-qv1-f42.google.com with SMTP id k4so7450593qvt.6 for ; Fri, 28 Jan 2022 16:55:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=/Babq3FplbrE6ia+3+gxSJA2pG5zbSBPMzCgi+sKFdk=; b=nV6ULo6Y+G2Wg4meFRNeDHaMRxniC97fbDBmxkPo51IFlCGPvTZ6twCsybA/0BL4Mo XmUxsMw6AnXwqvl5vtXkHc9lWAYPd7mSCcmSaz5Pryf7dlb1bAtUd6KBE4kYXzRvg9D+ RGAtJhCPbKqKxu5PS9clTuPqVRnYPuVDJh3kuhGpJ75SJ6Z93UCI8iQDmlBcUxPQUrDp 9Yu1j6RCJmWiEjfWisWNyCf17o2BbMzbeM8h9wxt/kx+ZPVp5U4eHmQZL+4pozUZoUFr c7lg5z1VGFQc1iKVOioG1d7Zr542uaHe+GDTZaSLV1E29MZCzvIx3oH73bg1cDSzn1J/ XMOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=/Babq3FplbrE6ia+3+gxSJA2pG5zbSBPMzCgi+sKFdk=; b=uttB7ArMFpqJsn9JokWmxZY8bT2yx4G/ObJXqEq08yWVKRnvGSZ3WJwI4uywWp+SVP oHM5UrmkXBRiFrLHRx0gY+zXsOQn4YNQ504EQ3LlcRF39ZJSvGhTHbGC5fK4pdc36T/o b2GhEg2Ki4wSl2sHQE6v2VbsbANHm/T1HjMqxn5/eDwLCI0+9Kzj0sfq55gOuLKxTZ3p hVU3lI9adw8gwrTnXY3lgxkMvVltl3JHlPAv3B2dQdKpa0DLiIhCPpK+KEScoON0EHo9 Z0Zd9wAEVRm1LpSSOgOTZzXcuC10/EEfzJnBOtN+6EGDlmLQwPFS3+cWRmjSIdM8axgo LV9g== X-Gm-Message-State: AOAM533OLyvBLBWZo7V/Zq3+rZQ2ondyVVt1Wc7RQa2v/oTWHoHaQnPF mJvXBQdv/ROfXnNUCCNsQvM= X-Google-Smtp-Source: ABdhPJxrHmBRRiruuUDQEiaw1eOLyEM0h4Jbo1PM/wLrOjvuiUbn5IVtzXefYh10Af7lQDHXfunCLA== X-Received: by 2002:a05:6214:d6e:: with SMTP id 14mr9371496qvs.32.1643417752838; Fri, 28 Jan 2022 16:55:52 -0800 (PST) Received: from mail.google.com ([207.246.89.135]) by smtp.gmail.com with ESMTPSA id z19sm1387496qtj.77.2022.01.28.16.55.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jan 2022 16:55:52 -0800 (PST) Date: Sat, 29 Jan 2022 08:55:46 +0800 From: Changbin Du To: Nick Desaulniers Cc: Changbin Du , Masahiro Yamada , Nathan Chancellor , linux-kernel@vger.kernel.org, llvm@lists.linux.dev, linux-riscv@lists.infradead.org Subject: Re: [PATCH] kallsyms: ignore local block labels generated by compiler Message-ID: <20220129005546.3k4xblksuo5lnr3f@mail.google.com> References: <20220128105746.2459-1-changbin.du@gmail.com> <20220128152147.mwjkf45z72qwdikq@mail.google.com> Precedence: bulk X-Mailing-List: llvm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Fri, Jan 28, 2022 at 10:59:55AM -0800, Nick Desaulniers wrote: > On Fri, Jan 28, 2022 at 7:21 AM Changbin Du wrote: > > > > On Fri, Jan 28, 2022 at 06:57:46PM +0800, Changbin Du wrote: > > > The llvm compiler can generate lots of local block labels and they might > > > overlap with C defined symbols. So let's ignore such local labels. > > > > > > Before this change, dumpstack shows a local symbol for epc: > > > [ 0.040341][ T0] Hardware name: riscv-virtio,qemu (DT) > > > [ 0.040376][ T0] epc : .LBB6_14+0x22/0x6a > > > [ 0.040452][ T0] ra : restore_all+0x12/0x6e > > > > > > After this change, the C defined symbol is shown which is expected: > > > [ 0.035795][ T0] Hardware name: riscv-virtio,qemu (DT) > > > [ 0.036332][ T0] epc : trace_hardirqs_on+0x54/0x13c > > > [ 0.036567][ T0] ra : restore_all+0x12/0x6e > > > > > > Signed-off-by: Changbin Du > > > --- > > > scripts/kallsyms.c | 1 + > > > 1 file changed, 1 insertion(+) > > > > > > diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c > > > index 54ad86d13784..5f4be9d72a32 100644 > > > --- a/scripts/kallsyms.c > > > +++ b/scripts/kallsyms.c > > > @@ -108,6 +108,7 @@ static bool is_ignored_symbol(const char *name, char type) > > > /* Symbol names that begin with the following are ignored.*/ > > > static const char * const ignored_prefixes[] = { > > > "$", /* local symbols for ARM, MIPS, etc. */ > > > + ".LBB", /* local block labels generated by compiler */ > > I aslo found many symbols like '.Ltmpxxx', '.L__unnamed_xx'. So should we just > > ignore all symbols prefixed by '.L'? > > .L prefixes are "local labels" meaning they don't get an entry in the > symbol table. The trade off is that there is no such convention > between compiler generated local label naming conventions, vs hand > written ones. If we omit all local labels, then it might be > surprising that a handwritten local label disappeared from this list. > I think though that we should omit all local labels, and if someone > needs a label to appear in their dumpstack, then they should simply > drop the .L prefix on their handwritten label. > Agree. I checked vmlinux for riscv and x86, seeing no handwritten function labels prefixed by '.L'. (just some data definition symbols). It should be safte to simply ignore all these symbols. > > > > > ".LASANPC", /* s390 kasan local symbols */ > > > "__crc_", /* modversions */ > > > "__efistub_", /* arm64 EFI stub namespace */ > > > -- > > > 2.32.0 > > > > > > > -- > > Cheers, > > Changbin Du > > > > -- > Thanks, > ~Nick Desaulniers -- Cheers, Changbin Du From mboxrd@z Thu Jan 1 00:00:00 1970 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 E9093C433EF for ; Sat, 29 Jan 2022 00:56:06 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BPUMq3UY8gLrpOA6WASCbqX4fuZ62DJVqIV1WeHLZXg=; b=FMquU08d/rQhVQ hdO3YhiIj5FKtV7qXCXQp7MPKsHfY3HWTbj+gD0NqIk7mr7Jc5yBT0sD9lvZr+GB6yw6eQfwViO/i FL7wyMIlSOyVnRbrjpFxha7284ZUo+D/YqpO+OmQRnFRyL0ZRKRUONEt2WC5NhUJfcWhT/q9d+6aC unFwg0P30hLYPY456c/MUDldaRBpW//AreivkGe49vwU/ot5RQm4YgodCl7CmdKq/zEGCiPq7a804 LDPpe5E2Y4XW4IDhUWRciSo7zAWeEgUOKrU1rjLoYVoxrhKMqB8KyLa0JMaBTU7c+pkeaPOayKz2L ofIC0GOD1oYEeddTVukA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nDc21-003qxQ-Ho; Sat, 29 Jan 2022 00:55:57 +0000 Received: from mail-qv1-xf2b.google.com ([2607:f8b0:4864:20::f2b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nDc1x-003qwp-Te for linux-riscv@lists.infradead.org; Sat, 29 Jan 2022 00:55:55 +0000 Received: by mail-qv1-xf2b.google.com with SMTP id g11so7481353qvu.3 for ; Fri, 28 Jan 2022 16:55:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=/Babq3FplbrE6ia+3+gxSJA2pG5zbSBPMzCgi+sKFdk=; b=nV6ULo6Y+G2Wg4meFRNeDHaMRxniC97fbDBmxkPo51IFlCGPvTZ6twCsybA/0BL4Mo XmUxsMw6AnXwqvl5vtXkHc9lWAYPd7mSCcmSaz5Pryf7dlb1bAtUd6KBE4kYXzRvg9D+ RGAtJhCPbKqKxu5PS9clTuPqVRnYPuVDJh3kuhGpJ75SJ6Z93UCI8iQDmlBcUxPQUrDp 9Yu1j6RCJmWiEjfWisWNyCf17o2BbMzbeM8h9wxt/kx+ZPVp5U4eHmQZL+4pozUZoUFr c7lg5z1VGFQc1iKVOioG1d7Zr542uaHe+GDTZaSLV1E29MZCzvIx3oH73bg1cDSzn1J/ XMOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=/Babq3FplbrE6ia+3+gxSJA2pG5zbSBPMzCgi+sKFdk=; b=qYUqWX9WTtnawAoBw4FrxyYOFEX8jVspYJ6tyje3MWSmLbqjle+eBhQ1f35YYzbixn 9WKKroxas2/VjfbZ5/y8dSlHWJF97A7p5UXYJwzFGvkVLDpjLT+4bUKcHwMHADRn/vE6 Bq86UyqFf/3XpNSX6g5SlI+2qrwXakvPZ446i32LvW7Qt7F07plZ5hcmoGH0lY9wl2ds gJrRyG8liBMyKjN3zA2KD+CcRVTPLu2Ejdal4+tGWA7AUtRBXEnhnxtUmDEEjcyNQ7P6 tW88ulUJwmrLQrSGwBRrB/ZDX0AGlVlw5NFdY1YBIcbLh8qKolDstqSUjwTxk8HiRPoK KZ9w== X-Gm-Message-State: AOAM531gSvVwj21nubF3ZcmZbIFtgfXcxdnJAGfq4ML/9erWrOcQumxj AdlFHU2SALiZLSkWC9YhyOU= X-Google-Smtp-Source: ABdhPJxrHmBRRiruuUDQEiaw1eOLyEM0h4Jbo1PM/wLrOjvuiUbn5IVtzXefYh10Af7lQDHXfunCLA== X-Received: by 2002:a05:6214:d6e:: with SMTP id 14mr9371496qvs.32.1643417752838; Fri, 28 Jan 2022 16:55:52 -0800 (PST) Received: from mail.google.com ([207.246.89.135]) by smtp.gmail.com with ESMTPSA id z19sm1387496qtj.77.2022.01.28.16.55.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jan 2022 16:55:52 -0800 (PST) Date: Sat, 29 Jan 2022 08:55:46 +0800 From: Changbin Du To: Nick Desaulniers Cc: Changbin Du , Masahiro Yamada , Nathan Chancellor , linux-kernel@vger.kernel.org, llvm@lists.linux.dev, linux-riscv@lists.infradead.org Subject: Re: [PATCH] kallsyms: ignore local block labels generated by compiler Message-ID: <20220129005546.3k4xblksuo5lnr3f@mail.google.com> References: <20220128105746.2459-1-changbin.du@gmail.com> <20220128152147.mwjkf45z72qwdikq@mail.google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220128_165554_000167_6F6AF995 X-CRM114-Status: GOOD ( 24.82 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Fri, Jan 28, 2022 at 10:59:55AM -0800, Nick Desaulniers wrote: > On Fri, Jan 28, 2022 at 7:21 AM Changbin Du wrote: > > > > On Fri, Jan 28, 2022 at 06:57:46PM +0800, Changbin Du wrote: > > > The llvm compiler can generate lots of local block labels and they might > > > overlap with C defined symbols. So let's ignore such local labels. > > > > > > Before this change, dumpstack shows a local symbol for epc: > > > [ 0.040341][ T0] Hardware name: riscv-virtio,qemu (DT) > > > [ 0.040376][ T0] epc : .LBB6_14+0x22/0x6a > > > [ 0.040452][ T0] ra : restore_all+0x12/0x6e > > > > > > After this change, the C defined symbol is shown which is expected: > > > [ 0.035795][ T0] Hardware name: riscv-virtio,qemu (DT) > > > [ 0.036332][ T0] epc : trace_hardirqs_on+0x54/0x13c > > > [ 0.036567][ T0] ra : restore_all+0x12/0x6e > > > > > > Signed-off-by: Changbin Du > > > --- > > > scripts/kallsyms.c | 1 + > > > 1 file changed, 1 insertion(+) > > > > > > diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c > > > index 54ad86d13784..5f4be9d72a32 100644 > > > --- a/scripts/kallsyms.c > > > +++ b/scripts/kallsyms.c > > > @@ -108,6 +108,7 @@ static bool is_ignored_symbol(const char *name, char type) > > > /* Symbol names that begin with the following are ignored.*/ > > > static const char * const ignored_prefixes[] = { > > > "$", /* local symbols for ARM, MIPS, etc. */ > > > + ".LBB", /* local block labels generated by compiler */ > > I aslo found many symbols like '.Ltmpxxx', '.L__unnamed_xx'. So should we just > > ignore all symbols prefixed by '.L'? > > .L prefixes are "local labels" meaning they don't get an entry in the > symbol table. The trade off is that there is no such convention > between compiler generated local label naming conventions, vs hand > written ones. If we omit all local labels, then it might be > surprising that a handwritten local label disappeared from this list. > I think though that we should omit all local labels, and if someone > needs a label to appear in their dumpstack, then they should simply > drop the .L prefix on their handwritten label. > Agree. I checked vmlinux for riscv and x86, seeing no handwritten function labels prefixed by '.L'. (just some data definition symbols). It should be safte to simply ignore all these symbols. > > > > > ".LASANPC", /* s390 kasan local symbols */ > > > "__crc_", /* modversions */ > > > "__efistub_", /* arm64 EFI stub namespace */ > > > -- > > > 2.32.0 > > > > > > > -- > > Cheers, > > Changbin Du > > > > -- > Thanks, > ~Nick Desaulniers -- Cheers, Changbin Du _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv