Is there a way to know when MP kernel is being used ?

I need to know when NTOSKRNL and HAL are the MP versions (specifically
under Windows 2003 Server).
Note that getting the number of processors (using KeNumberProcessors) is
not enough, because if you set the /ONECPU flag on BOOT.INI the system will
tell there is one CPU but it will continue to use the MP kernel.

Is there any way to know this, from a kernel driver ?

Thanks
Inaki

Why do you want this? Your code should not depend on this. Note: that all
the checked builds act as multi-processor.


Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply

“Inaki Castillo” wrote in message
news:xxxxx@ntdev…
>
> I need to know when NTOSKRNL and HAL are the MP versions (specifically
> under Windows 2003 Server).
> Note that getting the number of processors (using KeNumberProcessors) is
> not enough, because if you set the /ONECPU flag on BOOT.INI the system
will
> tell there is one CPU but it will continue to use the MP kernel.
>
> Is there any way to know this, from a kernel driver ?
>
> Thanks
> Inaki
>
>
>

If you are writing a driver that depends (in any way) on the number of
processors then you are asking for trouble.

Jim

-----Original Message-----
From: Inaki Castillo [mailto:xxxxx@inakicastillo.com]
Sent: Monday, April 12, 2004 3:36 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Is there a way to know when MP kernel is being used ?

I need to know when NTOSKRNL and HAL are the MP versions (specifically
under Windows 2003 Server).
Note that getting the number of processors (using KeNumberProcessors) is

not enough, because if you set the /ONECPU flag on BOOT.INI the system
will
tell there is one CPU but it will continue to use the MP kernel.

Is there any way to know this, from a kernel driver ?

Thanks
Inaki


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@youngendeavors.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Well, I expected this question back.:slight_smile:

The reason I need this is that when in DBG mode I check some parameters in
a structure within operating system.
I do this to assert that certain condition is met with other data I have.
This is useful in the testing phase to check everything is okay.

It happens that structure has different shape when you are using MP kernel.

When we are testing here we deploy a debug version for testing that is
tested in many different machines without my control.
In order to check my DBG sanity conditions I need to know when a MP kernel
is being used dynamically.

The problem I have found is that in some machines that do have
multiprocessor, testers use the flag /ONECPU from time to time to simulate
one cpu machines.
When this happens I see one cpu is being used while actually it is a MP
machine that is using only one cpu.

This has nothing to do with release versions.

Thanks for your answer.
Inaki.

At 19:20 12/04/2004 -0400, you wrote:

Why do you want this? Your code should not depend on this. Note: that all
the checked builds act as multi-processor.


Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply

“Inaki Castillo” wrote in message
>news:xxxxx@ntdev…
> >
> > I need to know when NTOSKRNL and HAL are the MP versions (specifically
> > under Windows 2003 Server).
> > Note that getting the number of processors (using KeNumberProcessors) is
> > not enough, because if you set the /ONECPU flag on BOOT.INI the system
>will
> > tell there is one CPU but it will continue to use the MP kernel.
> >
> > Is there any way to know this, from a kernel driver ?
> >
> > Thanks
> > Inaki
> >
> >
> >
>
>
>
>—
>Questions? First check the Kernel Driver FAQ at
>http://www.osronline.com/article.cfm?id=256
>
>You are currently subscribed to ntdev as: xxxxx@inakicastillo.com
>To unsubscribe send a blank email to xxxxx@lists.osr.com

So use a kernel check build for this phase, and then it will always be
consistant. Also you will benefit from the additional checks and
diagnostics of a checked kernel and hal.


Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting

