From mboxrd@z Thu Jan 1 00:00:00 1970 Subject: Re: [edk2-devel] [PATCH v4 3/5] UefiCpuPkg/PiSmmCpuDxeSmm: Consume SMM Base Hob for SmBase info To: Wu, Jiaxin ,devel@edk2.groups.io From: =?UTF-8?B?TWFydmluIEjDpHVzZXI=?= X-Originating-Location: Frankfurt am Main, Hesse, DE (172.225.190.213) X-Originating-Platform: Mac Safari 16.3 User-Agent: GROUPS.IO Web Poster MIME-Version: 1.0 Date: Fri, 10 Feb 2023 02:00:22 -0800 References: <20230210060519.11100-4-jiaxin.wu@intel.com> In-Reply-To: <20230210060519.11100-4-jiaxin.wu@intel.com> Message-ID: <15692.1676023222099843300@groups.io> Content-Type: multipart/alternative; boundary="eZp6td5rKH5WZMyeuNUp" --eZp6td5rKH5WZMyeuNUp Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi Jiaxin, 1) mSmmInitialized *must* be volatile. Your current code may cause anything= , from skipping waiting entirely (the loop is optimized away as the compile= r considers it free from side effects) to stalling (the memory access is op= timized away as the compiler considers it locally-immutable). 2) ASSERTs on memory allocation failures are one of the most terrible edk2 = "paradigms". 3) Comparisons against boolean constants are not allowed by the code style = spec. Best regards, Marvin --eZp6td5rKH5WZMyeuNUp Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi Jiaxin,

1) mSmmIn= itialized *must* be volatile. Your current code may cause anything, from sk= ipping waiting entirely (the loop is optimized away as the compiler conside= rs it free from side effects) to stalling (the memory access is optimized a= way as the compiler considers it locally-immutable).

2) ASSERTs = on memory allocation failures are one of the most terrible edk2 "paradigms"= .

3) Comparisons against boolean constants are not allowed by th= e code style spec.

Best regards,
Marvin
--eZp6td5rKH5WZMyeuNUp--