From: Jan Beulich <jbeulich@suse.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Xen-devel <xen-devel@lists.xenproject.org>,
"Wei Liu" <wl@xen.org>, "Roger Pau Monné" <roger.pau@citrix.com>
Subject: Re: [Xen-devel] [PATCH v2 0.5/8] libx86: Proactively initialise error pointers
Date: Fri, 13 Sep 2019 08:20:30 +0200 [thread overview]
Message-ID: <edfb5e08-0040-6d52-6684-ea2e0e4f0fd4@suse.com> (raw)
In-Reply-To: <20190912185556.22173-1-andrew.cooper3@citrix.com>
On 12.09.2019 20:55, Andrew Cooper wrote:
> This results in better behaviour for the caller.
>
> Suggested-by: Jan Beulich <JBeulich@suse.com>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
But I'm curious:
> --- a/tools/tests/cpu-policy/test-cpu-policy.c
> +++ b/tools/tests/cpu-policy/test-cpu-policy.c
> @@ -283,7 +283,7 @@ static void test_cpuid_deserialise_failure(void)
> for ( size_t i = 0; i < ARRAY_SIZE(tests); ++i )
> {
> const struct test *t = &tests[i];
> - uint32_t err_leaf = ~0u, err_subleaf = ~0u;
> + uint32_t err_leaf, err_subleaf;
> int rc;
>
> /* No writes should occur. Use NULL to catch errors. */
> @@ -336,7 +336,7 @@ static void test_msr_deserialise_failure(void)
> for ( size_t i = 0; i < ARRAY_SIZE(tests); ++i )
> {
> const struct test *t = &tests[i];
> - uint32_t err_msr = ~0u;
> + uint32_t err_msr;
Any reason for the (benign) switch from ~0u ...
> --- a/xen/lib/x86/cpuid.c
> +++ b/xen/lib/x86/cpuid.c
> @@ -381,6 +381,11 @@ int x86_cpuid_copy_from_buffer(struct cpuid_policy *p,
> unsigned int i;
> xen_cpuid_leaf_t data;
>
> + if ( err_leaf )
> + *err_leaf = -1;
> + if ( err_subleaf )
> + *err_subleaf = -1;
> +
> /*
> * A well formed caller is expected to pass an array with leaves in order,
> * and without any repetitions. However, due to per-vendor differences,
> --- a/xen/lib/x86/msr.c
> +++ b/xen/lib/x86/msr.c
> @@ -55,6 +55,9 @@ int x86_msr_copy_from_buffer(struct msr_policy *p,
> xen_msr_entry_t data;
> int rc;
>
> + if ( err_msr )
> + *err_msr = -1;
... to -1?
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
prev parent reply other threads:[~2019-09-13 6:20 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-11 20:04 [Xen-devel] [PATCH 0/8] x86/cpuid: Switch to using XEN_DOMCTL_set_cpumsr_policy Andrew Cooper
2019-09-11 20:04 ` [Xen-devel] [PATCH 1/8] libx86: Introduce x86_cpu_policies_are_compatible() Andrew Cooper
2019-09-12 7:43 ` Jan Beulich
2019-09-12 7:59 ` Andrew Cooper
2019-09-12 8:22 ` Jan Beulich
2019-09-12 11:41 ` Andrew Cooper
2019-09-11 20:04 ` [Xen-devel] [PATCH 2/8] x86/cpuid: Split update_domain_cpuid_info() in half Andrew Cooper
2019-09-12 7:52 ` Jan Beulich
2019-09-12 8:07 ` Andrew Cooper
2019-09-11 20:04 ` [Xen-devel] [PATCH 3/8] x86/domctl: Implement XEN_DOMCTL_set_cpumsr_policy Andrew Cooper
2019-09-12 8:06 ` Jan Beulich
2019-09-12 13:15 ` Andrew Cooper
2019-09-12 13:20 ` Jan Beulich
2019-09-12 16:34 ` Andrew Cooper
2019-09-11 20:05 ` [Xen-devel] [PATCH 4/8] tools/libxc: Pre-cleanup for xc_cpuid_{set, apply_policy}() Andrew Cooper
2019-09-12 8:09 ` Jan Beulich
2019-09-12 8:17 ` Jan Beulich
2019-09-12 8:38 ` Andrew Cooper
2019-09-11 20:05 ` [Xen-devel] [PATCH 5/8] tools/libxc: Rework xc_cpuid_set() to use {get, set}_cpu_policy() Andrew Cooper
2019-09-12 8:19 ` Jan Beulich
2019-09-12 8:36 ` Andrew Cooper
2019-09-12 9:11 ` Jan Beulich
2019-09-12 13:21 ` Andrew Cooper
2019-09-11 20:05 ` [Xen-devel] [PATCH 6/8] tools/libxc: Rework xc_cpuid_apply_policy() " Andrew Cooper
2019-09-12 9:02 ` Jan Beulich
2019-09-12 13:47 ` Andrew Cooper
2019-09-11 20:05 ` [Xen-devel] [PATCH 7/8] x86/domctl: Drop XEN_DOMCTL_set_cpuid Andrew Cooper
2019-09-12 9:04 ` Jan Beulich
2019-09-11 20:05 ` [Xen-devel] [PATCH 8/8] x86/cpuid: Enable CPUID Faulting for the control domain Andrew Cooper
2019-09-12 9:07 ` Jan Beulich
2019-09-12 9:28 ` Andrew Cooper
2019-09-12 18:55 ` [Xen-devel] [PATCH v2 8/8] x86/cpuid: Enable CPUID Faulting for the control domain by default Andrew Cooper
2019-09-13 6:38 ` Jan Beulich
2019-09-13 14:56 ` Andrew Cooper
2019-09-12 18:55 ` [Xen-devel] [PATCH v2 0.5/8] libx86: Proactively initialise error pointers Andrew Cooper
2019-09-13 6:20 ` Jan Beulich [this message]
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=edfb5e08-0040-6d52-6684-ea2e0e4f0fd4@suse.com \
--to=jbeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=roger.pau@citrix.com \
--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).