From: Yujie Liu <yujie.liu@intel.com>
To: "Paul E. McKenney" <paulmck@kernel.org>
Cc: kernel test robot <lkp@intel.com>,
<oe-kbuild-all@lists.linux.dev>, <linux-kernel@vger.kernel.org>
Subject: Re: [paulmck-rcu:dev.2024.03.27b 61/69] lib/cmpxchg-emu.c:24:11: warning: no previous prototype for 'cmpxchg_emu_u8'
Date: Mon, 1 Apr 2024 00:06:26 +0800 [thread overview]
Message-ID: <ZgmKAil/a3+av1E8@yujie-X299> (raw)
In-Reply-To: <e4b7ecac-719e-40f5-80b5-7a1c63e72b33@paulmck-laptop>
On Fri, Mar 29, 2024 at 04:08:10PM -0700, Paul E. McKenney wrote:
> On Sat, Mar 30, 2024 at 05:26:12AM +0800, kernel test robot wrote:
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git dev.2024.03.27b
> > head: 786fab3085d764055a78edb54023420920344333
> > commit: b48ffed4c636b96d2be7a93806870772ce34961f [61/69] csky: Emulate one-byte and two-byte cmpxchg
> > config: csky-allnoconfig (https://download.01.org/0day-ci/archive/20240330/202403300508.Xz7XNp71-lkp@intel.com/config)
> > compiler: csky-linux-gcc (GCC) 13.2.0
> > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240330/202403300508.Xz7XNp71-lkp@intel.com/reproduce)
> >
> > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > the same patch/commit), kindly add following tags
> > | Reported-by: kernel test robot <lkp@intel.com>
> > | Closes: https://lore.kernel.org/oe-kbuild-all/202403300508.Xz7XNp71-lkp@intel.com/
> >
> > All warnings (new ones prefixed by >>):
> >
> > >> lib/cmpxchg-emu.c:24:11: warning: no previous prototype for 'cmpxchg_emu_u8' [-Wmissing-prototypes]
> > 24 | uintptr_t cmpxchg_emu_u8(volatile u8 *p, uintptr_t old, uintptr_t new)
> > | ^~~~~~~~~~~~~~
> > >> lib/cmpxchg-emu.c:51:11: warning: no previous prototype for 'cmpxchg_emu_u16' [-Wmissing-prototypes]
> > 51 | uintptr_t cmpxchg_emu_u16(volatile u16 *p, uintptr_t old, uintptr_t new)
> > | ^~~~~~~~~~~~~~~
>
> Again, good catch, and thank you for the testing! Does the patch at the
> end of this email fix things for you?
The warning is fixed by the patch at the end of the mail.
Tested-by: Yujie Liu <yujie.liu@intel.com>
>
> Thanx, Paul
>
> > vim +/cmpxchg_emu_u8 +24 lib/cmpxchg-emu.c
> >
> > 0bbce967f3ecfc Paul E. McKenney 2024-03-17 22
> > 0bbce967f3ecfc Paul E. McKenney 2024-03-17 23 /* Emulate one-byte cmpxchg() in terms of 4-byte cmpxchg. */
> > 0bbce967f3ecfc Paul E. McKenney 2024-03-17 @24 uintptr_t cmpxchg_emu_u8(volatile u8 *p, uintptr_t old, uintptr_t new)
> > 0bbce967f3ecfc Paul E. McKenney 2024-03-17 25 {
> > 0bbce967f3ecfc Paul E. McKenney 2024-03-17 26 u32 *p32 = (u32 *)(((uintptr_t)p) & ~0x3);
> > 0bbce967f3ecfc Paul E. McKenney 2024-03-17 27 int i = ((uintptr_t)p) & 0x3;
> > 0bbce967f3ecfc Paul E. McKenney 2024-03-17 28 union u8_32 old32;
> > 0bbce967f3ecfc Paul E. McKenney 2024-03-17 29 union u8_32 new32;
> > 0bbce967f3ecfc Paul E. McKenney 2024-03-17 30 u32 ret;
> > 0bbce967f3ecfc Paul E. McKenney 2024-03-17 31
> > 0bbce967f3ecfc Paul E. McKenney 2024-03-17 32 old32.w = READ_ONCE(*p32);
> > 0bbce967f3ecfc Paul E. McKenney 2024-03-17 33 do {
> > 0bbce967f3ecfc Paul E. McKenney 2024-03-17 34 if (old32.b[i] != old)
> > 0bbce967f3ecfc Paul E. McKenney 2024-03-17 35 return old32.b[i];
> > 0bbce967f3ecfc Paul E. McKenney 2024-03-17 36 new32.w = old32.w;
> > 0bbce967f3ecfc Paul E. McKenney 2024-03-17 37 new32.b[i] = new;
> > 0bbce967f3ecfc Paul E. McKenney 2024-03-17 38 instrument_atomic_read_write(p, 1);
> > 0bbce967f3ecfc Paul E. McKenney 2024-03-17 39 ret = data_race(cmpxchg(p32, old32.w, new32.w));
> > 0bbce967f3ecfc Paul E. McKenney 2024-03-17 40 } while (ret != old32.w);
> > 0bbce967f3ecfc Paul E. McKenney 2024-03-17 41 return old;
> > 0bbce967f3ecfc Paul E. McKenney 2024-03-17 42 }
> > 0bbce967f3ecfc Paul E. McKenney 2024-03-17 43 EXPORT_SYMBOL_GPL(cmpxchg_emu_u8);
> > 0bbce967f3ecfc Paul E. McKenney 2024-03-17 44
> > 0bbce967f3ecfc Paul E. McKenney 2024-03-17 45 union u16_32 {
> > 0bbce967f3ecfc Paul E. McKenney 2024-03-17 46 u16 h[2];
> > 0bbce967f3ecfc Paul E. McKenney 2024-03-17 47 u32 w;
> > 0bbce967f3ecfc Paul E. McKenney 2024-03-17 48 };
> > 0bbce967f3ecfc Paul E. McKenney 2024-03-17 49
> > 0bbce967f3ecfc Paul E. McKenney 2024-03-17 50 /* Emulate two-byte cmpxchg() in terms of 4-byte cmpxchg. */
> > 0bbce967f3ecfc Paul E. McKenney 2024-03-17 @51 uintptr_t cmpxchg_emu_u16(volatile u16 *p, uintptr_t old, uintptr_t new)
> >
> > :::::: The code at line 24 was first introduced by commit
> > :::::: 0bbce967f3ecfc6da1e7e8756b0d398e791b8dee lib: Add one-byte and two-byte cmpxchg() emulation functions
> >
> > :::::: TO: Paul E. McKenney <paulmck@kernel.org>
> > :::::: CC: Paul E. McKenney <paulmck@kernel.org>
> >
> > --
> > 0-DAY CI Kernel Test Service
> > https://github.com/intel/lkp-tests/wiki
>
> commit a326496eb88936b291adea830c2e59e74ca1d373
> Author: Paul E. McKenney <paulmck@kernel.org>
> Date: Fri Mar 29 16:06:45 2024 -0700
>
> squash! lib: Add one-byte and two-byte cmpxchg() emulation functions
>
> [ paulmck: Apply kernel test robot feedback. ]
>
> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
>
> diff --git a/lib/cmpxchg-emu.c b/lib/cmpxchg-emu.c
> index abdd451767220..a88c4f3c88430 100644
> --- a/lib/cmpxchg-emu.c
> +++ b/lib/cmpxchg-emu.c
> @@ -14,6 +14,7 @@
> #include <linux/panic.h>
> #include <linux/bug.h>
> #include <asm-generic/rwonce.h>
> +#include <linux/cmpxchg-emu.h>
>
> union u8_32 {
> u8 b[4];
>
next prev parent reply other threads:[~2024-03-31 16:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-29 21:26 kernel test robot
2024-03-29 23:08 ` Paul E. McKenney
2024-03-31 16:06 ` Yujie Liu [this message]
2024-03-31 18:40 ` Paul E. McKenney
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=ZgmKAil/a3+av1E8@yujie-X299 \
--to=yujie.liu@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=paulmck@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
all inboxes | Powered by JetHome®