All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@elte.hu>, LKML <linux-kernel@vger.kernel.org>,
	Paul Mackerras <paulus@samba.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	"K. Prasad" <prasad@linux.vnet.ibm.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>
Subject: Re: [PATCH 2/9] perf: Remove pointless union that wraps the hw breakpoint fields
Date: Mon, 7 Dec 2009 02:46:47 +0100	[thread overview]
Message-ID: <20091207014645.GD4966@nowhere> (raw)
In-Reply-To: <1260095935.7818.258.camel@laptop>

On Sun, Dec 06, 2009 at 11:38:55AM +0100, Peter Zijlstra wrote:
> On Sun, 2009-12-06 at 08:34 +0100, Frederic Weisbecker wrote:
> > It stands to anonymize a structure, but structures can already
> > anonymize by themselves.
> > 
> > Reported-by: Peter Zijlstra <peterz@infradead.org>
> > Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
> > Cc: Paul Mackerras <paulus@samba.org>
> > Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> > Cc: "K. Prasad" <prasad@linux.vnet.ibm.com>
> > ---
> >  include/linux/perf_event.h |   14 ++++++--------
> >  1 files changed, 6 insertions(+), 8 deletions(-)
> > 
> > diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
> > index a61e4de..53230e9 100644
> > --- a/include/linux/perf_event.h
> > +++ b/include/linux/perf_event.h
> > @@ -215,14 +215,12 @@ struct perf_event_attr {
> >  		__u32		wakeup_watermark; /* bytes before wakeup   */
> >  	};
> >  
> > -	union {
> > -		struct { /* Hardware breakpoint info */
> > -			__u64		bp_addr;
> > -			__u32		bp_type;
> > -			__u32		bp_len;
> > -			__u64		__bp_reserved_1;
> > -			__u64		__bp_reserved_2;
> > -		};
> > +	struct { /* Hardware breakpoint info */
> > +		__u64		bp_addr;
> > +		__u32		bp_type;
> > +		__u32		bp_len;
> > +		__u64		__bp_reserved_1;
> > +		__u64		__bp_reserved_2;
> >  	};
> >  
> >  	__u32			__reserved_2;
> 
> So I'm a bit puzzled by the need for
>  - that structure to begin with



It has no practical use. It's just a logical separation
that makes it easier to review.

I won't mind much if you prefer to remove it.


>  - specialized __bp reserves


Because we'll probably have further new needs in the future
in the breakpoint fields. But well, these can map to the
current reserved fields already.



> Furthermore, you still got the packing wrong, leading to different
> structure layout on 32 and 64 bit platforms,..
> 
> How about?
> 
> diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
> index 89098e3..5595154 100644
> --- a/include/linux/perf_event.h
> +++ b/include/linux/perf_event.h
> @@ -215,17 +215,12 @@ struct perf_event_attr {
>  		__u32		wakeup_watermark; /* bytes before wakeup   */
>  	};
>  
> -	struct { /* Hardware breakpoint info */
> -		__u64		bp_addr;
> -		__u32		bp_type;
> -		__u32		bp_len;
> -		__u64		__bp_reserved_1;
> -		__u64		__bp_reserved_2;
> -	};
> -
>  	__u32			__reserved_2;
>  
> -	__u64			__reserved_3;
> +	/* Hardware breakpoint info */
> +	__u64		bp_addr;
> +	__u32		bp_type;
> +	__u32		bp_len;
>  };



Right this fixes the packing layout, but what if
we need other fields for the breakpoints in the future?

Thanks.


  reply	other threads:[~2009-12-07  1:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-06  7:34 [GIT PULL] perf/hw-breakpoints: Various updates Frederic Weisbecker
2009-12-06  7:34 ` [PATCH 1/9] hw-breakpoints: Add two reserved fields for future extensions Frederic Weisbecker
2009-12-06  7:34 ` [PATCH 2/9] perf: Remove pointless union that wraps the hw breakpoint fields Frederic Weisbecker
2009-12-06 10:38   ` Peter Zijlstra
2009-12-07  1:46     ` Frederic Weisbecker [this message]
2009-12-06  7:34 ` [PATCH 3/9] perf: Remove unused struct perf_event::event_callback Frederic Weisbecker
2009-12-06  7:34 ` [PATCH 4/9] hw-breakpoints: Drop callback and task parameters from modify helper Frederic Weisbecker
2009-12-06  7:34 ` [PATCH 5/9] hw-breakpoints: Use overflow handler instead of the event callback Frederic Weisbecker
2009-12-06  7:34 ` [PATCH 6/9] perf: Remove the "event" callback from perf events Frederic Weisbecker
2009-12-06 10:40   ` Peter Zijlstra
2009-12-06  7:34 ` [PATCH 7/9] x86/perf: Exclude the debug stack from the callchains Frederic Weisbecker
2009-12-06  7:34 ` [PATCH 8/9] x86: Fixup wrong debug exception frame link in stacktraces Frederic Weisbecker
2009-12-06  7:34 ` [PATCH 9/9] x86: Fixup wrong irq " Frederic Weisbecker
2009-12-06  7:58 ` [GIT PULL] perf/hw-breakpoints: Various updates Ingo Molnar

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=20091207014645.GD4966@nowhere \
    --to=fweisbec@gmail.com \
    --cc=acme@redhat.com \
    --cc=benh@kernel.crashing.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    --cc=prasad@linux.vnet.ibm.com \
    --cc=tglx@linutronix.de \
    /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.