Re: Detecting SMP

2001-02-24 Thread Mike A. Harris

On Tue, 20 Feb 2001, Burton Windle wrote:

>Hello. Is there a way, when running a non-SMP kernel, to detect or
>otherwise tell (software only; the machine is 2400 miles away) if the
>system has SMP capibilties? Would /proc/cpuinfo show two CPUs if the
>kernel is non-SMP?  Thanks!
>
>(btw, the kernel in question is a stock RH6.2 kernel 2.2.14-5, and yes, I
>know I should update it anyways and that a SMP kernel will run on a UP
>system)

Yes, there are several ways.  How do you want to know how to do
it, in C, or a bash script?  sysconf is one way, parsing
/proc/cpuinfo and /proc/stat is another.  Beware though, if you
parse /proc/cpuinfo or stat, it is very different on different
architectures, particularly sparc.

Here is some code which should do it more or less correctly on
any arch:

ncpus=$(egrep -c ^cpu[0-9]+ /proc/stat || :)
[ "$ncpus" = "0" ] && ncpus=1


--
Mike A. Harris  -  Linux advocate  -  Free Software advocate
  This message is copyright 2001, all rights reserved.
  Views expressed are my own, not necessarily shared by my employer.
--
if (argc > 1 && strcmp(argv[1], "-advice") == 0) {
printf("Don't Panic!\n");
exit(42);
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: Detecting SMP

2001-02-24 Thread Mike A. Harris

On Tue, 20 Feb 2001, Burton Windle wrote:

Hello. Is there a way, when running a non-SMP kernel, to detect or
otherwise tell (software only; the machine is 2400 miles away) if the
system has SMP capibilties? Would /proc/cpuinfo show two CPUs if the
kernel is non-SMP?  Thanks!

(btw, the kernel in question is a stock RH6.2 kernel 2.2.14-5, and yes, I
know I should update it anyways and that a SMP kernel will run on a UP
system)

Yes, there are several ways.  How do you want to know how to do
it, in C, or a bash script?  sysconf is one way, parsing
/proc/cpuinfo and /proc/stat is another.  Beware though, if you
parse /proc/cpuinfo or stat, it is very different on different
architectures, particularly sparc.

Here is some code which should do it more or less correctly on
any arch:

ncpus=$(egrep -c ^cpu[0-9]+ /proc/stat || :)
[ "$ncpus" = "0" ]  ncpus=1


--
Mike A. Harris  -  Linux advocate  -  Free Software advocate
  This message is copyright 2001, all rights reserved.
  Views expressed are my own, not necessarily shared by my employer.
--
if (argc  1  strcmp(argv[1], "-advice") == 0) {
printf("Don't Panic!\n");
exit(42);
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: Detecting SMP

2001-02-22 Thread Maciej W. Rozycki

On Wed, 21 Feb 2001, Tigran Aivazian wrote:

> So, one would normally expect this to mean an SMP board rather than
> multiple processors, _HOWEVER_, I can imagine a very clever MP-aware BIOS
> implementation which detects that there are many processors and prepares
> MP floating config table and does _not_ prepare it otherwise. So, it all
> depends on the BIOS implementation.

 I've seen systems that do so and while it's not forbidden I consider it a
bad thing.  It prevents us from being able to use I/O APICs.

-- 
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--+
+e-mail: [EMAIL PROTECTED], PGP key available+

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: Detecting SMP

2001-02-22 Thread Maciej W. Rozycki

On Wed, 21 Feb 2001, Tigran Aivazian wrote:

 So, one would normally expect this to mean an SMP board rather than
 multiple processors, _HOWEVER_, I can imagine a very clever MP-aware BIOS
 implementation which detects that there are many processors and prepares
 MP floating config table and does _not_ prepare it otherwise. So, it all
 depends on the BIOS implementation.

 I've seen systems that do so and while it's not forbidden I consider it a
bad thing.  It prevents us from being able to use I/O APICs.

-- 
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--+
+e-mail: [EMAIL PROTECTED], PGP key available+

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: Detecting SMP

2001-02-21 Thread Tigran Aivazian

yes, just run the famous mptable program. If the machine is SMP then it
will have a valid Intel MP 1.4 configuration tables so the program will
show meaningful output.

Regards,
Tigran

On Tue, 20 Feb 2001, Burton Windle wrote:

> Hello. Is there a way, when running a non-SMP kernel, to detect or
> otherwise tell (software only; the machine is 2400 miles away) if the
> system has SMP capibilties? Would /proc/cpuinfo show two CPUs if the
> kernel is non-SMP?  Thanks!
> 
> (btw, the kernel in question is a stock RH6.2 kernel 2.2.14-5, and yes, I 
> know I should update it anyways and that a SMP kernel will run on a UP
> system)
> 
> 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: Detecting SMP

2001-02-21 Thread Jay D Allen



What is the platform ( x86, Sparc, alpha or ?)?  On sparc look in the
bootprom (ls /proc/openprom) that works regardless of kernel SMP status.
On Intel I think your out of luck, at least with the commonly available
hardware/software.  In theory there could be a bios-peeking structure in
/proc much like openprom that could give you hints...



Sent by:  [EMAIL PROTECTED]

To:   [EMAIL PROTECTED]
cc:
Subject:  Detecting SMP



Hello. Is there a way, when running a non-SMP kernel, to detect or
otherwise tell (software only; the machine is 2400 miles away) if the
system has SMP capibilties? Would /proc/cpuinfo show two CPUs if the
kernel is non-SMP?  Thanks!

(btw, the kernel in question is a stock RH6.2 kernel 2.2.14-5, and yes, I
know I should update it anyways and that a SMP kernel will run on a UP
system)

--
Burton Windle [EMAIL PROTECTED]
Linux: the "grim reaper of innocent orphaned children."
  from /usr/src/linux-2.4.0/init/main.c:655

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: Detecting SMP

2001-02-21 Thread Tigran Aivazian

On Wed, 21 Feb 2001, Jeff Garzik wrote:

> On Wed, 21 Feb 2001, Tigran Aivazian wrote:
> > yes, just run the famous mptable program. If the machine is SMP then it
> > will have a valid Intel MP 1.4 configuration tables so the program will
> > show meaningful output.
> 
> Does that allow you to detect multiple processors... or just an SMP board?
> 

the answer is in section 4.1 of the Intel MP 1.4 spec:

   "An MP-compliant system must implement the MP floating pointer
structure, ..."

So, one would normally expect this to mean an SMP board rather than
multiple processors, _HOWEVER_, I can imagine a very clever MP-aware BIOS
implementation which detects that there are many processors and prepares
MP floating config table and does _not_ prepare it otherwise. So, it all
depends on the BIOS implementation.

Actually, I never tried unplugging all-1 processors from my SMP machines
and seeing what sort of MP table is left...

Regards,
Tigran

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: Detecting SMP

2001-02-21 Thread Tigran Aivazian

On Wed, 21 Feb 2001, Tigran Aivazian wrote:

> yes, just run the famous mptable program.

before I am snowed under with questions about where to get this program,
here is the src and binaries that I use -- it is quite possible that there
is a newer version (I suspect Ingo Molnar might know better :)

http://www.moses.uklinux.net/mptable

Regards,
Tigran


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: Detecting SMP

2001-02-21 Thread Jeff Garzik

On Wed, 21 Feb 2001, Tigran Aivazian wrote:
> yes, just run the famous mptable program. If the machine is SMP then it
> will have a valid Intel MP 1.4 configuration tables so the program will
> show meaningful output.

Does that allow you to detect multiple processors... or just an SMP board?

Jeff




-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: Detecting SMP

2001-02-21 Thread Jeff Garzik

On Wed, 21 Feb 2001, Tigran Aivazian wrote:
 yes, just run the famous mptable program. If the machine is SMP then it
 will have a valid Intel MP 1.4 configuration tables so the program will
 show meaningful output.

Does that allow you to detect multiple processors... or just an SMP board?

Jeff




-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: Detecting SMP

2001-02-21 Thread Tigran Aivazian

On Wed, 21 Feb 2001, Jeff Garzik wrote:

 On Wed, 21 Feb 2001, Tigran Aivazian wrote:
  yes, just run the famous mptable program. If the machine is SMP then it
  will have a valid Intel MP 1.4 configuration tables so the program will
  show meaningful output.
 
 Does that allow you to detect multiple processors... or just an SMP board?
 

the answer is in section 4.1 of the Intel MP 1.4 spec:

   "An MP-compliant system must implement the MP floating pointer
structure, ..."

So, one would normally expect this to mean an SMP board rather than
multiple processors, _HOWEVER_, I can imagine a very clever MP-aware BIOS
implementation which detects that there are many processors and prepares
MP floating config table and does _not_ prepare it otherwise. So, it all
depends on the BIOS implementation.

Actually, I never tried unplugging all-1 processors from my SMP machines
and seeing what sort of MP table is left...

Regards,
Tigran

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: Detecting SMP

2001-02-21 Thread Jay D Allen



What is the platform ( x86, Sparc, alpha or ?)?  On sparc look in the
bootprom (ls /proc/openprom) that works regardless of kernel SMP status.
On Intel I think your out of luck, at least with the commonly available
hardware/software.  In theory there could be a bios-peeking structure in
/proc much like openprom that could give you hints...



Sent by:  [EMAIL PROTECTED]

To:   [EMAIL PROTECTED]
cc:
Subject:  Detecting SMP



Hello. Is there a way, when running a non-SMP kernel, to detect or
otherwise tell (software only; the machine is 2400 miles away) if the
system has SMP capibilties? Would /proc/cpuinfo show two CPUs if the
kernel is non-SMP?  Thanks!

(btw, the kernel in question is a stock RH6.2 kernel 2.2.14-5, and yes, I
know I should update it anyways and that a SMP kernel will run on a UP
system)

--
Burton Windle [EMAIL PROTECTED]
Linux: the "grim reaper of innocent orphaned children."
  from /usr/src/linux-2.4.0/init/main.c:655

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: Detecting SMP

2001-02-21 Thread Tigran Aivazian

On Wed, 21 Feb 2001, Tigran Aivazian wrote:

 yes, just run the famous mptable program.

before I am snowed under with questions about where to get this program,
here is the src and binaries that I use -- it is quite possible that there
is a newer version (I suspect Ingo Molnar might know better :)

http://www.moses.uklinux.net/mptable

Regards,
Tigran


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: Detecting SMP

2001-02-21 Thread Tigran Aivazian

yes, just run the famous mptable program. If the machine is SMP then it
will have a valid Intel MP 1.4 configuration tables so the program will
show meaningful output.

Regards,
Tigran

On Tue, 20 Feb 2001, Burton Windle wrote:

 Hello. Is there a way, when running a non-SMP kernel, to detect or
 otherwise tell (software only; the machine is 2400 miles away) if the
 system has SMP capibilties? Would /proc/cpuinfo show two CPUs if the
 kernel is non-SMP?  Thanks!
 
 (btw, the kernel in question is a stock RH6.2 kernel 2.2.14-5, and yes, I 
 know I should update it anyways and that a SMP kernel will run on a UP
 system)
 
 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Detecting SMP

2001-02-20 Thread Burton Windle

Hello. Is there a way, when running a non-SMP kernel, to detect or
otherwise tell (software only; the machine is 2400 miles away) if the
system has SMP capibilties? Would /proc/cpuinfo show two CPUs if the
kernel is non-SMP?  Thanks!

(btw, the kernel in question is a stock RH6.2 kernel 2.2.14-5, and yes, I 
know I should update it anyways and that a SMP kernel will run on a UP
system)

-- 
Burton Windle   [EMAIL PROTECTED]
Linux: the "grim reaper of innocent orphaned children."
  from /usr/src/linux-2.4.0/init/main.c:655

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Detecting SMP

2001-02-20 Thread Burton Windle

Hello. Is there a way, when running a non-SMP kernel, to detect or
otherwise tell (software only; the machine is 2400 miles away) if the
system has SMP capibilties? Would /proc/cpuinfo show two CPUs if the
kernel is non-SMP?  Thanks!

(btw, the kernel in question is a stock RH6.2 kernel 2.2.14-5, and yes, I 
know I should update it anyways and that a SMP kernel will run on a UP
system)

-- 
Burton Windle   [EMAIL PROTECTED]
Linux: the "grim reaper of innocent orphaned children."
  from /usr/src/linux-2.4.0/init/main.c:655

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/