All of lore.kernel.org
 help / color / mirror / Atom feed
From: H. Peter Anvin <hpa@zytor.com>
To: lkp@lists.01.org
Subject: Re: [x86/asm] 0507503671: will-it-scale.per_process_ops -4.9% regression
Date: Mon, 15 Nov 2021 13:15:49 -0800	[thread overview]
Message-ID: <F17C5180-EE2C-4C25-9042-078525C4604D@zytor.com> (raw)
In-Reply-To: <20211115203952.GO174703@worktop.programming.kicks-ass.net>

[-- Attachment #1: Type: text/plain, Size: 1853 bytes --]

It is perhaps a bit hard for gcc to know what S's are C so they can be E'd, since all it sees is assembly.

It also doesn't explain how this code
could possibly have this kind of impact; of anything, it should make this change more beneficial, not less; certainly not make it consume 5% more CPU.



On November 15, 2021 12:39:52 PM PST, Peter Zijlstra <peterz@infradead.org> wrote:
>On Mon, Nov 15, 2021 at 11:20:07AM -0800, H. Peter Anvin wrote:
>> [Cc: Peter Z.]
>> 
>> This seems totally bizarre... that is an *enormous* change, and if I'm
>> reading it right it seems like this somehow related to the performance
>> monitoring framework itself?
>> 
>> The lower-performance init code is all pushed into the pre-boot path, unless
>> for some strange reason not all code gets patched e.g. at module loading
>> time.
>> 
>> A quick peek around made me notice a few minor possibilities, but none of
>> them look particularly sane:
>> 
>> 1. We don't use "asm inline" in asm_volatile_goto, and we probably
>>    should; otherwise gcc might get the idea this is a more heavyweight
>>    operation than it actually is.
>> 2. There is a workaround in asm_volatile_goto for a bug which apparently
>>    was fixed in gcc 4.8.x that might mislead gcc's code generator into
>>    generating worse code.
>> 
>> Did you see any functions for which the code got *bigger*?
>
>Urgh, that code uses _4_ static_cpu_has(X86_FEATURE_ARCH_LBR) which,
>IIRC, GCC can't CSE. I've been asking for CSE on jump-labels for a
>while, but that's not actually got me anywhere.
>
>https://lore.kernel.org/all/YG80wg/2iZjXfCDJ(a)hirez.programming.kicks-ass.net/?q=static_branch%2Fjump_label+vs+branch+merging
>
>Let me see if I can't re-arrange that code differently.

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

  reply	other threads:[~2021-11-15 21:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-15  7:37 [x86/asm] 0507503671: will-it-scale.per_process_ops -4.9% regression kernel test robot
2021-11-15  9:53 ` Yin Fengwei
2021-11-15 19:20   ` H. Peter Anvin
2021-11-15 20:39     ` Peter Zijlstra
2021-11-15 21:15       ` H. Peter Anvin [this message]
2021-11-15 21:46         ` Peter Zijlstra
2021-11-16  1:41           ` Feng Tang
2021-11-16  1:57         ` Yin Fengwei
2021-11-16  1:40     ` Yin Fengwei
2021-11-16  9:33       ` Yin Fengwei
2021-11-17  2:44         ` Oliver Sang
2021-11-17  1:00       ` H. Peter Anvin
2021-11-17  1:27         ` Yin Fengwei

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-all 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=F17C5180-EE2C-4C25-9042-078525C4604D@zytor.com \
    --to=hpa@zytor.com \
    --cc=lkp@lists.01.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.