From: Julien Grall <julien@xen.org>
To: Juergen Gross <jgross@suse.com>, xen-devel@lists.xenproject.org
Cc: "Stefano Stabellini" <sstabellini@kernel.org>,
"Wei Liu" <wl@xen.org>,
"Konrad Rzeszutek Wilk" <konrad.wilk@oracle.com>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
"Ian Jackson" <ian.jackson@eu.citrix.com>,
"George Dunlap" <george.dunlap@citrix.com>,
"Jan Beulich" <jbeulich@suse.com>,
"Roger Pau Monné" <roger.pau@citrix.com>
Subject: Re: [Xen-devel] [PATCH v6 01/12] xen: allow only sizeof(bool) variables for boolean_param()
Date: Mon, 9 Mar 2020 11:43:24 +0000 [thread overview]
Message-ID: <d3b83513-8fc2-634c-fa89-00df84c5c4fb@xen.org> (raw)
In-Reply-To: <20200226124705.29212-2-jgross@suse.com>
Hi Juergen,
On 26/02/2020 12:46, Juergen Gross wrote:
> Support of other variable sizes than that of normal bool ones for
> boolean_parameter() don't make sense, so catch any other sized
> variables at build time.
>
> Fix the one parameter using a plain int instead of bool.
>
> Signed-off-by: Juergen Gross <jgross@suse.com>
> ---
> V6:
> - new patch
> ---
> xen/arch/x86/hvm/asid.c | 2 +-
> xen/include/xen/param.h | 8 ++++++--
> 2 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/xen/arch/x86/hvm/asid.c b/xen/arch/x86/hvm/asid.c
> index 8e00a28443..8b5bb86dfd 100644
> --- a/xen/arch/x86/hvm/asid.c
> +++ b/xen/arch/x86/hvm/asid.c
> @@ -25,7 +25,7 @@
> #include <asm/hvm/asid.h>
>
> /* Xen command-line option to enable ASIDs */
> -static int opt_asid_enabled = 1;
> +static bool opt_asid_enabled = true;
> boolean_param("asid", opt_asid_enabled);
>
> /*
> diff --git a/xen/include/xen/param.h b/xen/include/xen/param.h
> index 75471eb4ad..d4578cd27f 100644
> --- a/xen/include/xen/param.h
> +++ b/xen/include/xen/param.h
> @@ -2,6 +2,8 @@
> #define _XEN_PARAM_H
>
> #include <xen/init.h>
> +#include <xen/lib.h>
> +#include <xen/stdbool.h>
>
> /*
> * Used for kernel command line parameter setup
> @@ -46,7 +48,8 @@ extern const struct kernel_param __param_start[], __param_end[];
> __kparam __setup_##_var = \
> { .name = __setup_str_##_var, \
> .type = OPT_BOOL, \
> - .len = sizeof(_var), \
> + .len = sizeof(_var) + \
> + BUILD_BUG_ON_ZERO(sizeof(_var) != sizeof(bool)), \
From my understanding, sizeof(bool) is not necessarily 1 (it can be
greater). While this is fine to use it in Xen, I think we want it to
always be one when exposed in the hypfs.
> .par.var = &_var }
> #define integer_param(_name, _var) \
> __setup_str __setup_str_##_var[] = _name; \
> @@ -86,7 +89,8 @@ extern const struct kernel_param __param_start[], __param_end[];
> __rtparam __rtpar_##_var = \
> { .name = _name, \
> .type = OPT_BOOL, \
> - .len = sizeof(_var), \
> + .len = sizeof(_var) + \
> + BUILD_BUG_ON_ZERO(sizeof(_var) != sizeof(bool)), \
> .par.var = &_var }
> #define integer_runtime_only_param(_name, _var) \
> __rtparam __rtpar_##_var = \
>
Cheers,
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2020-03-09 11:43 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-26 12:46 [Xen-devel] [PATCH v6 00/12] Add hypervisor sysfs-like support Juergen Gross
2020-02-26 12:46 ` [Xen-devel] [PATCH v6 01/12] xen: allow only sizeof(bool) variables for boolean_param() Juergen Gross
2020-03-03 16:40 ` Jan Beulich
2020-03-09 11:43 ` Julien Grall [this message]
2020-03-09 11:55 ` Jan Beulich
2020-03-09 13:01 ` Jürgen Groß
2020-03-09 13:06 ` Jan Beulich
2020-03-09 14:06 ` Jürgen Groß
2020-02-26 12:46 ` [Xen-devel] [PATCH v6 02/12] xen: add a generic way to include binary files as variables Juergen Gross
2020-02-26 12:46 ` [Xen-devel] [PATCH v6 03/12] docs: add feature document for Xen hypervisor sysfs-like support Juergen Gross
2020-03-09 11:48 ` Julien Grall
2020-03-25 14:05 ` Jürgen Groß
2020-02-26 12:46 ` [Xen-devel] [PATCH v6 04/12] xen: add basic hypervisor filesystem support Juergen Gross
2020-03-03 16:59 ` Jan Beulich
2020-03-04 12:00 ` Jürgen Groß
2020-03-04 13:03 ` Jan Beulich
2020-03-04 14:39 ` Jürgen Groß
2020-03-04 15:07 ` Jan Beulich
2020-03-04 15:14 ` Jürgen Groß
2020-03-04 15:21 ` Jan Beulich
2020-03-06 6:06 ` Jürgen Groß
2020-03-06 8:19 ` Jan Beulich
2020-02-26 12:46 ` [Xen-devel] [PATCH v6 05/12] libs: add libxenhypfs Juergen Gross
2020-02-26 12:46 ` [Xen-devel] [PATCH v6 06/12] tools: add xenfs tool Juergen Gross
2020-02-26 12:47 ` [Xen-devel] [PATCH v6 07/12] xen: provide version information in hypfs Juergen Gross
2020-02-26 12:47 ` [Xen-devel] [PATCH v6 08/12] xen: add /buildinfo/config entry to hypervisor filesystem Juergen Gross
2020-03-04 10:49 ` Jan Beulich
2020-03-04 12:06 ` Jürgen Groß
2020-03-04 13:04 ` Jan Beulich
2020-02-26 12:47 ` [Xen-devel] [PATCH v6 09/12] xen: add runtime parameter access support to hypfs Juergen Gross
2020-03-04 11:32 ` Jan Beulich
2020-03-04 15:07 ` Jürgen Groß
2020-03-04 15:19 ` Jan Beulich
2020-03-04 16:31 ` Jürgen Groß
2020-03-04 16:56 ` Jan Beulich
2020-03-05 6:01 ` Jürgen Groß
2020-03-05 8:26 ` Jan Beulich
2020-03-06 6:42 ` Jürgen Groß
2020-03-06 8:20 ` Jan Beulich
2020-03-06 8:47 ` Jürgen Groß
2020-03-06 9:04 ` Jan Beulich
2020-03-06 9:20 ` Jürgen Groß
2020-03-06 9:22 ` Jan Beulich
2020-03-06 9:27 ` Jürgen Groß
2020-03-23 10:38 ` Julien Grall
2020-02-26 12:47 ` [Xen-devel] [PATCH v6 10/12] tools/libxl: use libxenhypfs for setting xen runtime parameters Juergen Gross
2020-02-26 12:47 ` [Xen-devel] [PATCH v6 11/12] tools/libxc: remove xc_set_parameters() Juergen Gross
2020-02-26 12:47 ` [Xen-devel] [PATCH v6 12/12] xen: remove XEN_SYSCTL_set_parameter support Juergen Gross
2020-03-04 11:45 ` Jan Beulich
2020-03-04 14:40 ` Jürgen Groß
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d3b83513-8fc2-634c-fa89-00df84c5c4fb@xen.org \
--to=julien@xen.org \
--cc=andrew.cooper3@citrix.com \
--cc=george.dunlap@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=jgross@suse.com \
--cc=konrad.wilk@oracle.com \
--cc=roger.pau@citrix.com \
--cc=sstabellini@kernel.org \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).