“Inaki Castillo” wrote in message
news:xxxxx@ntdev…
> Well, I expected this question back.:slight_smile:
>
> The reason I need this is that when in DBG mode I check some parameters in
> a structure within operating system.
> I do this to assert that certain condition is met with other data I have.
> This is useful in the testing phase to check everything is okay.
>
> It happens that structure has different shape when you are using MP
kernel.
>
> When we are testing here we deploy a debug version for testing that is
> tested in many different machines without my control.
> In order to check my DBG sanity conditions I need to know when a MP kernel
> is being used dynamically.
>
> The problem I have found is that in some machines that do have
> multiprocessor, testers use the flag /ONECPU from time to time to simulate
> one cpu machines.
> When this happens I see one cpu is being used while actually it is a MP
> machine that is using only one cpu.
>
> This has nothing to do with release versions.
>
> Thanks for your answer.
> Inaki.
>
>
> At 19:20 12/04/2004 -0400, you wrote:
>
> >Why do you want this? Your code should not depend on this. Note: that
all
> >the checked builds act as multi-processor.
> >
> >–
> >Don Burn (MVP, Windows DDK)
> >Windows 2k/XP/2k3 Filesystem and Driver Consulting
> >Remove StopSpam from the email to reply
> >
> >“Inaki Castillo” wrote in message
> >news:xxxxx@ntdev…
> > >
> > > I need to know when NTOSKRNL and HAL are the MP versions (specifically
> > > under Windows 2003 Server).
> > > Note that getting the number of processors (using KeNumberProcessors)
is
> > > not enough, because if you set the /ONECPU flag on BOOT.INI the system
> >will
> > > tell there is one CPU but it will continue to use the MP kernel.
> > >
> > > Is there any way to know this, from a kernel driver ?
> > >
> > > Thanks
> > > Inaki
> > >
> > >
> > >
> >
> >
> >
> >—
> >Questions? First check the Kernel Driver FAQ at
> >http://www.osronline.com/article.cfm?id=256
> >
> >You are currently subscribed to ntdev as: xxxxx@inakicastillo.com
> >To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>

You can use the number of processors for scaling information (on datasets
for example.) That however is slightly different that depending on MP vs UP
kernel.

=====================
Mark Roddy

-----Original Message-----
From: Jim Young [mailto:xxxxx@youngendeavors.com]
Sent: Tuesday, April 13, 2004 12:57 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Is there a way to know when MP kernel is
being used ?

If you are writing a driver that depends (in any way) on the
number of processors then you are asking for trouble.

Jim

-----Original Message-----
From: Inaki Castillo [mailto:xxxxx@inakicastillo.com]
Sent: Monday, April 12, 2004 3:36 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Is there a way to know when MP kernel is being used ?

I need to know when NTOSKRNL and HAL are the MP versions
(specifically
under Windows 2003 Server).
Note that getting the number of processors (using
KeNumberProcessors) is

not enough, because if you set the /ONECPU flag on BOOT.INI the system
will
tell there is one CPU but it will continue to use the MP kernel.

Is there any way to know this, from a kernel driver ?

Thanks
Inaki


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@youngendeavors.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@stratus.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

“some parameters in a structure within operating system”

I’m guessing this is a kernel internal structure that you’re trying to
read from and not one of the DDK exported data structures. Don’t do
this - even in a debug mode you’re pretty much ensuring that your driver
will crash on future releases of the operating system (including service
packs). The layout of the kernel’s internal data could change at any
time.

Particularly if you have no control over the systems your driver is
being deployed on (even for testing) you shouldn’t tie yourself to a
particular build of the OS

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Inaki Castillo
Sent: Tuesday, April 13, 2004 5:46 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Is there a way to know when MP kernel is being used
?

Well, I expected this question back.:slight_smile:

The reason I need this is that when in DBG mode I check some parameters
in a structure within operating system.
I do this to assert that certain condition is met with other data I
have.
This is useful in the testing phase to check everything is okay.

It happens that structure has different shape when you are using MP
kernel.

When we are testing here we deploy a debug version for testing that is
tested in many different machines without my control.
In order to check my DBG sanity conditions I need to know when a MP
kernel is being used dynamically.

The problem I have found is that in some machines that do have
multiprocessor, testers use the flag /ONECPU from time to time to
simulate one cpu machines.
When this happens I see one cpu is being used while actually it is a MP
machine that is using only one cpu.

This has nothing to do with release versions.

Thanks for your answer.
Inaki.

At 19:20 12/04/2004 -0400, you wrote:

Why do you want this? Your code should not depend on this. Note: that

all the checked builds act as multi-processor.


Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting Remove StopSpam from

the email to reply

“Inaki Castillo” wrote in message
>news:xxxxx@ntdev…
> >
> > I need to know when NTOSKRNL and HAL are the MP versions
> > (specifically under Windows 2003 Server).
> > Note that getting the number of processors (using
> > KeNumberProcessors) is not enough, because if you set the /ONECPU
> > flag on BOOT.INI the system
>will
> > tell there is one CPU but it will continue to use the MP kernel.
> >
> > Is there any way to know this, from a kernel driver ?
> >
> > Thanks
> > Inaki
> >
> >
> >
>
>
>
>—
>Questions? First check the Kernel Driver FAQ at
>http://www.osronline.com/article.cfm?id=256
>
>You are currently subscribed to ntdev as: xxxxx@inakicastillo.com To
>unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

