From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38B23C43381 for ; Thu, 21 Feb 2019 22:57:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0E28E20838 for ; Thu, 21 Feb 2019 22:57:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726295AbfBUW5D (ORCPT ); Thu, 21 Feb 2019 17:57:03 -0500 Received: from www62.your-server.de ([213.133.104.62]:52036 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725891AbfBUW5D (ORCPT ); Thu, 21 Feb 2019 17:57:03 -0500 Received: from [78.46.172.3] (helo=sslproxy06.your-server.de) by www62.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1gwxGy-0000gv-6v; Thu, 21 Feb 2019 23:56:56 +0100 Received: from [178.197.248.36] (helo=linux.home) by sslproxy06.your-server.de with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1gwxGx-000NJn-Us; Thu, 21 Feb 2019 23:56:56 +0100 Subject: Re: [PATCH] x86, retpolines: raise limit for generating indirect calls from switch-case To: Linus Torvalds Cc: Thomas Gleixner , Linux List Kernel Mailing , Netdev , "David S . Miller" , =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , Magnus Karlsson , Jesper Dangaard Brouer , Alexei Starovoitov , Peter Zijlstra , David Woodhouse , Andy Lutomirski , Borislav Petkov References: <20190221221941.29358-1-daniel@iogearbox.net> From: Daniel Borkmann Message-ID: Date: Thu, 21 Feb 2019 23:56:55 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.100.2/25367/Thu Feb 21 14:02:13 2019) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 02/21/2019 11:27 PM, Linus Torvalds wrote: > On Thu, Feb 21, 2019 at 2:20 PM Daniel Borkmann wrote: >> >> In case of gcc, this setting is controlled by case-values-threshold >> which has an architecture global default that selects 4 or 5 ( > > Ack. For retpoline, that's much too low. > > Patch looks sane, although it would be good to verify just which > versions of gcc this works for. All versions with retpoline? The feature was first added in gcc 4.7 [0], under "General Optimizer Improvements": Support for a new parameter --param case-values-threshold=n was added to allow users to control the cutoff between doing switch statements as a series of if statements and using a jump table. >From what I can tell, original author (H.J. Lu) provided backports up to gcc 4.8 and distros seem to have pulled it from his github branch [1] as upstream gcc does not handle backports for stable versions that old. Thanks, Daniel [0] https://www.gnu.org/software/gcc/gcc-4.7/changes.html [1] https://bugs.launchpad.net/ubuntu/+source/gcc-4.8/+bug/1749261 https://github.com/hjl-tools/gcc/tree/hjl/indirect/gcc-4_8-branch/master