Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1282623

Re: [PATCH 1/2] mm, printk: introduce new format string for flags

From yalin wang <yalin.wang2010@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/2] mm, printk: introduce new format string for flags
Date 2015-12-03 01:20 +0100
Message-ID <qBpMS-5Y5-23@gated-at.bofh.it> (permalink)
References <qyJoK-7uW-33@gated-at.bofh.it> <qAzlg-5Uw-13@gated-at.bofh.it> <qBjHu-1WC-45@gated-at.bofh.it> <qBmYG-4b2-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


> On Dec 2, 2015, at 13:04, Vlastimil Babka <vbabka@suse.cz> wrote:
> 
> On 12/02/2015 06:40 PM, yalin wang wrote:
> 
> (please trim your reply next time, no need to quote whole patch here)
> 
>> i am thinking why not make %pg* to be more generic ?
>> not restricted to only GFP / vma flags / page flags .
>> so could we change format like this ?
>> define a flag spec struct to include flag and trace_print_flags and some other option :
>> typedef struct { 
>> unsigned long flag;
>> structtrace_print_flags *flags;
>> unsigned long option; } flag_sec;
>> flag_sec my_flag;
>> in printk we only pass like this :
>> printk(ā€œ%pg\nā€, &my_flag) ;
>> then it can print any flags defined by user .
>> more useful for other drivers to use .
> 
> I don't know, it sounds quite complicated given that we had no flags printing
> for years and now there's just three kinds of them. The extra struct flag_sec is
> IMHO nuissance. No other printk format needs such thing AFAIK? For example, if I
> were to print page flags from several places, each would have to define the
> struct flag_sec instance, or some header would have to provide it?
this can be avoided by provide a macro in header file .
we can add a new struct to declare trace_print_flags :
for example:
#define DECLARE_FLAG_PRINTK_FMT(name, flags_array)   flag_spec name = { .flags = flags_array};
#define FLAG_PRINTK_FMT(name, flag) ({  name.flag = flag;  &name})

in source code :
DECLARE_FLAG_PRINTK_FMT(my_flag, vmaflags_names);
printk(ā€œ%pg\nā€, FLAG_PRINTK_FMT(my_flag, vma->flag));

i am not if DECLARE_FLAG_PRINTK_FMT and FLAG_PRINTK_FMT macro 
can be defined into one macro ?
maybe need some trick here .

is it possible ?


Thanks



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] mm, printk: introduce new format string for flags Vlastimil Babka <vbabka@suse.cz> - 2015-11-30 17:20 +0100
  [PATCH 2/2] mm, page_owner: provide symbolic page flags and gfp_flags Vlastimil Babka <vbabka@suse.cz> - 2015-11-30 17:20 +0100
  Re: [PATCH 1/2] mm, printk: introduce new format string for flags Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2015-12-02 12:10 +0100
    Re: [PATCH 1/2] mm, printk: introduce new format string for flags Vlastimil Babka <vbabka@suse.cz> - 2015-12-02 21:40 +0100
      Re: [PATCH 1/2] mm, printk: introduce new format string for flags Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2015-12-03 13:40 +0100
        Re: [PATCH 1/2] mm, printk: introduce new format string for flags Vlastimil Babka <vbabka@suse.cz> - 2015-12-03 14:50 +0100
    [PATCH v2 3/3] mm, debug: move bad flags printing to bad_page() Vlastimil Babka <vbabka@suse.cz> - 2015-12-04 16:20 +0100
    [PATCH v2 2/3] mm, page_owner: provide symbolic page flags and gfp_flags Vlastimil Babka <vbabka@suse.cz> - 2015-12-04 16:20 +0100
    [PATCH v2 1/3] mm, printk: introduce new format string for flags Vlastimil Babka <vbabka@suse.cz> - 2015-12-04 16:20 +0100
      Re: [PATCH v2 1/3] mm, printk: introduce new format string for flags Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2015-12-05 21:10 +0100
      Re: [PATCH v2 1/3] mm, printk: introduce new format string for flags Arnd Bergmann <arnd@arndb.de> - 2015-12-09 12:40 +0100
        Re: [PATCH v2 1/3] mm, printk: introduce new format string for flags Vlastimil Babka <vbabka@suse.cz> - 2015-12-09 21:50 +0100
        Re: [PATCH v2 1/3] mm, printk: introduce new format string for flags James Hogan <james.hogan@imgtec.com> - 2015-12-10 13:30 +0100
      Re: [PATCH v2 1/3] mm, printk: introduce new format string for flags Joonsoo Kim <iamjoonsoo.kim@lge.com> - 2015-12-10 04:00 +0100
        Re: [PATCH v2 1/3] mm, printk: introduce new format string for flags Steven Rostedt <rostedt@goodmis.org> - 2015-12-10 05:10 +0100
          Re: [PATCH v2 1/3] mm, printk: introduce new format string for flags Joonsoo Kim <iamjoonsoo.kim@lge.com> - 2015-12-10 05:50 +0100
          Re: [PATCH v2 1/3] mm, printk: introduce new format string for flags Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2015-12-10 09:50 +0100
          Re: [PATCH v2 1/3] mm, printk: introduce new format string for flags Vlastimil Babka <vbabka@suse.cz> - 2015-12-10 11:10 +0100
      Re: [PATCH v2 1/3] mm, printk: introduce new format string for flags Steven Rostedt <rostedt@goodmis.org> - 2015-12-10 05:00 +0100
        Re: [PATCH v2 1/3] mm, printk: introduce new format string for flags Vlastimil Babka <vbabka@suse.cz> - 2015-12-10 11:00 +0100
  Re: [PATCH 1/2] mm, printk: introduce new format string for flags yalin wang <yalin.wang2010@gmail.com> - 2015-12-02 18:50 +0100
    Re: [PATCH 1/2] mm, printk: introduce new format string for flags Vlastimil Babka <vbabka@suse.cz> - 2015-12-02 22:20 +0100
      Re: [PATCH 1/2] mm, printk: introduce new format string for flags yalin wang <yalin.wang2010@gmail.com> - 2015-12-03 01:20 +0100
        Re: [PATCH 1/2] mm, printk: introduce new format string for flags Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2015-12-03 09:10 +0100
          Re: [PATCH 1/2] mm, printk: introduce new format string for flags yalin wang <yalin.wang2010@gmail.com> - 2015-12-03 19:40 +0100
            Re: [PATCH 1/2] mm, printk: introduce new format string for flags yalin wang <yalin.wang2010@gmail.com> - 2015-12-04 02:10 +0100
            Re: [PATCH 1/2] mm, printk: introduce new format string for flags Vlastimil Babka <vbabka@suse.cz> - 2015-12-04 15:20 +0100
              Re: [PATCH 1/2] mm, printk: introduce new format string for flags Steven Rostedt <rostedt@goodmis.org> - 2015-12-10 05:10 +0100

csiph-web