[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200810071124.17946.arnd@arndb.de>
Date: Tue, 7 Oct 2008 11:24:17 +0200
From: Arnd Bergmann <arnd@...db.de>
To: perfmon2-devel@...ts.sourceforge.net, eranian@...il.com
Cc: "David Gibson" <david@...son.dropbear.id.au>,
linux-kernel@...r.kernel.org
Subject: Re: [perfmon2] perfmon3 interface overview
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 <><
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists