Re: Hostid Value - CPUID

2002-03-29 Thread Post, Mark K

Well, I can't really do that, since the source tree for the kernel has the
sysinfo.c reference in the Makefile.  So, all I can assume is that the
install/boot kernel was built without the fix, and later on the fix was
incorporated.  I just rebuilt my kernel from the shipped source, and
rebooted, and /proc/sysinfo is there now.

Mark Post

-Original Message-
From: Oliver Paukstadt [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 29, 2002 10:56 AM
To: [EMAIL PROTECTED]
Subject: Re: Hostid Value - CPUID


On Fri, 29 Mar 2002, Post, Mark K wrote:

> What kernel level made this available?  My 2.4.9 system does not have it,
so
> it must be later than that.
November last year for 2.4.7:
http://www10.software.ibm.com/developerworks/opensource/linux390/current2_4.
shtml#nov232001-linux

Report this as a bug to your kernel packager ;-)

Greetings
Oliver Paukstadt



Re: Hostid Value.

2002-03-29 Thread Alan Altmark

On Friday, 03/29/2002 at 10:27 CST, "Dennis G. Wicks" <[EMAIL PROTECTED]>
wrote:
> Greetings;
>
> I guess you mean it is a privileged instruction in linux/390 because it
> isn't in VM. This leads to the strange situation where you need to be a
> privileged linux user to issue general user CP commands.

The same is true for any guest operating system.

Multi-user systems need supervisor/problem state to maintain the security
and integrity of the operating system and, hence, other users.  E.g. on
z/OS and VSE, only authorized programs can talk to CP because it requires
supervisor state.   We were kind of spoiled by CMS, which, as a
single-user system, runs everything in supervisor state with no worries.

Regards,
Alan Altmark
Sr. Software Engineer
IBM z/VM Development



Re: Hostid Value - CPUID

2002-03-29 Thread Oliver Paukstadt

On Fri, 29 Mar 2002, Post, Mark K wrote:

> What kernel level made this available?  My 2.4.9 system does not have it, so
> it must be later than that.
November last year for 2.4.7:
http://www10.software.ibm.com/developerworks/opensource/linux390/current2_4.shtml#nov232001-linux

Report this as a bug to your kernel packager ;-)

Greetings
Oliver Paukstadt

+++LINUX++
+++Manchmal stehe ich sogar nachts auf und installiere mir eins+++
+++ [EMAIL PROTECTED] +++ http://linux.zSeries.org/ ++
++



Re: Hostid Value - CPUID

2002-03-29 Thread Post, Mark K

What kernel level made this available?  My 2.4.9 system does not have it, so
it must be later than that.

Mark Post