You can hardly use checked build on systems which aren’t under your control…

As for original problem, I would check something which is different between MP and UP builds. What about spinlock implementation? Code should differ although I can’t check it now because don’t have UP binaries. I guess KeAcquireSpinLockAtDpcLevel could be simple ret at UP. Note tools as Driver Verifier and Bounds Checker can complicate it and checking should be done carefully. Considering OS version and SP, of course.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http:://www.upek.com]


From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com] on behalf of Don Burn[SMTP:xxxxx@acm.org]
Reply To: Windows System Software Devs Interest List
Sent: Tuesday, April 13, 2004 3:04 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Re:Is there a way to know when MP kernel is being used ?

So use a kernel check build for this phase, and then it will always be
consistant. Also you will benefit from the additional checks and
diagnostics of a checked kernel and hal.


Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting

“Inaki Castillo” wrote in message
> news:xxxxx@ntdev…
> > Well, I expected this question back.:slight_smile:
> >
> > The reason I need this is that when in DBG mode I check some parameters in
> > a structure within operating system.
> > I do this to assert that certain condition is met with other data I have.
> > This is useful in the testing phase to check everything is okay.
> >
> > It happens that structure has different shape when you are using MP
> kernel.
> >
> > When we are testing here we deploy a debug version for testing that is
> > tested in many different machines without my control.
> > In order to check my DBG sanity conditions I need to know when a MP kernel
> > is being used dynamically.
> >
> > The problem I have found is that in some machines that do have
> > multiprocessor, testers use the flag /ONECPU from time to time to simulate
> > one cpu machines.
> > When this happens I see one cpu is being used while actually it is a MP
> > machine that is using only one cpu.
> >
> > This has nothing to do with release versions.
> >
> > Thanks for your answer.
> > Inaki.
>

“Roddy, Mark” wrote in message news:xxxxx@ntdev…
> You can use the number of processors for scaling information (on datasets
> for example.) That however is slightly different that depending on MP vs
UP
> kernel.
>

And while we’re creating the “all 'bout things MP” topic, it would be a
serious error to assume that when you get the number of processors (by
checking KeNumberProcessors) that those processors are (a) contiguous, or
(b) the only processors that will be configured on that system.

So, just cuz you find that KeNumberProcessors is 4, that doesn’t mean that
processors 0,1,2, and 3 are the ones running on the system, or that 2 more
processors might not show up any moment.

I know lots of code that makes these assumptions, including some that I’ve
written. Too bad this will break, someday.

Peter
OSR

Well hopefully there will be some sort of kernel event in whichever version
of the OS supports dynamic processer addition/removal so that us peasants
can actually reconfigure our miserable drivers when the world has changed on
us.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Peter Viscarola
Sent: Tuesday, April 13, 2004 7:13 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Is there a way to know when MP kernel is
being used ?

“Roddy, Mark” wrote in message
> news:xxxxx@ntdev…
> > You can use the number of processors for scaling information (on
> > datasets for example.) That however is slightly different that
> > depending on MP vs
> UP
> > kernel.
> >
>
> And while we’re creating the “all 'bout things MP” topic, it
> would be a serious error to assume that when you get the
> number of processors (by checking KeNumberProcessors) that
> those processors are (a) contiguous, or
> (b) the only processors that will be configured on that system.
>
> So, just cuz you find that KeNumberProcessors is 4, that
> doesn’t mean that processors 0,1,2, and 3 are the ones
> running on the system, or that 2 more processors might not
> show up any moment.
>
> I know lots of code that makes these assumptions, including
> some that I’ve written. Too bad this will break, someday.
>
> Peter
> OSR
>
>
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as:
> xxxxx@hollistech.com To unsubscribe send a blank email to
> xxxxx@lists.osr.com
>

RE: [ntdev] Re:Is there a way to know when MP kernel is being used ?Which HAL and Kernel are in use is stored somewhere in the system, since it knows which one to use on an upgrade. I don’t have an MP machine handy at the moment to try to locate where this is, and I’ve long since forgotten. I’d guess either somewhere in the registry or maybe an inf file.

