public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ni, Ray" <ray.ni@intel.com>
To: Laszlo Ersek <lersek@redhat.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	"Wu, Jiaxin" <jiaxin.wu@intel.com>
Cc: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"Dong, Eric" <eric.dong@intel.com>,
	"Zeng, Star" <star.zeng@intel.com>,
	"Kumar, Rahul R" <rahul.r.kumar@intel.com>
Subject: Re: [PATCH v3 5/5] OvmfPkg/SmmCpuFeaturesLib: Skip SMBASE configuration
Date: Fri, 3 Feb 2023 03:45:46 +0000	[thread overview]
Message-ID: <MN6PR11MB8244299569BE5F2EDAE3C9208CD79@MN6PR11MB8244.namprd11.prod.outlook.com> (raw)
In-Reply-To: <00b01cd3-7ed2-b0f1-e2ef-1d48930a0083@redhat.com>



> -----Original Message-----
> From: Laszlo Ersek <lersek@redhat.com>
> Sent: Thursday, February 2, 2023 7:47 PM
> To: Gerd Hoffmann <kraxel@redhat.com>; Wu, Jiaxin <jiaxin.wu@intel.com>
> Cc: Ni, Ray <ray.ni@intel.com>; devel@edk2.groups.io; Dong, Eric
> <eric.dong@intel.com>; Zeng, Star <star.zeng@intel.com>; Kumar, Rahul R
> <rahul.r.kumar@intel.com>
> Subject: Re: [PATCH v3 5/5] OvmfPkg/SmmCpuFeaturesLib: Skip SMBASE
> configuration
> 
> I'm going to comment on this one email up-stream, because it showcases
> the community problem, as far as I'm concerned, and because Jiaxin made
> a reference to my initial request.
> 
> On 2/2/23 10:00, Gerd Hoffmann wrote:
> >   Hi,
> >
> >>> But the serialized SMBASE programming still happens, now in the PEI
> >>> module, and I don't see a good reason why the runtime the new PEI module
> >>> and the runtime of PiSmmCpuDxeSmm combined is faster than before.
> >>
> >> As I said, PEI module can also programs SMBASE in parallel, for
> >> example program the some register directly instead of depending the
> >> existing RSM instruction to reload the SMBASE register with the new
> >> allocated SMBASE each time when it exits SMM.
> >
> > Ok.  So new Intel processors apparently got new MSR(s) to set SMBASE
> > directly.  Any specific reason why you don't add support for that to
> > PiSmmCpuDxeSmm?  That would avoid needing the new HOB (and the related
> > problems with the 8190 cpu limit) in the first place.

The reason is the hardware interface to set SMBASE is in thread scope meaning
such firmware-hardware communication needs to be done for each CPU thread.

It's doable to program the hardware interface using DXE MP service protocol in
CpuSmm driver's entry point.
But, considering the standalone MM environment where the CpuMm driver runs
in a isolated environment and it cannot invoke any DXE or PEI MP service, you could
understand that why we choose to put the hardware interface programming in a separate
PEI module. This is the major reason.
I admit that a minor benefit of this design is we can isolate the private hardware interface
programming in a close-source module. Otherwise, the SmmCpuFeaturesLib might need to
expose a new API for the hardware interface programming.


> 
> See this is *exactly* my problem. The *whole work* on this should have
> started like this, with a new Feature Request Bugzilla:
> 
> "Intel are introducing a new processor register (MSR or other method)
> with their XY product line where firmware can program the SMBASE
> independently of the RSM instruction. The PEI code performing this logic
> will not be open sourced, similarly to other things that are kept
> binary-only in the FSP (firmware support packages), and perhaps
> similarly to how memory chips are initialized in the PEI phase too, by
> "MRC" (memory reference code). Because there is no intent to open source
> the initialization logic, possibly due to the new MSR not even being
> slated for documentation in the Intel SDM, we need a new *binary-only*
> interface."

Fair point. We will submit a Bugzilla for this.

> 
> *That* would have been honest, straight talk. Not this smoke-screen with
> "another vendor might have a different method". That's entirely
> speculative generality. Speculative generality has been an anti-pattern
> in software development for decades, even merely for technical means,
> but here the justification for it is not even technical: the language
> around the generality is just to hide the one actual purpose of the
> feature. Don't do that please. Describe your *specific* use case, list
> your arguments, and then explain your approach for making it
> regression-free for the existent cases.

Agree. Be specific and honest. Tell what we can tell and explain what we
cannot tell.

> 
> PI and UEFI are all about binary interfaces between proprietary vendors.
> As much as I disagree with the entire concept [*], I accept it as a fact
> of life. I just ask that, whenever that pattern (= introducing ABIs,
> rather than APIs) is exercised, at least the *actual goal* be documented.
> 
> ([*] I disagree with the concept for two reasons. One, ideological (no
> further explanation needed). Two, practical. If you "standardize" an
> interface when you have *one* application of it, that's always trouble.
> The second application, if there's ever going to be a second one, will
> almost surely not fit within the framework of the "standard". So it's
> best to either open source all the implementations, or at least openly
> document their *actual* interface needs. Clearly state that the initial
> interface implementation is "work in progress". If there are multiple
> (divergent) applications, *then* try to extract something common, either
> from the open source code bases, or the clearly documented data
> dependencies, and then codify that. UEFI is *hugely* harmed by the
> proliferation of protocols, where every new feature needs to be
> standardized, as soon as one implementation exists. These protocols then
> get ossified and linger around for absolutely forever. I feel that it's
> totally self-inflicted damage; it is the consequence of the proprietary
> software development model -- effectively the unwillingness to share.)

