From: Nicola Vetrini <nicola.vetrini@bugseng.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>,
"Jan Beulich" <jbeulich@suse.com>,
"Roger Pau Monné" <roger.pau@citrix.com>,
"Stefano Stabellini" <sstabellini@kernel.org>,
consulting@bugseng.com
Subject: Re: x86: Declarations for compat_set_{cx,px}_pminfo()
Date: Tue, 19 Nov 2024 00:13:51 +0100 [thread overview]
Message-ID: <7bb9fda3ea29f68cf8008cc32ec23874@bugseng.com> (raw)
In-Reply-To: <4de83f5b-5fde-44a9-8943-b1bb3f41d2e3@citrix.com>
[-- Attachment #1: Type: text/plain, Size: 1400 bytes --]
On 2024-11-18 22:41, Andrew Cooper wrote:
> Hello,
>
> Eclair reports Rule 8.4 violations for these two. They're real
> violations, but fixing them is proving challenging.
>
> Because of how x86_64/platform_hypercall.c sets up some defines and
> includes ../platform_hypercall.c, the declarations of
> compat_set_{cx,px}_pminfo() of pmstat.h become compat ones.
>
> Therefore the real hypercall handler does see a correct declaration.
>
> However, the implementation in cpufreq.c does not get the compat-ified
> version of pmstat.h, so misses the declaration and thus the violation.
>
> Worse however is the fact that cpufreq.c depends on not having the:
>
> #define xen_processor_performance compat_processor_performance
>
> in scope while it's transforming between the two formats, meaning we
> can't simply reuse pmstat.h with suitable defines.
>
> Any clever ideas for how to untangle this mess, before I go for the
> brute force approach of an #if COMPAT section in the main hypercall
> handler?
>
Yeah, that is why these were among the last ones. I'm afraid I didn't
come up with a reasonable to deal with this either.
You can find attached a tentative patch I made (not build tested, and
also based on an older tree). A last resort may be to special-case those
declarations, but that's undesirable.
--
Nicola Vetrini, BSc
Software Engineer, BUGSENG srl (https://bugseng.com)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: R8.4.patch --]
[-- Type: text/x-diff; name=R8.4.patch, Size: 1449 bytes --]
commit caffa89a06275b6b50ace99170b99b500b7b32f7
Author: Nicola Vetrini <nicola.vetrini@bugseng.com>
Date: Wed Nov 29 12:23:25 2023 +0100
x86_64/platform_hypercall: provide proper declarations for compat_*
Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
diff --git a/xen/arch/x86/x86_64/platform_hypercall.c b/xen/arch/x86/x86_64/platform_hypercall.c
index 347f5d65330e..3ad15742d9ef 100644
--- a/xen/arch/x86/x86_64/platform_hypercall.c
+++ b/xen/arch/x86/x86_64/platform_hypercall.c
@@ -5,6 +5,7 @@
EMIT_FILE;
#include <xen/lib.h>
+#include <xen/pmstat.h>
#include <xen/hypercall.h>
#define xen_platform_op compat_platform_op
@@ -14,11 +15,13 @@ EMIT_FILE;
#define efi_get_info efi_compat_get_info
#define efi_runtime_call(x) efi_compat_runtime_call(x)
-#define xen_processor_performance compat_processor_performance
-#define set_px_pminfo compat_set_px_pminfo
+#define xen_processor_performance compat_xen_processor_performance
+int compat_set_px_pminfo(uint32_t acpi_id,
+ struct compat_xen_processor_performance *perf);
-#define xen_processor_power compat_processor_power
-#define set_cx_pminfo compat_set_cx_pminfo
+#define xen_processor_power compat_xen_processor_power
+long compat_set_cx_pminfo(uint32_t acpi_id,
+ struct compat_xen_processor_power *power);
#define xen_pf_pcpuinfo xenpf_pcpuinfo
CHECK_pf_pcpuinfo;
next prev parent reply other threads:[~2024-11-18 23:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-18 21:41 x86: Declarations for compat_set_{cx,px}_pminfo() Andrew Cooper
2024-11-18 23:13 ` Nicola Vetrini [this message]
2024-11-19 8:12 ` [PATCH] x86/pmstat: deal with Misra 8.4 violations Jan Beulich
2024-11-19 10:30 ` Andrew Cooper
2024-11-19 10:55 ` Andrew Cooper
2024-11-19 12:04 ` Andrew Cooper
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=7bb9fda3ea29f68cf8008cc32ec23874@bugseng.com \
--to=nicola.vetrini@bugseng.com \
--cc=andrew.cooper3@citrix.com \
--cc=consulting@bugseng.com \
--cc=jbeulich@suse.com \
--cc=roger.pau@citrix.com \
--cc=sstabellini@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.