How to disable cores in OpenBSD? reddit / BSD ---------------------------------------------------------------------- Crowdop · 2017-06-19 18:24 Hello, i have never used OpenBSD, but at the moment i need it and i need to be able to disable 4 of 8 CPU cores at kernel level as my server BIOS doesn't have the option for this. I know how to do this on FreeBSD, just add several lines of "hint.lapic.CPUid.disabled=1" to /boot/loader.conf and it works very well. The question is can i do the same in OpenBSD? and please don't' ask why I need it, i just do. ---------------------------------------------------------------------- gyakovlev · 2017-06-19 18:33 try [config(8)](http://man.openbsd.org/config) not sure how it'll work on multi-core as I only have dual-core systems. ukc> find cpu 54 cpu0 at mainbus0 apid -1 flags 0x0 55 cpu* at mainbus0 apid -1 flags 0x0 ukc> disable 55 55 cpu* disabled ---------------------------------------------------------------------- shitty_po · 2017-06-19 19:39 what's the use case for that? isn't what you want is to disable hyperthreading? ---------------------------------------------------------------------- Crowdop · 2017-06-19 21:21 Thank you but it is AMD Opteron and HT disabled is not what i want, what i want is just half cores in job for very specific reason. The only answer i am looking for this question is ether it is possible or not. ---------------------------------------------------------------------- Crowdop · 2017-06-19 21:23 thank you mister, will try it soon. ---------------------------------------------------------------------- [deleted] · 2017-06-19 23:27 deleted ^^^^^^^^^^^^^^^^0.3311 [^^^What ^^^is ^^^this?](https://pastebin.com/FcrFs94k/55941) ---------------------------------------------------------------------- agrajag9 · 2017-06-19 23:35 There are 2 reasons people ask "why" in these situations: 1) Curiosity. Just plain, simple curiousity. 2) To find an alternative solution. Often in IT when people say "I just need it", it's because they're attempting to do something the hard way when there's a simpler solution that involves further root- cause analysis. So in that light, I'm curious why you want to disable cores so as to ascertain if there's a problem closer to the root cause. ---------------------------------------------------------------------- notpeter · 2017-06-20 01:51 No idea as to OP's underlying motivation, but one legit reason could be thermal issues. I've totally had boxes where everything was fine until it got a little too hot and a stable box with reduced performance would be totally acceptable. Or similarly testing whether a much lower spec'd box would offer acceptable performance. ---------------------------------------------------------------------- phessler · 2017-06-20 08:13 OpenBSD doesn't have that option. ---------------------------------------------------------------------- olga32 · 2017-06-20 12:17 y tho? ---------------------------------------------------------------------- teksimian · 2017-06-20 15:14 can you just compile without SMP? ---------------------------------------------------------------------- teksimian · 2017-06-20 15:41 Now op will never know that a far better solution exists ---------------------------------------------------------------------- shitty_po · 2017-06-20 16:52 The brute force method is to add a comparison by CPU number (using cpu_number()) [here](https://grok.dragonflybsd.org/xref/openbsd/sys/ar ch/amd64/amd64/cpu.c#705). I don't know if OpenBSD has anything pre-existing to do this ---------------------------------------------------------------------- teksimian · 2017-06-20 18:07 Are you looking for processor affinity? ---------------------------------------------------------------------- NerdVsGeek · 2017-06-21 20:08 I'll admit I'm curious as to the why for this... I mean potential energy savings and helping mitigate thermal issues come to mind, but... heh, curiosity! ---------------------------------------------------------------------- Crowdop · 2017-06-22 15:23 Too bad, this turns off all cores but one, found no option to disable arbitrary cores ---------------------------------------------------------------------- ben_bai · 2017-06-22 17:27 Not possible unless you compile your own kernel* and don't care which cores exactly are turned off. *you are on your own after this. ---------------------------------------------------------------------- calrogman · 2017-06-24 20:03 Completely untested, but you could try this... Change this line in /sys/arch/amd64/conf/GENERIC.MP: `cpu* at mainbus?` to `cpu1 at mainbus?` `cpu2 at mainbus?` `cpu3 at mainbus?` and rebuild your kernel as documented in `man release`. ---------------------------------------------------------------------- ben_bai · 2017-06-25 16:37 FYI. Yes it works. On my 4 CPU system i booted with 3 CPUs recognized. All good, but then disabling one (boot> boot -c) will result in a reboot loop... ---------------------------------------------------------------------- calrogman · 2017-06-25 20:06 Which one did you disable? ---------------------------------------------------------------------- ben_bai · 2017-06-28 18:43 had CPU0 to CPU2, disabled CPU1 ---------------------------------------------------------------------- calrogman · 2017-06-28 19:03 I'll bet you can only disable the last CPUs in the set.