-Original Message-
From: Oliver Paukstadt [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 29, 2002 10:56 AM
To: [EMAIL PROTECTED]
Subject: Re: Hostid Value - CPUID


-snip-
/proc/sysinfo is only available on latest distributions.

Greetings
Oliver Paukstadt



Re: Hostid Value.

2002-03-29 Thread Dennis G. Wicks

Greetings;

I guess you mean it is a privileged instruction in linux/390 because it
isn't in VM. This leads to the strange situation where you need to be a
privileged
linux user to issue general user CP commands.

Thanks for that info.
Dennis




Alan Altmark
cc:
Sent by: LinuxSubject:     Re: Hostid Value.
on 390 Port
<[EMAIL PROTECTED]
ARIST.EDU>


03/29/02 08:17
AM
Please respond
to Linux on 390
Port







On Friday, 03/29/2002 at 07:55 CST, "Dennis G. Wicks" <[EMAIL PROTECTED]>
wrote:
> I can't tell you how to get it in C but you shouldn't need root.
>
> Querying the CPUid is a class G (General/everybody/anybody) command.
>
> Good Luck!
> Dennis

You need the Neale's cpint package if you want to issue CP QUERY commands.
 Diagnose 8 is a privileged instruction and Linux user space programs
can't issue it directly.

The CPU ID is also available via the STIDP instruction, but it too is
privileged.

Regards,
Alan Altmark
Sr. Software Engineer
IBM z/VM Development



Re: Hostid Value - CPUID

2002-03-29 Thread Oliver Paukstadt

On Fri, 29 Mar 2002, Dennis G. Wicks wrote:

> Hey, that's neat!
>
> Even has the nuber of processors assigned and the type of hardware.
> Too bad it doesn't also have the hardware model. That might be useful
> for analysis programs.
/proc/sysinfo has the complete information available through STSI command
(POP zSeries 10-97).
For example:
Manufacturer: IBM
Type: 2064
Model:116
Sequence Code:
Plant:51

CPUs Total:   17
CPUs Configured:  16
CPUs Standby: 0
CPUs Reserved:1
[.]

/proc/sysinfo is only available on latest distributions.

Greetings
Oliver Paukstadt

+++LINUX++
+++Manchmal stehe ich sogar nachts auf und installiere mir eins+++
+++ [EMAIL PROTECTED] +++ http://linux.zSeries.org/ ++
++



Re: Hostid Value.

2002-03-29 Thread Alan Altmark

On Friday, 03/29/2002 at 07:55 CST, "Dennis G. Wicks" <[EMAIL PROTECTED]>
wrote:
> I can't tell you how to get it in C but you shouldn't need root.
>
> Querying the CPUid is a class G (General/everybody/anybody) command.
>
> Good Luck!
> Dennis

You need the Neale's cpint package if you want to issue CP QUERY commands.
 Diagnose 8 is a privileged instruction and Linux user space programs
can't issue it directly.

The CPU ID is also available via the STIDP instruction, but it too is
privileged.

Regards,
Alan Altmark
Sr. Software Engineer
IBM z/VM Development



Re: Hostid Value - CPUID

2002-03-29 Thread Dennis G. Wicks

Hey, that's neat!

Even has the nuber of processors assigned and the type of hardware.
Too bad it doesn't also have the hardware model. That might be useful
for analysis programs.

Thanks!
Dennis




"Ferguson, Neale"
  cc:
Sent by: Linux on 390       Subject: Re: Hostid Value - 
CPUID
Port
<[EMAIL PROTECTED]>


03/29/02 08:21 AM
Please respond to Linux
on 390 Port







Try reading the /proc/cpuinfo file.



Re: Hostid Value - CPUID

2002-03-29 Thread Oliver Paukstadt

On Fri, 29 Mar 2002, Ferguson, Neale wrote:

> Try reading the /proc/cpuinfo file.
/proc/sysinfo is much better but only available in up-to-date kernels.

Greetings
Oliver Paukstadt

+++LINUX++
+++Manchmal stehe ich sogar nachts auf und installiere mir eins+++
+++ [EMAIL PROTECTED] +++ http://linux.zSeries.org/ ++
++



Re: Hostid Value - CPUID

2002-03-29 Thread Ferguson, Neale

Try reading the /proc/cpuinfo file.



Re: Hostid Value.

2002-03-29 Thread Dennis G. Wicks

I can't tell you how to get it in C but you shouldn't need root.

Querying the CPUid is a class G (General/everybody/anybody) command.

Good Luck!
Dennis




Reinald Verheij
   cc:
Sent by: LinuxSubject: Re: Hostid Value.
on 390 Port
<[EMAIL PROTECTED]
ARIST.EDU>


03/29/02 03:35
AM
Please respond
to Linux on 390
Port







>> You can write a tiny app to grab the IBM cpu id
>> hack it up a bit and dump it in hostid if you want

how do I grab the IBM cpu id from a C program (which has no root
privilege)?

Reinald



Re: Hostid Value.

2002-03-29 Thread Reinald Verheij

>> You can write a tiny app to grab the IBM cpu id
>> hack it up a bit and dump it in hostid if you want

how do I grab the IBM cpu id from a C program (which has no root privilege)?

Reinald



Re: Hostid Value.

2002-03-28 Thread Rick Troth

I was wrong.
I misunderstood the nature of gethostid()
and therefore misunderstood the relationship of 'hostid' to it.
Thanks to those who have indulged me in re-education.



Re: Hostid Value.

2002-03-28 Thread Alan Cox

> I submit to you that the inspriation for  'hostid'  on Linux
> comes from  'hostid'  on Solaris,  which does NOT report something
> tied to the IP address  (as gethostid() would).   I further submit

Its way older than Solaris

> that  'hostid'  on Linux does not necessarily report something
> tied to the IP address but rather something it gets from /etc/hostid.

The Linux rule is as documented in info libc - /etc/hostid first if not
then the ip algorithm is used

> The CPU serial number in Sun land appears to be a 32-bit value.

Its actually from NvRAM on sun systems I used. If you know what you are doing
you can change it, because the protection system is trivial and also sun
apparently have published it in error before now.

> 1)  you retool it to report something derived from the CPU ID,  and
> 2)  you take into account the vendor  (to avoid collisions where
> both Sun and IBM happen to report CPU ID "12345").

You have to be very careful how its used, and its normally convenient to
be able to override it. You can write a tiny app to grab the IBM cpu id
hack it up a bit and dump it in hostid if you want

> Dead horse?

No thanks, I've already eaten

Alan



Re: Hostid Value.

2002-03-28 Thread Rick Troth

I have spoken from experience rather than from the spec.
Here I am scratching my head trying to figure out why Willem and Alan
are confusing  'hostid'  with  gethostid(),  and lo and behold
I see cross reference when I bother to read the man pages.   Sorry.

HOWEVER:

hostid != gethostid

I submit to you that the inspriation for  'hostid'  on Linux
comes from  'hostid'  on Solaris,  which does NOT report something
tied to the IP address  (as gethostid() would).   I further submit
that  'hostid'  on Linux does not necessarily report something
tied to the IP address but rather something it gets from /etc/hostid.

The CPU serial number in Sun land appears to be a 32-bit value.
Although Solaris' man pages  (as Linux's)  cross reference
'hostid'  to  gethostid(),  the behaviour of the former
clearly indicates that it is not related to a network address
but rather to the CPU identifier.

Combine the flag that says  "this is a Sun"  with that bit string
and you have something that we hope we can say is unique.
The CPU serial number in IBM (zSeries) land is a 64-bit value
of which we only use 24 or even 20 bits as the identification.
Combine the 64-bit string with  "this is an IBM mainframe"
and you have something that we hope we can say is unique.

Alan said:
> There's really no value to hostid or gethostid() because the result is
> not well-defined across platforms.   ...

Ignoring the gethostid() reference,  I say there *is* value in
'hostid'  if what you're after is a unique identifier  AND IFF
1)  you retool it to report something derived from the CPU ID,  and
2)  you take into account the vendor  (to avoid collisions where
both Sun and IBM happen to report CPU ID "12345").

> And I agree with Alan Cox that things like
> get-me-a-world-unique-64-bit-number() should be obtained by something
> other than the gethostid().

I too agree with that.

> Make such a call part of the POSIX standard
> or something.  It's not a networking thing.  gethostid(), for better or
> worse, is.

Right.   gethostid() is a networking thing.   'hostid'  is not.

Dead horse?



Re: Hostid Value.

2002-03-28 Thread Alan Cox

> And I agree with Alan Cox that things like
> get-me-a-world-unique-64-bit-number() should be obtained by something
> other than the gethostid().  Make such a call part of the POSIX standard
> or something.  It's not a networking thing.  gethostid(), for better or
> worse, is.

For pseudo-random 128bits is apparently what you need due to the birthday
paradox. There is an RFC for this and related standard (look for UUID)

Alan



Re: Hostid Value.

2002-03-28 Thread Alan Altmark

On Thursday, 03/28/2002 at 08:17 CST, Rick Troth <[EMAIL PROTECTED]> wrote:
> When I said it should be "retooled"
> what I meant was that for some HW platforms (like zSeries)
> there is a hardware concept of a processor serial number.
> On such platforms,  'hostid'  should report that value
> or should report something derived from it
> and not something derived from IP address or file content.
>
> Perhaps I've misunderstood the purpose of the 'hostid' command.

There's really no value to hostid or gethostid() because the result is not
well-defined across platforms.  gethostid() was useful in olden days to
find out your own IP address (forget multihomed hosts) so you could answer
the question "Did the connection originate on this host or somewhere
else?".

The fact that we're having this discussion illustrates the problem.  If we
don't agree on the semantics of the data, it has limited value.  Enter
IPv6, stage right.  For those systems on which gethostid() returns an IP
address, what should they do if they have only IPv6 IP addresses?  The
hostid is a 32-bit number.  Rats.

And I agree with Alan Cox that things like
get-me-a-world-unique-64-bit-number() should be obtained by something
other than the gethostid().  Make such a call part of the POSIX standard
or something.  It's not a networking thing.  gethostid(), for better or
worse, is.

