Live data from Hacker News

Portal 2 crashes if you have 128 cores, due to 15 year old assumptions

twitter.com

1–10 of 12 posts

Re: Portal 2 crashes if you have 128 cores, due to 15 year old assumptions

#2
MAX_THREAD_IDS is defined as 128 in a file with a copyright notice of 2005, which was when the very first consumer dual core processors started getting released:

https://github.com/perilouswithadollarsign/cstrike15_src/blo...

Entirely reasonable that no one in 2005 would even consider the possibility of 128 core processors. I bet nobody reconsidered or even looked at that code ever since, until it started breaking because of today's extremely parallel cpus starting to get somewhat affordable for consumers.

Re: Portal 2 crashes if you have 128 cores, due to 15 year old assumptions

#3
>"The solution?"

    # echo 0 > /sys/devices/system/cpu/cpu{121..127}/online
>"Disabling just one core makes the game start, but then it segfaults when the menu opens. Disabling six cores makes the menu work. Disabling seven makes the rest of the game work too."

What path do you walk to be able to figure out this kind of black magic by yourself?

Re: Portal 2 crashes if you have 128 cores, due to 15 year old assumptions

#4

> "The solution?" # echo 0 > /sys/devices/system/cpu/cpu{121..127}/online > "Disabling just one core makes the game start, but then it segfaults when the menu opens. Disabling six cores makes the menu work. Disabling seven makes the rest of the game work too. " What path do you walk to be able to figure out this kind of black magic by yourself?

It's just like the end of Portal 1: you have to remove some cores in order to win the game. ;)

Re: Portal 2 crashes if you have 128 cores, due to 15 year old assumptions

#5

> "The solution?" # echo 0 > /sys/devices/system/cpu/cpu{121..127}/online > "Disabling just one core makes the game start, but then it segfaults when the menu opens. Disabling six cores makes the menu work. Disabling seven makes the rest of the game work too. " What path do you walk to be able to figure out this kind of black magic by yourself?

For anyone curious/hopeful, this only really disables the cores in terms of the kernel.

They're still consuming about the same power they would normally (when idle) :)

Edit: cpusets would probably handle this better dynamically. I'm not sure if that influences the count visible to a process

Re: Portal 2 crashes if you have 128 cores, due to 15 year old assumptions

#7

MAX_THREAD_IDS is defined as 128 in a file with a copyright notice of 2005, which was when the very first consumer dual core processors started getting released: https://github.com/perilouswithadollarsign/cstrike15_src/blo... Entirely reasonable that no one in 2005 would even consider the possibility of 128 core processors. I bet nobody reconsidered or even looked at that code ever since, until it started breaking be…

it's weird because they used to use regular TLS variables and then they swapped to this at some point, pretty sure TF2 uses regular ones

Re: Portal 2 crashes if you have 128 cores, due to 15 year old assumptions

#8

> "The solution?" # echo 0 > /sys/devices/system/cpu/cpu{121..127}/online > "Disabling just one core makes the game start, but then it segfaults when the menu opens. Disabling six cores makes the menu work. Disabling seven makes the rest of the game work too. " What path do you walk to be able to figure out this kind of black magic by yourself?

This isn't really black magic.

Just reading a book on the Linux kernel and it's structure should be enough to get you going.

Re: Portal 2 crashes if you have 128 cores, due to 15 year old assumptions

#10

To be fair, the issue is not that there are too many physical cores, or that someone set that constant to 128. The issue is the code that spawns 1 thread per core doesn't check that constant to limit how many threads it spawns.

One would wonder what this game is planning to do with 128 threads running simultaneously.
Post reply on HN