From owner-freebsd-bugs Tue May 22 12:40: 9 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 8820237B424 for ; Tue, 22 May 2001 12:40:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f4MJe1w60704; Tue, 22 May 2001 12:40:01 -0700 (PDT) (envelope-from gnats) Received: from mail.disney.com (mail.disney.com [204.128.192.15]) by hub.freebsd.org (Postfix) with ESMTP id 8C98D37B422 for ; Tue, 22 May 2001 12:36:41 -0700 (PDT) (envelope-from Jim.Pirzyk@disney.com) Received: from pain10.corp.disney.com (root@pain10.corp.disney.com [153.7.110.100]) by mail.disney.com (Switch-2.0.1/Switch-2.0.1) with SMTP id f4MJa4A27258 for ; Tue, 22 May 2001 12:36:05 -0700 (PDT) Received: from louie.fa.disney.com by pain.corp.disney.com with ESMTP for FreeBSD-gnats-submit@freebsd.org; Tue, 22 May 2001 12:37:27 -0700 Received: from plio.fan.fa.disney.com (plio.fan.fa.disney.com [153.7.118.2]) by louie.fa.disney.com (8.9.2/8.9.2) with ESMTP id MAA28778 for ; Tue, 22 May 2001 12:36:38 -0700 (PDT) (envelope-from Jim.Pirzyk@fa.disney.com) Received: from snoopy.fan.fa.disney.com (snoopy.fan.fa.disney.com [153.7.117.170]) by plio.fan.fa.disney.com (8.9.2/8.9.2) with ESMTP id MAA09413 for ; Tue, 22 May 2001 12:36:37 -0700 (PDT) (envelope-from Jim.Pirzyk@fa.disney.com) Received: (from Jim.Pirzyk@localhost) by snoopy.fan.fa.disney.com (8.11.3/8.9.3) id f4MJaac07081; Tue, 22 May 2001 12:36:36 -0700 (PDT) (envelope-from Jim.Pirzyk@fa.disney.com) Message-Id: <200105221936.f4MJaac07081@snoopy.fan.fa.disney.com> Date: Tue, 22 May 2001 12:36:36 -0700 (PDT) From: Jim.Pirzyk@disney.com Reply-To: Jim.Pirzyk@disney.com To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: kern/27543: linprocfs:/proc/cpuinfo does not handle SMP hosts Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 27543 >Category: kern >Synopsis: /proc/cpuinfo does not handle SMP hosts >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue May 22 12:40:01 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Jim Pirzyk >Release: FreeBSD 4.3-RELEASE i386 >Organization: >Environment: System: FreeBSD snoopy 4.3-RELEASE FreeBSD 4.3-RELEASE #4: Fri Apr 27 01:14:59 PDT 2001 root@snoopy.fan.fa.disney.com:/auto/roy/dist/pub/FreeBSD/4.3-RELEASE/sys/compile/UP_WORKSTATION i386 >Description: cat'ing /compat/linux/proc/cpuinfo only reports information on the first cpu, not all of them: Jim.Pirzyk@brother:/usr/local/etc/rc.d 36>cat /compat/linux/proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 15 stepping : 6 flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 mmx fxsr xmm cpu MHz : 930.96 bogomips : 930.96 Where it should be this: Jim.Pirzyk@brother:/usr/local/etc/rc.d 36>cat /compat/linux/proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 15 stepping : 6 flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 mmx fxsr xmm cpu MHz : 930.96 bogomips : 930.96 processor : 1 vendor_id : GenuineIntel cpu family : 6 model : 15 stepping : 6 flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 mmx fxsr xmm cpu MHz : 930.96 bogomips : 930.96 >How-To-Repeat: cat /compat/linux/proc/cpuinfo on an smp host. >Fix: --- linprocfs_misc.c.orig Thu Dec 7 05:17:55 2000 +++ linprocfs_misc.c Tue May 22 12:28:54 2001 @@ -52,6 +52,7 @@ #include #include #include +#include #include #include @@ -174,7 +175,7 @@ int xlen; char psbuf[512]; /* XXX - conservative */ int class; - int i; + int ncpu, mib[2], i, cpucnt, olen=sizeof(ncpu), plen=0; #if 0 extern char *cpu_model; /* Yuck */ #endif @@ -217,14 +218,22 @@ break; } + mib[0] = CTL_HW; mib[1] = HW_NCPU; + if (kernel_sysctl(p, mib, 2, &ncpu, &olen, NULL, 0, &plen)) + ncpu=1; /* Fake out if the sysctl failed */ + ps = psbuf; - ps += sprintf(ps, + + for (cpucnt = 0; cpucnt < ncpu; cpucnt++) { + if ( cpucnt ) ps += sprintf (ps, "\n"); + + ps += sprintf(ps, "processor\t: %d\n" "vendor_id\t: %.20s\n" "cpu family\t: %d\n" "model\t\t: %d\n" "stepping\t: %d\n", - 0, cpu_vendor, class, cpu, cpu_id & 0xf); + cpucnt, cpu_vendor, class, cpu, cpu_id & 0xf); ps += sprintf(ps, "flags\t\t:"); @@ -248,6 +257,7 @@ (tsc_freq + 4999) / 1000000, ((tsc_freq + 4999) / 10000) % 100); } + } xlen = ps - psbuf; xlen -= uio->uio_offset; >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message