Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp951577imp; Thu, 21 Feb 2019 14:57:41 -0800 (PST) X-Google-Smtp-Source: AHgI3IYdlm4rFPtWhZXjH+wnBXZmlylTXyoC5X2Kgwb40INjJervVQlfekQT+lwI5ZEh01+9zf/b X-Received: by 2002:a62:e04b:: with SMTP id f72mr940046pfh.41.1550789861739; Thu, 21 Feb 2019 14:57:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550789861; cv=none; d=google.com; s=arc-20160816; b=WAgvCE0+9Qob5iLa0lj9w58OlhPJ+fCTYi7tB1hZPisb5OOS8k6lF5gH+WE/rM1pz0 Mp2L1pa94AUTDMh6JKGqghqqgtdQL0FDZh8RP+L/csXWpAFBWYAk7KQq778KBYjkkZDv vqL9wFQrvF5/Pj+wKzMMKI3LNRHcJaY/OVsxK/htAUDcQskqkM412TXKvBV85+wfshyo uzIfOt1gvSHdK56zM5gcOUceDLLuAnZRpGdYMia9gLU7/Ombe1EFtQvXsrg6SIKBOJYD uKIqHEcROQ9np5XtofvI2xJ8wnG4DTmIvOza1cWgNC8Mtpo4zhX0KDFvkNUVWp9GQU7C /O5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=scrCJIV2C2oTZFjAHa1b6AH216qAoMmetUQy86kNcqg=; b=Ixg8rzjREDfwb80ha9ChWPJHx9+SYzteigbLmxjz9RDNf4oIphG51ZHW5Rhp8v8kac JHAkwY8ymtGhX2r8+Zv3qqhCptmFo62kgljAFEA9uvhwQfcv5CWDkzAYTrXf9Vw6e9Ow +QrVUvb0G03NfVrZBqum+vkZFG+IvHrP/h2Tqm7CDZmCmr/NN6FMZpLyizrZ+XCtiReD Y5g16sxhHzyUIOutLoKtcgg7ZhaI1VHqPcKGbrDDH9nFRK0zWJmSU5X2fMDBVcmEFEUL +dzBCnWCq92EfiyMLXhkwwPuAUM3SsIXy21jlSsXeOMTAidBRhmu4O6EZzWOa2ztkeQP aWyg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b79si106474pfe.273.2019.02.21.14.57.25; Thu, 21 Feb 2019 14:57:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726685AbfBUW5D (ORCPT + 99 others); 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: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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