From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: keir@xen.org, suravee.suthikulpanit@amd.com,
andrew.cooper3@citrix.com, eddie.dong@intel.com,
dietmar.hahn@ts.fujitsu.com, jun.nakajima@intel.com,
xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH v3 07/16] x86/VPMU: Add public xenpmu.h
Date: Mon, 13 Jan 2014 10:23:35 -0500 [thread overview]
Message-ID: <52D404F7.9090906@oracle.com> (raw)
In-Reply-To: <52D3FAB20200007800113162@nat28.tlf.novell.com>
On 01/13/2014 08:39 AM, Jan Beulich wrote:
>> --- /dev/null
>> +++ b/xen/include/public/arch-x86/xenpmu.h
>> @@ -0,0 +1,74 @@
....
>> +
>> +/* AMD PMU registers and structures */
>> +struct amd_vpmu_context {
>> + uint64_t counters; /* Offset to counter MSRs */
>> + uint64_t ctrls; /* Offset to control MSRs */
>> + uint8_t msr_bitmap_set; /* Used by HVM only */
>> +};
> sizeof() of this structure will differ between 32- and 64-bit guests -
> are you intending to do the necessary translation even though it
> seems rather easy to avoid having to do so?
'msr_bitmap_set' field is actually never used by PV and it's the last
one in the structure which is why I didn't bother to make it bigger. But
you are right, I should fix this to avoid problems in the future.
>
>> +
>> +/* Intel PMU registers and structures */
>> +struct arch_cntr_pair {
>> + uint64_t counter;
>> + uint64_t control;
>> +};
>> +struct core2_vpmu_context {
> Blank line missing between the two structures.
>
>> + uint64_t global_ctrl;
>> + uint64_t global_ovf_ctrl;
>> + uint64_t global_status;
>> + uint64_t fixed_ctrl;
>> + uint64_t ds_area;
>> + uint64_t pebs_enable;
>> + uint64_t debugctl;
>> + uint64_t fixed_counters; /* Offset to fixed counter MSRs */
>> + uint64_t arch_counters; /* Offset to architectural counter MSRs */
>> +};
>> +
>> +/* ANSI-C does not support anonymous unions */
>> +#if !defined(__GNUC__) || defined(__STRICT_ANSI__)
>> +#define __ANON_UNION_NAME(x) x
>> +#else
>> +#define __ANON_UNION_NAME(x)
>> +#endif
> Why? And if really needed, why here?
I'll drop this. I thought anonymous unions looked better but now that I
look at it again I think the ifdefs are rather ugly too.
>
>> +
>> +#define XENPMU_MAX_CTXT_SZ (sizeof(struct amd_vpmu_context) > \
>> + sizeof(struct core2_vpmu_context) ? \
>> + sizeof(struct amd_vpmu_context) : \
>> + sizeof(struct core2_vpmu_context))
>> +#define XENPMU_CTXT_PAD_SZ (((XENPMU_MAX_CTXT_SZ + 64) & ~63) + 128)
>> +struct arch_xenpmu {
>> + union {
>> + struct cpu_user_regs regs;
>> + uint8_t pad1[256];
>> + } __ANON_UNION_NAME(r);
>> + union {
>> + uint32_t lapic_lvtpc;
>> + uint64_t pad2;
>> + } __ANON_UNION_NAME(l);
>> + union {
>> + struct amd_vpmu_context amd;
>> + struct core2_vpmu_context intel;
>> + uint8_t pad3[XENPMU_CTXT_PAD_SZ];
>> + } __ANON_UNION_NAME(c);
> I don't think there's be a severe problem if you simply always
> had names on these unions.
>
>> +};
>> +typedef struct arch_xenpmu arch_xenpmu_t;
> Overall you should also prefix all types added to global scope with
> "xen". I know this wasn't done consistently for older headers, but
> we shouldn't be extending this name space cluttering.
You mean something like arch_xenpmu ==> xen_arch_pmu ?
-boris
next prev parent reply other threads:[~2014-01-13 15:23 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-06 19:24 [PATCH v3 00/16] x86/PMU: Xen PMU PV support Boris Ostrovsky
2014-01-06 19:24 ` [PATCH v3 01/16] common/symbols: Export hypervisor symbols to PV guest Boris Ostrovsky
2014-01-10 17:01 ` Jan Beulich
2014-01-13 15:00 ` Boris Ostrovsky
2014-01-13 15:07 ` Jan Beulich
2014-01-06 19:24 ` [PATCH v3 02/16] x86/VPMU: Stop AMD counters when called from vpmu_save_force() Boris Ostrovsky
2014-01-06 19:24 ` [PATCH v3 03/16] x86/VPMU: Minor VPMU cleanup Boris Ostrovsky
2014-01-06 19:24 ` [PATCH v3 04/16] intel/VPMU: Clean up Intel VPMU code Boris Ostrovsky
2014-01-06 19:24 ` [PATCH v3 05/16] x86/VPMU: Handle APIC_LVTPC accesses Boris Ostrovsky
2014-01-13 13:28 ` Jan Beulich
2014-01-13 15:04 ` Boris Ostrovsky
2014-01-13 15:08 ` Jan Beulich
2014-01-06 19:24 ` [PATCH v3 06/16] intel/VPMU: MSR_CORE_PERF_GLOBAL_CTRL should be initialized to zero Boris Ostrovsky
2014-01-06 19:24 ` [PATCH v3 07/16] x86/VPMU: Add public xenpmu.h Boris Ostrovsky
2014-01-13 13:39 ` Jan Beulich
2014-01-13 15:23 ` Boris Ostrovsky [this message]
2014-01-13 15:38 ` Jan Beulich
2014-01-06 19:24 ` [PATCH v3 08/16] x86/VPMU: Make vpmu not HVM-specific Boris Ostrovsky
2014-01-06 19:24 ` [PATCH v3 09/16] x86/VPMU: Interface for setting PMU mode and flags Boris Ostrovsky
2014-01-13 14:02 ` Jan Beulich
2014-01-06 19:24 ` [PATCH v3 10/16] x86/VPMU: Initialize PMU for PV guests Boris Ostrovsky
2014-01-13 14:04 ` Jan Beulich
2014-01-13 15:25 ` Boris Ostrovsky
2014-01-13 14:05 ` Jan Beulich
2014-01-06 19:24 ` [PATCH v3 11/16] x86/VPMU: Add support for PMU register handling on " Boris Ostrovsky
2014-01-13 14:12 ` Jan Beulich
2014-01-13 15:44 ` Boris Ostrovsky
2014-01-13 15:58 ` Jan Beulich
2014-01-13 16:20 ` Boris Ostrovsky
2014-01-06 19:24 ` [PATCH v3 12/16] x86/VPMU: Handle PMU interrupts for " Boris Ostrovsky
2014-01-16 9:15 ` Jan Beulich
2014-01-16 14:58 ` Boris Ostrovsky
2014-01-16 15:48 ` Jan Beulich
2014-01-06 19:24 ` [PATCH v3 13/16] x86/VPMU: Add privileged PMU mode Boris Ostrovsky
2014-01-06 19:24 ` [PATCH v3 14/16] x86/VPMU: Save VPMU state for PV guests during context switch Boris Ostrovsky
2014-01-16 9:27 ` Jan Beulich
2014-01-06 19:24 ` [PATCH v3 15/16] x86/VPMU: NMI-based VPMU support Boris Ostrovsky
2014-01-16 9:35 ` Jan Beulich
2014-01-16 15:13 ` Boris Ostrovsky
2014-01-06 19:24 ` [PATCH v3 16/16] x86/VPMU: Move VPMU files up from hvm/ directory Boris Ostrovsky
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=52D404F7.9090906@oracle.com \
--to=boris.ostrovsky@oracle.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=dietmar.hahn@ts.fujitsu.com \
--cc=eddie.dong@intel.com \
--cc=jun.nakajima@intel.com \
--cc=keir@xen.org \
--cc=suravee.suthikulpanit@amd.com \
--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.