Wed, 14 Jun 2023 11:49:35 +0200 Jan Beulich <[email protected]>:

> However, if you're after adding packed attributes, and if you're
> meaning to only communicate between Xen and the tool stack, then
> the requirement above doesn't exist. Yet then I would also wonder
> whether you need any compat translation in the first place. Those
> packed structures would better be arch-/bitness-agnostic, wouldn't
> they? So perhaps we could arrange for your additions to be excluded
> from the compat translation machinery?

The change below works for me. I wonder if any special compat handling
for t_buf and t_rec is required. To me it looks like only uint32_t is
used, which will most likely cause no unexpected alignment issues.


Olaf

--- a/xen/common/trace.c
+++ b/xen/common/trace.c
@@ -34,15 +34,6 @@
 #include <asm/atomic.h>
 #include <public/sysctl.h>
 
-#ifdef CONFIG_COMPAT
-#include <compat/trace.h>
-#define xen_t_buf t_buf
-CHECK_t_buf;
-#undef xen_t_buf
-#else
-#define compat_t_rec t_rec
-#endif
-
 /* opt_tbuf_size: trace buffer size (in pages) for each cpu */
 static unsigned int opt_tbuf_size;
 static unsigned int opt_tevt_mask;
--- a/xen/include/Makefile
+++ b/xen/include/Makefile
@@ -30,7 +30,7 @@ headers-$(CONFIG_HVM)     += compat/hvm/hvm_op.h
 headers-$(CONFIG_HVM)     += compat/hvm/hvm_vcpu.h
 headers-$(CONFIG_HYPFS)   += compat/hypfs.h
 headers-$(CONFIG_KEXEC)   += compat/kexec.h
-headers-$(CONFIG_TRACEBUFFER) += compat/trace.h
+headers-n                 += compat/trace.h
 headers-$(CONFIG_XENOPROF) += compat/xenoprof.h
 headers-$(CONFIG_XSM_FLASK) += compat/xsm/flask_op.h
 
--- a/xen/include/public/trace.h
+++ b/xen/include/public/trace.h
@@ -81,6 +81,15 @@
 #define TRC_TRACE_WRAP_BUFFER  (TRC_GEN + 2)
 #define TRC_TRACE_CPU_CHANGE    (TRC_GEN + 3)
 
+#define TRC_a (TRC_GEN + 123)
+struct __attribute__((__packed__)) trc_a {
+    unsigned a;
+};
+#define TRC_b (TRC_GEN + 321)
+typedef struct __attribute__((__packed__)) trc_b {
+    unsigned b;
+} trc_b_t;
+
 #define TRC_SCHED_RUNSTATE_CHANGE   (TRC_SCHED_MIN + 1)
 #define TRC_SCHED_CONTINUE_RUNNING  (TRC_SCHED_MIN + 2)
 #define TRC_SCHED_DOM_ADD        (TRC_SCHED_VERBOSE +  1)

Attachment: pgpkpVFqhWdPr.pgp
Description: Digitale Signatur von OpenPGP

Reply via email to