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 44091C77B76 for ; Mon, 17 Apr 2023 13:50:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AE15D6B0071; Mon, 17 Apr 2023 09:50:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A910E8E0002; Mon, 17 Apr 2023 09:50:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9593C8E0001; Mon, 17 Apr 2023 09:50:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 869A36B0071 for ; Mon, 17 Apr 2023 09:50:08 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 4C76E140487 for ; Mon, 17 Apr 2023 13:50:08 +0000 (UTC) X-FDA: 80691016896.16.12B6298 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf12.hostedemail.com (Postfix) with ESMTP id A924B4000C for ; Mon, 17 Apr 2023 13:50:05 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf12.hostedemail.com: domain of mark.rutland@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=mark.rutland@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681739406; h=from:from:sender: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: in-reply-to:in-reply-to:references:references; bh=SbKdrcpPNUISKrNmgd71FzR8RfpwRzFccmJ99wxxoJg=; b=X3OoybsKfZznj85LDiLbUv/bdm20a+7yRZe7bFs3dq/zonMbD3v/AvNUWxZ1mDGoS9R7oV PQtmq3B0yljpDTPBcEBLYxHiEgFC1vG+jFMefos2X09ASO0gSOd/4CEFO1Zn9QE4+j359I SSyFTeltNwoQkR4RtGlpeYvcIIW7Zg0= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf12.hostedemail.com: domain of mark.rutland@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=mark.rutland@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681739406; a=rsa-sha256; cv=none; b=V0Lyvo1YkWEXJuMv1H5SElcaaLtXe/22iQ295Ctcmhy4x2RZuvGjSY/AFy7aynjHJ/y4gy QT107RQ6fHTQOmS/LpksBJ5EGgvsfFmuG0LeDqXsG1LIG0a3dYqJ8CKYW833yLzW82wU79 bHitoVw4WcsdRTsaxRQLR6kmiwbguYY= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5C1E91691; Mon, 17 Apr 2023 06:50:48 -0700 (PDT) Received: from FVFF77S0Q05N (unknown [10.57.19.253]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 87AD33F5A1; Mon, 17 Apr 2023 06:50:03 -0700 (PDT) Date: Mon, 17 Apr 2023 14:49:57 +0100 From: Mark Rutland To: kernel test robot Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev, Linux Memory Management List , Will Deacon , Ryan Roberts Subject: Re: [linux-next:master 10286/12016] arch/arm64/mm/fixmap.c:199:10: warning: variable 'bm_pudp' set but not used Message-ID: References: <202304172004.r3IPh5Ja-lkp@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202304172004.r3IPh5Ja-lkp@intel.com> X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: A924B4000C X-Stat-Signature: kmtjasbq5jg1q1hhz7wq6cmkzycwrobd X-HE-Tag: 1681739405-664599 X-HE-Meta: U2FsdGVkX193SIqKfnvvCHTLuuHcCdAjBEfTiMXVVIhSXNtD6lhU4qtieK9f5z34TdiV0LILsZ8CZVwS6eaPGna2cABsJM4SgtqrIBeKNPAq3W14FWg6/HVbavm+vUjdb8dwOo9IJmiuCS6C7nPYIfznUwL0v8c1YESTllhXHheYY1W5wJCCJK6fCKr9HiOsQ3BfcUT5LAnV39fqcdXi7Hqnv46XS5qil6NV8bZn4xTTdN02O+sjwwrZNfrnZe3eav86IS29k0fvfMJkeLQGdFzevoHnGEskyMN0/K+a5WLpHT0TkoDy9edf0yeu7ONL6YN8qtuaX96SEVzGc1VnznC61loQOec1Ti/8Lbvb8VNh7gThuKsRN30OSljUWgn/OuqMgQxjplSZGIZBBM1E88YgN1mAM7deM1cHnruw944hWhtz2XB84yoBCxpW5fD0yeWFFTIFWu/YZa7ykbVPsNMjjWIl4CuW/QY26rkNmKkA2fnCH8jlO+sFoct6A6aybXlRuc4iOSv3rC+X9crIvE6Z/CptTM6t0m+3zO40autY25reFccPsl5mp445csY31+gvlaqIaeRuqGPHFnoQM5utUoYb7300c2jcEYVwOQAIdc2i67bi+E99Z9sb046swuC81gYgKF+aZRIaIoj0b4Ru50R3TeS+i1R6PRQGB5eJ32S+BJWoLkFdNbsz7/R81XqRM2OQ+CtfTRT6P1HRBuE/34j9nV2G4QCiAaU7p9BuqG0c2tn7Ff4rAH4jx/zZ7qdkFL1xiLGWO1X6varVZfeCu+2NWP7mlPACWv4MdscULzpJxOXB3clVjDt6gfCuvIOqdyUOXalTEK/CqfauEn2EVtEOIfuxYS+VSOHka9R4tdjog6af+MO6BBk/nR+exfV4mpG1bt7aCZfQwChix05P4A7PeRvfcmr0FcEhkactmngXDIEPHGAn7JVZieZx2juEAIDj39WCTFIv09W B9sKz+zs 8MMc+S/keheS6jzJKNntQsuf7Q1Bhslxoo2/3UTwhuqbp5jX4E9d86tVDsczuAmJ+MGb19+JWrj+0UM26QR7s4kk85cQLSVGDSgb2V8eIMlGZGOtg78SevPw2h4xWqfQxsPTRz1S1wbyLfmXOsh/u0d8hg320wzGaKI1yX84ovvM5uy9vy5uVYEk2YgDvWnEjdfLeBvgwZ3GbSToRZpT8eJ/OtNhLKkB3g4t0VbzPRTNf5iJXeN9JVEZ+ET3FHoN0yfZ5Inp9pTxlxqp24diMNAe2rUiXpCEQeib52kv/GNYeIkkrPA+VcPhnwO/iPZYZpiqPrP/chiTLB3Tn1WO3y2nB3zl3yC0XL5WmQcivc5yTia/+Ji35JJS3cefgo83+4geP2c48jp97rmI= 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, Apr 17, 2023 at 08:55:17PM +0800, kernel test robot wrote: > Hi Mark, Hi, > FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant. I took a look, and this warning existed in the prior commit. All that has changed is that it has moved from arch/arm64/mm/mmu.c to arch/arm64/mm/init.c. This commit is not to blame, and there is no regression here. The warning itself is bogus; more details on that below. Please ignore this. > tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master > head: d3f2cd24819158bb70701c3549e586f9df9cee67 > commit: b97547761b02cc95e0e6be827dc9ca9da8142761 [10286/12016] arm64: mm: move fixmap code to its own file > config: arm64-buildonly-randconfig-r004-20230416 (https://download.01.org/0day-ci/archive/20230417/202304172004.r3IPh5Ja-lkp@intel.com/config) > compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 9638da200e00bd069e6dd63604e14cbafede9324) > reproduce (this is a W=1 build): > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross > chmod +x ~/bin/make.cross > # install arm64 cross compiling tool for clang build > # apt-get install binutils-aarch64-linux-gnu > # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=b97547761b02cc95e0e6be827dc9ca9da8142761 > git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git > git fetch --no-tags linux-next master > git checkout b97547761b02cc95e0e6be827dc9ca9da8142761 > # save the config file > mkdir build_dir && cp config build_dir/.config > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 olddefconfig > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash arch/arm64/mm/ > > If you fix the issue, kindly add following tag where applicable > | Reported-by: kernel test robot > | Link: https://lore.kernel.org/oe-kbuild-all/202304172004.r3IPh5Ja-lkp@intel.com/ > > All warnings (new ones prefixed by >>): > > >> arch/arm64/mm/fixmap.c:199:10: warning: variable 'bm_pudp' set but not used [-Wunused-but-set-variable] > pud_t *bm_pudp; > ^ > 1 warning generated. > > > vim +/bm_pudp +199 arch/arm64/mm/fixmap.c > :> 182 > 183 /* > 184 * Copy the fixmap region into a new pgdir. > 185 */ > 186 void __init fixmap_copy(pgd_t *pgdir) > 187 { > 188 if (!READ_ONCE(pgd_val(*pgd_offset_pgd(pgdir, FIXADDR_TOT_START)))) { > 189 /* > 190 * The fixmap falls in a separate pgd to the kernel, and doesn't > 191 * live in the carveout for the swapper_pg_dir. We can simply > 192 * re-use the existing dir for the fixmap. > 193 */ > 194 set_pgd(pgd_offset_pgd(pgdir, FIXADDR_TOT_START), > 195 READ_ONCE(*pgd_offset_k(FIXADDR_TOT_START))); > 196 } else if (CONFIG_PGTABLE_LEVELS > 3) { > 197 pgd_t *bm_pgdp; > 198 p4d_t *bm_p4dp; > > 199 pud_t *bm_pudp; The full piece of code in question is: | } else if (CONFIG_PGTABLE_LEVELS > 3) { | pgd_t *bm_pgdp; | p4d_t *bm_p4dp; | pud_t *bm_pudp; ^ defined | /* | * The fixmap shares its top level pgd entry with the kernel | * mapping. This can really only occur when we are running | * with 16k/4 levels, so we can simply reuse the pud level | * entry instead. | */ | BUG_ON(!IS_ENABLED(CONFIG_ARM64_16K_PAGES)); | bm_pgdp = pgd_offset_pgd(pgdp, FIXADDR_TOT_START); | bm_p4dp = p4d_offset(bm_pgdp, FIXADDR_TOT_START); | bm_pudp = pud_set_fixmap_offset(bm_p4dp, FIXADDR_TOT_START); ^ set | pud_populate(&init_mm, bm_pudp, lm_alias(bm_pmd)); ^ used | pud_clear_fixmap(); | } else { What's happening here is that the config has CONFIG_PGTABLE_LEVELS=2, where the above block is unreachable, but the warning is being generated for trivially unreachable code. With that config, we'll use include/asm-generic/pgtable-nopmd.h, where pud_populate() is defined as: | #define pud_populate(mm, pmd, pte) do { } while (0) ... and hence it's complaing that the (unreachable) definition and initialization of bm_pudp is not used. If I reconfigure the kernel with 4K pages and 48-bit VAs so that CONFIG_PGTABLE_LEVELS=4, the above warning isn't generated. Thanks, Mark.