public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Kinney, Michael D" <michael.d.kinney@intel.com>
To: "Gao, Liming" <liming.gao@intel.com>,
	"afish@apple.com" <afish@apple.com>,
	 "Zhang, Shenglei" <shenglei.zhang@intel.com>,
	"Kinney, Michael D" <michael.d.kinney@intel.com>
Cc: edk2-devel-01 <edk2-devel@lists.01.org>
Subject: Re: [PATCH 3/3] MdePkg/BaseSynchronizationLib: Remove inline X86 assembly code
Date: Tue, 5 Mar 2019 21:45:23 +0000	[thread overview]
Message-ID: <E92EE9817A31E24EB0585FDF735412F5B8BB7B8C@ORSMSX113.amr.corp.intel.com> (raw)
In-Reply-To: <4A89E2EF3DFEDB4C8BFDE51014F606A14E3FBBC2@SHSMSX104.ccr.corp.intel.com>

Liming,

I agree .nasm files replacing .S/.asm files.  But the use of inline
assembly in C files for some primitives does produce much smaller/faster
code.

I would prefer that this BZ identify the specific functions that you
think would provide better maintainability with no impact to size
or performance.

Thanks,

Mike

> -----Original Message-----
> From: Gao, Liming
> Sent: Tuesday, March 5, 2019 1:33 PM
> To: afish@apple.com; Zhang, Shenglei
> <shenglei.zhang@intel.com>
> Cc: edk2-devel-01 <edk2-devel@lists.01.org>; Kinney,
> Michael D <michael.d.kinney@intel.com>
> Subject: RE: [edk2] [PATCH 3/3]
> MdePkg/BaseSynchronizationLib: Remove inline X86
> assembly code
> 
> Andrew:
>   BZ 1163 is to remove inline X86 assembly code in C
> source file. But, this patch is wrong. I have gave my
> comments to update this patch.
> 
>   The change is to reduce the duplicated
> implementation. It will be good on the code maintain.
> Recently, one patch has to update .c and .nasm both.
> Please see https://lists.01.org/pipermail/edk2-
> devel/2019-February/037165.html. Beside this change, I
> propose to remove all GAS assembly code for IA32 and
> X64 arch. After those change, the patch owner will
> collect the impact of the image size.
> 
> Thanks
> Liming
> > -----Original Message-----
> > From: afish@apple.com [mailto:afish@apple.com]
> > Sent: Tuesday, March 5, 2019 12:58 PM
> > To: Zhang, Shenglei <shenglei.zhang@intel.com>
> > Cc: edk2-devel-01 <edk2-devel@lists.01.org>; Kinney,
> Michael D <michael.d.kinney@intel.com>; Gao, Liming
> <liming.gao@intel.com>
> > Subject: Re: [edk2] [PATCH 3/3]
> MdePkg/BaseSynchronizationLib: Remove inline X86
> assembly code
> >
> > Shenglei,
> >
> > I was confused by the names of these patches. From a
> C point of view this is inline assembly:
> >
> > VOID
> > EFIAPI
> > CpuBreakpoint (
> > VOID
> > )
> > {
> > __asm__ __volatile__ ("int $3");
> > }
> >
> > These patches seem to be removing GAS and MASM
> assembly files, but not the inline assembly *.c files?
> >
> > We don't want to remove the inline assembly from the
> BaseLib as that could have size, performance, and
> compiler optimization impact.
> >
> > For example CpuBreakpoint() for clang with LTO would
> end up inlining a single byte. For i385 a call to
> assembler would be 5 bytes at each
> > call location plus the overhead of the function. So
> that is a size increase and a performance overhead. For
> a C complier calling an assembly
> > function is a serializing event an that can restrict
> optimizations. Thus having some limited inline assembly
> support is very useful.
> >
> > Thanks,
> >
> > Andrew Fish
> >
> > > On Mar 4, 2019, at 5:40 PM, Shenglei Zhang
> <shenglei.zhang@intel.com> wrote:
> > >
> > > MdePkg BaseSynchronizationLib still uses the inline
> X86 assembly code
> > > in C code files.It should be updated to consume
> nasm only.
> > > https://bugzilla.tianocore.org/show_bug.cgi?id=1163
> > >
> > > Cc: Michael D Kinney <michael.d.kinney@intel.com>
> > > Cc: Liming Gao <liming.gao@intel.com>
> > > Contributed-under: TianoCore Contribution Agreement
> 1.1
> > > Signed-off-by: Shenglei Zhang
> <shenglei.zhang@intel.com>
> > > ---
> > >
> .../Library/BaseSynchronizationLib/BaseSynchronizationL
> ib.inf   | 2 --
> > > 1 file changed, 2 deletions(-)
> > >
> > > diff --git
> a/MdePkg/Library/BaseSynchronizationLib/BaseSynchroniza
> tionLib.inf
> >
> b/MdePkg/Library/BaseSynchronizationLib/BaseSynchroniza
> tionLib.inf
> > > index 32414b29fa..719dc1938d 100755
> > > ---
> a/MdePkg/Library/BaseSynchronizationLib/BaseSynchroniza
> tionLib.inf
> > > +++
> b/MdePkg/Library/BaseSynchronizationLib/BaseSynchroniza
> tionLib.inf
> > > @@ -75,13 +75,11 @@
> > >
> > > [Sources.ARM]
> > > Synchronization.c
> > > -  Arm/Synchronization.asm       | RVCT
> > > Arm/Synchronization.S         | GCC
> > >
> > > [Sources.AARCH64]
> > > Synchronization.c
> > > AArch64/Synchronization.S     | GCC
> > > -  AArch64/Synchronization.asm   | MSFT
> > >
> > > [Packages]
> > > MdePkg/MdePkg.dec
> > > --
> > > 2.18.0.windows.1
> > >
> > > _______________________________________________
> > > edk2-devel mailing list
> > > edk2-devel@lists.01.org
> > > https://lists.01.org/mailman/listinfo/edk2-devel



  reply	other threads:[~2019-03-05 21:45 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-05  1:40 [PATCH 0/3] MdePkg: Remove inline X86 assembly code Shenglei Zhang
2019-03-05  1:40 ` [PATCH 1/3] MdePkg/BaseCpuLib: " Shenglei Zhang
2019-03-05  1:40 ` [PATCH 2/3] MdePkg/BaseLib: " Shenglei Zhang
2019-03-05  1:40 ` [PATCH 3/3] MdePkg/BaseSynchronizationLib: " Shenglei Zhang
2019-03-05 20:57   ` Andrew Fish
2019-03-05 21:32     ` Gao, Liming
2019-03-05 21:45       ` Kinney, Michael D [this message]
2019-03-05 22:43       ` Andrew Fish
2019-03-07  0:28         ` Gao, Liming
2019-03-07  0:41           ` Kinney, Michael D
2019-03-07  1:31             ` Andrew Fish
2019-03-07  5:06               ` Yao, Jiewen
2019-03-07  5:56                 ` Andrew Fish
2019-03-07  6:09                   ` Yao, Jiewen
2019-03-07  6:45                     ` Andrew Fish
2019-03-07  7:15                       ` Gao, Liming
2019-03-07  7:25                         ` Yao, Jiewen
2019-03-09  0:07                           ` Kinney, Michael D
2019-03-09  0:15                             ` Andrew Fish
2019-03-14 22:27                               ` Gao, Liming
2019-03-05  2:10 ` [PATCH 0/3] MdePkg: " Gao, Liming

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=E92EE9817A31E24EB0585FDF735412F5B8BB7B8C@ORSMSX113.amr.corp.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