mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: perfmon2-devel@lists.sourceforge.net, eranian@gmail.com
Cc: "David Gibson" <david@gibson.dropbear.id.au>,
	linux-kernel@vger.kernel.org
Subject: Re: [perfmon2] perfmon3 interface overview
Date: Tue, 7 Oct 2008 11:24:17 +0200	[thread overview]
Message-ID: <200810071124.17946.arnd@arndb.de> (raw)
In-Reply-To: <7c86c4470810051423v2116193vc2e1b67ce480488d@mail.gmail.com>

On Sunday 05 October 2008, stephane eranian wrote:
> If I summarize our discussion. It seems we can define the API as follows:
> 
>     int pfm_create_session(int fd, uint64_t flags, pfarg_sinfo_t *sif,
> [ char *smpl_name, void *smpl_arg, size_t arg_size]);
>     int pfm_read_pmrs(int fd, uint64_t flags, void *tab, size_t sz);
>     int pfm_write_pmrs(int fd, uint64_t flags, void *tab, size_t sz);
>     int pfm_attach_session(int fd, uint64_t flags, int target);   /*
> attach, detach with target=-1 */
>     int pfm_control_session(int fd, uint64_t flags);   /* for start/stop */
>     int pfm_control_sets(int fd, uint64_t flags, void *sets, size_t sz);


There are two problems with uint64_t arguments to system calls:

1. You have to mandate the use of stdint.h before including the
perfmon header file. This is a minor problem as long as all callers
go through libpfm, but you can avoid it entirely by using the kernel
__u32 instead of uint32_t style types everywhere in your interface.

2. The calling conventions for passing 64 bit values on 32 bit
architecture are complex, every architecture enforces different
rules here. On the syscall interface, bettwe always use native
types like 'unsigned long' instead of '__u64'. This is different
from the case where you pass a pointer to data, in which case
a '__u64 *' is much preferred over a 'unsigned long *'.

I did not understand the reason for going to a 64 bit flags parameter,
but I think that you would do everyone a favour if you can instead
use two 32-bit flags or a unsigned long flags parameter.

	Arnd <><

  parent reply	other threads:[~2008-10-07  9:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <7c86c4470809231432j4231cfa4g7dd158a7fe9c9277@mail.gmail.com>
2008-09-25 21:48 ` stephane eranian
2008-10-03  6:17   ` David Gibson
     [not found]     ` <7c86c4470810030354x6984372akfe18761da7504a0c@mail.gmail.com>
2008-10-03 10:58       ` stephane eranian
2008-10-03 11:12         ` stephane eranian
2008-10-04  6:05           ` David Gibson
2008-10-04  7:20             ` stephane eranian
2008-10-05  5:44               ` David Gibson
2008-10-05  5:53         ` David Gibson
2008-10-05 21:23           ` stephane eranian
2008-10-07  3:56             ` David Gibson
2008-10-07  9:46               ` stephane eranian
2008-10-08  0:53                 ` David Gibson
2008-10-08 10:09                   ` stephane eranian
2008-10-07  9:24             ` Arnd Bergmann [this message]
2008-10-03 14:44 ` stephane 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=200810071124.17946.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=david@gibson.dropbear.id.au \
    --cc=eranian@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perfmon2-devel@lists.sourceforge.net \
    /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

Powered by JetHome