public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ni, Ruiyu" <ruiyu.ni@Intel.com>
To: "Duran, Leo" <leo.duran@amd.com>,
	Laszlo Ersek <lersek@redhat.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Dong, Eric" <eric.dong@intel.com>
Subject: Re: [PATCH] UefiCpuPkg/MtrrLib: Add flag to skip disabling MTRRs prior to MTRR change.
Date: Wed, 19 Sep 2018 16:58:54 +0800	[thread overview]
Message-ID: <698c833c-163d-ccde-8f4e-eae083997895@Intel.com> (raw)
In-Reply-To: <CY4PR12MB1815BA0799966CD815CA2484F91D0@CY4PR12MB1815.namprd12.prod.outlook.com>

On 9/18/2018 10:57 PM, Duran, Leo wrote:
> 
> 
>> -----Original Message-----
>> From: Ni, Ruiyu [mailto:ruiyu.ni@Intel.com]
>> Sent: Tuesday, September 18, 2018 3:34 AM
>> To: Laszlo Ersek <lersek@redhat.com>; Duran, Leo <leo.duran@amd.com>;
>> edk2-devel@lists.01.org
>> Cc: Dong, Eric <eric.dong@intel.com>
>> Subject: Re: [edk2] [PATCH] UefiCpuPkg/MtrrLib: Add flag to skip disabling
>> MTRRs prior to MTRR change.
>>
>> On 9/18/2018 12:38 AM, Laszlo Ersek wrote:
>>> On 09/17/18 18:20, Duran, Leo wrote:
>>>>
>>>>> -----Original Message-----
>>>>> From: Ni, Ruiyu <ruiyu.ni@Intel.com>
>>>>> Sent: Thursday, September 13, 2018 11:44 PM
>>>>> To: Duran, Leo <leo.duran@amd.com>; Laszlo Ersek
>>>>> <lersek@redhat.com>; edk2-devel@lists.01.org
>>>>> Cc: Dong, Eric <eric.dong@intel.com>
>>>>> Subject: Re: [edk2] [PATCH] UefiCpuPkg/MtrrLib: Add flag to skip
>>>>> disabling MTRRs prior to MTRR change.
>>>>>
>>>>> On 9/14/2018 3:31 AM, Duran, Leo wrote:
>>>>>>
>>>>>>
>>>>>>> -----Original Message-----
>>>>>>> From: Ni, Ruiyu <ruiyu.ni@intel.com>
>>>>>>> Sent: Wednesday, September 12, 2018 9:39 PM
>>>>>>> To: Duran, Leo <leo.duran@amd.com>; Laszlo Ersek
>>>>> <lersek@redhat.com>;
>>>>>>> edk2-devel@lists.01.org
>>>>>>> Cc: Dong, Eric <eric.dong@intel.com>
>>>>>>> Subject: RE: [PATCH] UefiCpuPkg/MtrrLib: Add flag to skip
>>>>>>> disabling MTRRs prior to MTRR change.
>>>>>>>
>>>>>>> Leo,
>>>>>>> Sorry I was in leave yesterday so didn't see the mail.
>>>>>>> Which MSRs are shared? Only the
>>>>> MSR_IA32_MTRR_DEF_TYPE_REGISTER?
>>>>>>> Or all the MSRs that configures the CPU MTRR setting?
>>>>>>>
>>>>>>
>>>>>> Hi Ray,
>>>>>> The MTTR config MSRs are also shared by threads within a core.
>>>>>>
>>>>>
>>>>> Hi Leo,
>>>>> Do you think that fixing the caller is more proper?
>>>>
>>>> Hi Ray,
>>>> Actually,
>>>> The proposed PCD is the simplest solution, as that works for us and does
>> not change the existing (default) flow.
>>>>
>>>> That is,
>>>> I'd prefer making a decision about the PCD in platform-specific code,
>> rather than introducing complex detection and heuristics at the caller level in
>> EDK2 (just for AMD).
>>>>
>>>> So, please approve the PCD.
>>
>> Leo,
>> I agree with you on the first part "the PCD is the simplest solution".
>> But this really looks like a workaround of the real issue.
>> For a multiple-socket system, it may contain S sockets, each socket contains C
>> cores and each core contains T threads. In summary the system contains S *
>> C * T threads.
>> As you said all threads inside a core share the MTRR setting.
>> Do all cores inside a socket share the MTRR setting?
>> Do all sockets share the MTRR setting?
>>
>> If one of the answer of above questions is "no", how can we configure the
>> PCD?
>>
> [Duran, Leo]
> Hi Ray,
> The MTTR settings are share by threads within a core (but each core has its own, etc.)
> The PCD would be set in our platform-specific code (e.g., it can be set at build-time in the .DSC file).
> 
> As I mentioned,
> We don't need (Mtrr.Enable=0) to change MTRR settings, so having the PCD to skip (Mtrr.Enable=0) is reasonable for us.
> 
> Leo.
> 

If the PCD is false, no thread disables the MTRR before programming it.
Is it safe? Per Intel's SDM, it's not.

Maybe it works in AMD's case. But I still suggest we change the caller, 
which is more natural.
At least I'd like to see how potential-ugly the change can be.
We can then discuss how to make the ugly change better looking.

>>>
>>> - From my side, if it works for you, it works for me. (The general
>>> trend has been to avoid adding more PCDs to the "core" package DEC
>>> files, but I'm 100% neutral on that.)
>>>
>>> Laszlo
>>>
>>
>> Laszlo,
>> Thanks for pointing out the general trend. Yes less PCDs are very welcomed.
>> To me, PCD is no different from protocol. And even worse, because it's very
>> easily to be over-used.
>> But I am not sure whether a PCD has to be introduced for this issue.
>> Maybe even we choose to fix the caller, the PCD is still needed. I am not
>> sure.
>>
>> --
>> Thanks,
>> Ray
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
> 


-- 
Thanks,
Ray


  reply	other threads:[~2018-09-19  8:58 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-11 15:41 [PATCH] Add flag to skip disabling MTRRs Leo Duran
2018-09-11 15:41 ` [PATCH] UefiCpuPkg/MtrrLib: Add flag to skip disabling MTRRs prior to MTRR change Leo Duran
2018-09-11 18:49   ` Laszlo Ersek
2018-09-11 19:47     ` Duran, Leo
2018-09-12  9:54       ` Laszlo Ersek
2018-09-12 15:17         ` Duran, Leo
2018-09-12 17:59           ` Laszlo Ersek
2018-09-12 18:21             ` Duran, Leo
2018-09-13  2:39               ` Ni, Ruiyu
2018-09-13 19:31                 ` Duran, Leo
2018-09-14  4:44                   ` Ni, Ruiyu
2018-09-17 16:20                     ` Duran, Leo
2018-09-17 16:38                       ` Laszlo Ersek
2018-09-18  8:34                         ` Ni, Ruiyu
2018-09-18 14:57                           ` Duran, Leo
2018-09-19  8:58                             ` Ni, Ruiyu [this message]
2018-09-21 16:52                               ` Duran, Leo
2018-09-21 17:13                                 ` Duran, Leo
2018-09-25 14:29                                   ` Duran, Leo

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=698c833c-163d-ccde-8f4e-eae083997895@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