Loren
----- Original Message -----
From: Michal Vodicka
To: Windows System Software Devs Interest List
Sent: Tuesday, April 13, 2004 11:39 AM
Subject: RE: [ntdev] Re:Is there a way to know when MP kernel is being used ?

You can hardly use checked build on systems which aren’t under your control…

As for original problem, I would check something which is different between MP and UP builds. What about spinlock implementation? Code should differ although I can’t check it now because don’t have UP binaries. I guess KeAcquireSpinLockAtDpcLevel could be simple ret at UP. Note tools as Driver Verifier and Bounds Checker can complicate it and checking should be done carefully. Considering OS version and SP, of course.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http:://www.upek.com]


From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com] on behalf of Don Burn[SMTP:xxxxx@acm.org]

Reply To: Windows System Software Devs Interest List
Sent: Tuesday, April 13, 2004 3:04 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Re:Is there a way to know when MP kernel is being used ?

So use a kernel check build for this phase, and then it will always be
consistant. Also you will benefit from the additional checks and
diagnostics of a checked kernel and hal.


Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting

“Inaki Castillo” wrote in message
news:xxxxx@ntdev…
> Well, I expected this question back.:slight_smile:
>
> The reason I need this is that when in DBG mode I check some parameters in
> a structure within operating system.
> I do this to assert that certain condition is met with other data I have.
> This is useful in the testing phase to check everything is okay.
>
> It happens that structure has different shape when you are using MP
kernel.
>
> When we are testing here we deploy a debug version for testing that is
> tested in many different machines without my control.
> In order to check my DBG sanity conditions I need to know when a MP kernel
> is being used dynamically.
>
> The problem I have found is that in some machines that do have
> multiprocessor, testers use the flag /ONECPU from time to time to simulate
> one cpu machines.
> When this happens I see one cpu is being used while actually it is a MP
> machine that is using only one cpu.
>
> This has nothing to do with release versions.
>
> Thanks for your answer.
> Inaki.


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@earthlink.net
To unsubscribe send a blank email to xxxxx@lists.osr.com

Have you tried reading the registry to see the name of the current version?
Look at

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentType

“Inaki Castillo” wrote in message
news:xxxxx@ntdev…
> Well, I expected this question back.:slight_smile:
>
> The reason I need this is that when in DBG mode I check some parameters in
> a structure within operating system.
> I do this to assert that certain condition is met with other data I have.
> This is useful in the testing phase to check everything is okay.
>
> It happens that structure has different shape when you are using MP
kernel.
>
> When we are testing here we deploy a debug version for testing that is
> tested in many different machines without my control.
> In order to check my DBG sanity conditions I need to know when a MP kernel
> is being used dynamically.
>
> The problem I have found is that in some machines that do have
> multiprocessor, testers use the flag /ONECPU from time to time to simulate
> one cpu machines.
> When this happens I see one cpu is being used while actually it is a MP
> machine that is using only one cpu.
>
> This has nothing to do with release versions.
>
> Thanks for your answer.
> Inaki.
>
>
> At 19:20 12/04/2004 -0400, you wrote:
>
> >Why do you want this? Your code should not depend on this. Note: that
all
> >the checked builds act as multi-processor.
> >
> >–
> >Don Burn (MVP, Windows DDK)
> >Windows 2k/XP/2k3 Filesystem and Driver Consulting
> >Remove StopSpam from the email to reply
> >
> >“Inaki Castillo” wrote in message
> >news:xxxxx@ntdev…
> > >
> > > I need to know when NTOSKRNL and HAL are the MP versions (specifically
> > > under Windows 2003 Server).
> > > Note that getting the number of processors (using KeNumberProcessors)
is
> > > not enough, because if you set the /ONECPU flag on BOOT.INI the system
> >will
> > > tell there is one CPU but it will continue to use the MP kernel.
> > >
> > > Is there any way to know this, from a kernel driver ?
> > >
> > > Thanks
> > > Inaki
> > >
> > >
> > >
> >
> >
> >
> >—
> >Questions? First check the Kernel Driver FAQ at
> >http://www.osronline.com/article.cfm?id=256
> >
> >You are currently subscribed to ntdev as: xxxxx@inakicastillo.com
> >To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>

“Mark Roddy” wrote in message news:xxxxx@ntdev…
> Well hopefully there will be some sort of kernel event in whichever
version
> of the OS supports dynamic processer addition/removal so that us peasants
> can actually reconfigure our miserable drivers when the world has changed
on
> us.
>

