Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1311883
| Path | csiph.com!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | "H. Peter Anvin" <hpa@zytor.com> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init |
| Date | Tue, 19 Jan 2016 02:40:02 +0100 |
| Message-ID | <qStr4-D8-1@gated-at.bofh.it> (permalink) |
| References | <qREHU-i0-3@gated-at.bofh.it> <qRERA-mf-1@gated-at.bofh.it> <qRFaV-v0-1@gated-at.bofh.it> <qRSUx-1gy-15@gated-at.bofh.it> <qSljR-3pb-13@gated-at.bofh.it> <qSmzg-4r1-13@gated-at.bofh.it> <qSnbY-4FZ-15@gated-at.bofh.it> <qSt7I-vW-11@gated-at.bofh.it> |
| User-Agent | K-9 Mail for Android |
| MIME-Version | 1.0 |
| Content-Transfer-Encoding | 8bit |
| Content-Type | text/plain; charset=UTF-8 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 75 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | the arch/x86 maintainers <x86@kernel.org>, Linux Kernel Mailing List <linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@kernel.org>, Denys Vlasenko <dvlasenk@redhat.com>, Andy Lutomirski <luto@amacapital.net>, Linus Torvalds <torvalds@linux-foundation.org> |
| X-Original-Date | Mon, 18 Jan 2016 17:33:03 -0800 |
| X-Original-Message-ID | <DD7599E0-BB19-4BEC-B598-B0B29ACF5A36@zytor.com> |
| X-Original-References | <1452972124-7380-1-git-send-email-brgerst@gmail.com> <20160116193658.GC32085@pd.tnic> <CAMzpN2hHVhjJD57wYnRLPZ_58FQGvSEn511ywGhgXzuSAZXD_A@mail.gmail.com> <20160117103337.GC8549@pd.tnic> <CAMzpN2i+LELbLaBbxDS0MF1Y0sn_Jm3ztCWATzMyrp4rnhWRQA@mail.gmail.com> <20160118181457.GG12651@pd.tnic> <20160118185107.GI12651@pd.tnic> <20160119011026.GA12911@pd.tnic> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1311883 |
Show key headers only | View raw
On January 18, 2016 5:10:26 PM PST, Borislav Petkov <bp@suse.de> wrote:
>On Mon, Jan 18, 2016 at 07:51:07PM +0100, Borislav Petkov wrote:
>> [45] .static_cpu_has PROGBITS ffffffff97aa655b 16ea655b
>> 00000000000002df 0000000000000000 AX 0 0 1
>
>Ok, staring at this section was wrong. I went and looked at
>the .s file and now it clicked: gcc inlines those calls to
>__static_cpu_has_safe of the dynamic jump target:
>
> .loc 4 538 0
> movl $125, %edi #,
> call __static_cpu_has_safe #
>.LBE885:
>.LBE886:
>.LBE914:
> .loc 1 240 0
> testb %al, %al # D.30157
> je .L150 #,
> jmp .L151 #
>.L152:
>.LBB915:
>.LBB909:
>.LBB905:
>.LBB893:
>.LBB892:
> .loc 4 538 0
> movl $154, %edi #,
> call __static_cpu_has_safe #
>.LBE892:
>.LBE893:
>.LBE905:
> .loc 7 431 0
> testb %al, %al # D.30157
> jne .L154 #,
>
>which turn into:
>
> 751: bf 7d 00 00 00 mov $0x7d,%edi
> 756: e8 00 00 00 00 callq 75b <fpu__copy+0xab>
> 75b: 84 c0 test %al,%al
> 75d: 74 a3 je 702 <fpu__copy+0x52>
> 75f: eb 90 jmp 6f1 <fpu__copy+0x41>
> 761: bf 9a 00 00 00 mov $0x9a,%edi
> 766: e8 00 00 00 00 callq 76b <fpu__copy+0xbb>
> 76b: 84 c0 test %al,%al
>
>That's like 28 bytes in this particular case, which is 14 per call
>site,
>on average.
>
>So grepping through my tailored vmlinux, it has 35 entries with
>X86_FEATURE_ALWAYS in .altinstructions X 14 = 490 bytes.
>
>So yeah, we probably should do this, allyesconfig should give more
>savings.
>
>One thing I'd probably do differently is not call the throwaway section
>.static_cpu_has but something like .altinstr_temporary or so and put it
>after the replacement insns:
>
>.altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) {
> *(.altinstr_replacement)
> *(.altinstr_temporary)
> }
>
>so that we know those instructions belong to the alternatives
>mechanism.
>They'll get discared too, of course.
>
>I could just as well be talking a lot of crap, it is waay too late
>here.
Why the f do we call a subroutine for what amounts to a single bt or test instruction?
--
Sent from my Android device with K-9 Mail. Please excuse brevity and formatting.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] x86: static_cpu_has_safe: discard dynamic check after init Brian Gerst <brgerst@gmail.com> - 2016-01-16 20:30 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init Borislav Petkov <bp@suse.de> - 2016-01-16 20:40 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init Brian Gerst <brgerst@gmail.com> - 2016-01-16 21:00 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init Borislav Petkov <bp@suse.de> - 2016-01-17 11:40 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init Brian Gerst <brgerst@gmail.com> - 2016-01-18 18:00 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init Andy Lutomirski <luto@amacapital.net> - 2016-01-18 18:50 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init Borislav Petkov <bp@suse.de> - 2016-01-18 19:20 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init Andy Lutomirski <luto@amacapital.net> - 2016-01-18 19:30 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init Borislav Petkov <bp@suse.de> - 2016-01-18 19:40 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init "H. Peter Anvin" <hpa@zytor.com> - 2016-01-18 20:50 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init Borislav Petkov <bp@suse.de> - 2016-01-19 00:10 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init "H. Peter Anvin" <hpa@zytor.com> - 2016-01-19 00:20 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init Borislav Petkov <bp@suse.de> - 2016-01-19 00:30 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init Borislav Petkov <bp@suse.de> - 2016-01-19 15:00 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init Borislav Petkov <bp@suse.de> - 2016-01-19 17:30 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init Borislav Petkov <bp@suse.de> - 2016-01-20 00:20 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init Andy Lutomirski <luto@amacapital.net> - 2016-01-20 00:30 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init Boris Petkov <bp@suse.de> - 2016-01-20 01:00 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init "H. Peter Anvin" <hpa@zytor.com> - 2016-01-20 05:10 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init Borislav Petkov <bp@suse.de> - 2016-01-20 11:40 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init "H. Peter Anvin" <hpa@zytor.com> - 2016-01-20 11:50 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init Borislav Petkov <bp@suse.de> - 2016-01-21 23:20 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init "H. Peter Anvin" <hpa@zytor.com> - 2016-01-21 23:30 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init Borislav Petkov <bp@suse.de> - 2016-01-22 00:00 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init "H. Peter Anvin" <hpa@zytor.com> - 2016-01-22 00:40 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init "H. Peter Anvin" <hpa@zytor.com> - 2016-01-22 00:40 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init Borislav Petkov <bp@suse.de> - 2016-01-22 11:40 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init Borislav Petkov <bp@suse.de> - 2016-01-18 20:00 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init Borislav Petkov <bp@suse.de> - 2016-01-19 02:20 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init "H. Peter Anvin" <hpa@zytor.com> - 2016-01-19 02:40 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init Borislav Petkov <bp@suse.de> - 2016-01-19 10:30 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init "H. Peter Anvin" <hpa@zytor.com> - 2016-01-20 05:10 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init Brian Gerst <brgerst@gmail.com> - 2016-01-20 05:40 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init "H. Peter Anvin" <hpa@zytor.com> - 2016-01-20 05:50 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init "H. Peter Anvin" <hpa@zytor.com> - 2016-01-20 12:00 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init Borislav Petkov <bp@suse.de> - 2016-01-20 12:10 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init "H. Peter Anvin" <hpa@zytor.com> - 2016-01-20 15:50 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init Borislav Petkov <bp@suse.de> - 2016-01-20 12:00 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init Borislav Petkov <bp@suse.de> - 2016-01-20 16:10 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init "H. Peter Anvin" <hpa@zytor.com> - 2016-01-20 16:20 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init Borislav Petkov <bp@suse.de> - 2016-01-20 17:10 +0100
Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init "H. Peter Anvin" <hpa@zytor.com> - 2016-01-20 17:20 +0100
csiph-web