Re: [patch 05/24] perfmon: X86 generic code (x86)

From: David Miller
Date: Thu Nov 27 2008 - 06:37:52 EST


From: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Date: Thu, 27 Nov 2008 11:56:24 +0100 (CET)

> 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)); ???

Shouldn't be needed and this woule kill performance on RISC (every
struct member is accessed with byte sized loads and shifts/masking).

We did this for the pfkey.h structures by accident, and I truly regret
it.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/