We can but hope.

It’s not actually that hard to accomodate dynamically, in any case (look at
the mask of active processors, if a bit is set that you previously haven’t
seen, do what you need to do to accomodate it --similarly if a bit is clear
that was previously set).

The main thing for folks to keep in mind is that if KeNumberProcessors is 4,
those four CPUs could be numbers 62, 12, 7, and 0 (not 0,1,2,3). Thus (BAD
CODE FOLLOWS):

myCpuArray = ExAllocatePoolWithTag(NonpagedPool,
sizeof(MY_STRUCT) * KeNumberProcessors,
‘1vgp’ )

followed by references such as:

stuff = myCpuArray[KeGetCurrentProcessor()]

is a bad idea and could break. Fix it by changing KeNumberProcessors to 64,
and you’re cool (assuming Windows-64 in the examples here, giving 64 CPUs
max).

Peter
OSR

Hmmm, no, indeed it looks useful.
I think this is what I want.

Thank you Doug!
Inaki.

-----Mensaje original-----
De: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]En nombre de Doug
Enviado el: mi?rcoles, 14 de abril de 2004 14:08
Para: Windows System Software Devs Interest List
Asunto: Re:[ntdev] Is there a way to know when MP kernel is being used ?

Have you tried reading the registry to see the name of the current version?
Look at

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentType

“Inaki Castillo” wrote in message
news:xxxxx@ntdev…
> Well, I expected this question back.:slight_smile:
>
> The reason I need this is that when in DBG mode I check some parameters in
> a structure within operating system.
> I do this to assert that certain condition is met with other data I have.
> This is useful in the testing phase to check everything is okay.
>
> It happens that structure has different shape when you are using MP
kernel.
>
> When we are testing here we deploy a debug version for testing that is
> tested in many different machines without my control.
> In order to check my DBG sanity conditions I need to know when a MP kernel
> is being used dynamically.
>
> The problem I have found is that in some machines that do have
> multiprocessor, testers use the flag /ONECPU from time to time to simulate
> one cpu machines.
> When this happens I see one cpu is being used while actually it is a MP
> machine that is using only one cpu.
>
> This has nothing to do with release versions.
>
> Thanks for your answer.
> Inaki.
>
>
> At 19:20 12/04/2004 -0400, you wrote:
>
> >Why do you want this? Your code should not depend on this. Note: that
all
> >the checked builds act as multi-processor.
> >
> >–
> >Don Burn (MVP, Windows DDK)
> >Windows 2k/XP/2k3 Filesystem and Driver Consulting
> >Remove StopSpam from the email to reply
> >
> >“Inaki Castillo” wrote in message
> >news:xxxxx@ntdev…
> > >
> > > I need to know when NTOSKRNL and HAL are the MP versions (specifically
> > > under Windows 2003 Server).
> > > Note that getting the number of processors (using KeNumberProcessors)
is
> > > not enough, because if you set the /ONECPU flag on BOOT.INI the system
> >will
> > > tell there is one CPU but it will continue to use the MP kernel.
> > >
> > > Is there any way to know this, from a kernel driver ?
> > >
> > > Thanks
> > > Inaki
> > >
> > >
> > >
> >
> >
> >
> >—
> >Questions? First check the Kernel Driver FAQ at
> >http://www.osronline.com/article.cfm?id=256
> >
> >You are currently subscribed to ntdev as: xxxxx@inakicastillo.com
> >To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@pandasoftware.es
To unsubscribe send a blank email to xxxxx@lists.osr.com

I know that in an MP system, the “Original Filename” of ntoskrnl.exe is
ntkrnlmp.exe. How hard is it to get to that information from kernel mode ?

Alberto.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of I?aki Castillo
Sent: Wednesday, April 14, 2004 11:24 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Is there a way to know when MP kernel is being used
?

Hmmm, no, indeed it looks useful.
I think this is what I want.

Thank you Doug!
Inaki.

-----Mensaje original-----
De: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]En nombre de Doug
Enviado el: mi?rcoles, 14 de abril de 2004 14:08
Para: Windows System Software Devs Interest List
Asunto: Re:[ntdev] Is there a way to know when MP kernel is being used ?

Have you tried reading the registry to see the name of the current version?
Look at

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentType

“Inaki Castillo” wrote in message
news:xxxxx@ntdev…
> Well, I expected this question back.:slight_smile:
>
> The reason I need this is that when in DBG mode I check some parameters in
> a structure within operating system.
> I do this to assert that certain condition is met with other data I have.
> This is useful in the testing phase to check everything is okay.
>
> It happens that structure has different shape when you are using MP
kernel.
>
> When we are testing here we deploy a debug version for testing that is
> tested in many different machines without my control.
> In order to check my DBG sanity conditions I need to know when a MP kernel
> is being used dynamically.
>
> The problem I have found is that in some machines that do have
> multiprocessor, testers use the flag /ONECPU from time to time to simulate
> one cpu machines.
> When this happens I see one cpu is being used while actually it is a MP
> machine that is using only one cpu.
>
> This has nothing to do with release versions.
>
> Thanks for your answer.
> Inaki.
>
>
> At 19:20 12/04/2004 -0400, you wrote:
>
> >Why do you want this? Your code should not depend on this. Note: that
all
> >the checked builds act as multi-processor.
> >
> >–
> >Don Burn (MVP, Windows DDK)
> >Windows 2k/XP/2k3 Filesystem and Driver Consulting
> >Remove StopSpam from the email to reply
> >
> >“Inaki Castillo” wrote in message
> >news:xxxxx@ntdev…
> > >
> > > I need to know when NTOSKRNL and HAL are the MP versions (specifically
> > > under Windows 2003 Server).
> > > Note that getting the number of processors (using KeNumberProcessors)
is
> > > not enough, because if you set the /ONECPU flag on BOOT.INI the system
> >will
> > > tell there is one CPU but it will continue to use the MP kernel.
> > >
> > > Is there any way to know this, from a kernel driver ?
> > >
> > > Thanks
> > > Inaki
> > >
> > >
> > >
> >
> >
> >
> >—
> >Questions? First check the Kernel Driver FAQ at
> >http://www.osronline.com/article.cfm?id=256
> >
> >You are currently subscribed to ntdev as: xxxxx@inakicastillo.com
> >To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@pandasoftware.es
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@compuware.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.

This may not suffice for machines where the user has copied over new kernals
and HALs…

“Iñaki Castillo” wrote in message
news:xxxxx@ntdev…

Hmmm, no, indeed it looks useful.
I think this is what I want.

Thank you Doug!
Inaki.

-----Mensaje original-----
De: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]En nombre de Doug
Enviado el: miércoles, 14 de abril de 2004 14:08
Para: Windows System Software Devs Interest List
Asunto: Re:[ntdev] Is there a way to know when MP kernel is being used ?

Have you tried reading the registry to see the name of the current version?
Look at

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentType

“Inaki Castillo” wrote in message
news:xxxxx@ntdev…
> Well, I expected this question back.:slight_smile:
>
> The reason I need this is that when in DBG mode I check some parameters in
> a structure within operating system.
> I do this to assert that certain condition is met with other data I have.
> This is useful in the testing phase to check everything is okay.
>
> It happens that structure has different shape when you are using MP
kernel.
>
> When we are testing here we deploy a debug version for testing that is
> tested in many different machines without my control.
> In order to check my DBG sanity conditions I need to know when a MP kernel
> is being used dynamically.
>
> The problem I have found is that in some machines that do have
> multiprocessor, testers use the flag /ONECPU from time to time to simulate
> one cpu machines.
> When this happens I see one cpu is being used while actually it is a MP
> machine that is using only one cpu.
>
> This has nothing to do with release versions.
>
> Thanks for your answer.
> Inaki.
>
>
> At 19:20 12/04/2004 -0400, you wrote:
>
> >Why do you want this? Your code should not depend on this. Note: that
all
> >the checked builds act as multi-processor.
> >
> >–
> >Don Burn (MVP, Windows DDK)
> >Windows 2k/XP/2k3 Filesystem and Driver Consulting
> >Remove StopSpam from the email to reply
> >
> >“Inaki Castillo” wrote in message
> >news:xxxxx@ntdev…
> > >
> > > I need to know when NTOSKRNL and HAL are the MP versions (specifically
> > > under Windows 2003 Server).
> > > Note that getting the number of processors (using KeNumberProcessors)
is
> > > not enough, because if you set the /ONECPU flag on BOOT.INI the system
> >will
> > > tell there is one CPU but it will continue to use the MP kernel.
> > >
> > > Is there any way to know this, from a kernel driver ?
> > >
> > > Thanks
> > > Inaki
> > >
> > >
> > >
> >
> >
> >
> >—
> >Questions? First check the Kernel Driver FAQ at
> >http://www.osronline.com/article.cfm?id=256
> >
> >You are currently subscribed to ntdev as: xxxxx@inakicastillo.com
> >To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@pandasoftware.es
To unsubscribe send a blank email to xxxxx@lists.osr.com

>It’s not actually that hard to accomodate dynamically, in any case (look at

the mask of active processors, if a bit is set that you previously haven’t
seen, do what you need to do to accomodate it --similarly if a bit is clear
that was previously set).

Well, that is fine for the case where you need to know the number of
processors before taking some action, but if you are using this for scaling
information as Mark originally suggested then an event would sure beat
polling this value.

Interesting problem to have though :slight_smile:


Bill McKenzie
Software Engineer - Prism 802.11 Wireless Solutions
Conexant Systems, Inc.

“Peter Viscarola” wrote in message news:xxxxx@ntdev…
>
> “Mark Roddy” wrote in message news:xxxxx@ntdev…
> > Well hopefully there will be some sort of kernel event in whichever
> version
> > of the OS supports dynamic processer addition/removal so that us
peasants
> > can actually reconfigure our miserable drivers when the world has
changed
> on
> > us.
> >
>
> We can but hope.
>
> It’s not actually that hard to accomodate dynamically, in any case (look
at
> the mask of active processors, if a bit is set that you previously haven’t
> seen, do what you need to do to accomodate it --similarly if a bit is
clear
> that was previously set).
>
> The main thing for folks to keep in mind is that if KeNumberProcessors is
4,
> those four CPUs could be numbers 62, 12, 7, and 0 (not 0,1,2,3). Thus
(BAD
> CODE FOLLOWS):
>
> myCpuArray = ExAllocatePoolWithTag(NonpagedPool,
> sizeof(MY_STRUCT) * KeNumberProcessors,
> ‘1vgp’ )
>
> followed by references such as:
>
> stuff = myCpuArray[KeGetCurrentProcessor()]
>
> is a bad idea and could break. Fix it by changing KeNumberProcessors to
64,
> and you’re cool (assuming Windows-64 in the examples here, giving 64 CPUs
> max).
>
> Peter
> OSR
>
>
>

Its not an interesting problem to have. Its a nightmare.

I spent a good long time some 3 years back working on trying to get hotswap processors and memory and IO busses working, and it just didn’t happen. One of the main problems is the processor affinity mask and the fact that everyone believes it to be static. I can pretty trivially hack ACPI so that I can bring new processors into the system or cause remove events for them prepertory to making them go away. You would think that a rebalance at that point would be all that it would take. It isn’t.

We’ve had hardware out there running NT that will hotswap processors, memory, and IO clusters for probably 3-4 years now. None of that works. Oh, the hardware does. Biut there is no way to use it in NT.

Loren

-----Original Message-----
From: Bill McKenzie
Sent: Apr 14, 2004 5:00 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Is there a way to know when MP kernel is being used ?

>It’s not actually that hard to accomodate dynamically, in any case (look at
>the mask of active processors, if a bit is set that you previously haven’t
>seen, do what you need to do to accomodate it --similarly if a bit is clear
>that was previously set).

Well, that is fine for the case where you need to know the number of
processors before taking some action, but if you are using this for scaling
information as Mark originally suggested then an event would sure beat
polling this value.

Interesting problem to have though :slight_smile:


Bill McKenzie
Software Engineer - Prism 802.11 Wireless Solutions
Conexant Systems, Inc.

