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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6560C43334 for ; Wed, 8 Jun 2022 17:59:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1B9956B0071; Wed, 8 Jun 2022 13:59:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 168136B0072; Wed, 8 Jun 2022 13:59:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 02F886B0073; Wed, 8 Jun 2022 13:59:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id E277E6B0071 for ; Wed, 8 Jun 2022 13:59:31 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id A949861587 for ; Wed, 8 Jun 2022 17:59:31 +0000 (UTC) X-FDA: 79555830942.18.AEB1FB7 Received: from polaris.svanheule.net (polaris.svanheule.net [84.16.241.116]) by imf19.hostedemail.com (Postfix) with ESMTP id DE6301A0051 for ; Wed, 8 Jun 2022 17:59:30 +0000 (UTC) Received: from [IPv6:2a02:a03f:eaf9:8401:aa9f:5d01:1b2a:e3cd] (unknown [IPv6:2a02:a03f:eaf9:8401:aa9f:5d01:1b2a:e3cd]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: sander@svanheule.net) by polaris.svanheule.net (Postfix) with ESMTPSA id 0DF752E4BB7; Wed, 8 Jun 2022 19:59:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svanheule.net; s=mail1707; t=1654711167; h=from:from:reply-to:subject:subject: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=vyTeB1JzZD9fmF558GD2qgS4Kq5QrIO/iFm0srgpPl0=; b=lxAvNswjnRftM23DfjCpgOhPgHLrjEyrvLCPka6PDjTjRusJoRjKIsHCQfRVl2W3NEOWhk 73bQt63OxjIkg16LwpCk4QKTZCeqhWxQhmeYVcswxxRikc2dwukxvJGBh5llwjPaiDidze i5+LpiyVE9uNuUr2ayLww0+HjGnl3UlxuWnsr6rcjFaFD3r66uSSVH0tKqkHctdR863ROp u1/HPmp/Rai8AlzS4hBJNZci1BxyHx5HjzxAJnaGO6UuVm6NtjHMvlPNMpnqiUWhvDNExQ rA92Im/RgrJ95lYi2PyXe5j2JAcwBgOoBKK0QGPp6fcYIKJCeBDygfOFntkC5w== Message-ID: <99cf531fb8c7e8155edbad56817c8c0208e793c2.camel@svanheule.net> Subject: Re: [PATCH v3 1/4] cpumask: Fix invalid uniprocessor mask assumption From: Sander Vanheule To: Andy Shevchenko , kernel test robot Cc: Peter Zijlstra , Yury Norov , Andrew Morton , Valentin Schneider , Thomas Gleixner , Greg Kroah-Hartman , Marco Elver , kbuild-all@lists.01.org, Linux Memory Management List , linux-kernel@vger.kernel.org Date: Wed, 08 Jun 2022 19:59:24 +0200 In-Reply-To: References: <202206060858.wA0FOzRy-lkp@intel.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.2 (3.44.2-1.fc36) MIME-Version: 1.0 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: DE6301A0051 Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=svanheule.net header.s=mail1707 header.b=lxAvNswj; dmarc=pass (policy=none) header.from=svanheule.net; spf=pass (imf19.hostedemail.com: domain of sander@svanheule.net designates 84.16.241.116 as permitted sender) smtp.mailfrom=sander@svanheule.net X-Stat-Signature: h5chmh37qhmxqpodfat7899fmqjmydzm X-Rspam-User: X-HE-Tag: 1654711170-604343 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 Mon, 2022-06-06 at 13:40 +0300, Andy Shevchenko wrote: > On Mon, Jun 06, 2022 at 08:48:05AM +0800, kernel test robot wrote: > > Hi Sander, > >=20 > > I love your patch! Yet something to improve: > >=20 > > [auto build test ERROR on akpm-mm/mm-everything] > > [also build test ERROR on linus/master v5.18 next-20220603] > > [If your patch is applied to the wrong git tree, kindly drop us a note. > > And when submitting patch, we suggest to use '--base' as documented in > > https://git-scm.com/docs/git-format-patch] > >=20 > > url:=C2=A0=C2=A0=C2=A0 > > https://github.com/intel-lab-lkp/linux/commits/Sander-Vanheule/cpumask-= Fix-invalid-uniprocessor-assumptions/20220606-004959 > > base:=C2=A0=C2=A0 https://git.kernel.org/pub/scm/linux/kernel/git/akpm/= mm.git=C2=A0mm-everything > > config: i386-randconfig-a009 > > (https://download.01.org/0day-ci/archive/20220606/202206060858.wA0FOzRy= -lkp@intel.com/config) > > compiler: gcc-11 (Debian 11.3.0-1) 11.3.0 > > reproduce (this is a W=3D1 build): > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 # https://github.com/intel-l= ab-lkp/linux/commit/37b3f10c4604ea299b454f39ac5ba3cad903ae16 > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 git remote add linux-review = https://github.com/intel-lab-lkp/linux > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 git fetch --no-tags linux-re= view Sander-Vanheule/cpumask-Fix-invalid-uniprocessor- > > assumptions/20220606-004959 > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 git checkout 37b3f10c4604ea2= 99b454f39ac5ba3cad903ae16 > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 # save the config file > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 mkdir build_dir && cp config= build_dir/.config > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 make W=3D1 O=3Dbuild_dir ARC= H=3Di386 SHELL=3D/bin/bash > >=20 > > If you fix the issue, kindly add following tag where applicable > > Reported-by: kernel test robot > >=20 > > All errors (new ones prefixed by >>): > >=20 > > =C2=A0=C2=A0 ld: arch/x86/kernel/cpu/cacheinfo.o: in function `__cache_= amd_cpumap_setup': > > =C2=A0=C2=A0 arch/x86/kernel/cpu/cacheinfo.c:890: undefined reference t= o `cpu_llc_shared_map' > > > > ld: arch/x86/kernel/cpu/cacheinfo.c:895: undefined reference to `cp= u_llc_shared_map' >=20 > Seems like somewhere we need stubs for UP builds for those cache related = functions. >=20 I think I finally figured out what's going on here. cpu_llc_shared_map is always declared with DECLARE_PER_CPU_READ_MOSTLY, but= defined in arch/x86/kernel/smpboot.c which only builds on CONFIG_SMP=3Dy. cpu_llc_shared_map is accessed in a for_each_cpu loop: for_each_cpu(i, cpu_llc_shared_mask(cpu)) The old (wrong) UP implementation would ignore the mask, so cpu_llc_shared_= map access was optimised out and the linker would never see that symbol. Adding a stub for the two inline functions in arch/x86/include/smp.h won't = be sufficient I'm afraid. But I think we can safely make the following assumptions (nobody complained= before): * anything using cpumask_first_zero(), cpumask_next_zero(), and for_each_c= pu_not() was expecting an empty mask on UP builds, * anything else would have expected a filled mask on UP builds. I'll think about how to identify all the possible cases, but may not be abl= e to spend a lot of time on this in the two coming weeks. Any suggestions, or alternative solutions,= are of course welcome. Best, Sander