Regards,
Alan Altmark
Sr. Software Engineer
IBM z/VM Development



Re: Hostid Value.

2002-03-28 Thread Rick Troth

When I said it should be "retooled"
what I meant was that for some HW platforms (like zSeries)
there is a hardware concept of a processor serial number.
On such platforms,  'hostid'  should report that value
or should report something derived from it
and not something derived from IP address or file content.

Perhaps I've misunderstood the purpose of the 'hostid' command.



Re: Hostid Value.

2002-03-28 Thread Dougie G Lawson

>For S/390 you simply need to set the hostid in the file at boot
appropriately
>by default. (/etc/hostid)

On SuSE 7.0 the hostid file is /var/adm/hostid

Setting it is easy from root (I assume it checks for uid(0) rather than
root - haven't looked at the source yet) with `hostid 12345`. So I suspect
adding that to /etc/boot.local would be the best idea (assuming a mangled
IP address isn't good enough).

Regards, Dougie



Re: Hostid Value.

2002-03-27 Thread Willem Konynenberg

"Rick Troth" wrote:
> 'hostid' should probably be retooled for zSeries.

"Retooled" is probably a somewhat "heavy" term for optionally
calling the sethostid function once during installation, which
will store its argument value in /etc/hostid, from where
gethostid will fetch it henceforth.

> In my experience,  it started with Sun where each motherboard
> had (has) a unique serial number.   Memory is a little fuzzy
> but it was (is) probably tied to the MAC address (ethernet HW addr)
> which followed (follows) the motherboard in many cases.

I'm not sure where it originally started, but the manual
pages all indicate that the gethostid function was originally
introduced in 4.2BSD, which dates it at 1982/1983.
Given that SunOS is documented to be originally based on
4.2BSD, I think it is reasonable to assume that Sun got it
from 4.2BSD, and not the other way around.

Both the BSD and the Linux manual pages mention that the
"normal" value is related to the Internet address of the
local machine.  No mention of MAC address or processor
serial number.

Note the interesting history of this function.  It was
introduced in 1982 in 4.2BSD, with the intent of providing
a 32-bit identifier that was unique among all UNIX systems
in existence.  It was then removed in 4.4BSD, but meanwhile
inherited by System V Release 4, and from there it ended up
in some "official" standards.  (although in the Single Unix
Specification the specification is so diluted as to be
meaningless: "The Open Group does not define the domain
in which the return value is unique.")
I think it is a mistake that has survived far longer than
it should have...

> Linux then emulated this nifty tool,  but did so sloppily.

Actually, Linux does not implement gethostid at all.
It is the GNU C library that implements it at user level,
and I don't think it "did so sloppily", given that it
follows the original BSD spec quite closely.
(although perhaps not the SunOS spec...)

> Well ... for older PCs what we have is better than nothing,  IMHO.
> But again,  should be retooled so that where the processor
> supports a serial number,  that is what gets reported.

I don't understand the logic that lead you to say this.

The gethostid function has well-defined semantics, has had
these since 1982, and the current implementation on Linux
provides these semantics just fine (on old and new PCs, old
and new Sun systems, old and new RS/6000s, and even on S/390).

If you want different semantics for some processor serial
number function, then please use another interface for that.
A processor serial number is only unique for that particular
vendor and model of processor, which does not satisfy the
documented purpose of the gethostid function.


--
 Willem Konynenberg <[EMAIL PROTECTED]>



Re: Hostid Value.

2002-03-27 Thread Alan Cox

> Linux then emulated this nifty tool,  but did so sloppily.=20
> Well ... for older PCs what we have is better than nothing,  IMHO.=20
> But again,  should be retooled so that where the processor=20
> supports a serial number,  that is what gets reported.=20
> (No comments about the privacy concerns.   That is an application issue. =

Actually its a relevant issue for a lot of PC users - lots of daft binary
only apps use hostid blindly. The fact its configurable on the PC makes life
much easier for many things.

For S/390 you simply need to set the hostid in the file at boot appropriately
by default. (/etc/hostid)

Alan



Re: Hostid Value.

2002-03-27 Thread Steve Kotzmoyer

Just fyi, on OS/390 or z/OS 1.x, gethostid returns the 32 bit IP address
of the primary interface.  Many applications written for the mainframe
expect this behavior.

Steve

Alan Cox wrote:
>
> > Linux then emulated this nifty tool,  but did so sloppily.=20
> > Well ... for older PCs what we have is better than nothing,  IMHO.=20
> > But again,  should be retooled so that where the processor=20
> > supports a serial number,  that is what gets reported.=20
> > (No comments about the privacy concerns.   That is an application issue.
> =
>
> Actually its a relevant issue for a lot of PC users - lots of daft binary
> only apps use hostid blindly. The fact its configurable on the PC makes
> life
> much easier for many things.
>
> For S/390 you simply need to set the hostid in the file at boot
> appropriately
> by default. (/etc/hostid)
>
> Alan

--
Steve Kotzmoyer   [EMAIL PROTECTED]

 TCP/IP Monitor Development   Home: (540) 253-5821
 Landmark Systems Work: (703) 464-1695



Re: Hostid Value.

2002-03-27 Thread Rick Troth

'hostid' should probably be retooled for zSeries. 
In my experience,  it started with Sun where each motherboard 
had (has) a unique serial number.   Memory is a little fuzzy 
but it was (is) probably tied to the MAC address (ethernet HW addr) 
which followed (follows) the motherboard in many cases. 
 
Linux then emulated this nifty tool,  but did so sloppily. 
Well ... for older PCs what we have is better than nothing,  IMHO. 
But again,  should be retooled so that where the processor 
supports a serial number,  that is what gets reported. 
 
(No comments about the privacy concerns.   That is an application issue. 
Easy enough to code web clients to not report this stuff.) 
 



Re: Hostid Value.

2002-03-27 Thread Post, Mark K

Eric,

I did some poking around, but exactly what value gets used to generate the
hostid is unclear for any particular system.  The man page for
gethostid/sethostid says "Get  or set a unique 32-bit identifier for the
current machine.  The 32-bit identifier is intended to be unique among all
UNIX systems in  existence.  This  normally resembles  the  Internet
address  for the local machine, as returned by gethostby-name(3), and thus
usually never needs to be set."

But, when I look on my systems, the values aren't even close to the IP
address.  Other places I've looked indicated that the value could be some
kind of hash of the hostname itself.  Others, well...

In any case, it's supposed to be unique, which means that it probably isn't
if you really need it to be.  :)

Mark Post

-Original Message-
From: Eric Lawler [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 27, 2002 7:09 AM
To: [EMAIL PROTECTED]
Subject: Hostid Value.


Hello,

We currently run Linux under VM (2.4.0) in LPAR on S390 G6 processor.
When we issue 'HOSTID - V' cmd we get a hex and a decimal value returned.
Can anyone tell us what this value means or is taken from ?
We use virtual ctcs from Linux virtual machines to an OS390 gateway TCPIP
stack and we do not have a mac address which Linux running on an Intel
for example returns as the Hostid value. See example below of cmd issued on
Linux in a virtual machine.:-

hostid -v
Hostid is 134881268 (0x80a1ff4)

Thanks, Eric Lawler.


Eric Lawler,
Infrastructure Support (Platforms),
Barclays Enable,
Ground Floor (A7), Block 10, Radbroke Hall, WA16 9EU (M).
Phone: 7-2000-3729 (Internal)
+44 (0)1565 613729 (External)
Email: [EMAIL PROTECTED]


Internet communications are not secure and therefore the Barclays Group
does not accept legal responsibility for the contents of this message.
Although the Barclays Group operates anti-virus programmes, it does not
accept responsibility for any damage whatsoever that is caused by
viruses being passed.  Any views or opinions presented are solely those
of the author and do not necessarily represent those of the Barclays
Group.  Replies to this email may be monitored by the Barclays Group
for operational or business reasons.



Re: Hostid Value.

2002-03-27 Thread Dougie G Lawson

Eric,

Try `man hostid`

On my SuSE Intel system (9.180.130.22) I get this:

root@silica ~> hostid -v
Hostid is 3020494466 (0xb4091682)
root@silica ~>

So hostid in that case is giving the, sort of, little-endian form of
9.180.130.22 (0x09B48216).

Regards, Dougie Lawson

--
ITS Technical Support
Enterprise/ASSIST SupportLine for IMS, DB2 & Linux

See me and my 50 year old car in Amherst, MA this summer.
http://www.icccr.org