linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Vyukov <dvyukov@google.com>
To: kbuild test robot <fengguang.wu@intel.com>
Cc: kbuild-all@01.org, LKML <linux-kernel@vger.kernel.org>,
	tipbuild@zytor.com, Ingo Molnar <mingo@kernel.org>
Subject: Re: [tip:locking/core 9/11] include/asm-generic/atomic-instrumented.h:288:24: sparse: cast truncates bits from constant value (100 becomes 0)
Date: Mon, 12 Mar 2018 18:17:32 +0300	[thread overview]
Message-ID: <CACT4Y+Yscqe6M1jXSkcuvw+5-27YzZn4AXwKzU1oJCNhUrj1Ng@mail.gmail.com> (raw)
In-Reply-To: <201803122219.vHl3IwRo%fengguang.wu@intel.com>

On Mon, Mar 12, 2018 at 5:52 PM, kbuild test robot
<fengguang.wu@intel.com> wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git locking/core
> head:   ac605bee0bfab40fd5d11964705e907d2d5a32de
> commit: 8bf705d130396e69c04cd8e6e010244ad2ce71f4 [9/11] locking/atomic/x86: Switch atomic.h to use atomic-instrumented.h
> reproduce:
>         # apt-get install sparse
>         git checkout 8bf705d130396e69c04cd8e6e010244ad2ce71f4
>         make ARCH=x86_64 allmodconfig
>         make C=1 CF=-D__CHECK_ENDIAN__
>
>
> sparse warnings: (new ones prefixed by >>)
>
>    kernel/locking/qspinlock.c:418:22: sparse: incorrect type in assignment (different modifiers) @@    expected struct mcs_spinlock *prev @@    got struct struct mcs_spinlock *prev @@
>    kernel/locking/qspinlock.c:418:22:    expected struct mcs_spinlock *prev
>    kernel/locking/qspinlock.c:418:22:    got struct mcs_spinlock [pure] *
>    kernel/locking/qspinlock_paravirt.h:519:1: sparse: symbol '__pv_queued_spin_unlock_slowpath' was not declared. Should it be static?
>    kernel/locking/qspinlock.c:418:22: sparse: incorrect type in assignment (different modifiers) @@    expected struct mcs_spinlock *prev @@    got struct struct mcs_spinlock *prev @@
>    kernel/locking/qspinlock.c:418:22:    expected struct mcs_spinlock *prev
>    kernel/locking/qspinlock.c:418:22:    got struct mcs_spinlock [pure] *
>>> include/asm-generic/atomic-instrumented.h:288:24: sparse: cast truncates bits from constant value (100 becomes 0)
>
> vim +288 include/asm-generic/atomic-instrumented.h
>
> b06ed71a6 Dmitry Vyukov 2018-01-29  282
> b06ed71a6 Dmitry Vyukov 2018-01-29  283  static __always_inline unsigned long
> b06ed71a6 Dmitry Vyukov 2018-01-29  284  cmpxchg_size(volatile void *ptr, unsigned long old, unsigned long new, int size)
> b06ed71a6 Dmitry Vyukov 2018-01-29  285  {
> b06ed71a6 Dmitry Vyukov 2018-01-29  286         switch (size) {
> b06ed71a6 Dmitry Vyukov 2018-01-29  287         case 1:
> b06ed71a6 Dmitry Vyukov 2018-01-29 @288                 return arch_cmpxchg((u8 *)ptr, (u8)old, (u8)new);
> b06ed71a6 Dmitry Vyukov 2018-01-29  289         case 2:
> b06ed71a6 Dmitry Vyukov 2018-01-29  290                 return arch_cmpxchg((u16 *)ptr, (u16)old, (u16)new);
> b06ed71a6 Dmitry Vyukov 2018-01-29  291         case 4:
> b06ed71a6 Dmitry Vyukov 2018-01-29  292                 return arch_cmpxchg((u32 *)ptr, (u32)old, (u32)new);
> b06ed71a6 Dmitry Vyukov 2018-01-29  293         case 8:
> b06ed71a6 Dmitry Vyukov 2018-01-29  294                 BUILD_BUG_ON(sizeof(unsigned long) != 8);
> b06ed71a6 Dmitry Vyukov 2018-01-29  295                 return arch_cmpxchg((u64 *)ptr, (u64)old, (u64)new);
> b06ed71a6 Dmitry Vyukov 2018-01-29  296         }
> b06ed71a6 Dmitry Vyukov 2018-01-29  297         BUILD_BUG();
> b06ed71a6 Dmitry Vyukov 2018-01-29  298         return 0;
> b06ed71a6 Dmitry Vyukov 2018-01-29  299  }
> b06ed71a6 Dmitry Vyukov 2018-01-29  300
>
> :::::: The code at line 288 was first introduced by commit
> :::::: b06ed71a624ba088a3e3e3ac7d4185f48c7c1660 locking/atomic, asm-generic: Add asm-generic/atomic-instrumented.h
>
> :::::: TO: Dmitry Vyukov <dvyukov@google.com>
> :::::: CC: Ingo Molnar <mingo@kernel.org>


I will take a look tomorrow.

  reply	other threads:[~2018-03-12 15:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-12 14:52 [tip:locking/core 9/11] include/asm-generic/atomic-instrumented.h:288:24: sparse: cast truncates bits from constant value (100 becomes 0) kbuild test robot
2018-03-12 15:17 ` Dmitry Vyukov [this message]
2018-03-13  8:49   ` Dmitry Vyukov
2018-03-13 10:46     ` Peter Zijlstra
2018-03-13 11:08       ` Dmitry Vyukov
2018-03-13 17:29         ` Christopher Li
2018-03-13 18:00         ` Luc Van Oostenryck
2018-03-13 18:08           ` Peter Zijlstra
2018-03-13 20:01             ` Luc Van Oostenryck

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=CACT4Y+Yscqe6M1jXSkcuvw+5-27YzZn4AXwKzU1oJCNhUrj1Ng@mail.gmail.com \
    --to=dvyukov@google.com \
    --cc=fengguang.wu@intel.com \
    --cc=kbuild-all@01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tipbuild@zytor.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;
as well as URLs for NNTP newsgroup(s).