linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Nick Desaulniers <ndesaulniers@google.com>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: Yi Liu <yi.l.liu@intel.com>, kernel test robot <lkp@intel.com>,
	llvm@lists.linux.dev,  oe-kbuild-all@lists.linux.dev,
	 Linux Memory Management List <linux-mm@kvack.org>,
	Alex Williamson <alex.williamson@redhat.com>,
	 Ard Biesheuvel <ardb@kernel.org>, Jessica Yu <jeyu@kernel.org>,
	Kees Cook <keescook@chromium.org>,  Will Deacon <will@kernel.org>,
	Nathan Chancellor <nathan@kernel.org>
Subject: Re: [linux-next:master 3581/12910] arch/powerpc/kvm/../../../virt/kvm/vfio.c:89:7: error: attribute declaration must precede definition
Date: Fri, 25 Aug 2023 13:04:31 -0700	[thread overview]
Message-ID: <CAKwvOdnBg2aY+WwG_GGusRcf-XPZYyqNAYoDb62dJw1MoZs_Nw@mail.gmail.com> (raw)
In-Reply-To: <ZOkDvPOt/UMprbU4@nvidia.com>

On Fri, Aug 25, 2023 at 12:40 PM Jason Gunthorpe <jgg@nvidia.com> wrote:
>
> On Fri, Aug 25, 2023 at 11:49:53AM -0700, Nick Desaulniers wrote:
> > I think this example demonstrates a little clearer what's going on:
> > https://godbolt.org/z/9d6scv1hE
> >
> > So based on the warning, it seems like symbol_get() can only be used
> > before the parameter it's passed is defined, otherwise the "weak" and
> > "visibility(hidden)" attributes are ignored.  These attributes are
> > merge-able upon redeclaration up until the first definition.
>
> No, that doesn't make sense. The macro does:
>
> #define symbol_get(x) ({ extern typeof(x) x __attribute__((weak,visibility("hidden"))); &(x); })
>
> x must be defined for typeof(x) to work.

x must be //declared// for typeof(x) to work, but x doesn't need to be
//defined//.
https://godbolt.org/z/qv6zPWf9K

But I think it's kind of moot, given the kconfig discussion below.

>
> I think the issue is that:
>
> # CONFIG_VFIO is not set
> CONFIG_KVM_VFIO=y
>
> And
>
> kvm-$(CONFIG_KVM_VFIO) += $(KVM)/vfio.o
>
> Which is a combination that doesn't make any sense.
>
> Looks like CONFIG_KVM_VFIO should probably be called CONFIG_KVM_ARCH_VFIO
>
> And then
>
> config KVM_VFIO
>      bool
>      depends on KVM_ARCH_VFIO
>      depends on VFIO
>
> (or similar)
>
> So we don't even attempt to compile kvm/vfio.c if we don't have VFIO
> support turned on.

Do we need to split the Kconfig?

```
diff --git a/virt/kvm/Kconfig b/virt/kvm/Kconfig
index 484d0873061c..e5ebf89de855 100644
--- a/virt/kvm/Kconfig
+++ b/virt/kvm/Kconfig
@@ -61,6 +61,7 @@ config HAVE_KVM_CPU_RELAX_INTERCEPT

 config KVM_VFIO
        bool
+       depends on VFIO

 config HAVE_KVM_INVALID_WAKEUPS
        bool
```
$ ./scripts/config -e VFIO
$ make LLVM=1 ARCH=powerpc -j128 olddefconfig
arch/powerpc/kvm/../../../virt/kvm/vfio.o
#
# configuration written to .config
#
  SYNC    include/config/auto.conf.cmd
  CALL    scripts/checksyscalls.sh
  CC      arch/powerpc/kvm/../../../virt/kvm/vfio.o
$
-- 
Thanks,
~Nick Desaulniers


  reply	other threads:[~2023-08-25 20:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-25 11:23 kernel test robot
2023-08-25 12:12 ` Jason Gunthorpe
2023-08-25 18:49   ` Nick Desaulniers
2023-08-25 19:40     ` Jason Gunthorpe
2023-08-25 20:04       ` Nick Desaulniers [this message]
2023-08-30 17:19         ` Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKwvOdnBg2aY+WwG_GGusRcf-XPZYyqNAYoDb62dJw1MoZs_Nw@mail.gmail.com \
    --to=ndesaulniers@google.com \
    --cc=alex.williamson@redhat.com \
    --cc=ardb@kernel.org \
    --cc=jeyu@kernel.org \
    --cc=jgg@nvidia.com \
    --cc=keescook@chromium.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=will@kernel.org \
    --cc=yi.l.liu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox