Return-Path: Received: from mail-pg0-x232.google.com ([2607:f8b0:400e:c05::232]) by Galois.linutronix.de with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1fQeae-00069F-Cm for speck@linutronix.de; Wed, 06 Jun 2018 21:59:28 +0200 Received: by mail-pg0-x232.google.com with SMTP id a14-v6so2909760pgw.10 for ; Wed, 06 Jun 2018 12:59:28 -0700 (PDT) Received: from i7.lan (c-73-11-52-149.hsd1.or.comcast.net. [73.11.52.149]) by smtp.gmail.com with ESMTPSA id i127-v6sm91393770pfc.154.2018.06.06.12.59.20 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Jun 2018 12:59:20 -0700 (PDT) Sender: Linus Torvalds Date: Wed, 6 Jun 2018 12:59:19 -0700 (PDT) From: Linus Torvalds Subject: [MODERATED] Re: [patch V2 12/12] x86/apic: Ignore secondary threads if nosmt=force In-Reply-To: <20180606192807.929619226@linutronix.de> Message-ID: References: <20180606192714.754943543@linutronix.de> <20180606192807.929619226@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit To: speck@linutronix.de List-ID: On Wed, 6 Jun 2018, speck for Thomas Gleixner wrote: > > nosmt=force makes the APIC detection code ignore the secondary SMT siblings > completely, so they even do not show up as possible CPUs. This is more or > less equivalent to disabling SMT in the BIOS. So if we go down this route, I do think it should be very clearly documented that the BIOS disable can (and does) end up having resource allocation advantages that we cannot do in software later on. The intel optimization manual is not very clear on what the partitioning rules are. I find: "In general, the buffers for staging instructions between major pipe stages are partitioned. These buffers include µop queues after the execution trace cache, the queues after the register rename stage, the reorder buffer which stages instructions for retirement, and the load and store buffers. In the case of load and store buffers, partitioning also provided an easier implementation to maintain memory ordering for each logical processor and detect memory ordering violations" but some of that partitioning may be relaxed if the HT thread is "not active": "In Intel microarchitecture code name Sandy Bridge, the micro-op queue is statically partitioned to provide 28 entries for each logical processor, irrespective of software executing in single thread or multiple threads. If one logical processor is not active in Intel microarchitecture code name Ivy Bridge, then a single thread executing on that processor core can use the 56 entries in the micro-op queue" but I do not know what "not active" means, and how dynamic it is. Some of that partitioning may be entirely static and depend on the early BIOS disabling of HT, and even if we park the cores, the resources will just be wasted. From the above, it does sound like even if some of the instruction queues may be relaxed when one thread is idle (if that is what "not active") means, load and store buffers may be entirely statically partitioned. So I would really wanmt to have a big note along with the "This is more or less equivalent to disabling SMT in the BIOS" because on some loads it might be a case of "less equivalent" than not. Linus