Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp96039pxj; Wed, 23 Jun 2021 16:42:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRQsjVnRcAcLut+5Jm1yl2EYMoCIei2rr04cGd5JDHDx9jj4qR8/pZdB1SkVEzXohMZurD X-Received: by 2002:a05:6402:d6a:: with SMTP id ec42mr2981066edb.211.1624491767527; Wed, 23 Jun 2021 16:42:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624491767; cv=none; d=google.com; s=arc-20160816; b=FNGH1AKQVyZ0aG784il25eMZ/sP0+Icu0bk/aruJI/3NjYY2FWEWfAMG3eB1bYQ1hf Rr10wyE+3t84llsC30r/1JacDFaY7lysy4k85Sbe1Jbxogm9Rz5E74EhbfqyTV5tHH/r VIXbBjawD8Ca3FXLpmmRMbrAtHDyDFcRnS9Uj2qqMfkTtMjVZhF3/mc8mwi9YUxiTbZE NLbfsm1TUhxjRicjWrimZMuhtRjftB71gmH15ur3RdLAJtdqsyzCiTKB8ir6xVssUMpP VH5oRpI9iImydUIxmE6C8acg39nzcvGNzSJwOMdNoVsDPPYTdvkrUHO7t4oMmxnAsGxt eK4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=m22T5sLi5MlC7izMU83G6XELshO1TaCPD5d1ECbMfac=; b=cA+gdKWLuQuFh5FXZVOarZvSofiStpo+Z+7LqtNgFDc6HsMxggg8wlRgz4SJLaHcwZ C7YWmBrXN+by5dgSyrxuGf8HsyBUGIo4HcHhc9/WjhMymeloJZtolnO84n1UKJssne8Q Lo28YpJLUxnZzKnxvye4PQ3FyVOp08n8EUTWjJkQ4hTSBDRRx/Q+PDEkOOl4N2T3QSJ2 SLFA1Ej0lvQOUtc/m7EwBueVF5iLOLYV//BCbvPSe9jo1UEf1DPhzRWNKjiNNFHGdsfd EBvtXfnKQ+ZnbEjdZz2cBRfVxyIhbb2HstM9PMQovffYtBPsFt7hBp/fPoDVVoTNdmw6 ENuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=kYlOcxyd; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o8si1274802ejj.94.2021.06.23.16.42.25; Wed, 23 Jun 2021 16:42:47 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=kYlOcxyd; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230001AbhFWXmb (ORCPT + 99 others); Wed, 23 Jun 2021 19:42:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229994AbhFWXma (ORCPT ); Wed, 23 Jun 2021 19:42:30 -0400 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D72BC061574 for ; Wed, 23 Jun 2021 16:40:11 -0700 (PDT) Received: by mail-lj1-x229.google.com with SMTP id r16so5210966ljk.9 for ; Wed, 23 Jun 2021 16:40:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=m22T5sLi5MlC7izMU83G6XELshO1TaCPD5d1ECbMfac=; b=kYlOcxydYne7K3UofWUlouyNMEFl8Ul06Flm3MVhkhmJfe8bLDR4bHZD4KvVWkBIgY qc7E/sbFvHltDrrnGBn2x3sRPKJdT9KHVxas98fbgfi819yGP1WrsW4XoNjKrtPmR95k rJQjQI5F69ZukAtJI9FbH5wpS0KsBHnMhBO0WtuK0v8nXQF1tslMUK3qwlyuFtWCuNnD nX4JA1CGHRfrzv0fqmwVktpzPHfGivDVn3xnRoODT0pOIm82K0BJru6bzzmSZbpigUBA MbjYbgrN4PuClJvu7Szn/WhFGiUSxOXCc3JPiQNbgrnRUQK3fbOSMfYmUvhY1hnEa7Qd CHDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=m22T5sLi5MlC7izMU83G6XELshO1TaCPD5d1ECbMfac=; b=ER56ilyZMrXMhUWyLgq3agETYNVGF0zYFcY8fTGBuJEutLDnVFmHPFboKCNZ7Ljhvy IeR24oHYMtqvsu/OuShTPBMKViprRcQ48WYwiijAhHt2DrmOD/ulSgRBv4Lodz6soK7a uonj16YdOv1X2IqhuXfZkirk/XC7r4pCLp1iODLd6Ftkv9iGcOP8ra9hRWZFygmI82LL nHpFMTt1GaCQ3DSoSkVbx1pdep8+rUB5W9zoDa7oNHbve/JE6O6iYfbSPnT/DfVDKvV6 ttoDPMpfpYKbHcJ5MYYddfUHnWLWEK1qFjZkSv2Ua0H+q5y0akMRsDoF2aC2El/x2Ia5 o4oA== X-Gm-Message-State: AOAM5322CNQks6krPNtDG7NsHfDAYT1ZVzNL73y4WVuXBbFeqEfFf8Nt 4HX+M57IiucxSkSCuUm5ojDudqCi8f7WMfcMEMAPfA== X-Received: by 2002:a2e:a492:: with SMTP id h18mr1567944lji.495.1624491609801; Wed, 23 Jun 2021 16:40:09 -0700 (PDT) MIME-Version: 1.0 References: <6f3c5317-2877-9a57-0126-e9305f000269@linux.ibm.com> In-Reply-To: From: Nick Desaulniers Date: Wed, 23 Jun 2021 16:39:56 -0700 Message-ID: Subject: Re: [next] [clang] x86_64-linux-gnu-ld: mm/mremap.o: in function `move_pgt_entry': mremap.c:(.text+0x763): undefined reference to `__compiletime_assert_342' To: Nathan Chancellor Cc: "Aneesh Kumar K.V" , Andrew Morton , Matthew Wilcox , Naresh Kamboju , Linux Next Mailing List , clang-built-linux , lkft-triage@lists.linaro.org, LKML , Arnd Bergmann , Stephen Rothwell , "Paul E. McKenney" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org An additional report: https://lore.kernel.org/lkml/20210623223015.GA315292@paulmck-ThinkPad-P17-Gen-1/ EOM On Fri, Jun 18, 2021 at 4:05 PM Nathan Chancellor wrote: > > On Fri, Jun 18, 2021 at 10:32:42AM +0530, Aneesh Kumar K.V wrote: > > On 6/17/21 11:32 PM, Nathan Chancellor wrote: > > > Rebuilt the CC list because most people were added based on the > > > incorrect bisect result. > > > > > > On Thu, Jun 17, 2021 at 02:51:49PM +0100, Matthew Wilcox wrote: > > > > On Thu, Jun 17, 2021 at 06:15:45PM +0530, Naresh Kamboju wrote: > > > > > On Thu, 17 Jun 2021 at 17:41, Naresh Kamboju wrote: > > > > > > x86_64-linux-gnu-ld: mm/mremap.o: in function `move_pgt_entry': > > > > > > mremap.c:(.text+0x763): undefined reference to `__compiletime_assert_342' > > > > > > > > > > The git bisect pointed out the first bad commit. > > > > > > > > > > The first bad commit: > > > > > commit 928cf6adc7d60c96eca760c05c1000cda061604e > > > > > Author: Stephen Boyd > > > > > Date: Thu Jun 17 15:21:35 2021 +1000 > > > > > module: add printk formats to add module build ID to stacktraces > > > > > > > > Your git bisect probably went astray. There's no way that commit > > > > caused that regression. > > > > > > My bisect landed on commit 83f85ac75855 ("mm/mremap: convert huge PUD > > > move to separate helper"). flush_pud_tlb_range() evaluates to > > > BUILD_BUG() when CONFIG_TRANSPARENT_HUGEPAGE is unset but this function > > > is present just based on the value of > > > CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD. > > > > > > $ make -skj(nproc) ARCH=x86_64 CC=clang O=build/x86_64 distclean allnoconfig mm/mremap.o > > > > > > $ llvm-readelf -s build/x86_64/mm/mremap.o &| rg __compiletime_assert > > > 21: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND __compiletime_assert_337 > > > > > > $ rg TRANSPARENT_ build/x86_64/.config > > > 450:CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y > > > 451:CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD=y > > > 562:# CONFIG_TRANSPARENT_HUGEPAGE is not set > > > > > > Not sure why this does not happen on newer clang versions, presumably > > > something with inlining decisions? Still seems like a legitimate issue > > > to me. > > > > > > > gcc 10 also doesn't give a build error. I guess that is because we evaluate > > > > if (pud_trans_huge(*old_pud) || pud_devmap(*old_pud)) { > > > > to if (0) with CONFIG_TRANSPARENT_HUGEPAGE disabled. > > > > switching that to if (1) do results in BUILD_BUG triggering. > > Thanks for pointing that out. I think what happens with clang-10 and > clang-11 is that move_huge_pud() gets inlined into move_pgt_entry() but > then the compiler does not figure out that the HPAGE_PUD case is dead so > the code sticks around, where as GCC and newer clang versions can figure > that out and eliminate that case. > > > Should we fix this ? > > Yes, I believe that we should. > > > modified mm/mremap.c > > @@ -336,7 +336,7 @@ static inline bool move_normal_pud(struct vm_area_struct > > *vma, > > } > > #endif > > > > -#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD > > +#if defined(CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD) && > > defined(CONFIG_TRANSPARENT_HUGEPAGE) > > static bool move_huge_pud(struct vm_area_struct *vma, unsigned long > > old_addr, > > unsigned long new_addr, pud_t *old_pud, pud_t *new_pud) > > { > > That works or we could mirror what has already been done for the > HPAGE_PMD case. No personal preference. > > diff --git a/mm/mremap.c b/mm/mremap.c > index 9a7fbec31dc9..5989d3990020 100644 > --- a/mm/mremap.c > +++ b/mm/mremap.c > @@ -460,7 +460,8 @@ static bool move_pgt_entry(enum pgt_entry entry, struct vm_area_struct *vma, > new_entry); > break; > case HPAGE_PUD: > - moved = move_huge_pud(vma, old_addr, new_addr, old_entry, > + moved = IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) && > + move_huge_pud(vma, old_addr, new_addr, old_entry, > new_entry); > break; > > > Cheers, > Nathan -- Thanks, ~Nick Desaulniers