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 X-Spam-Level: X-Spam-Status: No, score=-15.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 474A3C47088 for ; Wed, 26 May 2021 17:43:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id ADFFA613CD for ; Wed, 26 May 2021 17:43:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ADFFA613CD Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1A40C6B006C; Wed, 26 May 2021 13:43:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 153A16B006E; Wed, 26 May 2021 13:43:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E9A1B6B0070; Wed, 26 May 2021 13:43:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0253.hostedemail.com [216.40.44.253]) by kanga.kvack.org (Postfix) with ESMTP id B2CF36B006C for ; Wed, 26 May 2021 13:43:13 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 399A2181AEF30 for ; Wed, 26 May 2021 17:43:13 +0000 (UTC) X-FDA: 78184103466.26.E7B4EB5 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf28.hostedemail.com (Postfix) with ESMTP id BCF4F20007FD for ; Wed, 26 May 2021 17:43:05 +0000 (UTC) Received: from imap.suse.de (imap-alt.suse-dmz.suse.de [192.168.254.47]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id AB4191FD2E; Wed, 26 May 2021 17:43:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1622050991; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FhwLWgQA/H6r0Q6/NuTDJGX+fECggpPUHvnSVd8w/N8=; b=qM2YF4S8iluCj3stLUkfbHkmbEFUUrWr3CglsS78PeoFOwT8Bq8CNAxavh0Ceg0ZTsWqiY VEyn7N3f3LK1ItLgdHiJpb0kIqrp6ELFu092RmbDrZ/A5d0CBGJXQHABCiwrc5tgUWGjmF 7n3CjJ7dZo9E7Mz+2K/ZVw4gzTS+67w= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1622050991; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FhwLWgQA/H6r0Q6/NuTDJGX+fECggpPUHvnSVd8w/N8=; b=bz56rcfOXvFGrxINSTVBEX+E5H+XYi9VDKyWbITpJ/MbfJFoo9losKPDUsaPT0ptGSgBvm SxrLcNJlJTHgAQDA== Received: from director2.suse.de (director2.suse-dmz.suse.de [192.168.254.72]) by imap.suse.de (Postfix) with ESMTPSA id 80C5411A98; Wed, 26 May 2021 17:43:11 +0000 (UTC) Date: Wed, 26 May 2021 19:43:10 +0200 From: Michal =?iso-8859-1?Q?Such=E1nek?= To: Andrii Nakryiko Cc: Mel Gorman , Linux Kbuild mailing list , Andrew Morton , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , open list , Arnaldo Carvalho de Melo , Jiri Olsa , Hritik Vijay , bpf , Linux-Net , Linux-MM , Masahiro Yamada Subject: Re: (BTF) [PATCH] mm/page_alloc: Work around a pahole limitation with zero-sized struct pagesets Message-ID: <20210526174310.GA8544@kitsune.suse.cz> References: <20210526080741.GW30378@techsingularity.net> <20210526083342.GY8544@kitsune.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=qM2YF4S8; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=bz56rcfO; spf=pass (imf28.hostedemail.com: domain of msuchanek@suse.de designates 195.135.220.29 as permitted sender) smtp.mailfrom=msuchanek@suse.de; dmarc=none X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: BCF4F20007FD X-Stat-Signature: i83qphjq85graxoiayotrwbzhnny1ezn X-HE-Tag: 1622050985-375636 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, May 26, 2021 at 10:00:34AM -0700, Andrii Nakryiko wrote: > On Wed, May 26, 2021 at 1:33 AM Michal Such=E1nek w= rote: > > > > On Wed, May 26, 2021 at 09:07:41AM +0100, Mel Gorman wrote: > > > Michal Suchanek reported the following problem with linux-next > > > > > > [ 0.000000] Linux version 5.13.0-rc2-next-20210519-1.g3455ff8-= vanilla (geeko@buildhost) (gcc (SUSE Linux) 10.3.0, GNU ld (GNU Binutils;= openSUSE Tumbleweed) 2.36.1.20210326-3) #1 SMP Wed May 19 10:05:10 UTC 2= 021 (3455ff8) > > > [ 0.000000] Command line: BOOT_IMAGE=3D/boot/vmlinuz-5.13.0-rc= 2-next-20210519-1.g3455ff8-vanilla root=3DUUID=3Dec42c33e-a2c2-4c61-afcc-= 93e9527 8f687 plymouth.enable=3D0 resume=3D/dev/disk/by-uuid/f1fe4560-a80= 1-4faf-a638-834c407027c7 mitigations=3Dauto earlyprintk initcall_debug no= modeset earlycon ignore_loglevel console=3DttyS0,115200 > > > ... > > > [ 26.093364] calling tracing_set_default_clock+0x0/0x62 @ 1 > > > [ 26.098937] initcall tracing_set_default_clock+0x0/0x62 return= ed 0 after 0 usecs > > > [ 26.106330] calling acpi_gpio_handle_deferred_request_irqs+0x= 0/0x7c @ 1 > > > [ 26.113033] initcall acpi_gpio_handle_deferred_request_irqs+0x= 0/0x7c returned 0 after 3 usecs > > > [ 26.121559] calling clk_disable_unused+0x0/0x102 @ 1 > > > [ 26.126620] initcall clk_disable_unused+0x0/0x102 returned 0 a= fter 0 usecs > > > [ 26.133491] calling regulator_init_complete+0x0/0x25 @ 1 > > > [ 26.138890] initcall regulator_init_complete+0x0/0x25 returned= 0 after 0 usecs > > > [ 26.147816] Freeing unused decrypted memory: 2036K > > > [ 26.153682] Freeing unused kernel image (initmem) memory: 2308= K > > > [ 26.165776] Write protecting the kernel read-only data: 26624k > > > [ 26.173067] Freeing unused kernel image (text/rodata gap) memo= ry: 2036K > > > [ 26.180416] Freeing unused kernel image (rodata/data gap) memo= ry: 1184K > > > [ 26.187031] Run /init as init process > > > [ 26.190693] with arguments: > > > [ 26.193661] /init > > > [ 26.195933] with environment: > > > [ 26.199079] HOME=3D/ > > > [ 26.201444] TERM=3Dlinux > > > [ 26.204152] BOOT_IMAGE=3D/boot/vmlinuz-5.13.0-rc2-next-202= 10519-1.g3455ff8-vanilla > > > [ 26.254154] BPF: type_id=3D35503 offset=3D178440 size=3D4 > > > [ 26.259125] BPF: > > > [ 26.261054] BPF:Invalid offset > > > [ 26.264119] BPF: > > > [ 26.264119] > > > [ 26.267437] failed to validate module [efivarfs] BTF: -22 > > > > > > Andrii Nakryiko bisected the problem to the commit "mm/page_alloc: = convert > > > per-cpu list protection to local_lock" currently staged in mmotm. I= n his > > > own words > > > > > > The immediate problem is two different definitions of numa_node p= er-cpu > > > variable. They both are at the same offset within .data..percpu E= LF > > > section, they both have the same name, but one of them is marked = as > > > static and another as global. And one is int variable, while anot= her > > > is struct pagesets. I'll look some more tomorrow, but adding Jiri= and > > > Arnaldo for visibility. > > > > > > [110907] DATASEC '.data..percpu' size=3D178904 vlen=3D303 > > > ... > > > type_id=3D27753 offset=3D163976 size=3D4 (VAR 'numa_node') > > > type_id=3D27754 offset=3D163976 size=3D4 (VAR 'numa_node') > > > > > > [27753] VAR 'numa_node' type_id=3D27556, linkage=3Dstatic > > > [27754] VAR 'numa_node' type_id=3D20, linkage=3Dglobal > > > > > > [20] INT 'int' size=3D4 bits_offset=3D0 nr_bits=3D32 encoding=3DS= IGNED > > > > > > [27556] STRUCT 'pagesets' size=3D0 vlen=3D1 > > > 'lock' type_id=3D507 bits_offset=3D0 > > > > > > [506] STRUCT '(anon)' size=3D0 vlen=3D0 > > > [507] TYPEDEF 'local_lock_t' type_id=3D506 > > > > > > The patch in question introduces a zero-sized per-cpu struct and wh= ile > > > this is not wrong, versions of pahole prior to 1.22 (unreleased) ge= t > > > confused during BTF generation with two separate variables occupyin= g the > > > same address. > > > > > > This patch checks for older versions of pahole and forces struct pa= gesets > > > to be non-zero sized as a workaround when CONFIG_DEBUG_INFO_BTF is = set. A > > > warning is omitted so that distributions can update pahole when 1.2= 2 > > > is released. > > > > > > Reported-by: Michal Suchanek > > > Reported-by: Hritik Vijay > > > Debugged-by: Andrii Nakryiko > > > Signed-off-by: Mel Gorman > > > --- > > > lib/Kconfig.debug | 3 +++ > > > mm/page_alloc.c | 11 +++++++++++ > > > 2 files changed, 14 insertions(+) > > > > > > diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug > > > index 678c13967580..f88a155b80a9 100644 > > > --- a/lib/Kconfig.debug > > > +++ b/lib/Kconfig.debug > > > @@ -313,6 +313,9 @@ config DEBUG_INFO_BTF > > > config PAHOLE_HAS_SPLIT_BTF > > > def_bool $(success, test `$(PAHOLE) --version | sed -E 's/v([= 0-9]+)\.([0-9]+)/\1\2/'` -ge "119") > > > > > > +config PAHOLE_HAS_ZEROSIZE_PERCPU_SUPPORT > > > + def_bool $(success, test `$(PAHOLE) --version | sed -E 's/v([= 0-9]+)\.([0-9]+)/\1\2/'` -ge "122") > > > + > > > > This does not seem workable with dummy-tools. > > > > Do we even have dummy pahole? > > >=20 > I don't know what dummy-tools is, so probably no. But if you don't > have pahole on the build host, you can't have DEBUG_INFO_BTF=3Dy > anyways. As in, your build will fail because it will be impossible to > generate BTF information. So you'll have to disable DEBUG_INFO_BTF if > you can't get pahole onto your build host for some reason. dummy-tools is used to maintain configuration files outside of build the environment. It is not easy to have all tools with all bells and whistles for all architectures on one machine. That is you should be able to enable DEBUG_INFO_BTF without pahole, and then build the config on a build host that has a compiler and pohole for the target architecture. Thanks Michal