xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] common: re-arrange struct kernel_param fields
@ 2016-02-15  7:36 Jan Beulich
  2016-02-15  8:18 ` Andrew Cooper
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2016-02-15  7:36 UTC (permalink / raw)
  To: xen-devel
  Cc: Ian Campbell, Andrew Cooper, Keir Fraser, Ian Jackson, Tim Deegan

[-- Attachment #1: Type: text/plain, Size: 2017 bytes --]

Even if placed in .init.* there's no reason to needlessly bloat the
binary due to padding fields the compiler needs to insert on 64-bit
architectures.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/include/xen/init.h
+++ b/xen/include/xen/init.h
@@ -81,34 +81,35 @@ struct kernel_param {
         OPT_SIZE,
         OPT_CUSTOM
     } type;
-    void *var;
     unsigned int len;
+    void *var;
 };
 
 extern struct kernel_param __setup_start, __setup_end;
 
 #define __setup_str static __initdata __attribute__((__aligned__(1))) char
-#define __kparam static __initsetup struct kernel_param
+#define __kparam static __initsetup \
+    __attribute__((__aligned__(sizeof(void *)))) struct kernel_param
 
 #define custom_param(_name, _var) \
     __setup_str __setup_str_##_var[] = _name; \
-    __kparam __setup_##_var = { __setup_str_##_var, OPT_CUSTOM, _var, 0 }
+    __kparam __setup_##_var = { __setup_str_##_var, OPT_CUSTOM, 0, _var }
 #define boolean_param(_name, _var) \
     __setup_str __setup_str_##_var[] = _name; \
     __kparam __setup_##_var = \
-        { __setup_str_##_var, OPT_BOOL, &_var, sizeof(_var) }
+        { __setup_str_##_var, OPT_BOOL, sizeof(_var), &_var }
 #define integer_param(_name, _var) \
     __setup_str __setup_str_##_var[] = _name; \
     __kparam __setup_##_var = \
-        { __setup_str_##_var, OPT_UINT, &_var, sizeof(_var) }
+        { __setup_str_##_var, OPT_UINT, sizeof(_var), &_var }
 #define size_param(_name, _var) \
     __setup_str __setup_str_##_var[] = _name; \
     __kparam __setup_##_var = \
-        { __setup_str_##_var, OPT_SIZE, &_var, sizeof(_var) }
+        { __setup_str_##_var, OPT_SIZE, sizeof(_var), &_var }
 #define string_param(_name, _var) \
     __setup_str __setup_str_##_var[] = _name; \
     __kparam __setup_##_var = \
-        { __setup_str_##_var, OPT_STR, &_var, sizeof(_var) }
+        { __setup_str_##_var, OPT_STR, sizeof(_var), &_var }
 
 #endif /* __ASSEMBLY__ */
 




[-- Attachment #2: setup-data-rearrange.patch --]
[-- Type: text/plain, Size: 2060 bytes --]

common: re-arrange struct kernel_param fields

Even if placed in .init.* there's no reason to needlessly bloat the
binary due to padding fields the compiler needs to insert on 64-bit
architectures.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/include/xen/init.h
+++ b/xen/include/xen/init.h
@@ -81,34 +81,35 @@ struct kernel_param {
         OPT_SIZE,
         OPT_CUSTOM
     } type;
-    void *var;
     unsigned int len;
+    void *var;
 };
 
 extern struct kernel_param __setup_start, __setup_end;
 
 #define __setup_str static __initdata __attribute__((__aligned__(1))) char
-#define __kparam static __initsetup struct kernel_param
+#define __kparam static __initsetup \
+    __attribute__((__aligned__(sizeof(void *)))) struct kernel_param
 
 #define custom_param(_name, _var) \
     __setup_str __setup_str_##_var[] = _name; \
-    __kparam __setup_##_var = { __setup_str_##_var, OPT_CUSTOM, _var, 0 }
+    __kparam __setup_##_var = { __setup_str_##_var, OPT_CUSTOM, 0, _var }
 #define boolean_param(_name, _var) \
     __setup_str __setup_str_##_var[] = _name; \
     __kparam __setup_##_var = \
-        { __setup_str_##_var, OPT_BOOL, &_var, sizeof(_var) }
+        { __setup_str_##_var, OPT_BOOL, sizeof(_var), &_var }
 #define integer_param(_name, _var) \
     __setup_str __setup_str_##_var[] = _name; \
     __kparam __setup_##_var = \
-        { __setup_str_##_var, OPT_UINT, &_var, sizeof(_var) }
+        { __setup_str_##_var, OPT_UINT, sizeof(_var), &_var }
 #define size_param(_name, _var) \
     __setup_str __setup_str_##_var[] = _name; \
     __kparam __setup_##_var = \
-        { __setup_str_##_var, OPT_SIZE, &_var, sizeof(_var) }
+        { __setup_str_##_var, OPT_SIZE, sizeof(_var), &_var }
 #define string_param(_name, _var) \
     __setup_str __setup_str_##_var[] = _name; \
     __kparam __setup_##_var = \
-        { __setup_str_##_var, OPT_STR, &_var, sizeof(_var) }
+        { __setup_str_##_var, OPT_STR, sizeof(_var), &_var }
 
 #endif /* __ASSEMBLY__ */
 

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

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

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

* Re: [PATCH] common: re-arrange struct kernel_param fields
  2016-02-15  7:36 [PATCH] common: re-arrange struct kernel_param fields Jan Beulich
@ 2016-02-15  8:18 ` Andrew Cooper
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Cooper @ 2016-02-15  8:18 UTC (permalink / raw)
  To: Jan Beulich, xen-devel; +Cc: Ian Campbell, Keir Fraser, Ian Jackson, Tim Deegan

On 15/02/2016 07:36, Jan Beulich wrote:
> Even if placed in .init.* there's no reason to needlessly bloat the
> binary due to padding fields the compiler needs to insert on 64-bit
> architectures.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

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

end of thread, other threads:[~2016-02-15  8:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-15  7:36 [PATCH] common: re-arrange struct kernel_param fields Jan Beulich
2016-02-15  8:18 ` Andrew Cooper

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).