From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=eric.dong@intel.com; receiver=edk2-devel@lists.01.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (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 B9F8D2117CEB4 for ; Fri, 9 Nov 2018 19:19:29 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Nov 2018 19:19:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,485,1534834800"; d="scan'208";a="95158099" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by FMSMGA003.fm.intel.com with ESMTP; 09 Nov 2018 19:19:28 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 9 Nov 2018 19:19:28 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.84]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.214]) with mapi id 14.03.0415.000; Sat, 10 Nov 2018 11:19:26 +0800 From: "Dong, Eric" To: "Kinney, Michael D" , "edk2-devel@lists.01.org" , "afish@apple.com" , Leif Lindholm , "Laszlo Ersek (lersek@redhat.com)" CC: "Ni, Ruiyu" Thread-Topic: [edk2] [Patch 0/2] Separate semaphore container. Thread-Index: AQHUdxYTGrz8bnrZmUWyYKK4ZI8G2KVIWY3w Date: Sat, 10 Nov 2018 03:19:26 +0000 Message-ID: References: <20181108025800.12112-1-eric.dong@intel.com> In-Reply-To: <20181108025800.12112-1-eric.dong@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZDJlZGNkNWYtMWMwYy00YTQwLTgxZTEtNGVkM2NhOGQ4MjlkIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiZEVHeExtUFpiYytvejhhMkk1MzI0RThHdG1YUGtaVWdadWdSYW11clVBNUtreDg4MmhzWlwvRElFMWQ1ejFaSWMifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch 0/2] Separate semaphore container. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Nov 2018 03:19:30 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Stewards: =20 Since this is a bug fix, and the risk for this release is small. I plan to = push this serial changes before edk2-stable201811 tag. If you have any concern, please raise here.=20 Thanks, Eric > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Er= ic > Dong > Sent: Thursday, November 8, 2018 10:58 AM > To: edk2-devel@lists.01.org > Cc: Ni, Ruiyu ; Laszlo Ersek > Subject: [edk2] [Patch 0/2] Separate semaphore container. >=20 > In current implementation, core level semaphore use same container with > package level semaphore. This design will let the core level semaphore no= t > works as expected in below case: > 1. Feature A has CPU_FEATURE_CORE_BEFORE dependence with Feature B. > 2. Feature C has CPU_FEATURE_PACKAGE_AFTER dependence with Feature B. > in this case an core level semaphore will be add between A and B, and an > package level semaphore will be add between B and C. >=20 > For a CPU has one package, two cores and 4 threads. Execute like below: >=20 > Thread 1 Thread 2 ..... Thread 4 > ReleaseSemaph(1,2) -| > WaitForSemaph(1(2)) -|<-----------------------These two are Core Semaph > ReleaseSemaph(1,2) -| > WaitForSemaph(2) -| <--- Core Semaph >=20 > ReleaseSemaph (1,2,3,4) -| > WaitForSemaph (1(4)) -| <---------------- Package Semaph >=20 > ReleaseSemaph(3,4) > WaitForSemaph(4(2)) <- Core Semaph >=20 > In above case, for thread 4, when it executes a core semaphore, i will fo= und > WaitForSemaph(4(2)) is met because Thread 1 has execute a package > semaphore and ReleaseSemaph(4) for it before. This is not an expect behav= ior. > Thread 4 should wait for thread 3 to do this. >=20 > Fix this issue by separate the semaphore container for core level and pac= kage > level. >=20 > Cc: Laszlo Ersek > Cc: Ruiyu Ni > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Eric Dong >=20 > Eric Dong (2): > UefiCpuPkg/RegisterCpuFeaturesLib: Separate semaphore container. > UefiCpuPkg/PiSmmCpuDxeSmm: Separate semaphore container. >=20 > .../RegisterCpuFeaturesLib/CpuFeaturesInitialize.c | 9 ++++++--- > .../RegisterCpuFeaturesLib/RegisterCpuFeatures.h | 7 ++++--- > UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 21 ++++++++++++++-= ------ > 3 files changed, 24 insertions(+), 13 deletions(-) >=20 > -- > 2.15.0.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel