From: "Ni, Ray" <ray.ni@intel.com>
To: Laszlo Ersek <lersek@redhat.com>,
"Dong, Eric" <eric.dong@intel.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Gao, Liming" <liming.gao@intel.com>
Subject: Re: [PATCH v2] UefiCpuPkg/PiSmmCpuDxeSmm: Avoid allocate Token every time.
Date: Mon, 2 Dec 2019 05:14:49 +0000 [thread overview]
Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C38341C@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <1f1dd740-420d-2074-dd7e-198b3b5386ad@redhat.com>
> > 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.
The benefit of MmMp is it introduces StartupAllAps service which
is very useful in many core system.
There are needs to call the new services in close source code.
PI spec contains a more detailed description on the differences:
* It is possible to invoke a procedure on multiple processors.
* Supports blocking and non-blocking modes of operation.
>
> > 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 agree 1 is different from disabling the pre-allocating.
But 1 is not enough in a system that needs to use MmMp multiple times
in a single SMI.
>
> > 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.
Back to your suggestion, I am a bit curious why you prefer to have a
PCD to turn on/off MmMp instead of pre-allocating 2KB/4KB memory.
Any PCD introduces a cost that future developers needs to understand
the meaning of the PCD and know how to set the PCD.
Thanks,
Ray
next prev parent reply other threads:[~2019-12-02 5:14 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-28 6:17 [PATCH v2] UefiCpuPkg/PiSmmCpuDxeSmm: Avoid allocate Token every time Dong, Eric
2019-11-28 6:37 ` [edk2-devel] " Ni, Ray
2019-11-28 13:15 ` Philippe Mathieu-Daudé
2019-12-04 5:44 ` Dong, Eric
2019-11-28 13:57 ` Laszlo Ersek
2019-11-29 1:22 ` Ni, Ray
2019-11-29 7:17 ` Laszlo Ersek
2019-12-02 5:14 ` Ni, Ray [this message]
2019-12-02 12:56 ` Laszlo Ersek
2019-11-29 3:02 ` [edk2-devel] " Dong, Eric
2019-11-29 7:39 ` Laszlo Ersek
2019-12-04 5:33 ` Dong, Eric
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=734D49CCEBEEF84792F5B80ED585239D5C38341C@SHSMSX104.ccr.corp.intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox