Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp2527918pxy; Mon, 3 May 2021 02:03:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfMmTqroCcRL7j/BE+ZKL4pOdAphL7Qt29I+1g2ASWAOtFvY38MVQLudqoKGFNHLWBBx+f X-Received: by 2002:a17:907:7882:: with SMTP id ku2mr15353552ejc.346.1620032581311; Mon, 03 May 2021 02:03:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620032581; cv=none; d=google.com; s=arc-20160816; b=GuelFmBcVNh4S0XBvLXWdSWr7ez+gypuBOsGBEkxlXg5aTQGjLgJ1p2h7d7UAC2LLq Dv1XMrWXsom2McybgdBC/G5m5kdqhA/K3K3LP+Iun4HN5KMQJgSilRwqTLUp4j9liup+ 4Nvm8Z6PAKRJLqsjMsX3VBlWI014M5qI5ZDkkWsbFveFYhrUz/dg0IQ84HA8VtlxTYdo Za9LR/01z/96nGo9v3rpQKfgXjhvh+qzrYjuxZQaBPhJVlUqEOwUxj220UgvvACvjN1r Nn3oVeJuhLxDd0k7MT1LBbnReWnMNuAJnQhYBm8zq7S3Sob04ZKVo8nYlwYtb5szv+vB z7vA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:in-reply-to:mime-version :user-agent:date:message-id:references:cc:to:from:subject; bh=ylNixxPElN4FOLfZxMBmuRN5VwI+oDqntB6I0UOtU8A=; b=DfcbjLUdCzxqI1MCfNF+kJnCUcDLMDekcJ1AZlOhckRw8Q75Ky5xYo28pCrOIaFfiU lwxIMA6INLgUks27a+CXXMCKUqInzAsIh/hOtAKn1ZqEx/4h1rOZdWLUBunJ/VqYlN1+ lTDyJP1zxveLNUhHiJLoNiEIEiZYHDGpdAqspKFRJUIjuMToUGeFzmxENXxPxwFZr9z3 uwYY576RbXNrFnVJrHfk3tg66WRvyHFTeyn5jUP+kcpoJLKn7m+IqOXf4XybEnmqiOhh ggWkfuprrOvMbqa2SEtOZTkoHx/LpQ6n2FflTRZx3LPXT6WUy/OmMurIgW605XTtTC/o q+mA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bt1si8514916edb.12.2021.05.03.02.02.38; Mon, 03 May 2021 02:03:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233000AbhECJAl (ORCPT + 99 others); Mon, 3 May 2021 05:00:41 -0400 Received: from mail-ed1-f42.google.com ([209.85.208.42]:45718 "EHLO mail-ed1-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231531AbhECJAl (ORCPT ); Mon, 3 May 2021 05:00:41 -0400 Received: by mail-ed1-f42.google.com with SMTP id d14so5383803edc.12; Mon, 03 May 2021 01:59:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=ylNixxPElN4FOLfZxMBmuRN5VwI+oDqntB6I0UOtU8A=; b=k7SLplqDezicLt8YgTF6HXDf5V7Y6CIk8I7NNVKUQ3XtVYBl1CCECEG+0QV7Cl+oNT Ex9yLwkwqv1kJTbBNH29pbKg6nzqGg0CyFfPv088aIsEvIpzdhElKnkE0lF+Y2d4qmJ/ 7hkun4r8Llw6CmMWPoUK5alfTlv79nKujM725jlOINU8dIgKSmKginzaRhU9mx2Bg6+a f39Sa3uKMy3N0DJAgeCJ16Yul8gFgyreHctBgVTwE9NBiNAQCDpKNrkQ/3SdM4wJ+lqb wVbad8eAWMwCzbIo1VR6kxB9qB8tOaT5mUhfs5FJ74dGsxyK+44iOMoJFvOLxTaXoCQX EClA== X-Gm-Message-State: AOAM533T0v24xPFXL0vFGLeIEsJwELygdMXRSrX9MIiH8UDZgQVC4QmB ebDMlhcPNMqOHiVH3NYO7nzVEpR7l9o4FQ== X-Received: by 2002:a05:6402:b88:: with SMTP id cf8mr18803891edb.227.1620032386776; Mon, 03 May 2021 01:59:46 -0700 (PDT) Received: from ?IPv6:2a0b:e7c0:0:107::70f? ([2a0b:e7c0:0:107::70f]) by smtp.gmail.com with ESMTPSA id c12sm13207764edx.54.2021.05.03.01.59.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 03 May 2021 01:59:46 -0700 (PDT) Subject: Re: linux-next failing build due to missing cubictcp_state symbol From: Jiri Slaby To: =?UTF-8?Q?Michal_Such=c3=a1nek?= , Jiri Olsa Cc: Yonghong Song , linux-kernel@vger.kernel.org, Martin KaFai Lau , "David S. Miller" , Hideaki YOSHIFUJI , David Ahern , Jakub Kicinski , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Song Liu , John Fastabend , KP Singh , netdev@vger.kernel.org, bpf@vger.kernel.org, Jiri Olsa , Jesper Dangaard Brouer , dwarves@vger.kernel.org, Arnaldo Carvalho de Melo References: <316e86f9-35cc-36b0-1594-00a09631c736@fb.com> <20210423175528.GF6564@kitsune.suse.cz> <20210425111545.GL15381@kitsune.suse.cz> <20210426113215.GM15381@kitsune.suse.cz> <20210426121220.GN15381@kitsune.suse.cz> <20210426121401.GO15381@kitsune.suse.cz> <49f84147-bf32-dc59-48e0-f89241cf6264@fb.com> <20210427121237.GK6564@kitsune.suse.cz> <20210430174723.GP15381@kitsune.suse.cz> <3d148516-0472-8f0a-085b-94d68c5cc0d5@suse.com> <6c14f3c8-7474-9f3f-b4a6-2966cb19e1ed@kernel.org> <4e051459-8532-7b61-c815-f3435767f8a0@kernel.org> Message-ID: Date: Mon, 3 May 2021 10:59:44 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 MIME-Version: 1.0 In-Reply-To: <4e051459-8532-7b61-c815-f3435767f8a0@kernel.org> Content-Type: multipart/mixed; boundary="------------730411CEEE03A22CBB5BD79E" Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is a multi-part message in MIME format. --------------730411CEEE03A22CBB5BD79E Content-Type: text/plain; charset=iso-8859-2; format=flowed Content-Transfer-Encoding: 8bit CCing pahole people. On 03. 05. 21, 9:59, Jiri Slaby wrote: > On 03. 05. 21, 8:11, Jiri Slaby wrote: >>>>>>> looks like vfs_truncate did not get into BTF data, >>>>>>> I'll try to reproduce >>> >>> _None_ of the functions are generated by pahole -J from debuginfo on >>> ppc64. debuginfo appears to be correct. Neither pahole -J fs/open.o >>> works correctly. collect_functions in dwarves seems to be defunct on >>> ppc64... "functions" array is bogus (so find_function -- the bsearch >>> -- fails). >> >> It's not that bogus. I forgot an asterisk: >>> #0? find_function (btfe=0x100269f80, name=0x10024631c "stream_open") >>> at /usr/src/debug/dwarves-1.21-1.1.ppc64/btf_encoder.c:350 >>> (gdb) p (*functions)@84 >>> $5 = {{name = 0x7ffff68e0922 ".__se_compat_sys_ftruncate", addr = >>> 75232, size = 72, sh_addr = 65536, generated = false}, { >>> ??? name = 0x7ffff68e019e ".__se_compat_sys_open", addr = 80592, size >>> = 216, sh_addr = 65536, generated = false}, { >>> ??? name = 0x7ffff68e0076 ".__se_compat_sys_openat", addr = 80816, >>> size = 232, sh_addr = 65536, generated = false}, { >>> ??? name = 0x7ffff68e0908 ".__se_compat_sys_truncate", addr = 74304, >>> size = 100, sh_addr = 65536, generated = false}, { >> ... >>> ??? name = 0x7ffff68e0808 ".stream_open", addr = 65824, size = 72, >>> sh_addr = 65536, generated = false}, { >> ... >>> ??? name = 0x7ffff68e0751 ".vfs_truncate", addr = 73392, size = 544, >>> sh_addr = 65536, generated = false}} >> >> The dot makes the difference, of course. The question is why is it >> there? I keep looking into it. Only if someone has an immediate idea... > > Well, .vfs_truncate is in .text (and contains an ._mcount call). And > vfs_truncate is in .opd (w/o an ._mcount call). Since setup_functions > excludes all functions without the ._mcount call, is_ftrace_func later > returns false for such functions and they are filtered before the BTF > processing. > > Technically, get_vmlinux_addrs looks at a list of functions between > __start_mcount_loc and __stop_mcount_loc and considers only the listed. > > I don't know what the correct fix is (exclude .opd functions from the > filter?). Neither why cross compiler doesn't fail, nor why ebi v2 avoids > this too. Attaching a patch for pahole which fixes the issue, but I have no idea whether it is the right fix at all. > regards,-- js suse labs --------------730411CEEE03A22CBB5BD79E Content-Type: text/x-patch; charset=UTF-8; name="ppc64-opd-fix.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="ppc64-opd-fix.patch" From: Jiri Slaby Subject: ppc64: .opd section fix Patch-mainline: submitted 2021/05/03 Functions in the .opd section should be considered valid too. Otherwise, pahole cannot produce a .BTF section from vmlinux and kernel build fails on ppc64. --- btf_encoder.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) --- a/btf_encoder.c +++ b/btf_encoder.c @@ -31,6 +31,8 @@ struct funcs_layout { unsigned long mcount_start; unsigned long mcount_stop; unsigned long mcount_sec_idx; + unsigned long opd_start; + unsigned long opd_stop; }; struct elf_function { @@ -271,11 +273,24 @@ static int is_ftrace_func(struct elf_fun return start <= addrs[r] && addrs[r] < end; } +static int is_opd_func(struct elf_function *func, struct funcs_layout *fl) +{ + return fl->opd_start <= func->addr && func->addr < fl->opd_stop; +} + static int setup_functions(struct btf_elf *btfe, struct funcs_layout *fl) { __u64 *addrs, count, i; int functions_valid = 0; bool kmod = false; + GElf_Shdr shdr; + Elf_Scn *sec; + + sec = elf_section_by_name(btfe->elf, &btfe->ehdr, &shdr, ".opd", NULL); + if (sec) { + fl->opd_start = shdr.sh_addr; + fl->opd_stop = shdr.sh_addr + shdr.sh_size; + } /* * Check if we are processing vmlinux image and @@ -322,7 +337,8 @@ static int setup_functions(struct btf_el func->addr += func->sh_addr; /* Make sure function is within ftrace addresses. */ - if (is_ftrace_func(func, addrs, count)) { + if (is_opd_func(func, fl) || + is_ftrace_func(func, addrs, count)) { /* * We iterate over sorted array, so we can easily skip * not valid item and move following valid field into --------------730411CEEE03A22CBB5BD79E--