From: Thomas Gleixner <tglx@linutronix.de>
To: eranian@gmail.com
Cc: Stephen Rothwell <sfr@canb.auug.org.au>,
Andi Kleen <andi@firstfloor.org>,
linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
mingo@elte.hu, x86@kernel.org
Subject: Re: [patch 05/24] perfmon: X86 generic code (x86)
Date: Thu, 27 Nov 2008 11:56:24 +0100 (CET) [thread overview]
Message-ID: <alpine.LFD.2.00.0811271132290.3325@localhost.localdomain> (raw)
In-Reply-To: <7c86c4470811270151i33ffaa44mb5d9bd79f9d73968@mail.gmail.com>
Stephane,
On Thu, 27 Nov 2008, stephane eranian wrote:
> > Why do you want to do u64 -> u32 BE32 magic on every interrupt,
> > context switch etc., if you can do it once in the userspace interface ?
> >
> I think we agree as to why the user visible structures have to have fixed size.
>
> Some structures have bitfields in them (no in the current patchset yet).
> Here is an example:
>
> #define PFM_PMD_BV (256/sizeof(__u64))
>
> struct pfarg_pmd_attr {
> __u16 reg_num; /* which register */
> __u16 reg_set; /* which event set */
> __u32 reg_flags; /* REGFL flags */
> __u64 reg_value; /* 64-bit value */
> __u64 reg_long_reset; /* write: value to reload after notification */
> __u64 reg_short_reset; /* write: reset after counter overflow */
> __u64 reg_random_mask; /* write: bitmask used to limit random value */
> __u64 reg_smpl_pmds[PFM_PMD_BV]; /* write: record in sample */
> __u64 reg_reset_pmds[PFM_PMD_BV]; /* write: reset on overflow */
> __u64 reg_ovfl_swcnt; /* write: # of overflows before switch */
> __u64 reg_smpl_eventid; /* write: opaque event identifier */
> __u64 reg_last_value; /* read : return: PMD last reset value */
> __u64 reg_reserved[8]; /* for future use */
> };
__attribute__ ((packed)); ???
> So you are advocating keeping that layout for the user level code,
> i.e., the user level perfmon.h.
> But then, in the kernel, you'd have a different version of the same
> structure with the same name
> and the size but with the bitmask defined as unsigned long instead.
> All internal only bitmask
> would also be unsigned long. So the structure would like as follows:
>
> #define PFM_PMD_BV (256/sizeof(unsigned long))
> struct pfarg_pmd_attr {
> __u16 reg_num; /* which register */
> __u16 reg_set; /* which event set */
> __u32 reg_flags; /* REGFL flags */
> __u64 reg_value; /* 64-bit value */
> __u64 reg_long_reset; /* write: value to reload after notification */
> __u64 reg_short_reset; /* write: reset after counter overflow */
> __u64 reg_random_mask; /* write: bitmask used to limit random value */
> unsigned long reg_smpl_pmds[PFM_PMD_BV]; /* write: record in sample */
> unsigned long reg_reset_pmds[PFM_PMD_BV]; /* write: reset on overflow */
> __u64 reg_ovfl_swcnt; /* write: # of overflows before switch */
> __u64 reg_smpl_eventid; /* write: opaque event identifier */
> __u64 reg_last_value; /* read : return: PMD last reset value */
> __u64 reg_reserved[8]; /* for future use */
> };
>
> Then we could not directly export include/linux/perfmon.h to user
> via Kbuild.
I really can not see the problem.
1) perfmon.h can have a section for kernel and user space. We have
tons of examples of this in the kernel already.
The user space data structures are separate, simply because they are
an user space ABI and can not be changed.
Kernel data structures can be completely different from the user ABI
and can be changed at any given time as the code evolves. The design
you are proposing is tying the in kernel data structures to the user
ABI forever.
I can see that it might be good performance wise if you dont have to
touch stuff twice, but reshuffling the bitmasks should not be that
expensive.
2) You can have an union of
union {
__u64 bla[N];
unsigned long blub[M];
};
Where M = N for 64 bit and M = 2 * N for 32 bit.
FYI, I talked to Paulus about that and he thinks that doing the PPC
BE32 bitops for u64 are pretty cheap, but we agreed that this is
neither a perfmon nor an arch feature and has to be done as generic as
possible similar to the atomic64 ops. That way we have just two
implementations (generic and BE32) and not 10 copies of the same
wrappers around ulong bitops all over the place.
Also test_bit_64() is definitely more acceptable and more useful than
pfm_arch_bv_test_bit().
Thanks,
tglx
next prev parent reply other threads:[~2008-11-27 10:59 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-26 8:42 eranian
2008-11-26 11:33 ` Andi Kleen
2008-11-26 12:05 ` Stephen Rothwell
2008-11-26 12:22 ` Andi Kleen
2008-11-26 12:48 ` Stephen Rothwell
2008-11-26 13:32 ` Thomas Gleixner
2008-11-26 13:56 ` stephane eranian
2008-11-26 16:38 ` Thomas Gleixner
2008-11-27 9:51 ` stephane eranian
2008-11-27 10:56 ` Thomas Gleixner [this message]
2008-11-27 11:37 ` David Miller
2008-11-27 14:40 ` Thomas Gleixner
2008-11-26 13:35 ` Thomas Gleixner
2008-11-26 14:00 ` Andi Kleen
2008-11-26 21:18 ` Thomas Gleixner
2008-11-26 21:37 ` stephane eranian
2008-11-26 23:16 ` Thomas Gleixner
2008-11-27 9:38 ` stephane eranian
2008-11-26 22:54 ` Thomas Gleixner
2008-11-27 10:06 ` Andi Kleen
2008-11-27 10:09 ` stephane eranian
2008-11-27 10:29 ` Thomas Gleixner
2008-11-27 11:31 ` Andi Kleen
2008-11-27 11:35 ` stephane eranian
2008-11-27 11:42 ` David Miller
2008-11-27 11:49 ` Thomas Gleixner
2008-11-27 12:38 ` Andi Kleen
2008-11-27 12:31 ` stephane eranian
2008-11-27 12:46 ` Andi Kleen
2008-11-27 13:32 ` Thomas Gleixner
2008-11-27 13:37 ` stephane eranian
2008-11-27 13:51 ` Andi Kleen
2008-11-27 13:50 ` Andi Kleen
2008-11-27 11:52 ` Peter Zijlstra
2008-11-27 12:04 ` stephane eranian
2008-11-27 12:16 ` Peter Zijlstra
2008-11-27 12:32 ` Andi Kleen
2008-11-27 12:28 ` stephane eranian
2008-11-27 12:45 ` Andi Kleen
2008-11-27 13:30 ` stephane eranian
2008-11-27 13:49 ` Andi Kleen
2008-11-27 13:47 ` stephane eranian
-- strict thread matches above, loose matches on Subject: below --
2008-11-25 21:36 eranian
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=alpine.LFD.2.00.0811271132290.3325@localhost.localdomain \
--to=tglx@linutronix.de \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=eranian@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=sfr@canb.auug.org.au \
--cc=x86@kernel.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
all inboxes | Powered by JetHome®