From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.151, mailfrom: liming.gao@intel.com) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by groups.io with SMTP; Mon, 08 Apr 2019 17:18:47 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Apr 2019 17:18:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,327,1549958400"; d="scan'208";a="159916473" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga004.fm.intel.com with ESMTP; 08 Apr 2019 17:18:46 -0700 Received: from fmsmsx125.amr.corp.intel.com (10.18.125.40) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 8 Apr 2019 17:18:46 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX125.amr.corp.intel.com (10.18.125.40) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 8 Apr 2019 17:18:45 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.92]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.39]) with mapi id 14.03.0415.000; Tue, 9 Apr 2019 08:18:44 +0800 From: "Liming Gao" To: "Feng, Bob C" , "devel@edk2.groups.io" Subject: Re: [Patch V2] BaseTools: Fixed issue in MultiThread Genfds function Thread-Topic: [Patch V2] BaseTools: Fixed issue in MultiThread Genfds function Thread-Index: AQHU6cNfIoSVTSEFxEO5EpAn6JxFdaYpu5jA//98Q4CACcf+sA== Date: Tue, 9 Apr 2019 00:18:43 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E420B33@SHSMSX104.ccr.corp.intel.com> References: <20190403021702.11940-1-bob.c.feng@intel.com> <4A89E2EF3DFEDB4C8BFDE51014F606A14E41D04A@SHSMSX104.ccr.corp.intel.com> <08650203BA1BD64D8AD9B6D5D74A85D1600D1AE0@SHSMSX101.ccr.corp.intel.com> In-Reply-To: <08650203BA1BD64D8AD9B6D5D74A85D1600D1AE0@SHSMSX101.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZWIyYzY4ZmItMDRkZC00YTQ5LTg2YjItOWEzYzk4N2QwODk4IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoidFlVelVxaytBcDVZVVA4dVUrN2ZXTHNqdGxPRVVNcTNhS1dCM0ZVUGY0S1Q5M3haOE1cL04xRDNha2g2TXhONzAifQ== 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 Return-Path: liming.gao@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable If so, the change is good to me. Reviewed-by: Liming Gao > -----Original Message----- > From: Feng, Bob C > Sent: Wednesday, April 3, 2019 10:56 AM > To: Gao, Liming > Cc: edk2-devel@lists.01.org > Subject: RE: [Patch V2] BaseTools: Fixed issue in MultiThread Genfds func= tion >=20 > If user does not use multiple thread genfds, there will be no problem. >=20 > -----Original Message----- > From: Gao, Liming > Sent: Wednesday, April 3, 2019 10:49 AM > To: Feng, Bob C > Cc: edk2-devel@lists.01.org > Subject: RE: [Patch V2] BaseTools: Fixed issue in MultiThread Genfds func= tion >=20 > Bob: > Thanks for your updating. If user only update BaseTools, and don't upda= te Conf\build_rule.txt. What problem will happen? >=20 > Thanks > Liming > > -----Original Message----- > > From: Feng, Bob C > > Sent: Wednesday, April 3, 2019 10:17 AM > > To: edk2-devel@lists.01.org > > Cc: Feng, Bob C ; Gao, Liming > > > > Subject: [Patch V2] BaseTools: Fixed issue in MultiThread Genfds > > function > > > > https://bugzilla.tianocore.org/show_bug.cgi?id=3D1450 > > In the Multiple thread Genfds feature, build tool generates GenSec, > > GenFFS command in Makefile. > > > > The Non-Hii Driver does not generate .offset file for uni string > > offset, but the build tool has not knowledge about this in autogen > > phase. So in this patch, I add a check in Makefile for GenSec command. > > If the GenSec input file does not exist, the GenSec will not be > > called. And if GenSec command is not called, its output file, which is > > also the input file of GenFfs command, will also not exist.So for > > GenFfs command, I add a new command parameter -oi which means the > > input file is an optional input file which would not exist. so that I > > can generate GenFfs command with "-oi" parameter in Makefile. > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Bob Feng > > Cc: Liming Gao > > --- > > BaseTools/Conf/build_rule.template | 8 ++++---- > > BaseTools/Source/C/GenFfs/GenFfs.c | 17 +++++++++++++++-- > > BaseTools/Source/Python/AutoGen/GenMake.py | 2 +- > > .../Python/GenFds/GenFdsGlobalVariable.py | 10 +++++++++- > > .../Source/Python/Workspace/DscBuildData.py | 3 +++ > > BaseTools/Source/Python/build/build.py | 10 +++++----- > > 6 files changed, 37 insertions(+), 13 deletions(-) > > > > diff --git a/BaseTools/Conf/build_rule.template > > b/BaseTools/Conf/build_rule.template > > index e56b1d9c59..17e7353063 100755 > > --- a/BaseTools/Conf/build_rule.template > > +++ b/BaseTools/Conf/build_rule.template > > @@ -357,15 +357,15 @@ > > [Dynamic-Library-File] > > > > ?.dll > > > > > > - $(DEBUG_DIR)(+)$(MODULE_NAME).efi > > + $(OUTPUT_DIR)(+)$(MODULE_NAME).efi > > > > > > "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} ${src} $(GENFW_FLAGS) > > - $(CP) ${dst} $(OUTPUT_DIR) > > + $(CP) ${dst} $(DEBUG_DIR) > > $(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi > > -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR) > > -$(CP) $(DEBUG_DIR)(+)*.pdb $(OUTPUT_DIR) > > > > $(CP) ${src} $(DEBUG_DIR)(+)$(MODULE_NAME).debug > > @@ -376,21 +376,21 @@ > > # > > -$(OBJCOPY) $(OBJCOPY_ADDDEBUGFLAG) ${src} > > -$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).debug > > $(BIN_DIR)(+)$(MODULE_NAME_GUID).debug > > > > "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} ${src} $(GENFW_FLAGS) > > - $(CP) ${dst} $(OUTPUT_DIR) > > + $(CP) ${dst} $(DEBUG_DIR) > > $(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi > > -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR) > > > > > > # tool to convert Mach-O to PE/COFF > > "$(MTOC)" -subsystem $(MODULE_TYPE) $(MTOC_FLAGS) ${src} $(= DEBUG_DIR)(+)$(MODULE_NAME).pecoff > > # create symbol file for GDB debug > > -$(DSYMUTIL) ${src} > > "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} $(DEBUG_DIR)(+)$(MODULE= _NAME).pecoff $(GENFW_FLAGS) > > - $(CP) ${dst} $(OUTPUT_DIR) > > + $(CP) ${dst} $(DEBUG_DIR) > > $(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi > > -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR) > > > > [Dependency-Expression-File] > > > > diff --git a/BaseTools/Source/C/GenFfs/GenFfs.c > > b/BaseTools/Source/C/GenFfs/GenFfs.c > > index 02c7ac30f0..ea36b22bef 100644 > > --- a/BaseTools/Source/C/GenFfs/GenFfs.c > > +++ b/BaseTools/Source/C/GenFfs/GenFfs.c > > @@ -17,10 +17,14 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, = EITHER EXPRESS OR IMPLIED. > > #include > > #include > > #include > > #endif > > > > +#ifdef __GNUC__ > > +#include > > +#endif > > + > > #include > > #include > > #include > > > > #include > > @@ -158,10 +162,12 @@ Returns: > > FileAlign points to file alignment, which only= support\n\ > > the following align: 1,2,4,8,16,128,512,1K,4K,= 32K,64K\n\ > > 128K,256K,512K,1M,2M,4M,8M,16M\n"); > > fprintf (stdout, " -i SectionFile, --sectionfile SectionFile\n\ > > Section file will be contained in this FFS > > file.\n"); > > + fprintf (stdout, " -oi SectionFile, --optionalsectionfile SectionFi= le\n\ > > + If the Section file exists, it will be > > + contained in this FFS file, otherwise, it will be ignored.\n"); > > fprintf (stdout, " -n SectionAlign, --sectionalign SectionAlign\n\ > > SectionAlign points to section alignment, whic= h support\n\ > > the alignment scope 0~16M. If SectionAlign is = specified\n\ > > as 0, tool get alignment value from SectionFil= e. It is\n\ > > specified together with sectionfile to point > > its\n\ @@ -734,19 +740,26 @@ Returns: > > argc -=3D 2; > > argv +=3D 2; > > continue; > > } > > > > - if ((stricmp (argv[0], "-i") =3D=3D 0) || (stricmp (argv[0], "--se= ctionfile") =3D=3D 0)) { > > + if ((stricmp (argv[0], "-oi") =3D=3D 0) || (stricmp (argv[0], > > + "--optionalsectionfile") =3D=3D 0) || (stricmp (argv[0], "-i") =3D=3D= 0) || > > + (stricmp (argv[0], > > "--sectionfile") =3D=3D 0)) { > > // > > // Get Input file name and its alignment > > // > > if (argv[1] =3D=3D NULL || argv[1][0] =3D=3D '-') { > > Error (NULL, 0, 1003, "Invalid option value", "input section f= ile is missing for -i option"); > > goto Finish; > > } > > - > > + if ((stricmp (argv[0], "-oi") =3D=3D 0) || (stricmp (argv[0], "-= -optionalsectionfile") =3D=3D 0) ){ > > + if (-1 =3D=3D access(argv[1] , 0)){ > > + Warning(NULL, 0, 0001, "File is not found.", argv[1]); > > + argc -=3D 2; > > + argv +=3D 2; > > + continue; > > + } > > + } > > // > > // Allocate Input file name buffer and its alignment buffer. > > // > > if ((InputFileNum =3D=3D 0) && (InputFileName =3D=3D NULL)) { > > InputFileName =3D (CHAR8 **) malloc (MAXIMUM_INPUT_FILE_NUM * > > sizeof (CHAR8 *)); diff --git > > a/BaseTools/Source/Python/AutoGen/GenMake.py > > b/BaseTools/Source/Python/AutoGen/GenMake.py > > index b441817b52..2374bcf550 100644 > > --- a/BaseTools/Source/Python/AutoGen/GenMake.py > > +++ b/BaseTools/Source/Python/AutoGen/GenMake.py > > @@ -714,11 +714,11 @@ cleanlib: > > > > FfsCmdList =3D Cmd[0] > > for index, Str in enumerate(FfsCmdList): > > if '-o' =3D=3D Str: > > OutputFile =3D FfsCmdList[index + 1] > > - if '-i' =3D=3D Str: > > + if '-i' =3D=3D Str or "-oi" =3D=3D Str: > > if DepsFileList =3D=3D []: > > DepsFileList =3D [FfsCmdList[index + 1]] > > else: > > DepsFileList.append(FfsCmdList[index + 1]) > > DepsFileString =3D ' '.join(DepsFileList).strip() diff > > --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py > > b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py > > index 028bcc480c..b42829b698 100644 > > --- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py > > +++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py > > @@ -33,10 +33,11 @@ from Common.ToolDefClassObject import > > ToolDefClassObject, ToolDefDict from AutoGen.BuildEngine import > > BuildRule import Common.DataType as DataType from Common.Misc import > > PathClass from Common.LongFilePathSupport import OpenLongFilePath as > > open from Common.MultipleWorkspace import MultipleWorkspace as mws > > +import Common.GlobalData as GlobalData > > > > ## Global variables > > # > > # > > class GenFdsGlobalVariable: > > @@ -499,10 +500,14 @@ class GenFdsGlobalVariable: > > Cmd +=3D ("-o", Output) > > Cmd +=3D Input > > > > SaveFileOnChange(CommandFile, ' '.join(Cmd), False) > > if IsMakefile: > > + if GlobalData.gGlobalDefines.get("FAMILY") =3D=3D "MSF= T": > > + Cmd =3D ['if', 'exist', Input[0]] + Cmd > > + else: > > + Cmd =3D ['test', '-e', Input[0], "&&"] + Cmd > > if ' '.join(Cmd).strip() not in GenFdsGlobalVariable.S= ecCmdList: > > GenFdsGlobalVariable.SecCmdList.append(' '.join(Cm= d).strip()) > > elif GenFdsGlobalVariable.NeedsUpdate(Output, list(Input) = + [CommandFile]): > > GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%= s needs update because of newer %s" % (Output, > Input)) > > GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to > > generate section") @@ -540,11 +545,14 @@ class GenFdsGlobalVariable: > > Align =3D mFfsValidAlign[index + 1] > > Cmd +=3D ("-a", Align) > > > > Cmd +=3D ("-o", Output) > > for I in range(0, len(Input)): > > - Cmd +=3D ("-i", Input[I]) > > + if MakefilePath: > > + Cmd +=3D ("-oi", Input[I]) > > + else: > > + Cmd +=3D ("-i", Input[I]) > > if SectionAlign and SectionAlign[I]: > > Cmd +=3D ("-n", SectionAlign[I]) > > > > CommandFile =3D Output + '.txt' > > SaveFileOnChange(CommandFile, ' '.join(Cmd), False) diff > > --git a/BaseTools/Source/Python/Workspace/DscBuildData.py > > b/BaseTools/Source/Python/Workspace/DscBuildData.py > > index 129c0c950b..ac95c7df17 100644 > > --- a/BaseTools/Source/Python/Workspace/DscBuildData.py > > +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py > > @@ -318,10 +318,13 @@ class DscBuildData(PlatformBuildClassObject): > > > > ## Get architecture > > @property > > def Arch(self): > > return self._Arch > > + @property > > + def Dir(self): > > + return self.MetaFile.Dir > > > > ## Retrieve all information in [Defines] section > > # > > # (Retrieving all [Defines] information in one-shot is just to s= ave time.) > > # > > diff --git a/BaseTools/Source/Python/build/build.py > > b/BaseTools/Source/Python/build/build.py > > index de641fb452..41d405e6ff 100644 > > --- a/BaseTools/Source/Python/build/build.py > > +++ b/BaseTools/Source/Python/build/build.py > > @@ -1667,11 +1667,11 @@ class Build(): > > self.Progress.Stop("done!") > > > > # Add ffs build to makefile > > CmdListDict =3D {} > > if GlobalData.gEnableGenfdsMultiThread and self.Fdf: > > - CmdListDict =3D self._GenFfsCmd() > > + CmdListDict =3D self._GenFfsCmd(Wa.ArchList) > > > > for Arch in Wa.ArchList: > > GlobalData.gGlobalDefines['ARCH'] =3D Arch > > Pa =3D PlatformAutoGen(Wa, self.PlatformFile, Buil= dTarget, ToolChain, Arch) > > for Module in Pa.Platform.Modules: > > @@ -1760,11 +1760,11 @@ class Build(): > > self.LoadFixAddress =3D Wa.Platform.LoadFixAddress > > Wa.CreateMakeFile(False) > > # Add ffs build to makefile > > CmdListDict =3D None > > if GlobalData.gEnableGenfdsMultiThread and self.Fdf: > > - CmdListDict =3D self._GenFfsCmd() > > + CmdListDict =3D self._GenFfsCmd(Wa.ArchList) > > self.Progress.Stop("done!") > > MaList =3D [] > > ExitFlag =3D threading.Event() > > ExitFlag.clear() > > self.AutoGenTime +=3D int(round((time.time() - > > WorkspaceAutoGenTime))) @@ -1879,15 +1879,15 @@ class Build(): > > # > > # Save MAP buffer into MAP file. > > # > > self._SaveMapFile (MapBuffer, Wa) > > > > - def _GenFfsCmd(self): > > + def _GenFfsCmd(self,ArchList): > > # convert dictionary of Cmd:(Inf,Arch) > > # to a new dictionary of (Inf,Arch):Cmd,Cmd,Cmd... > > CmdSetDict =3D defaultdict(set) > > - GenFfsDict =3D GenFds.GenFfsMakefile('', GlobalData.gFdfParser= , self, self.ArchList, GlobalData) > > + GenFfsDict =3D GenFds.GenFfsMakefile('', GlobalData.gFdfParser= , > > + self, ArchList, GlobalData) > > for Cmd in GenFfsDict: > > tmpInf, tmpArch =3D GenFfsDict[Cmd] > > CmdSetDict[tmpInf, tmpArch].add(Cmd) > > return CmdSetDict > > > > @@ -1927,11 +1927,11 @@ class Build(): > > Wa.CreateMakeFile(False) > > > > # Add ffs build to makefile > > CmdListDict =3D None > > if GlobalData.gEnableGenfdsMultiThread and self.Fdf: > > - CmdListDict =3D self._GenFfsCmd() > > + CmdListDict =3D self._GenFfsCmd(Wa.ArchList) > > > > # multi-thread exit flag > > ExitFlag =3D threading.Event() > > ExitFlag.clear() > > self.AutoGenTime +=3D int(round((time.time() - > > WorkspaceAutoGenTime))) > > -- > > 2.20.1.windows.1