public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ni, Ruiyu" <ruiyu.ni@Intel.com>
To: Laszlo Ersek <lersek@redhat.com>
Cc: edk2-devel@lists.01.org
Subject: Re: [PATCH] UefiCpuPkg/MpInitLib: AP uses memory preceding IDT to store CpuMpData
Date: Fri, 29 Jun 2018 17:36:09 +0800	[thread overview]
Message-ID: <8f4d9fdf-a437-d8e0-cd42-ce968cbc87c1@Intel.com> (raw)
In-Reply-To: <efba1052-8196-ad9d-d89d-b8e2ea73a245@redhat.com>

On 6/27/2018 8:00 PM, Laszlo Ersek wrote:
> Roughly, I figured that we could set the pre-IDT pointer on the BSP,
> *before*  starting up the APs, to a mapping table. The mapping table
> would consist of two columns, the first containing the APIC ID (of each
> CPU), the second containing AP-specific pointer values. Then, after
> starting up the APs, each AP could locate its own row (based on APIC ID)
> in the table, and the context pointer that belongs to it.
> 
> But, this is likely not useful, as we want to expose just the same one
> pointer value to all APs together.
> 
>>> - or else, we should stick with the current idea, but use atomic
>>>     compare-and-swap operations, so that the original PEI services pointer
>>>     value be restored ultimately, at the least,
>> I like this idea. Will generate the V2 patch.

I finally give up on this direction.
The basic idea of this approach is there is a master AP and many other 
slave APs. The master AP is responsible to save CpuMpData to PeiServices 
pointer location, the restores PeiServices pointer back after all slave 
APs finish.
When slave AP doesn't hit timeout when executing AP procedure, 
everything should be good as long as we take good care of the 
synchronous stuff.
But when one slave AP hits timeout, the master AP is treated as hitting 
timeout as well from BSP's perspective.
So BSP resets the two APs (including master AP) which leads to no one 
restores back the PeiServices pointer.
It's true that in such case BSP can do the restore job. But that causes 
the code very unreadable.

>>
>>> - or else (possibly the simplest fix), allocate a separate IDT for each
>>>     AP, including the UINTN that precedes the (now AP-specific) IDT. This
>>>     means that the PEI services pointer*location*  would be separate for
>>>     each AP, and no contention would occur.
>> I think it's the most complicated fix:)
> It might take the most code, but I guess it would be the simplest to
> reason about. No data sharing --> no locking necessary, and no races
> possible.

I will go in this direction. Yes it may introduce more code but much 
more readable than the above solution. Easy to maintain.

> 
> Anyway, I saw your v2 (just the subject, and your note that we should
> ignore v2 for now). I'll stay tuned for v3.
> 
> Meta-question: some of your emails are apparently addressed to the list
> only, and not CC'd to people who commented earlier on the thread. Did
> you drop CCs deliberately, or is it some kind of mail agent glitch?

I am using Outlook for internal communication, ThunderBird for this 
mailing list.
Sometimes I may click [Reply List] button in that mail client. It will 
only send the mail to the mailing list without CC.
I agree [Reply All] is better:)

-- 
Thanks,
Ray


  reply	other threads:[~2018-06-29  9:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-25  2:54 [PATCH] UefiCpuPkg/MpInitLib: AP uses memory preceding IDT to store CpuMpData Ruiyu Ni
2018-06-25 16:01 ` Laszlo Ersek
2018-06-25 17:01   ` Laszlo Ersek
2018-06-26  7:50     ` Ni, Ruiyu
2018-06-26 12:52       ` Laszlo Ersek
2018-06-26 17:06 ` Laszlo Ersek
2018-06-26 17:20   ` Andrew Fish
2018-06-26 18:57     ` Laszlo Ersek
2018-06-27  6:00       ` Ni, Ruiyu
2018-06-27 12:00         ` Laszlo Ersek
2018-06-29  9:36           ` Ni, Ruiyu [this message]
2018-06-27  5:06     ` Ni, Ruiyu
2018-06-27  4:50   ` Ni, Ruiyu

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=8f4d9fdf-a437-d8e0-cd42-ce968cbc87c1@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