On 11/29/19 02:22, Ni, Ray wrote: >> >> I suggest that we introduce a new PCD for "token count per chunk", and >> set the default value to 1, in the DEC file. (And we should copy the PCD >> into a global variable, in InitializeDataForMmMp().) >> >> This way, if a platform suddenly starts consuming tokens, it will work >> (there will always be a single available token). If they want to improve >> performance (using a chunked allocation style), they can set the PCD as >> they see fit. >> > > Laszlo, > I agree with you to use to PCD for "token count per chunk". > But I suggest the default value of that PCD can be at least 64. > Reasons: > 1. MM_MP is the new MP protocol in SMM environment and we expect > all SMM code start to use the new protocol instead of the original > StartupThisAp > service exposed through SMM System table.
If we consider the older SmmStartupThisAp() / MmStartupThisAp() member functions, the situation is almost the same -- (almost) no callers. In edk2, only SmmPeriodicSmiLib seems to call this SMST (MMST) API. In edk2-platforms, MinPlatformPkg uses the lib class, and also calls SmmStartupThisAp(). I'm just saying that "all SMM code" using "the original StartupThisAp service" in fact means a single open source platform. > 2. A value of 1 is totally to disable the pre-allocating. I disagree; with value 1, the InitializeDataForMmMp() function allocates a new chunk, with room for 1 token. That occurs ahead of actually needing the token, therefore it is a preallocation. What you mean is that the chunking will not make a difference relative to the current behavior, because every token creation/use will require a new chunk allocation. Indeed. But that doesn't change the fact that the first token will be allocated prior to actually needing it, and if a platform never needs a token, then the first chunk will just be there doing nothing. > I prefer this > pre-allocating is activated by default given the reason #1. > > 64 * 32/64 (SPIN LOCK size) = 2KB/4KB is not a big size. Would it be possible to *not* produce the MM MP protocol at all, if the PCD were 0? Because in that case, the DEC default for the PCD could be 64 (or any other value), and in OVMF we could set the PCD in the DSC file to zero. Thanks, Laszlo -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#51499): https://edk2.groups.io/g/devel/message/51499 Mute This Topic: https://groups.io/mt/63850169/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-