Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2757094iof; Wed, 8 Jun 2022 11:21:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynBwqNks8BOjoa1lqgXod8z3gq2dhY1hlY41uIvtH9ucHmmKMBlR23sOZJg2N4PdNTTCOx X-Received: by 2002:a17:907:e92:b0:711:9fe4:b226 with SMTP id ho18-20020a1709070e9200b007119fe4b226mr19131877ejc.88.1654712483828; Wed, 08 Jun 2022 11:21:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654712483; cv=none; d=google.com; s=arc-20160816; b=YRV16gL205nG7cVyrpMGecXaK2V8lSX0QUl95MzcekvYveo+HP3GjWcXnMSuuIvWpn F/SV/JOyVT/L9LuyLeIaQYdhJWTCbV+OXjFh6xEH0yuZgNnt8mzhlhfSYl4wDDwz975+ NHaEGc9IdSQQAAdT4bVcekCq1qeKrR4sUe3QK0twLFMqIM/LbLeezIzoDZCr6hja6FQx MhaNJycyAZ/PdRJupysVciFCjIdF6FA1XxFMU1IUlIZlkvtF1UIJfs1uiWxxNQrgti5w QAt3NpN1DIlSbRHTraN1O1wyFA2grfh6lkULKBTJq+mg5Yybp8A/0ioI6VNZWwQn5H54 NJdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=vyTeB1JzZD9fmF558GD2qgS4Kq5QrIO/iFm0srgpPl0=; b=OIYnc2+dOQxkN8mDpwvV6RgGpUAQJRdeY8KXA3Q4OaLDqT1YM6Dyj7447MrdrOUrlQ PT0a4yHixhyHXeynKRmCNCGJ1BEHC0SIr28zRSX2XFpw4zgx+1nLJyeBi17SCLzlbXvD lhg/9IPwRyqdTuT6vwayP+IQpim9o2c8IeEDL+a2P9mSpRG+YXLyXZt4OA+tP7qKS1fp sTZ9gbbAeO5n6PvxAjBYH/mn5f4Hh+ktnMrO9ckoh42YwwWWY5lgw/q5gIumfXBEuDpQ K5ByHUEoD8V5uwxD/4Wlj3eg/Dbt/QtShU+xXMmMDTP4atj+JGkyt9NLsDGmhAQ0Hiud YPWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@svanheule.net header.s=mail1707 header.b=lxAvNswj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=svanheule.net Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hs4-20020a1709073e8400b006ff49b183e9si19921505ejc.971.2022.06.08.11.20.58; Wed, 08 Jun 2022 11:21:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@svanheule.net header.s=mail1707 header.b=lxAvNswj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=svanheule.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233678AbiFHSBV (ORCPT + 99 others); Wed, 8 Jun 2022 14:01:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233825AbiFHR7c (ORCPT ); Wed, 8 Jun 2022 13:59:32 -0400 Received: from polaris.svanheule.net (polaris.svanheule.net [IPv6:2a00:c98:2060:a004:1::200]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CAB315AB11 for ; Wed, 8 Jun 2022 10:59:30 -0700 (PDT) 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-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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