“Peter Viscarola” wrote in message news:xxxxx@ntdev…
>
> “Mark Roddy” wrote in message news:xxxxx@ntdev…
> > Well hopefully there will be some sort of kernel event in whichever
> version
> > of the OS supports dynamic processer addition/removal so that us
peasants
> > can actually reconfigure our miserable drivers when the world has
changed
> on
> > us.
> >
>
> We can but hope.
>
> It’s not actually that hard to accomodate dynamically, in any case (look
at
> the mask of active processors, if a bit is set that you previously haven’t
> seen, do what you need to do to accomodate it --similarly if a bit is
clear
> that was previously set).
>
> The main thing for folks to keep in mind is that if KeNumberProcessors is
4,
> those four CPUs could be numbers 62, 12, 7, and 0 (not 0,1,2,3). Thus
(BAD
> CODE FOLLOWS):
>
> myCpuArray = ExAllocatePoolWithTag(NonpagedPool,
> sizeof(MY_STRUCT) * KeNumberProcessors,
> ‘1vgp’ )
>
> followed by references such as:
>
> stuff = myCpuArray[KeGetCurrentProcessor()]
>
> is a bad idea and could break. Fix it by changing KeNumberProcessors to
64,
> and you’re cool (assuming Windows-64 in the examples here, giving 64 CPUs
> max).
>
> Peter
> OSR
>
>
>


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@earthlink.net
To unsubscribe send a blank email to xxxxx@lists.osr.com

The affinity mask and other such issues need to be dealt with by the OS
first, using a virtualization scheme, so that nobody gets put out of
business for not understanding that the world changed, and then by
configuration-change-aware components via a configuration event of some
sort. Without OS support I agree that this is not workable.

=====================
Mark Roddy

-----Original Message-----
From: Loren Wilton [mailto:xxxxx@earthlink.net]
Sent: Wednesday, April 14, 2004 9:13 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Is there a way to know when MP kernel is
being used ?

Its not an interesting problem to have. Its a nightmare.

I spent a good long time some 3 years back working on trying
to get hotswap processors and memory and IO busses working,
and it just didn’t happen. One of the main problems is the
processor affinity mask and the fact that everyone believes
it to be static. I can pretty trivially hack ACPI so that I
can bring new processors into the system or cause remove
events for them prepertory to making them go away. You would
think that a rebalance at that point would be all that it
would take. It isn’t.

We’ve had hardware out there running NT that will hotswap
processors, memory, and IO clusters for probably 3-4 years
now. None of that works. Oh, the hardware does. Biut there
is no way to use it in NT.

Loren

-----Original Message-----
From: Bill McKenzie
> Sent: Apr 14, 2004 5:00 PM
> To: Windows System Software Devs Interest List
> Subject: Re:[ntdev] Is there a way to know when MP kernel is
> being used ?
>
> >It’s not actually that hard to accomodate dynamically, in any case
> >(look at the mask of active processors, if a bit is set that you
> >previously haven’t seen, do what you need to do to accomodate it
> >–similarly if a bit is clear that was previously set).
>
> Well, that is fine for the case where you need to know the
> number of processors before taking some action, but if you
> are using this for scaling information as Mark originally
> suggested then an event would sure beat polling this value.
>
> Interesting problem to have though :slight_smile:
>
> –
> Bill McKenzie
> Software Engineer - Prism 802.11 Wireless Solutions Conexant
> Systems, Inc.
>
>
> “Peter Viscarola” wrote in message
> news:xxxxx@ntdev…
> >
> > “Mark Roddy” wrote in message
> news:xxxxx@ntdev…
> > > Well hopefully there will be some sort of kernel event in
> whichever
> > version
> > > of the OS supports dynamic processer addition/removal so that us
> peasants
> > > can actually reconfigure our miserable drivers when the world has
> changed
> > on
> > > us.
> > >
> >
> > We can but hope.
> >
> > It’s not actually that hard to accomodate dynamically, in
> any case (look
> at
> > the mask of active processors, if a bit is set that you
> previously haven’t
> > seen, do what you need to do to accomodate it --similarly
> if a bit is
> clear
> > that was previously set).
> >
> > The main thing for folks to keep in mind is that if
> KeNumberProcessors is
> 4,
> > those four CPUs could be numbers 62, 12, 7, and 0 (not
> 0,1,2,3). Thus
> (BAD
> > CODE FOLLOWS):
> >
> > myCpuArray = ExAllocatePoolWithTag(NonpagedPool,
> > sizeof(MY_STRUCT) * KeNumberProcessors,
> > ‘1vgp’ )
> >
> > followed by references such as:
> >
> > stuff = myCpuArray[KeGetCurrentProcessor()]
> >
> > is a bad idea and could break. Fix it by changing
> KeNumberProcessors to
> 64,
> > and you’re cool (assuming Windows-64 in the examples here,
> giving 64 CPUs
> > max).
> >
> > Peter
> > OSR
> >
> >
> >
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@earthlink.net
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@stratus.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>