From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=209.132.183.28; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id C9D142034CF93 for ; Thu, 26 Oct 2017 01:22:01 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E4A0AC050904; Thu, 26 Oct 2017 08:25:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E4A0AC050904 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=lersek@redhat.com Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-110.rdu2.redhat.com [10.10.120.110]) by smtp.corp.redhat.com (Postfix) with ESMTP id D64CA5C548; Thu, 26 Oct 2017 08:25:45 +0000 (UTC) To: Eric Dong , edk2-devel@lists.01.org Cc: Ruiyu Ni , Jeff Fan References: <1508997586-2492-1-git-send-email-eric.dong@intel.com> From: Laszlo Ersek Message-ID: Date: Thu, 26 Oct 2017 10:25:44 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <1508997586-2492-1-git-send-email-eric.dong@intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 26 Oct 2017 08:25:47 +0000 (UTC) Subject: Re: [Patch] UefiCpuPkg/MpInitLib: Keep compatible with former solution. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Oct 2017 08:22:02 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 10/26/17 07:59, Eric Dong wrote: > For some special platforms (such as Ovmf), it is possible > that, some APs start up *and finish* before the remaining > APs not start up *at all*. In this case, the enhance (1) I think the word "not" should be removed from the above line, so that we get: "some APs start up *and finish* before the remaining APs [] start up *at all*". (2) For the subject line: can we add "AP counting" or "AP collection" somehow? For example: UefiCpuPkg/MpInitLib: Keep compatible with former AP counting solution. I don't insist, but I think these changes would improve the commit message. They can be implemented before pushing. Either way, Reviewed-by: Laszlo Ersek Thank you for the quick update, Eric and Jeff! Laszlo > solution by changes 0594ec41 not works as expected. > > This change remove check CpuMpData->CpuCount logic to let old > solution still workable if platform owner still set a long > time for PcdCpuApInitTimeOutInMicroSeconds. It's platform > owner's response to decide which solution to use. > > Cc: Ruiyu Ni > Cc: Laszlo Ersek > Cc: Jeff Fan > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Eric Dong > --- > UefiCpuPkg/Library/MpInitLib/MpLib.c | 21 +++++++++++++-------- > 1 file changed, 13 insertions(+), 8 deletions(-) > > diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c > index 48f930b..18060fd 100644 > --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c > +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c > @@ -936,15 +936,20 @@ WakeUpAP ( > } > if (CpuMpData->InitFlag == ApInitConfig) { > // > - // Wait for one potential AP waken up in one specified period > + // Here support two methods to collect AP count through adjust > + // PcdCpuApInitTimeOutInMicroSeconds values. > // > - if (CpuMpData->CpuCount == 0) { > - TimedWaitForApFinish ( > - CpuMpData, > - PcdGet32 (PcdCpuMaxLogicalProcessorNumber) - 1, > - PcdGet32 (PcdCpuApInitTimeOutInMicroSeconds) > - ); > - } > + // one way is set a value to just let the first AP to start the > + // initialization, then through the later while loop to wait all Aps > + // finsh the initialization. > + // The other way is set a value to let all APs finished the initialzation. > + // In this case, the later while loop is useless. > + // > + TimedWaitForApFinish ( > + CpuMpData, > + PcdGet32 (PcdCpuMaxLogicalProcessorNumber) - 1, > + PcdGet32 (PcdCpuApInitTimeOutInMicroSeconds) > + ); > > while (CpuMpData->MpCpuExchangeInfo->NumApsExecuting != 0) { > CpuPause(); >