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=-23.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL 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 8A230C433B4 for ; Wed, 12 May 2021 19:29:58 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1284E61289 for ; Wed, 12 May 2021 19:29:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1284E61289 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 55A716B006C; Wed, 12 May 2021 15:29:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 50AD06B006E; Wed, 12 May 2021 15:29:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3D3926B0070; Wed, 12 May 2021 15:29:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0062.hostedemail.com [216.40.44.62]) by kanga.kvack.org (Postfix) with ESMTP id 0B5C16B006C for ; Wed, 12 May 2021 15:29:56 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 9FD50BBF8 for ; Wed, 12 May 2021 19:29:56 +0000 (UTC) X-FDA: 78133569192.25.FE266D9 Received: from mail-io1-f51.google.com (mail-io1-f51.google.com [209.85.166.51]) by imf03.hostedemail.com (Postfix) with ESMTP id E15F8C0007EA for ; Wed, 12 May 2021 19:29:47 +0000 (UTC) Received: by mail-io1-f51.google.com with SMTP id l21so22819882iob.1 for ; Wed, 12 May 2021 12:29:56 -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=fXSEYjzURqZe/rhzGwaoLJmTe5r20EicuqgCItC3qOU=; b=WKtVDfyEpTQhCBTsxYcI8Pso3ISoLVVgd+5HXuIVYugfFZsRDNFyiX4elj4nsMXep1 sxDE7DtzFAilcD43z5aaUNLaRzoX4MZgI2D2PwKWup6A3HHqNnYUpVzhxXOvv2MR0au3 k6U2lzoeAAP0NZR6hptPtE+WgWDssOnEGgVA4YNJsKzq1TdgZmH4CRnPIc4lpHhno19Q 8NcvnLRoZZj32nFoz+tXkmjw8W8g94RJ/K0mXSrXhodnAjGvA4KrZFmnPX0gCjd/zr5T ATaAwmeUVcz5GEuIkS/ONJy7ueNVPs8mWDqDwIT1YmIBYh5ItQyFPEK/1135xUa4h9K4 1taA== 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=fXSEYjzURqZe/rhzGwaoLJmTe5r20EicuqgCItC3qOU=; b=ED8GFlpocwLHGcU9zayeaQQKIbsL53FpC8sUPwVzvcNrtGougqV3IjonLZZlpeY56u D+PflRDvZgS/rud+53LyCMETxHoN4nOJdrdUv3o+2Vnge0pIJY7ityNBZh8TNldb9Daq ADBO08ACgLiuOfJtLgonD0OwiktoBibFnOoDcfsQDFIpDV1rQbs/EYYAd30PmZTdxMFS 3lW1FLIw5iX3CJr14sTxCfy5A+IFzU4L1pb/By2hhKxOGDPGIophO50632PQcn9VaLka Gmf0r0MKoAVsTLOLbGr0Uakp+kzV3XdM/3r4iih3BHZd3uIPsSBvwuLsn24yAhIhbBh0 jTfA== X-Gm-Message-State: AOAM531ahcOusWGQvty70cPSBoECIZg84DDda70JDSzKVH6q5UA6tfTx 9ZIBOrPmS+J6B3kOhuNffYRQryGsvGPz6zW1+idkyg== X-Google-Smtp-Source: ABdhPJxavCNj3/VQQ8QOgEF0l+bkpvspFvzICzxYr9kTJ3KVIJE4+rulZcyjei0bVCMOYiaRr0XXT2dN6Hj8yxr2Q68= X-Received: by 2002:a6b:b409:: with SMTP id d9mr26771251iof.57.1620847795421; Wed, 12 May 2021 12:29:55 -0700 (PDT) MIME-Version: 1.0 References: <202105122224.mJzg3ncL-lkp@intel.com> In-Reply-To: From: Axel Rasmussen Date: Wed, 12 May 2021 12:29:19 -0700 Message-ID: Subject: Re: [linux-next:master 2078/2633] include/linux/hugetlb.h:340:30: error: variable has incomplete type 'enum mcopy_atomic_mode' To: Hugh Dickins Cc: kernel test robot , kbuild-all@lists.01.org, clang-built-linux@googlegroups.com, Linux Memory Management List , Peter Xu , Andrew Morton , Mike Kravetz Content-Type: text/plain; charset="UTF-8" Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=google.com header.s=20161025 header.b=WKtVDfyE; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf03.hostedemail.com: domain of axelrasmussen@google.com designates 209.85.166.51 as permitted sender) smtp.mailfrom=axelrasmussen@google.com X-Stat-Signature: agx7d3473ocn8c5i77yyw9rdwc3qt855 X-Rspamd-Queue-Id: E15F8C0007EA X-Rspamd-Server: rspam02 Received-SPF: none (google.com>: No applicable sender policy available) receiver=imf03; identity=mailfrom; envelope-from=""; helo=mail-io1-f51.google.com; client-ip=209.85.166.51 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1620847787-476202 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 12, 2021 at 11:56 AM Hugh Dickins wrote: > > On Wed, 12 May 2021, Axel Rasmussen wrote: > > > Andrew, the straightforward fix is just to drop this commit, which is > > currently in the mm tree (not in v5.13-rc1): > > Yes, that's easiest. > > > > > 09ff184a3eb1c9 userfaultfd/hugetlbfs: avoid including userfaultfd_k.h > > in hugetlb.h > > > > (Happy to send a revert patch, but I suspect it's easier for you to > > drop than to revert + squash later?) > > > > Adding Hugh as well, since he suggested this cleanup and might prefer > > doing something else instead. > > Yes, sorry for dropping you in it. > > > > > On Wed, May 12, 2021 at 7:45 AM kernel test robot wrote: > > > > > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master > > > head: ec85c95b0c90a17413901b018e8ade7b9eae7cad > > > commit: 09ff184a3eb1c9cb42f64325ca4a51e36206f4f5 [2078/2633] userfaultfd/hugetlbfs: avoid including userfaultfd_k.h in hugetlb.h > > > config: s390-randconfig-r023-20210512 (attached as .config) > > > compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project a0fed635fe1701470062495a6ffee1c608f3f1bc) > > > 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 s390 cross compiling tool for clang build > > I was puzzled, thinking it was something special to s390 or to clang; > until noticing that it says s390-randconfig above. > > > > # apt-get install binutils-s390x-linux-gnu > > > # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=09ff184a3eb1c9cb42f64325ca4a51e36206f4f5 > > > 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 09ff184a3eb1c9cb42f64325ca4a51e36206f4f5 > > > # save the attached .config to linux build tree > > > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=s390 > > > > > > If you fix the issue, kindly add following tag as appropriate > > > Reported-by: kernel test robot > > > > > > All errors (new ones prefixed by >>): > > > > > > In file included from arch/s390/mm/fault.c:33: > > > >> include/linux/hugetlb.h:340:30: error: variable has incomplete type 'enum mcopy_atomic_mode' > > > enum mcopy_atomic_mode mode, > > > ^ > > > include/linux/hugetlb.h:18:6: note: forward declaration of 'enum mcopy_atomic_mode' > > > enum mcopy_atomic_mode; > > > ^ > > And line 340 is not the first, usual use of mcopy_atomic_mode in hugetlb.h, > but its use in the CONFIG_USERFAULTFD=y CONFIG_HUGETLB_PAGE=n static inline > stub. Right, the compiler would probably want to compile that before > optimizing it away; and want to know more about the enum to do so. > > My actual preference would be to keep the "enum mcopy_atomic_mode;" > patch, and fix it with the patch below: since the only call to > hugetlb_mcopy_atomic_pte() is under #ifdef CONFIG_HUGETLB_PAGE anyway. > > But since I have not even tried building with this patch on x86_64 gcc, > in any configuration at all, I expect you all to be rather wary of my > suggestions by now, and prefer to just drop the troublesome patch. > But in case anyone is tempted, now or later, Yeah, I would want to do some more testing first on various compilers and things. My understanding is that the C standard says enums may be as small as a char or as big as an int depending on the value(s) they can have, so with just a forward declaration we can't know the size which I think is needed even for just a function signature. But, GCC seems to do something to make this "work" (at least without -pedantic). Another small cleanup I'd like to do is, after our other code review, I think "enum mcopy_atomic_mode" should rather be named "enum mfill_atomic_mode" - since Andrea intended "mcopy" to refer specifically to copy_from_user, and "mfill" to refer to the more general operation. So, I think we drop this patch for now, and I'll keep this in mind for some future cleanup series. > > --- mmotm/include/linux/hugetlb.h 2021-05-11 08:33:39.987553392 -0700 > +++ linux/include/linux/hugetlb.h 2021-05-12 11:20:52.385063935 -0700 > @@ -331,20 +331,6 @@ static inline void hugetlb_free_pgd_rang > BUG(); > } > > -#ifdef CONFIG_USERFAULTFD > -static inline int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, > - pte_t *dst_pte, > - struct vm_area_struct *dst_vma, > - unsigned long dst_addr, > - unsigned long src_addr, > - enum mcopy_atomic_mode mode, > - struct page **pagep) > -{ > - BUG(); > - return 0; > -} > -#endif /* CONFIG_USERFAULTFD */ > - > static inline pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr, > unsigned long sz) > {