From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.120]) by mx.groups.io with SMTP id smtpd.web12.267.1587746383021630497 for ; Fri, 24 Apr 2020 09:39:43 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GHJ+q/Vl; spf=pass (domain: redhat.com, ip: 207.211.31.120, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587746382; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lRuSXc6KBo6LKlqCJAxTTN5zrLKiMAfjHi0YewytiSk=; b=GHJ+q/Vl5tIjUG0SnbDGCKmWzlLeDbVfctcJUu2mvNtsdQ87jk52/CHO9OlxApJDFoeuYk VvhHnWUFgdWIKWhyE56MMkaEfT0nzl+g7Z6JSPyveRlhuG8oAt2m+bL4a/JpBtYySLUIsd VZ/uuTaQ/n3Fe0xLOuHm9jyXbPaHtJU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-315-Ht122zEMP0KbFCmJxbp4_g-1; Fri, 24 Apr 2020 12:39:38 -0400 X-MC-Unique: Ht122zEMP0KbFCmJxbp4_g-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D85A41842BFA; Fri, 24 Apr 2020 16:39:36 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-113-159.ams2.redhat.com [10.36.113.159]) by smtp.corp.redhat.com (Postfix) with ESMTP id E6772196AE; Fri, 24 Apr 2020 16:39:35 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH v2 2/2] UefiCpuPkg/MpInitLib: Avoid ApInitReconfig in PEI. To: devel@edk2.groups.io, eric.dong@intel.com Cc: Ray Ni , Chandana Kumar References: <20200422090111.423-1-eric.dong@intel.com> <20200422090111.423-2-eric.dong@intel.com> From: "Laszlo Ersek" Message-ID: <982a9bf3-6fc2-2a47-9730-aa5c6f7a1129@redhat.com> Date: Fri, 24 Apr 2020 18:39:35 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20200422090111.423-2-eric.dong@intel.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 04/22/20 11:01, Dong, Eric wrote: > From: "Dong, Eric" > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2683 > > In PEI phase, AP already been waked up through ApInitConfig, > so it can directly wake up it through change wakup buffer > instead of use ApInitReconfig flag. It can save some time. > > Change code to only use ApInitReconfig flag in DXE phase > which must need to update the wake up buffer. > > Cc: Ray Ni > Cc: Laszlo Ersek > Cc: Chandana Kumar > Signed-off-by: Eric Dong > --- > V2: > 1. Enhance code to remove CpuMpData->ApLoopMode == ApInHltLoop check. > > UefiCpuPkg/Library/MpInitLib/MpLib.c | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c > index 2e87aa1f06..6d3a0ccc72 100644 > --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c > +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c > @@ -1818,7 +1818,14 @@ MpInitLibInitialize ( > // Wakeup APs to do some AP initialize sync (Microcode & MTRR) > // > if (CpuMpData->CpuCount > 1) { > - CpuMpData->InitFlag = ApInitReconfig; > + if (OldCpuMpData != NULL) { > + // > + // Only needs to use this flag for DXE phase to update the wake up > + // buffer. Wakeup buffer allocated in PEI phase is no longer valid > + // in DXE. > + // > + CpuMpData->InitFlag = ApInitReconfig; > + } > WakeUpAP (CpuMpData, TRUE, 0, ApInitializeSync, CpuMpData, TRUE); > // > // Wait for all APs finished initialization > @@ -1826,7 +1833,9 @@ MpInitLibInitialize ( > while (CpuMpData->FinishedCount < (CpuMpData->CpuCount - 1)) { > CpuPause (); > } > - CpuMpData->InitFlag = ApInitDone; > + if (OldCpuMpData != NULL) { > + CpuMpData->InitFlag = ApInitDone; > + } > for (Index = 0; Index < CpuMpData->CpuCount; Index++) { > SetApState (&CpuMpData->CpuData[Index], CpuStateIdle); > } > Hm. The only feedback I could provide for this patch is a regression test result. However, seeing how Ray has outstanding questions for this patch, I think I'll delay my testing to the next version (or do it later for this version, if Ray is ultimately OK with it). Thanks Laszlo