public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: "Metzger, Markus T" <markus.t.metzger@intel.com>
To: Pedro Alves <palves@redhat.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: RE: [PATCH v2 03/13] btrace, linux: add perf event buffer abstraction
Date: Tue, 27 Jan 2015 18:14:00 -0000	[thread overview]
Message-ID: <A78C989F6D9628469189715575E55B231E6C7F80@IRSMSX104.ger.corp.intel.com> (raw)
In-Reply-To: <54C773CE.8040708@redhat.com>

> -----Original Message-----
> From: Pedro Alves [mailto:palves@redhat.com]
> Sent: Tuesday, January 27, 2015 12:18 PM
> To: Metzger, Markus T
> Cc: gdb-patches@sourceware.org
> Subject: Re: [PATCH v2 03/13] btrace, linux: add perf event buffer abstraction
> 
> On 11/20/2014 10:47 AM, Markus Metzger wrote:
> 
> > -  volatile struct perf_event_mmap_page *header;
> > +  struct perf_event_buffer *pevent;
> >    const uint8_t *begin, *end, *start;
> > -  unsigned long data_head, data_tail, retries = 5;
> > -  size_t buffer_size, size;
> > +  unsigned long long data_head, data_tail, buffer_size, size;
> > +  size_t retries = 5;
> 
> I notice that this is changing types from long to long long.
> Also, a bit odd that retries is now size_t, given it's just a counter.

I changed retries to unsigned int.

data_head and data_tail correspond to respective fields in
struct perf_event_mmap_page, a kernel data structure.
buffer_size corresponds to the data_size field in the same
struct.

I can't say why they had been unsigned long before.  It was likely
a bug.


> > +#if HAVE_LINUX_PERF_EVENT_H
> > +/* A Linux perf event buffer.  */
> > +struct perf_event_buffer
> > +{
> > +  /* The mapped memory.  */
> > +  const uint8_t *mem;
> > +
> > +  /* The size of the mapped memory in bytes.  */
> > +  unsigned long long size;
> > +
> > +  /* A pointer to the data_head field for this buffer. */
> > +  volatile unsigned long long *data_head;
> > +
> > +  /* The data_head value from the last read.  */
> > +  unsigned long long last_head;
> > +};
> 
> Isn't there a better type to use here instead of "long long"?
> Why not size_t, if a host buffer size; uint64_t, if it's a fixed
> buffer format, assuming 64-bit here; or ULONGEST, the widest
> integer we support?

I'm using the same data type as the respective fields in
struct perf_event_mmap_page  (after resolving a few typedefs).

I'm also fine to directly use __u64 or to use uint64_t.

Thanks,
Markus.

Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen, Deutschland
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk
Registergericht: Muenchen HRB 47456
Ust.-IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052

  reply	other threads:[~2015-01-27 15:31 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-20 10:47 [PATCH v2 00/13] record btrace: prepare for a new trace format Markus Metzger
2014-11-20 10:47 ` [PATCH v2 06/13] btrace: update btrace_compute_ftrace parameters Markus Metzger
2014-11-20 10:47 ` [PATCH v2 01/13] btrace: add struct btrace_data Markus Metzger
2015-01-27 11:29   ` Pedro Alves
2014-11-20 10:47 ` [PATCH v2 13/13] [wip] btrace: support Intel(R) Processor Trace Markus Metzger
2014-11-20 16:32   ` Eli Zaretskii
2014-11-20 10:47 ` [PATCH v2 09/13] btrace: identify cpu Markus Metzger
2014-11-20 10:47 ` [PATCH v2 02/13] btrace: add format argument to supports_btrace Markus Metzger
2014-11-20 10:47 ` [PATCH v2 07/13] btrace: extend struct btrace_insn Markus Metzger
2014-11-20 10:47 ` [PATCH v2 04/13] record btrace: add configuration struct Markus Metzger
2014-11-20 10:47 ` [PATCH v2 10/13] btrace: use the new cpu identifier Markus Metzger
2014-11-20 10:47 ` [PATCH v2 11/13] record-btrace: indicate gaps Markus Metzger
2014-11-20 17:32   ` Metzger, Markus T
2014-11-20 17:36     ` Eli Zaretskii
2014-11-20 10:47 ` [PATCH v2 12/13] configure: check for libipt Markus Metzger
2014-11-20 10:47 ` [PATCH v2 08/13] btrace: move and rename btrace-common Markus Metzger
2015-01-27 11:25   ` Pedro Alves
2015-01-28 17:58     ` Metzger, Markus T
2014-11-20 10:47 ` [PATCH v2 03/13] btrace, linux: add perf event buffer abstraction Markus Metzger
2015-01-27 15:31   ` Pedro Alves
2015-01-27 18:14     ` Metzger, Markus T [this message]
2015-01-27 18:15       ` Pedro Alves
2015-01-28 16:50         ` Metzger, Markus T
2014-11-20 10:47 ` [PATCH v2 05/13] record-btrace: add bts buffer size configuration option Markus Metzger
2014-11-20 16:25   ` Eli Zaretskii

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=A78C989F6D9628469189715575E55B231E6C7F80@IRSMSX104.ger.corp.intel.com \
    --to=markus.t.metzger@intel.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).