mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vasily Averin <vvs@openvz.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: kernel test robot <lkp@intel.com>, Ingo Molnar <mingo@redhat.com>,
	kbuild-all@lists.01.org, Shakeel Butt <shakeelb@google.com>,
	kernel@openvz.org, linux-kernel@vger.kernel.org,
	Roman Gushchin <roman.gushchin@linux.dev>,
	Vlastimil Babka <vbabka@suse.cz>, Michal Hocko <mhocko@suse.com>,
	cgroups@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Memory Management List <linux-mm@kvack.org>,
	Dennis Zhou <dennis@kernel.org>, Tejun Heo <tj@kernel.org>,
	Christoph Lameter <cl@linux-foundation.org>
Subject: Re: [PATCH] percpu: improve percpu_alloc_percpu event trace
Date: Tue, 10 May 2022 07:22:02 +0300	[thread overview]
Message-ID: <6e68298c-7cdd-9984-215e-7e6fb3d03fe8@openvz.org> (raw)
In-Reply-To: <20220509170605.2eb7637e@gandalf.local.home>

On 5/10/22 00:06, Steven Rostedt wrote:
> I'm curious as to where the gfp_t to unsigned long is happening in the
> macros?

original ___GFP_* flags are usual defines

/* Plain integer GFP bitmasks. Do not use this directly. */
#define ___GFP_DMA              0x01u
#define ___GFP_HIGHMEM          0x02u
#define ___GFP_DMA32            0x04u

... but __GFP_* flags used elsewhere are declared as 'forced to gfp_t'

#define __GFP_DMA       ((__force gfp_t)___GFP_DMA)
#define __GFP_HIGHMEM   ((__force gfp_t)___GFP_HIGHMEM)
#define __GFP_DMA32     ((__force gfp_t)___GFP_DMA32)
...
#define GFP_DMA         __GFP_DMA
#define GFP_DMA32       __GFP_DMA32

... and when  __def_gfpflag_names() traslates them to unsigned long

       {(unsigned long)GFP_DMA,                "GFP_DMA"},             \
       {(unsigned long)__GFP_HIGHMEM,          "__GFP_HIGHMEM"},       \
       {(unsigned long)GFP_DMA32,              "GFP_DMA32"},           \

... it leads to sparse warnings bacuse type gfp_t was declared as 'bitwise'
From mas sparse

       -Wbitwise
              Warn about unsupported operations or type mismatches with
              restricted integer types.

               Sparse supports an extended attribute,
              __attribute__((bitwise)), which creates a new restricted
              integer type from a base integer type, distinct from the
              base integer type and from any other restricted integer
              type not declared in the same declaration or typedef.

             __bitwise is for *unique types* that cannot be mixed with
              other types, and that you'd never want to just use as a
              random integer (the integer 0 is special, though, and gets
              silently accepted iirc - it's kind of like "NULL" for
              pointers). So "gfp_t" or the "safe endianness" types would
              be __bitwise: you can only operate on them by doing
              specific operations that know about *that* particular
              type.

              Sparse issues these warnings by default.

Thank you,
	Vasily Averin

  reply	other threads:[~2022-05-10  4:28 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-06  4:46 Vasily Averin
2022-05-06  7:52 ` Vasily Averin
2022-05-06 19:29   ` [PATCH v2] " Vasily Averin
2022-05-11  2:33     ` Roman Gushchin
2022-05-11  5:11       ` Vasily Averin
2022-05-11 17:30         ` Roman Gushchin
2022-05-15 22:06       ` Steven Rostedt
2022-05-06 20:38 ` [PATCH] " kernel test robot
2022-05-07 14:51   ` Vasily Averin
2022-05-07 19:02     ` [PATCH mm] tracing: incorrect gfp_t conversion Vasily Averin
2022-05-07 19:37       ` Andrew Morton
2022-05-07 22:28         ` Vasily Averin
2022-05-07 22:48           ` Andrew Morton
2022-05-07 23:00             ` Andrew Morton
2022-05-08 20:37               ` Matthew Wilcox
2022-05-08 20:51             ` Joe Perches
2022-05-11  7:20               ` [PATCH mm v2] " Vasily Averin
2022-05-15 22:09                 ` Steven Rostedt
2022-05-16 20:55                   ` Andrew Morton
2022-05-09 21:06     ` [PATCH] percpu: improve percpu_alloc_percpu event trace Steven Rostedt
2022-05-10  4:22       ` Vasily Averin [this message]
2022-05-10 14:16         ` Steven Rostedt

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=6e68298c-7cdd-9984-215e-7e6fb3d03fe8@openvz.org \
    --to=vvs@openvz.org \
    --cc=akpm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=cl@linux-foundation.org \
    --cc=dennis@kernel.org \
    --cc=kbuild-all@lists.01.org \
    --cc=kernel@openvz.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --cc=mhocko@suse.com \
    --cc=mingo@redhat.com \
    --cc=roman.gushchin@linux.dev \
    --cc=rostedt@goodmis.org \
    --cc=shakeelb@google.com \
    --cc=tj@kernel.org \
    --cc=vbabka@suse.cz \
    /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®