When we designed the flow for the new feature, we examined the design by
thinking about if current SMBASE relocation done in PiSmmCpu driver can fit
in the new design. Our conclusion is yes though we don’t have a plan to do it
meaning we don't want to separate today's SMBASE relocation logic in a separate
driver then produce a HOB.
I hate introducing new interfaces as well. A better design should not only cover
today's use case but also future's use case (5-10 years maybe, no guarantee of forever).
Sometimes the designer might invent some interfaces not flexible enough for satisfying
the future different instances of the similar use cases, that's a bad design in my opinion
but we cannot avoid that. I think that triggered the code-first process which requires
implementation first and standardization second. 
Though this new HOB is not in PI spec, you remind me that we might need to add more fields
to the HOB so a way to distinguish between different versions of the HOB should be considered.
The way could be to introduce a new GUID for new version of HOB, or add a field (version?) in the HOB.
I prefer the second.




  parent reply	other threads:[~2023-02-03  3:45 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-18  9:56 [PATCH v3 0/5] Simplify SMM Relocation Process Wu, Jiaxin
2023-01-18  9:56 ` [PATCH v3 1/5] UefiCpuPkg/SmmBaseHob.h: Add SMM Base HOB Data Wu, Jiaxin
2023-01-18 11:19   ` Gerd Hoffmann
2023-01-18 15:06     ` Ni, Ray
2023-01-19  7:13       ` Gerd Hoffmann
2023-01-29  5:08         ` Wu, Jiaxin
2023-02-01 13:02           ` Gerd Hoffmann
2023-01-20  8:21       ` Laszlo Ersek
2023-01-29  5:24         ` Wu, Jiaxin
2023-02-01 13:14           ` Gerd Hoffmann
2023-02-02  0:44             ` Wu, Jiaxin
2023-02-02  3:54             ` [edk2-devel] " Ni, Ray
2023-02-02  3:52         ` Ni, Ray
2023-02-02 12:51           ` Gerd Hoffmann
2023-02-02 22:29             ` [edk2-devel] " Brian J. Johnson
2023-02-03  3:14               ` Ni, Ray
2023-02-03  7:54                 ` Gerd Hoffmann
2023-02-03 13:22                   ` Wu, Jiaxin
2023-02-03 13:31                     ` Ni, Ray
2023-02-03 15:00                     ` Gerd Hoffmann
2023-01-18  9:56 ` [PATCH v3 2/5] UefiCpuPkg/PiSmmCpuDxeSmm: Fix invalid InitializeMpSyncData call Wu, Jiaxin
2023-01-18  9:56 ` [PATCH v3 3/5] UefiCpuPkg/PiSmmCpuDxeSmm: Consume SMM Base Hob for SmBase info Wu, Jiaxin
2023-01-18 12:02   ` Gerd Hoffmann
2023-01-29  6:14     ` [edk2-devel] " Wu, Jiaxin
2023-01-18  9:56 ` [PATCH v3 4/5] UefiCpuPkg/SmmCpuFeaturesLib: Skip SMBASE configuration Wu, Jiaxin
2023-01-18  9:56 ` [PATCH v3 5/5] OvmfPkg/SmmCpuFeaturesLib: " Wu, Jiaxin
2023-01-18 12:19   ` Gerd Hoffmann
2023-01-18 14:37     ` Ni, Ray
2023-01-19  7:53       ` Gerd Hoffmann
2023-01-29  5:47         ` Wu, Jiaxin
2023-02-01 13:40           ` Gerd Hoffmann
2023-02-02  1:41             ` Wu, Jiaxin
2023-02-02  9:00               ` Gerd Hoffmann
2023-02-02 11:47                 ` Laszlo Ersek
2023-02-02 12:24                   ` Gerd Hoffmann
2023-02-03  3:05                     ` Wu, Jiaxin
2023-02-03  2:47                   ` Wu, Jiaxin
2023-02-03  3:45                   ` Ni, Ray [this message]
2023-02-03  7:31                     ` Gerd Hoffmann
2023-02-03  7:43                       ` Ni, Ray
2023-02-03  8:49                         ` Gerd Hoffmann
2023-02-03 11:18                         ` Wu, Jiaxin
     [not found] ` <173B5EAF72B992BD.14781@groups.io>
2023-02-03  8:59   ` [edk2-devel] " Wu, Jiaxin
2023-02-03  9:04     ` Gerd Hoffmann
2023-02-03 11:15       ` Wu, Jiaxin

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=MN6PR11MB8244299569BE5F2EDAE3C9208CD79@MN6PR11MB8244.namprd11.prod.outlook.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