Re: [PATCH 10/12] sched: use {cpu|node}mask pr_cont and seq output functions

From: Peter Zijlstra
Date: Mon Jan 12 2015 - 08:50:43 EST


On Mon, Jan 12, 2015 at 08:31:45AM -0500, Tejun Heo wrote:
> Hello, Peter.
>
> On Mon, Dec 15, 2014 at 11:39:15AM +0100, Peter Zijlstra wrote:
> > I would very much prefer something like the below instead..
> >
> > I'm not a great fan of pr_cont, it makes a mess of things if there's
> > multiple cpus printing bits.
>
> Yeah, it does sometimes get annoying and bitmaps should be generic
> enough to have support from core printk functions.
>
> ...
> > --- a/lib/vsprintf.c
> > +++ b/lib/vsprintf.c
> > @@ -27,6 +27,7 @@
> > #include <linux/uaccess.h>
> > #include <linux/ioport.h>
> > #include <linux/dcache.h>
> > +#include <linux/cpumask.h>
> > #include <net/addrconf.h>
> >
> > #include <asm/page.h> /* for PAGE_SIZE */
> > @@ -1218,6 +1219,7 @@ int kptr_restrict __read_mostly;
> > * The maximum supported length is 64 bytes of the input. Consider
> > * to use print_hex_dump() for the larger input.
> > * - 'a' For a phys_addr_t type and its derivative types (passed by reference)
> > + * - 'c' For a cpumask list
> > *
> > * Note: The difference between 'S' and 'F' is that on ia64 and ppc64
> > * function pointers are really function descriptors, which contain a
> > @@ -1335,6 +1337,8 @@ char *pointer(const char *fmt, char *buf
> > return dentry_name(buf, end,
> > ((const struct file *)ptr)->f_path.dentry,
> > spec, fmt);
> > + case 'c':
> > + return buf + cpulist_scnprintf(buf, end - buf, ptr);
>
> I think we prolly want something more generic than hard coding cpu and
> node masks into printk. Prolly something along the line of %*pb so
> that the caller can do something along the line of
>
> printk("cpumask: %*pb\n", nr_cpumask_bits, cpumask);
>
> I'll see if that's actually doable.

See this thread:
https://lkml.org/lkml/2012/5/9/416
https://lkml.org/lkml/2012/5/9/353

At the time I couldn't make it work :/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/