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

2015-12-09 Thread Steven Rostedt
On Fri, Dec 04, 2015 at 03:15:45PM +0100, Vlastimil Babka wrote: > On 12/03/2015 07:38 PM, yalin wang wrote: > >that’s all, see cpumask_pr_args(masks) macro, > >it also use macro and %*pb to print cpu mask . > >i think this method is not very complex to use . > > Well, one also has to write the

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

2015-12-09 Thread Steven Rostedt
On Fri, Dec 04, 2015 at 03:15:45PM +0100, Vlastimil Babka wrote: > On 12/03/2015 07:38 PM, yalin wang wrote: > >that’s all, see cpumask_pr_args(masks) macro, > >it also use macro and %*pb to print cpu mask . > >i think this method is not very complex to use . > > Well, one also has to write the

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

2015-12-04 Thread Vlastimil Babka
On 12/03/2015 07:38 PM, yalin wang wrote: that’s all, see cpumask_pr_args(masks) macro, it also use macro and %*pb to print cpu mask . i think this method is not very complex to use . Well, one also has to write the appropriate translation tables. search source code , there is lots of

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

2015-12-04 Thread Vlastimil Babka
On 12/03/2015 07:38 PM, yalin wang wrote: that’s all, see cpumask_pr_args(masks) macro, it also use macro and %*pb to print cpu mask . i think this method is not very complex to use . Well, one also has to write the appropriate translation tables. search source code , there is lots of

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

2015-12-03 Thread yalin wang
>> Technically, I think the answer is yes, at least in C99 (and I suppose >> gcc would accept it in gnu89 mode as well). >> >> printk("%pg\n", &(struct flag_printer){.flags = my_flags, .names = >> vmaflags_names}); >> >> Not tested, and I still don't think it would be particularly readable >>

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

2015-12-03 Thread yalin wang
> On Dec 3, 2015, at 00:03, Rasmus Villemoes wrote: > > On Thu, Dec 03 2015, yalin wang wrote: > >>> On Dec 2, 2015, at 13:04, Vlastimil Babka 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

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

2015-12-03 Thread Vlastimil Babka
On 12/03/2015 01:37 PM, Rasmus Villemoes wrote: > On Wed, Dec 02 2015, Vlastimil Babka wrote: >> --- a/include/linux/mmdebug.h >> +++ b/include/linux/mmdebug.h >> @@ -7,6 +7,9 @@ >> struct page; >> struct vm_area_struct; >> struct mm_struct; >> +struct trace_print_flags; // can't include

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

2015-12-03 Thread Rasmus Villemoes
On Wed, Dec 02 2015, Vlastimil Babka wrote: >> [where I've assumed that the trace_print_flags array is terminated with >> an entry with 0 mask. Passing its length is also possible, but maybe a >> little awkward if the arrays are defined in mm/ and contents depend on >> .config.] ... > >> Rasmus

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

2015-12-03 Thread Rasmus Villemoes
On Thu, Dec 03 2015, yalin wang wrote: >> On Dec 2, 2015, at 13:04, Vlastimil Babka 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

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

2015-12-03 Thread Rasmus Villemoes
On Wed, Dec 02 2015, Vlastimil Babka wrote: >> [where I've assumed that the trace_print_flags array is terminated with >> an entry with 0 mask. Passing its length is also possible, but maybe a >> little awkward if the arrays are defined in mm/ and contents depend on >> .config.]

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

2015-12-03 Thread Rasmus Villemoes
On Thu, Dec 03 2015, yalin wang wrote: >> On Dec 2, 2015, at 13:04, Vlastimil Babka 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

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

2015-12-03 Thread Vlastimil Babka
On 12/03/2015 01:37 PM, Rasmus Villemoes wrote: > On Wed, Dec 02 2015, Vlastimil Babka wrote: >> --- a/include/linux/mmdebug.h >> +++ b/include/linux/mmdebug.h >> @@ -7,6 +7,9 @@ >> struct page; >> struct vm_area_struct; >> struct mm_struct; >> +struct trace_print_flags; //

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

2015-12-03 Thread yalin wang
> On Dec 3, 2015, at 00:03, Rasmus Villemoes wrote: > > On Thu, Dec 03 2015, yalin wang wrote: > >>> On Dec 2, 2015, at 13:04, Vlastimil Babka wrote: >>> >>> On 12/02/2015 06:40 PM, yalin wang wrote: >>> >>> (please trim

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

2015-12-03 Thread yalin wang
>> Technically, I think the answer is yes, at least in C99 (and I suppose >> gcc would accept it in gnu89 mode as well). >> >> printk("%pg\n", &(struct flag_printer){.flags = my_flags, .names = >> vmaflags_names}); >> >> Not tested, and I still don't think it would be particularly readable >>

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

2015-12-02 Thread yalin wang
> On Dec 2, 2015, at 13:04, Vlastimil Babka 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

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

2015-12-02 Thread Vlastimil Babka
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

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

2015-12-02 Thread Vlastimil Babka
On 12/02/2015 12:01 PM, Rasmus Villemoes wrote: > On Mon, Nov 30 2015, Vlastimil Babka wrote: > > I'd prefer to have the formatting code in vsprintf.c, so that we'd avoid > having to call vsnprintf recursively (and repeatedly - not that this is > going to be used in hot paths, but if the box is

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

2015-12-02 Thread yalin wang
> On Nov 30, 2015, at 08:10, Vlastimil Babka wrote: > > In mm we use several kinds of flags bitfields that are sometimes printed for > debugging purposes, or exported to userspace via sysfs. To make them easier to > interpret independently on kernel version and config, we want to dump also the

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

2015-12-02 Thread Rasmus Villemoes
On Mon, Nov 30 2015, Vlastimil Babka wrote: > In mm we use several kinds of flags bitfields that are sometimes printed for > debugging purposes, or exported to userspace via sysfs. To make them easier to > interpret independently on kernel version and config, we want to dump also the > symbolic

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

2015-12-02 Thread yalin wang
> On Nov 30, 2015, at 08:10, Vlastimil Babka wrote: > > In mm we use several kinds of flags bitfields that are sometimes printed for > debugging purposes, or exported to userspace via sysfs. To make them easier to > interpret independently on kernel version and config, we want

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

2015-12-02 Thread Vlastimil Babka
On 12/02/2015 12:01 PM, Rasmus Villemoes wrote: > On Mon, Nov 30 2015, Vlastimil Babka wrote: > > I'd prefer to have the formatting code in vsprintf.c, so that we'd avoid > having to call vsnprintf recursively (and repeatedly - not that this is > going to be used in hot paths,

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

2015-12-02 Thread Vlastimil Babka
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

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

2015-12-02 Thread yalin wang
> On Dec 2, 2015, at 13:04, Vlastimil Babka 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

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

2015-12-02 Thread Rasmus Villemoes
On Mon, Nov 30 2015, Vlastimil Babka wrote: > In mm we use several kinds of flags bitfields that are sometimes printed for > debugging purposes, or exported to userspace via sysfs. To make them easier to > interpret independently on kernel version and config, we want to dump also

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

2015-11-30 Thread Vlastimil Babka
In mm we use several kinds of flags bitfields that are sometimes printed for debugging purposes, or exported to userspace via sysfs. To make them easier to interpret independently on kernel version and config, we want to dump also the symbolic flag names. So far this has been done with repeated

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

2015-11-30 Thread Vlastimil Babka
In mm we use several kinds of flags bitfields that are sometimes printed for debugging purposes, or exported to userspace via sysfs. To make them easier to interpret independently on kernel version and config, we want to dump also the symbolic flag names. So far this has been done with repeated