Message ID | 1473165667-25707-2-git-send-email-wei.liu2@citrix.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 06/09/16 13:41, Wei Liu wrote: > Signed-off-by: Wei Liu <wei.liu2@citrix.com> > --- > Cc: Stefano Stabellini <sstabellini@kernel.org> > Cc: Julien Grall <julien.grall@arm.com> > Cc: Jan Beulich <jbeulich@suse.com> > Cc: Andrew Cooper <andrew.cooper3@citrix.com> > --- > xen/arch/arm/traps.c | 5 +++-- > xen/arch/x86/x86_64/traps.c | 5 +++-- > xen/drivers/char/console.c | 5 +++-- > xen/include/xen/lib.h | 6 ++++++ > 4 files changed, 15 insertions(+), 6 deletions(-) > > diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c > index 683bcb2..3bac8e8 100644 > --- a/xen/arch/arm/traps.c > +++ b/xen/arch/arm/traps.c > @@ -141,14 +141,15 @@ static void print_xen_info(void) > { > char taint_str[TAINT_STRING_MAX_LEN]; > > - printk("----[ Xen-%d.%d%s %s debug=%c %s ]----\n", > + printk("----[ Xen-%d.%d%s %s debug=%c gcov=%c %s ]----\n", > xen_major_version(), xen_minor_version(), xen_extra_version(), > #ifdef CONFIG_ARM_32 > "arm32", > #else > "arm64", > #endif > - debug_build() ? 'y' : 'n', print_tainted(taint_str)); > + debug_build() ? 'y' : 'n', gcov_build() ? 'y' : 'n', > + print_tainted(taint_str)); > } > > #ifdef CONFIG_ARM_32 > diff --git a/xen/arch/x86/x86_64/traps.c b/xen/arch/x86/x86_64/traps.c > index 2d8ecf5..0708cc7 100644 > --- a/xen/arch/x86/x86_64/traps.c > +++ b/xen/arch/x86/x86_64/traps.c > @@ -30,9 +30,10 @@ static void print_xen_info(void) > { > char taint_str[TAINT_STRING_MAX_LEN]; > > - printk("----[ Xen-%d.%d%s x86_64 debug=%c %s ]----\n", > + printk("----[ Xen-%d.%d%s x86_64 debug=%c gcov=%c %s ]----\n", > xen_major_version(), xen_minor_version(), xen_extra_version(), > - debug_build() ? 'y' : 'n', print_tainted(taint_str)); > + debug_build() ? 'y' : 'n', gcov_build() ? 'y' : 'n', > + print_tainted(taint_str)); > } > > enum context { CTXT_hypervisor, CTXT_pv_guest, CTXT_hvm_guest }; > diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c > index 650035d..e773076 100644 > --- a/xen/drivers/char/console.c > +++ b/xen/drivers/char/console.c > @@ -735,10 +735,11 @@ void __init console_init_preirq(void) > spin_lock(&console_lock); > __putstr(xen_banner()); > spin_unlock(&console_lock); > - printk("Xen version %d.%d%s (%s@%s) (%s) debug=%c %s\n", > + printk("Xen version %d.%d%s (%s@%s) (%s) debug=%c gcov=%c %s\n", Please instead use printk("Xen version %d.%d%s (%s@%s) (%s) debug=%c" #ifdef CONFIG_GCOV " gcov=y" #endif " %s\n", Enabling gcov will be extremely rare in the grand scheme of things, and this method causes zero overhead for the case where gcov is compiled out. (Similarly elsewhere.) ~Andrew
>>> On 06.09.16 at 14:47, <andrew.cooper3@citrix.com> wrote: > On 06/09/16 13:41, Wei Liu wrote: >> --- a/xen/drivers/char/console.c >> +++ b/xen/drivers/char/console.c >> @@ -735,10 +735,11 @@ void __init console_init_preirq(void) >> spin_lock(&console_lock); >> __putstr(xen_banner()); >> spin_unlock(&console_lock); >> - printk("Xen version %d.%d%s (%s@%s) (%s) debug=%c %s\n", >> + printk("Xen version %d.%d%s (%s@%s) (%s) debug=%c gcov=%c %s\n", > > Please instead use > > printk("Xen version %d.%d%s (%s@%s) (%s) debug=%c" > #ifdef CONFIG_GCOV > " gcov=y" > #endif > " %s\n", > > Enabling gcov will be extremely rare in the grand scheme of things, and > this method causes zero overhead for the case where gcov is compiled > out. (Similarly elsewhere.) How about instead of the kind of ugly #ifdef-ery above, instead of +#ifdef CONFIG_GCOV +#define gcov_build() 1 +#else +#define gcov_build() 0 +#endif we'd have +#ifdef CONFIG_GCOV +#define gcov_string "gcov=y" +#else +#define gcov_string "" +#endif (with the identifier name open for improvement), which can then be embedded easily into any string literal? Jan
On Tue, 6 Sep 2016, Wei Liu wrote: > Signed-off-by: Wei Liu <wei.liu2@citrix.com> Acked-by: Stefano Stabellini <sstabellini@kernel.org> > Cc: Stefano Stabellini <sstabellini@kernel.org> > Cc: Julien Grall <julien.grall@arm.com> > Cc: Jan Beulich <jbeulich@suse.com> > Cc: Andrew Cooper <andrew.cooper3@citrix.com> > --- > xen/arch/arm/traps.c | 5 +++-- > xen/arch/x86/x86_64/traps.c | 5 +++-- > xen/drivers/char/console.c | 5 +++-- > xen/include/xen/lib.h | 6 ++++++ > 4 files changed, 15 insertions(+), 6 deletions(-) > > diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c > index 683bcb2..3bac8e8 100644 > --- a/xen/arch/arm/traps.c > +++ b/xen/arch/arm/traps.c > @@ -141,14 +141,15 @@ static void print_xen_info(void) > { > char taint_str[TAINT_STRING_MAX_LEN]; > > - printk("----[ Xen-%d.%d%s %s debug=%c %s ]----\n", > + printk("----[ Xen-%d.%d%s %s debug=%c gcov=%c %s ]----\n", > xen_major_version(), xen_minor_version(), xen_extra_version(), > #ifdef CONFIG_ARM_32 > "arm32", > #else > "arm64", > #endif > - debug_build() ? 'y' : 'n', print_tainted(taint_str)); > + debug_build() ? 'y' : 'n', gcov_build() ? 'y' : 'n', > + print_tainted(taint_str)); > } > > #ifdef CONFIG_ARM_32 > diff --git a/xen/arch/x86/x86_64/traps.c b/xen/arch/x86/x86_64/traps.c > index 2d8ecf5..0708cc7 100644 > --- a/xen/arch/x86/x86_64/traps.c > +++ b/xen/arch/x86/x86_64/traps.c > @@ -30,9 +30,10 @@ static void print_xen_info(void) > { > char taint_str[TAINT_STRING_MAX_LEN]; > > - printk("----[ Xen-%d.%d%s x86_64 debug=%c %s ]----\n", > + printk("----[ Xen-%d.%d%s x86_64 debug=%c gcov=%c %s ]----\n", > xen_major_version(), xen_minor_version(), xen_extra_version(), > - debug_build() ? 'y' : 'n', print_tainted(taint_str)); > + debug_build() ? 'y' : 'n', gcov_build() ? 'y' : 'n', > + print_tainted(taint_str)); > } > > enum context { CTXT_hypervisor, CTXT_pv_guest, CTXT_hvm_guest }; > diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c > index 650035d..e773076 100644 > --- a/xen/drivers/char/console.c > +++ b/xen/drivers/char/console.c > @@ -735,10 +735,11 @@ void __init console_init_preirq(void) > spin_lock(&console_lock); > __putstr(xen_banner()); > spin_unlock(&console_lock); > - printk("Xen version %d.%d%s (%s@%s) (%s) debug=%c %s\n", > + printk("Xen version %d.%d%s (%s@%s) (%s) debug=%c gcov=%c %s\n", > xen_major_version(), xen_minor_version(), xen_extra_version(), > xen_compile_by(), xen_compile_domain(), > - xen_compiler(), debug_build() ? 'y' : 'n', xen_compile_date()); > + xen_compiler(), debug_build() ? 'y' : 'n', > + gcov_build() ? 'y' : 'n', xen_compile_date()); > printk("Latest ChangeSet: %s\n", xen_changeset()); > > if ( opt_sync_console ) > diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h > index e518adc..464fb05 100644 > --- a/xen/include/xen/lib.h > +++ b/xen/include/xen/lib.h > @@ -26,6 +26,12 @@ > #define BUILD_BUG_ON(cond) ((void)BUILD_BUG_ON_ZERO(cond)) > #endif > > +#ifdef CONFIG_GCOV > +#define gcov_build() 1 > +#else > +#define gcov_build() 0 > +#endif > + > #ifndef NDEBUG > #define ASSERT(p) \ > do { if ( unlikely(!(p)) ) assert_failed(#p); } while (0) > -- > 2.1.4 >
diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 683bcb2..3bac8e8 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -141,14 +141,15 @@ static void print_xen_info(void) { char taint_str[TAINT_STRING_MAX_LEN]; - printk("----[ Xen-%d.%d%s %s debug=%c %s ]----\n", + printk("----[ Xen-%d.%d%s %s debug=%c gcov=%c %s ]----\n", xen_major_version(), xen_minor_version(), xen_extra_version(), #ifdef CONFIG_ARM_32 "arm32", #else "arm64", #endif - debug_build() ? 'y' : 'n', print_tainted(taint_str)); + debug_build() ? 'y' : 'n', gcov_build() ? 'y' : 'n', + print_tainted(taint_str)); } #ifdef CONFIG_ARM_32 diff --git a/xen/arch/x86/x86_64/traps.c b/xen/arch/x86/x86_64/traps.c index 2d8ecf5..0708cc7 100644 --- a/xen/arch/x86/x86_64/traps.c +++ b/xen/arch/x86/x86_64/traps.c @@ -30,9 +30,10 @@ static void print_xen_info(void) { char taint_str[TAINT_STRING_MAX_LEN]; - printk("----[ Xen-%d.%d%s x86_64 debug=%c %s ]----\n", + printk("----[ Xen-%d.%d%s x86_64 debug=%c gcov=%c %s ]----\n", xen_major_version(), xen_minor_version(), xen_extra_version(), - debug_build() ? 'y' : 'n', print_tainted(taint_str)); + debug_build() ? 'y' : 'n', gcov_build() ? 'y' : 'n', + print_tainted(taint_str)); } enum context { CTXT_hypervisor, CTXT_pv_guest, CTXT_hvm_guest }; diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c index 650035d..e773076 100644 --- a/xen/drivers/char/console.c +++ b/xen/drivers/char/console.c @@ -735,10 +735,11 @@ void __init console_init_preirq(void) spin_lock(&console_lock); __putstr(xen_banner()); spin_unlock(&console_lock); - printk("Xen version %d.%d%s (%s@%s) (%s) debug=%c %s\n", + printk("Xen version %d.%d%s (%s@%s) (%s) debug=%c gcov=%c %s\n", xen_major_version(), xen_minor_version(), xen_extra_version(), xen_compile_by(), xen_compile_domain(), - xen_compiler(), debug_build() ? 'y' : 'n', xen_compile_date()); + xen_compiler(), debug_build() ? 'y' : 'n', + gcov_build() ? 'y' : 'n', xen_compile_date()); printk("Latest ChangeSet: %s\n", xen_changeset()); if ( opt_sync_console ) diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h index e518adc..464fb05 100644 --- a/xen/include/xen/lib.h +++ b/xen/include/xen/lib.h @@ -26,6 +26,12 @@ #define BUILD_BUG_ON(cond) ((void)BUILD_BUG_ON_ZERO(cond)) #endif +#ifdef CONFIG_GCOV +#define gcov_build() 1 +#else +#define gcov_build() 0 +#endif + #ifndef NDEBUG #define ASSERT(p) \ do { if ( unlikely(!(p)) ) assert_failed(#p); } while (0)
Signed-off-by: Wei Liu <wei.liu2@citrix.com> --- Cc: Stefano Stabellini <sstabellini@kernel.org> Cc: Julien Grall <julien.grall@arm.com> Cc: Jan Beulich <jbeulich@suse.com> Cc: Andrew Cooper <andrew.cooper3@citrix.com> --- xen/arch/arm/traps.c | 5 +++-- xen/arch/x86/x86_64/traps.c | 5 +++-- xen/drivers/char/console.c | 5 +++-- xen/include/xen/lib.h | 6 ++++++ 4 files changed, 15 insertions(+), 6 deletions(-)