linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Robert Jarzmik <robert.jarzmik@free.fr>
Cc: Frederic Weisbecker <fweisbec@gmail.com>,
	Ingo Molnar <mingo@redhat.com>,
	linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
	Michal Hocko <mhocko@suse.cz>,
	kbuild test robot <fengguang.wu@intel.com>
Subject: Re: [memcg:since-3.6 493/499] include/trace/events/filemap.h:14:1: sparse: incompatible types for operation (<)
Date: Fri, 07 Dec 2012 21:00:53 -0500	[thread overview]
Message-ID: <1354932053.17101.113.camel@gandalf.local.home> (raw)
In-Reply-To: <87ehj81pxx.fsf@free.fr>

On Sun, 2012-12-02 at 15:36 +0100, Robert Jarzmik wrote:
> kbuild test robot <fengguang.wu@intel.com> writes:
> 
> > tree:   git://git.kernel.org/pub/scm/linux/kernel/git/mhocko/mm.git since-3.6
> > head:   422a0f651b5cefa1b6b3ede2e1c9e540a24a6e01
> > commit: 07b81da5f80b27543ddbe3164170c64e0941a812 [493/499] mm: trace filemap add and del
> >
> >
> > sparse warnings:
> >
> > + include/trace/events/filemap.h:14:1: sparse: incompatible types for operation (<)
> > include/trace/events/filemap.h:14:1:    left side has type struct page *<noident>
> > include/trace/events/filemap.h:14:1:    right side has type int
> > include/trace/events/filemap.h:45:1: sparse: incompatible types for operation (<)
> > include/trace/events/filemap.h:45:1:    left side has type struct page *<noident>
> > include/trace/events/filemap.h:45:1:    right side has type int
> 
> Hi Steven, Frederic and Ingo,

Sorry for the late reply, It's end of year and I'm getting a lot of
pressure at work to get things done.

> 
> I just drop this note to make you aware (as FTRACE maintainers) of the sparse
> warning I received.
> 
> This sparse warning will touch all submission to the FTRACE events API AFAIK.
> The node of the problem :
>  - in include/linux/ftrace_event.h, we have :
>    #define is_signed_type(type)	(((type)(-1)) < 0)
>  - this is used by kernel/trace/trace_events.c
>    #define __common_field(type, item)
>    ...
>      is_signed_type(type)
>    ...
> 
> Here, if a trace field is a pointer (for example struct page *), we end up with
> this in my case :
> 
> static int __attribute__((no_instrument_function))
> ftrace_define_fields_mm_filemap_delete_from_page_cache(struct ftrace_event_call
> *event_call) { struct ftrace_raw_mm_filemap_delete_from_page_cache field; int
> ret; ret = trace_define_field(event_call, "struct page *", "page",
> __builtin_offsetof(typeof(field),page), sizeof(field.page), (((struct page
> *)(-1)) < 0), FILTER_OTHER); if (ret) return ret; ret =
> trace_define_field(event_call, "unsigned long", "i_ino",
> __builtin_offsetof(typeof(field),i_ino), sizeof(field.i_ino), (((unsigned
> long)(-1)) < 0), FILTER_OTHER); if (ret) return ret; ret =
> trace_define_field(event_call, "unsigned long", "index",
> __builtin_offsetof(typeof(field),index), sizeof(field.index), (((unsigned
> long)(-1)) < 0), FILTER_OTHER); if (ret) return ret; ret =
> trace_define_field(event_call, "dev_t", "s_dev",
> __builtin_offsetof(typeof(field),s_dev), sizeof(field.s_dev), (((dev_t)(-1)) <
> 0), FILTER_OTHER); if (ret) return ret;; return ret; }; ;;
> 
> And I think, (((struct page *)(-1)) < 0) gives the warning. I don't know if
> "is_signed_type()" makes sense on a pointer, but I think you'll get other
> reports of that kind for any new event added to trace API.

Hmm, this is mostly automated via the macros. Not sure how we can
differentiate a pointer from other fields. Would this be fixed if we
did:

#define is_signed_type(type) (((type)(-1) < (type)0)

?

-- Steve


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2012-12-08  2:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-29 23:46 kbuild test robot
2012-12-02 14:36 ` Robert Jarzmik
2012-12-08  2:00   ` Steven Rostedt [this message]
2012-12-08 18:47     ` Robert Jarzmik

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=1354932053.17101.113.camel@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=fengguang.wu@intel.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    --cc=mingo@redhat.com \
    --cc=robert.jarzmik@free.fr \
    /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