[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH V3 14/41] xen/arm: Create a hierarchical device tree



On Fri, 2013-05-10 at 03:18 +0100, Julien Grall wrote:
> +static void dt_printk(const char *fmt, ...)
> +{
> +    static char buf[512];
> +    va_list args;
> +
> +    va_start(args, fmt);
> +
> +    if ( system_state == SYS_STATE_early_boot )
> +        early_vprintk(fmt, args);
> +    else
> +    {
> +        vsnprintf(buf, sizeof(buf), fmt, args);
> +        printk(buf);
> +    }
> +    va_end(args);
> +}

It's unfortunate that there is no vprintk, since printk is just going to
do a nop reformatting into yet another buffer.

I wonder what Keir thinks about refactoring printk to allow this? It
looks like it would be trivial.

Of course having done that then we might almost as well go back to the
longer term plan of adding an #ifdef EARLY_PRINTK with this check to
printk itself.

If we don't want to do any of this for 4.3 than I think a macro might
actually be better here:
#define DT_PRINTK(fmt,...) \
        if ( system_state == SYS_STATE_early_boot ) \
                early_vprintk(fmt, __VA_ARGS__); \
        else \
                printk(fmt, __VAR_ARGS__);

Normally I'd be against using a macro, but avoiding the double buffer
seems worth it.

Ian.


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.