kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: PPC: Move and undef TRACE_INCLUDE_PATH/FILE
@ 2018-11-07  1:49 Scott Wood
  2018-11-07 14:19 ` Naveen N. Rao
  2018-11-07 21:27 ` Michael Ellerman
  0 siblings, 2 replies; 3+ messages in thread
From: Scott Wood @ 2018-11-07  1:49 UTC (permalink / raw)
  To: Alexander Graf; +Cc: kvm, kvm-ppc, Scott Wood, Christian Zigotzky, linuxppc-dev

TRACE_INCLUDE_PATH and TRACE_INCLUDE_FILE are used by
<trace/define_trace.h>, so like that #include, they should
be outside #ifdef protection.

They also need to be #undefed before defining, in case multiple trace
headers are included by the same C file.  This became the case on
book3e after commit cf4a6085151a ("powerpc/mm: Add missing tracepoint for
tlbie"), leading to the following build error:

   CC      arch/powerpc/kvm/powerpc.o
In file included from arch/powerpc/kvm/powerpc.c:51:0:
arch/powerpc/kvm/trace.h:9:0: error: "TRACE_INCLUDE_PATH" redefined
[-Werror]
  #define TRACE_INCLUDE_PATH .
  ^
In file included from arch/powerpc/kvm/../mm/mmu_decl.h:25:0,
                  from arch/powerpc/kvm/powerpc.c:48:
./arch/powerpc/include/asm/trace.h:224:0: note: this is the location of
the previous definition
  #define TRACE_INCLUDE_PATH asm
  ^
cc1: all warnings being treated as errors

Reported-by: Christian Zigotzky <chzigotzky@xenosoft.de>
Signed-off-by: Scott Wood <oss@buserror.net>
---
 arch/powerpc/kvm/trace.h       | 8 ++++++--
 arch/powerpc/kvm/trace_booke.h | 9 +++++++--
 arch/powerpc/kvm/trace_hv.h    | 9 +++++++--
 arch/powerpc/kvm/trace_pr.h    | 9 +++++++--
 4 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/kvm/trace.h b/arch/powerpc/kvm/trace.h
index 491b0f715d6b..ea1d7c808319 100644
--- a/arch/powerpc/kvm/trace.h
+++ b/arch/powerpc/kvm/trace.h
@@ -6,8 +6,6 @@
 
 #undef TRACE_SYSTEM
 #define TRACE_SYSTEM kvm
-#define TRACE_INCLUDE_PATH .
-#define TRACE_INCLUDE_FILE trace
 
 /*
  * Tracepoint for guest mode entry.
@@ -120,4 +118,10 @@ TRACE_EVENT(kvm_check_requests,
 #endif /* _TRACE_KVM_H */
 
 /* This part must be outside protection */
+#undef TRACE_INCLUDE_PATH
+#undef TRACE_INCLUDE_FILE
+
+#define TRACE_INCLUDE_PATH .
+#define TRACE_INCLUDE_FILE trace
+
 #include <trace/define_trace.h>
diff --git a/arch/powerpc/kvm/trace_booke.h b/arch/powerpc/kvm/trace_booke.h
index ac640e81fdc5..3837842986aa 100644
--- a/arch/powerpc/kvm/trace_booke.h
+++ b/arch/powerpc/kvm/trace_booke.h
@@ -6,8 +6,6 @@
 
 #undef TRACE_SYSTEM
 #define TRACE_SYSTEM kvm_booke
-#define TRACE_INCLUDE_PATH .
-#define TRACE_INCLUDE_FILE trace_booke
 
 #define kvm_trace_symbol_exit \
 	{0, "CRITICAL"}, \
@@ -218,4 +216,11 @@ TRACE_EVENT(kvm_booke_queue_irqprio,
 #endif
 
 /* This part must be outside protection */
+
+#undef TRACE_INCLUDE_PATH
+#undef TRACE_INCLUDE_FILE
+
+#define TRACE_INCLUDE_PATH .
+#define TRACE_INCLUDE_FILE trace_booke
+
 #include <trace/define_trace.h>
diff --git a/arch/powerpc/kvm/trace_hv.h b/arch/powerpc/kvm/trace_hv.h
index bcfe8a987f6a..8a1e3b0047f1 100644
--- a/arch/powerpc/kvm/trace_hv.h
+++ b/arch/powerpc/kvm/trace_hv.h
@@ -9,8 +9,6 @@
 
 #undef TRACE_SYSTEM
 #define TRACE_SYSTEM kvm_hv
-#define TRACE_INCLUDE_PATH .
-#define TRACE_INCLUDE_FILE trace_hv
 
 #define kvm_trace_symbol_hcall \
 	{H_REMOVE,			"H_REMOVE"}, \
@@ -497,4 +495,11 @@ TRACE_EVENT(kvmppc_run_vcpu_exit,
 #endif /* _TRACE_KVM_HV_H */
 
 /* This part must be outside protection */
+
+#undef TRACE_INCLUDE_PATH
+#undef TRACE_INCLUDE_FILE
+
+#define TRACE_INCLUDE_PATH .
+#define TRACE_INCLUDE_FILE trace_hv
+
 #include <trace/define_trace.h>
diff --git a/arch/powerpc/kvm/trace_pr.h b/arch/powerpc/kvm/trace_pr.h
index 2f9a8829552b..46a46d328fbf 100644
--- a/arch/powerpc/kvm/trace_pr.h
+++ b/arch/powerpc/kvm/trace_pr.h
@@ -8,8 +8,6 @@
 
 #undef TRACE_SYSTEM
 #define TRACE_SYSTEM kvm_pr
-#define TRACE_INCLUDE_PATH .
-#define TRACE_INCLUDE_FILE trace_pr
 
 TRACE_EVENT(kvm_book3s_reenter,
 	TP_PROTO(int r, struct kvm_vcpu *vcpu),
@@ -257,4 +255,11 @@ TRACE_EVENT(kvm_exit,
 #endif /* _TRACE_KVM_H */
 
 /* This part must be outside protection */
+
+#undef TRACE_INCLUDE_PATH
+#undef TRACE_INCLUDE_FILE
+
+#define TRACE_INCLUDE_PATH .
+#define TRACE_INCLUDE_FILE trace_pr
+
 #include <trace/define_trace.h>
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: PPC: Move and undef TRACE_INCLUDE_PATH/FILE
  2018-11-07  1:49 [PATCH] KVM: PPC: Move and undef TRACE_INCLUDE_PATH/FILE Scott Wood
@ 2018-11-07 14:19 ` Naveen N. Rao
  2018-11-07 21:27 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Naveen N. Rao @ 2018-11-07 14:19 UTC (permalink / raw)
  To: Alexander Graf, Scott Wood
  Cc: kvm, Steven Rostedt, kvm-ppc, Christian Zigotzky, linuxppc-dev

Scott Wood wrote:
> TRACE_INCLUDE_PATH and TRACE_INCLUDE_FILE are used by
> <trace/define_trace.h>, so like that #include, they should
> be outside #ifdef protection.
> 
> They also need to be #undefed before defining, in case multiple trace
> headers are included by the same C file.  This became the case on
> book3e after commit cf4a6085151a ("powerpc/mm: Add missing tracepoint for
> tlbie"), leading to the following build error:
> 
>    CC      arch/powerpc/kvm/powerpc.o
> In file included from arch/powerpc/kvm/powerpc.c:51:0:
> arch/powerpc/kvm/trace.h:9:0: error: "TRACE_INCLUDE_PATH" redefined
> [-Werror]
>   #define TRACE_INCLUDE_PATH .
>   ^
> In file included from arch/powerpc/kvm/../mm/mmu_decl.h:25:0,
>                   from arch/powerpc/kvm/powerpc.c:48:
> ./arch/powerpc/include/asm/trace.h:224:0: note: this is the location of
> the previous definition
>   #define TRACE_INCLUDE_PATH asm
>   ^
> cc1: all warnings being treated as errors
> 
> Reported-by: Christian Zigotzky <chzigotzky@xenosoft.de>
> Signed-off-by: Scott Wood <oss@buserror.net>
> ---
>  arch/powerpc/kvm/trace.h       | 8 ++++++--
>  arch/powerpc/kvm/trace_booke.h | 9 +++++++--
>  arch/powerpc/kvm/trace_hv.h    | 9 +++++++--
>  arch/powerpc/kvm/trace_pr.h    | 9 +++++++--
>  4 files changed, 27 insertions(+), 8 deletions(-)

Thanks for getting to this. Apart from a small nit below, for this 
patch:
Reviewed-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>

> 
> diff --git a/arch/powerpc/kvm/trace.h b/arch/powerpc/kvm/trace.h
> index 491b0f715d6b..ea1d7c808319 100644
> --- a/arch/powerpc/kvm/trace.h
> +++ b/arch/powerpc/kvm/trace.h
> @@ -6,8 +6,6 @@
> 
>  #undef TRACE_SYSTEM
>  #define TRACE_SYSTEM kvm
> -#define TRACE_INCLUDE_PATH .
> -#define TRACE_INCLUDE_FILE trace

The convention is to also have the TRACE_SYSTEM macro defined outside 
and before the header #ifdef. So, that would be good to do as part of 
this cleanup as well. If not, I can send a patch later.

Thanks,
Naveen


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: KVM: PPC: Move and undef TRACE_INCLUDE_PATH/FILE
  2018-11-07  1:49 [PATCH] KVM: PPC: Move and undef TRACE_INCLUDE_PATH/FILE Scott Wood
  2018-11-07 14:19 ` Naveen N. Rao
@ 2018-11-07 21:27 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2018-11-07 21:27 UTC (permalink / raw)
  To: Scott Wood, Alexander Graf
  Cc: Scott Wood, linuxppc-dev, kvm-ppc, kvm, Christian Zigotzky

On Wed, 2018-11-07 at 01:49:34 UTC, Scott Wood wrote:
> TRACE_INCLUDE_PATH and TRACE_INCLUDE_FILE are used by
> <trace/define_trace.h>, so like that #include, they should
> be outside #ifdef protection.
> 
> They also need to be #undefed before defining, in case multiple trace
> headers are included by the same C file.  This became the case on
> book3e after commit cf4a6085151a ("powerpc/mm: Add missing tracepoint for
> tlbie"), leading to the following build error:
> 
>    CC      arch/powerpc/kvm/powerpc.o
> In file included from arch/powerpc/kvm/powerpc.c:51:0:
> arch/powerpc/kvm/trace.h:9:0: error: "TRACE_INCLUDE_PATH" redefined
> [-Werror]
>   #define TRACE_INCLUDE_PATH .
>   ^
> In file included from arch/powerpc/kvm/../mm/mmu_decl.h:25:0,
>                   from arch/powerpc/kvm/powerpc.c:48:
> ./arch/powerpc/include/asm/trace.h:224:0: note: this is the location of
> the previous definition
>   #define TRACE_INCLUDE_PATH asm
>   ^
> cc1: all warnings being treated as errors
> 
> Reported-by: Christian Zigotzky <chzigotzky@xenosoft.de>
> Signed-off-by: Scott Wood <oss@buserror.net>

Applied to powerpc fixes, thanks.

https://git.kernel.org/powerpc/c/28c5bcf74fa07c25d5bd118d127192

cheers

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-11-07 21:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-07  1:49 [PATCH] KVM: PPC: Move and undef TRACE_INCLUDE_PATH/FILE Scott Wood
2018-11-07 14:19 ` Naveen N. Rao
2018-11-07 21:27 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).