mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stephane Eranian <eranian@hpl.hp.com>
To: Philip Mucci <mucci@cs.utk.edu>
Cc: perfmon@napali.hpl.hp.com,
	"Bryan O'Sullivan" <bos@serpentine.com>,
	perfctr-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: Re: [Perfctr-devel] Re: [perfmon] perfmon2 code review: 32-bit ABI on 64-bit OS
Date: Tue, 14 Feb 2006 15:41:24 -0800	[thread overview]
Message-ID: <20060214234124.GH13532@frankl.hpl.hp.com> (raw)
In-Reply-To: <1139857076.4342.10.camel@localhost.localdomain>

Phil,

On Tue, Feb 14, 2006 at 12:57:55AM +0600, Philip Mucci wrote:
> Stefane,
> 
> I know this is ugly, but what about in the user code checking the arch?
> Is it not true that if a kernel is running 64 bit, it has the 64 tagged
> on the the end of the arch? i.e. mips64, ppc64, x86_64?
> 
> The other solution would be to add am information call to the API, like
> perfctr has. This would export the processor type along with other
> feature bits, including the number of bits of the IP. 
> 

The problem is at compile time and not so much at runtime.
Take a kernel struct that is shared with user (i.e., passed through syscall)
that has the following layout:

	struct foo {
		unsigned long bar;
		int dummy;
	};

For a 64-bit app on a 64-bit OS OR a 32-bit app on a 32-bit OS, this works
perfectly.

For a 32-bit on a 64-bit OS, there is a problem, the 32-bit app must be compiled
with the following definition instead:
	struct foo {
		unsigned long long bar;
		int dummy;
	};

to share the struct with the 64-bit OS. An application compile with the above
struct, would not work when run on a 32-bit OS.

So I think that we need to replace all unsigned long, size_t, void * by uint64_t
to make sure this works either way. It is overkill on pure 32-bit but ensures
that the application can be migrated over to a 64-bit OS without the need for
special recompilation.

-- 
-Stephane

  parent reply	other threads:[~2006-02-14 23:44 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-20 18:37 [perfmon] Re: quick overview of the perfmon2 interface Truong, Dan
2006-01-20 22:22 ` Andrew Morton
2006-01-25 20:33 ` Bryan O'Sullivan
2006-01-25 22:28   ` [Perfctr-devel] " Stephane Eranian
2006-01-25 22:46     ` Bryan O'Sullivan
2006-01-26  7:48       ` Stephane Eranian
2006-01-26 18:26         ` Bryan O'Sullivan
     [not found]     ` <1138649612.4077.50.camel@localhost.localdomain>
     [not found]       ` <1138651545.4487.13.camel@camp4.serpentine.com>
     [not found]         ` <1139155731.4279.0.camel@localhost.localdomain>
     [not found]           ` <1139245253.27739.8.camel@camp4.serpentine.com>
2006-02-10 15:36             ` perfmon2 code review: 32-bit ABI on 64-bit OS Stephane Eranian
2006-02-10 18:27               ` Bryan O'Sullivan
     [not found]                 ` <1139681785.4316.33.camel@localhost.localdomain>
2006-02-11 22:33                   ` [perfmon] " Stephane Eranian
2006-02-12 23:46                     ` [Perfctr-devel] " David Gibson
2006-02-13  0:03                       ` Eric Gouriou
2006-02-13 20:31                         ` Stephane Eranian
     [not found]                     ` <1139857076.4342.10.camel@localhost.localdomain>
2006-02-14 23:41                       ` Stephane Eranian [this message]
2006-02-20 17:54                       ` Stephane Eranian
2006-02-13 20:34                 ` 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=20060214234124.GH13532@frankl.hpl.hp.com \
    --to=eranian@hpl.hp.com \
    --cc=bos@serpentine.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mucci@cs.utk.edu \
    --cc=perfctr-devel@lists.sourceforge.net \
    --cc=perfmon@napali.hpl.hp.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

all inboxes | Powered by JetHome®