Linux-Sparse Archive mirror
 help / color / mirror / Atom feed
From: Charlemagne Lasse <charlemagnelasse@gmail.com>
To: Uros Bizjak <ubizjak@gmail.com>, linux-sparse@vger.kernel.org
Cc: x86@kernel.org, LKML <linux-kernel@vger.kernel.org>,
	 Luc Van Oostenryck <lucvoo@kernel.org>,
	Andy Lutomirski <luto@kernel.org>, Ingo Molnar <mingo@kernel.org>,
	 Brian Gerst <brgerst@gmail.com>,
	Denys Vlasenko <dvlasenk@redhat.com>,
	 "H . Peter Anvin" <hpa@zytor.com>,
	Peter Zijlstra <peterz@infradead.org>,
	 Thomas Gleixner <tglx@linutronix.de>,
	Borislav Petkov <bp@alien8.de>,
	Josh Poimboeuf <jpoimboe@redhat.com>
Subject: Re: warning: cast removes address space '__percpu' of expression
Date: Wed, 3 Apr 2024 09:14:48 +0200	[thread overview]
Message-ID: <CAFGhKbzJ-icVy-YmPVSNd4O4AA-4QGiaYZWM+2T=xq5_-MB4MA@mail.gmail.com> (raw)
In-Reply-To: <CAFULd4ahxmEiJ37hLXUg3RwZMW9GnkN=38ZuirSq_cu3VHMU0g@mail.gmail.com>

Am Di., 2. Apr. 2024 um 22:40 Uhr schrieb Uros Bizjak <ubizjak@gmail.com>:
[snip]
> > ```
> > git reset --hard ed2f752e0e0a21d941ca0ee539ef3d4cd576bc5e
> > git cherry-pick 3a1d3829e193c091475ceab481c5f8deab385023
> > patch -p1 -i ~/p.diff.txt
> > git clean -dfx
> > make allnoconfig -j$(nproc)
> > make kvm_guest.config
> > echo CONFIG_MODULES=y >> .config
> > echo CONFIG_NET_9P_VIRTIO=m >> .config
> > make olddefconfig
> > make prepare -j$(nproc)
> > touch net/9p/trans_virtio.c
> > make C=1 M=net/9p/ trans_virtio.o CHECK="sparse -Wconstexpr-not-const"
> > ```
> >
> > This now shows the warning:
> >
> > ```
> > net/9p/trans_virtio.c:831:1: warning: non-constant initializer for static object
> > net/9p/trans_virtio.c:832:1: warning: non-constant initializer for static object
> > ```
[snip]
> It's this part:
>
> diff --git a/include/linux/compiler.h b/include/linux/compiler.h
> index d7779a18b24fc3..bf9815eaf4aabf 100644
> --- a/include/linux/compiler.h
> +++ b/include/linux/compiler.h
> @@ -212,7 +212,7 @@ void ftrace_likely_update(struct
> ftrace_likely_data *f, int val,
> */
> #define ___ADDRESSABLE(sym, __attrs) \
> static void * __used __attrs \
> - __UNIQUE_ID(__PASTE(__addressable_,sym)) = (void *)&sym;
> + __UNIQUE_ID(__PASTE(__addressable_,sym)) = (void *)(uintptr_t)&sym;
> #define __ADDRESSABLE(sym) \
> ___ADDRESSABLE(sym, __section(".discard.addressable"))
>
> But ... how is this not const?

@Luc Van Oostenryck Do you have any idea how to correctly implement it
to make sparse happy?

       reply	other threads:[~2024-04-03  7:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAFGhKbzev7W4aHwhFPWwMZQEHenVgZUj7=aunFieVqZg3mt14A@mail.gmail.com>
     [not found] ` <CAFULd4a75kS=3cJzYKsOcJ3ULjW8k5M1cvPYZQ25zZqTo3QX9Q@mail.gmail.com>
     [not found]   ` <CAFGhKbx3dzrMC0euRMNe5=sAhM87v=6gLwOT+c9HwWKZrWc5Gg@mail.gmail.com>
     [not found]     ` <CAFULd4ZNi7eONVu8syiWyA5ek2TgHTf6jTM+Pf7SaSG6WyHoNw@mail.gmail.com>
     [not found]       ` <CAFGhKbwqrr=_bOnKW+wqtX2OyW0xpS_9wkJnHpwxmwx7MHGhfg@mail.gmail.com>
     [not found]         ` <CAFGhKbzdWLw7fmRTLYPhEycWZvfjE-OCvnWct2A_kWVe94-p-A@mail.gmail.com>
     [not found]           ` <CAFULd4ahxmEiJ37hLXUg3RwZMW9GnkN=38ZuirSq_cu3VHMU0g@mail.gmail.com>
2024-04-03  7:14             ` Charlemagne Lasse [this message]
2024-04-22  7:22               ` warning: cast removes address space '__percpu' of expression Charlemagne Lasse

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='CAFGhKbzJ-icVy-YmPVSNd4O4AA-4QGiaYZWM+2T=xq5_-MB4MA@mail.gmail.com' \
    --to=charlemagnelasse@gmail.com \
    --cc=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=dvlasenk@redhat.com \
    --cc=hpa@zytor.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=lucvoo@kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=ubizjak@gmail.com \
    --cc=x86@kernel.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).