[email protected] (Mark Kettenis), 2016.05.04 (Wed) 16:20 (CEST):
> > Date: Tue, 3 May 2016 08:47:22 -0700
> > From: Philip Guenther <[email protected]>
> >
> > On Tue, 3 May 2016, Mark Kettenis wrote:
> > > I think the answer is that we should set CPUF_PRIMARY earlier. In fact
> > > we can set it in the initializer of cpu_info_primary. I'll need to
> > > check i386 as well.
> >
> > Beware, i386 is weird: quoting i386/machdep.c:
> >
> > * Note that identifycpu() is called twice for the primary CPU: the first
> > * is very early (right after the "OpenBSD X.Y" line) with the CPUF_PRIMARY
> > * flag *not* set, then again later in the config sequence with CPUF_PRIMARY
> > * set. Thus, the tests here for ((ci->ci_flags & CPUF_PRIMARY) == 0) are
> > * actually saying "do this on the first call for each CPU". Don't change
> > * them to use CPU_IS_PRIMARY() because then they would be done on both
> > * calls in the SP build.
> >
> > Setting CPUF_PRIMARY early without doing something about the tests and/or
> > rearranging the calls on the primary CPU will cause problems.
>
> Thanks for the heads-up. That code is pretty gross. But I'm sure we
> can figure out some sort of MD hack for it.
>
> Meanwhile, here is how I propose to address the issue on amd64.
FWIW, works for me, thank you.
(cvc up; patch < patch; config; make; mv; boot; zzz; resume; type msg)
Marcus
OpenBSD 5.9-current (GENERIC.MP) #10: Wed May 4 19:57:06 CEST 2016
x@y:/cvs/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 4166717440 (3973MB)
avail mem = 4035969024 (3849MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.4 @ 0xe0010 (68 entries)
bios0: vendor LENOVO version "6DET72WW (3.22 )" date 10/25/2012
bios0: LENOVO 7470W1W
acpi0 at bios0: rev 2
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP SSDT ECDT APIC MCFG HPET SLIC BOOT ASF! SSDT TCPA DMAR
SSDT SSDT SSDT
acpi0: wakeup devices LID_(S3) SLPB(S3) IGBE(S4) EXP0(S4) EXP1(S4) EXP2(S4)
EXP3(S4) USB0(S3) USB3(S3) USB5(S3) EHC0(S3) EHC1(S3) HDEF(S4)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpiec0 at acpi0
acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Core(TM)2 Duo CPU L9400 @ 1.86GHz, 1862.31 MHz
cpu0:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,XSAVE,NXE,LONG,LAHF,PERF,SENSOR
cpu0: 6MB 64b/line 16-way L2 cache
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 7 var ranges, 88 fixed ranges
cpu0: apic clock running at 266MHz
cpu0: mwait min=64, max=64, C-substates=0.2.2.2.2.1.3, IBE
cpu1 at mainbus0: apid 1 (application processor)
cpu1: Intel(R) Core(TM)2 Duo CPU L9400 @ 1.86GHz, 1862.00 MHz
cpu1:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,XSAVE,NXE,LONG,LAHF,PERF,SENSOR
cpu1: 6MB 64b/line 16-way L2 cache
cpu1: smt 0, core 1, package 0
ioapic0 at mainbus0: apid 1 pa 0xfec00000, version 20, 24 pins
ioapic0: misconfigured as apic 2, remapped to apid 1
acpimcfg0 at acpi0 addr 0xe0000000, bus 0-63
acpihpet0 at acpi0: 14318179 Hz
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus -1 (AGP_)
acpiprt2 at acpi0: bus 2 (EXP0)
acpiprt3 at acpi0: bus 3 (EXP1)
acpiprt4 at acpi0: bus -1 (EXP2)
acpiprt5 at acpi0: bus 5 (EXP3)
acpicpu0 at acpi0: !C3(100@57 mwait.3@0x30), !C2(500@1 mwait.1@0x10), C1(1000@1
mwait.1), PSS
acpicpu1 at acpi0: !C3(100@57 mwait.3@0x30), !C2(500@1 mwait.1@0x10), C1(1000@1
mwait.1), PSS
acpipwrres0 at acpi0: PUBS, resource for USB0, USB3, USB5, EHC0, EHC1
acpitz0 at acpi0: critical temperature is 127 degC
acpitz1 at acpi0: critical temperature is 104 degC
acpibtn0 at acpi0: LID_
acpibtn1 at acpi0: SLPB
"PNP0303" at acpi0 not configured
"IBM3780" at acpi0 not configured
acpibat0 at acpi0: BAT0 model "93P5030" serial 165 type LION oem "SANYO"
acpiac0 at acpi0: AC unit online
acpithinkpad0 at acpi0
"PNP0C14" at acpi0 not configured
acpidock0 at acpi0: GDCK not docked (0)
acpivideo0 at acpi0: VID_
acpivout0 at acpivideo0: LCD0
acpivideo1 at acpi0: VID_
cpu0: Enhanced SpeedStep 1862 MHz: speeds: 1867, 1866, 1600, 800 MHz
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 "Intel GM45 Host" rev 0x07
inteldrm0 at pci0 dev 2 function 0 "Intel GM45 Video" rev 0x07
drm0 at inteldrm0
intagp0 at inteldrm0
agp0 at intagp0: aperture at 0xd0000000, size 0x10000000
inteldrm0: msi
inteldrm0: 1280x800
wsdisplay0 at inteldrm0 mux 1: console (std, vt100 emulation)
wsdisplay0: screen 1-5 added (std, vt100 emulation)
"Intel GM45 Video" rev 0x07 at pci0 dev 2 function 1 not configured
"Intel GM45 HECI" rev 0x07 at pci0 dev 3 function 0 not configured
em0 at pci0 dev 25 function 0 "Intel ICH9 IGP M AMT" rev 0x03: msi, address
00:1f:16:32:df:5c
uhci0 at pci0 dev 26 function 0 "Intel 82801I USB" rev 0x03: apic 1 int 20
uhci1 at pci0 dev 26 function 1 "Intel 82801I USB" rev 0x03: apic 1 int 21
uhci2 at pci0 dev 26 function 2 "Intel 82801I USB" rev 0x03: apic 1 int 22
ehci0 at pci0 dev 26 function 7 "Intel 82801I USB" rev 0x03: apic 1 int 23
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 "Intel EHCI root hub" rev 2.00/1.00 addr 1
azalia0 at pci0 dev 27 function 0 "Intel 82801I HD Audio" rev 0x03: msi
azalia0: codecs: Conexant CX20561
audio0 at azalia0
ppb0 at pci0 dev 28 function 0 "Intel 82801I PCIE" rev 0x03: msi
pci1 at ppb0 bus 2
ppb1 at pci0 dev 28 function 1 "Intel 82801I PCIE" rev 0x03: msi
pci2 at ppb1 bus 3
iwn0 at pci2 dev 0 function 0 "Intel WiFi Link 5300" rev 0x00: msi, MIMO 3T3R,
MoW, address 00:21:6a:8c:3d:9c
ppb2 at pci0 dev 28 function 3 "Intel 82801I PCIE" rev 0x03: msi
pci3 at ppb2 bus 5
uhci3 at pci0 dev 29 function 0 "Intel 82801I USB" rev 0x03: apic 1 int 16
uhci4 at pci0 dev 29 function 1 "Intel 82801I USB" rev 0x03: apic 1 int 17
uhci5 at pci0 dev 29 function 2 "Intel 82801I USB" rev 0x03: apic 1 int 18
ehci1 at pci0 dev 29 function 7 "Intel 82801I USB" rev 0x03: apic 1 int 19
usb1 at ehci1: USB revision 2.0
uhub1 at usb1 "Intel EHCI root hub" rev 2.00/1.00 addr 1
ppb3 at pci0 dev 30 function 0 "Intel 82801BAM Hub-to-PCI" rev 0x93
pci4 at ppb3 bus 13
pcib0 at pci0 dev 31 function 0 "Intel 82801IEM LPC" rev 0x03
ahci0 at pci0 dev 31 function 2 "Intel 82801I AHCI" rev 0x03: msi, AHCI 1.2
ahci0: port 0: 3.0Gb/s
scsibus1 at ahci0: 32 targets
sd0 at scsibus1 targ 0 lun 0: <ATA, SanDisk SDSSDHII, X312> SCSI3 0/direct
fixed naa.5001b44e1d7ef244
sd0: 228936MB, 512 bytes/sector, 468862128 sectors, thin
ichiic0 at pci0 dev 31 function 3 "Intel 82801I SMBus" rev 0x03: apic 1 int 23
iic0 at ichiic0
usb2 at uhci0: USB revision 1.0
uhub2 at usb2 "Intel UHCI root hub" rev 1.00/1.00 addr 1
usb3 at uhci1: USB revision 1.0
uhub3 at usb3 "Intel UHCI root hub" rev 1.00/1.00 addr 1
usb4 at uhci2: USB revision 1.0
uhub4 at usb4 "Intel UHCI root hub" rev 1.00/1.00 addr 1
usb5 at uhci3: USB revision 1.0
uhub5 at usb5 "Intel UHCI root hub" rev 1.00/1.00 addr 1
usb6 at uhci4: USB revision 1.0
uhub6 at usb6 "Intel UHCI root hub" rev 1.00/1.00 addr 1
usb7 at uhci5: USB revision 1.0
uhub7 at usb7 "Intel UHCI root hub" rev 1.00/1.00 addr 1
isa0 at pcib0
isadma0 at isa0
pckbc0 at isa0 port 0x60/5 irq 1 irq 12
pckbd0 at pckbc0 (kbd slot)
wskbd0 at pckbd0: console keyboard, using wsdisplay0
pms0 at pckbc0 (aux slot)
wsmouse0 at pms0 mux 0
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
aps0 at isa0 port 0x1600/31
uvideo0 at uhub0 port 6 configuration 1 interface 0 "Lenovo product 0x480c" rev
2.00/31.34 addr 2
video0 at uvideo0
vscsi0 at root
scsibus2 at vscsi0: 256 targets
softraid0 at root
scsibus3 at softraid0: 256 targets
root on sd0a (ba2fda317d02edc5.a) swap on sd0b dump on sd0b
softraid0: incorrect key or passphrase
uhub2 detached
uhub3 detached
uhub4 detached
video0 detached
uvideo0 detached
uhub0 detached
uhub5 detached
uhub6 detached
uhub7 detached
uhub1 detached
uhub0 at usb2 "Intel UHCI root hub" rev 1.00/1.00 addr 1
uhub1 at usb3 "Intel UHCI root hub" rev 1.00/1.00 addr 1
uhub2 at usb4 "Intel UHCI root hub" rev 1.00/1.00 addr 1
uhub3 at usb0 "Intel EHCI root hub" rev 2.00/1.00 addr 1
uhub4 at usb5 "Intel UHCI root hub" rev 1.00/1.00 addr 1
uhub5 at usb6 "Intel UHCI root hub" rev 1.00/1.00 addr 1
uhub6 at usb7 "Intel UHCI root hub" rev 1.00/1.00 addr 1
uhub7 at usb1 "Intel EHCI root hub" rev 2.00/1.00 addr 1
uvideo0 at uhub3 port 6 configuration 1 interface 0 "Lenovo product 0x480c" rev
2.00/31.34 addr 2
video0 at uvideo0
sd1 at scsibus3 targ 1 lun 0: <OPENBSD, SR CRYPTO, 006> SCSI2 0/direct fixed
sd1: 207103MB, 512 bytes/sector, 424147633 sectors
> ok?
>
>
> Index: cpu.c
> ===================================================================
> RCS file: /cvs/src/sys/arch/amd64/amd64/cpu.c,v
> retrieving revision 1.96
> diff -u -p -r1.96 cpu.c
> --- cpu.c 17 Mar 2016 13:18:47 -0000 1.96
> +++ cpu.c 4 May 2016 14:15:26 -0000
> @@ -170,7 +170,10 @@ struct cfdriver cpu_cd = {
> * CPU, on uniprocessors). The CPU info list is initialized to
> * point at it.
> */
> -struct cpu_info cpu_info_primary = { 0, &cpu_info_primary };
> +struct cpu_info cpu_info_primary = {
> + .ci_self = &cpu_info_primary,
> + .ci_flags = CPUF_PRIMARY
> +};
>
> struct cpu_info *cpu_info_list = &cpu_info_primary;
>
> @@ -401,7 +404,7 @@ cpu_attach(struct device *parent, struct
> switch (caa->cpu_role) {
> case CPU_ROLE_SP:
> printf("(uniprocessor)\n");
> - ci->ci_flags |= CPUF_PRESENT | CPUF_SP | CPUF_PRIMARY;
> + ci->ci_flags |= CPUF_PRESENT | CPUF_SP;
> cpu_intr_init(ci);
> identifycpu(ci);
> #ifdef MTRR
> @@ -413,7 +416,7 @@ cpu_attach(struct device *parent, struct
>
> case CPU_ROLE_BP:
> printf("apid %d (boot processor)\n", caa->cpu_number);
> - ci->ci_flags |= CPUF_PRESENT | CPUF_BSP | CPUF_PRIMARY;
> + ci->ci_flags |= CPUF_PRESENT | CPUF_BSP;
> cpu_intr_init(ci);
> identifycpu(ci);
> #ifdef MTRR
>
>
> !DSPAM:572a065d302926791211174!
>