From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755857AbbIYLo1 (ORCPT ); Fri, 25 Sep 2015 07:44:27 -0400 Received: from mail.skyhub.de ([78.46.96.112]:40898 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754255AbbIYLoZ (ORCPT ); Fri, 25 Sep 2015 07:44:25 -0400 Date: Fri, 25 Sep 2015 13:44:23 +0200 From: Borislav Petkov To: Denys Vlasenko Cc: Ingo Molnar , Andy Lutomirski , "H. Peter Anvin" , Brian Gerst , x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86/processor.h: Force inlining of cpu_relax() Message-ID: <20150925114423.GD3568@pd.tnic> References: <1443096149-27291-1-git-send-email-dvlasenk@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1443096149-27291-1-git-send-email-dvlasenk@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 24, 2015 at 02:02:29PM +0200, Denys Vlasenko wrote: > On x86, cpu_relax() simply calls rep_nop(), which generates one > instruction, PAUSE (aka REP NOP). > > With this config: > http://busybox.net/~vda/kernel_config_OPTIMIZE_INLINING_and_Os > gcc-4.7.2 does not always inline rep_nop(): it generates > several copies of this: > > (16 copies, 194 calls): > 55 push %rbp > 48 89 e5 mov %rsp,%rbp > f3 90 pause > 5d pop %rbp > c3 retq > > See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66122 > > This patch fixes this via s/inline/__always_inline/ > on rep_nop() and cpu_relax(). > (Forcing inlining only on rep_nop() causes gcc to > deinline cpu_relax(), with almost no change in generated code). > > text data bss dec hex filename > 88118971 19905208 36421632 144445811 89c1173 vmlinux.before > 88118139 19905208 36421632 144444979 89c0e33 vmlinux Looks ok to me, text even grows smaller. Acked-by: Borislav Petkov -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply.