harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rana Dasgupta" <rdasg...@gmail.com>
Subject Re: [DRLVM][PORT] correct API to retrieve processor number
Date Sun, 12 Nov 2006 02:28:35 GMT
I added a patch 2154 to look in the Windows kernel32.dll for
GetNativeSystemInfo first and use it and use GetSystemInfo otherwise.
Because of the organization of  64 bit and 32 bit kernel dlls as
kernel32.dll and WOW redirection of kernel32.dll in emulation mode, this
should ensure that we get back the correct info.

I also added an api port_Cores_number() for Core counting arounf
GetLogicalProcessorInfo(). We can expand this api as we need to also return
cache and NUMA information as we discover further requirements. On the Linux
mailing lists it looks like sysconf() will expand to return cores info for
multicore systems and the NUMA api's on Linux are a different bunch
altogether.

Thanks,
Rana


On 11/1/06, Xiao-Feng Li <xiaofeng.li@gmail.com> wrote:
>
> Very informative! Thanks, Rana.
>
> -xiaofeng
>
> On 11/2/06, Rana Dasgupta <rdasgupt@gmail.com> wrote:
> >    On Windows, there is a bunch of bugs.
> >
> >    - On W2003 SP1, Vista, XP-64 GetLogicalProcessorInformation() is the
> >    recommended api. It returns # of cores on AMD and # of logical procs
> on
> >    Intel.
> >    - GetSystemInfo() is on XP-32 and Windows Server. It does not work in
> >    wow mode. I think GetNativeSystemInfo is needed.
> >    - For x64, the VC/VC++ the __cpuid() intrinsic returns
> >    wrong information
> >
> >       The root cause is that the incorrect versions use the cpuid
> > instruction incorrectly. __cpuid() uses old style cpuid and takes input
> from
> > eax only instead of eax, ecx . GetSystemInfo() uses the registers in
> short
> > mode when doing cpuid, so I think it fails for wow. It is amazing how
> > Windows works at all!
> >
> >
> >
> >
> > On 11/1/06, Xiao-Feng Li <xiaofeng.li@gmail.com> wrote:
> > >
> > > On 11/1/06, Alexey Varlamov <alexey.v.varlamov@gmail.com> wrote:
> > > > Just a wild guess: this may be caused by x86 emulation on em64t
> > > > (x86_64). SDK docs advise to use GetNativeSystemInfo() in such case,
> > > > instead of currently used GetSystemInfo(). (See
> > > > vm\port\src\misc\win\sysinfo.c).
> > > >
> > >
> > > huh, I guess you are right, since my machine is X86-64bit. :-) I will
> > > try the API you pointed.
> > >
> > > Thanks,
> > > xiaofeng
> > >
> > >
> >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message