Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3300270img; Mon, 25 Mar 2019 07:38:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqy72VzGJM5C1223ILXQpUUuVLAHBqLzNCvb+RJPnDx1vt6fKlv01GQSy99CHLXvtBKmPCLD X-Received: by 2002:a17:902:9a88:: with SMTP id w8mr25880648plp.8.1553524727561; Mon, 25 Mar 2019 07:38:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553524727; cv=none; d=google.com; s=arc-20160816; b=TpWIB8J6dcz3n48ikL7/7bzB44wYaKC0seFitIPQNW8zS6otHlyeMLgQtM+X8ZxdlJ JtR1Lq0B/RtFB2/HtSuhp6oA0FER2lcODO92AjxIDywnYH5C9D6ezWJAzOzayQa60gnL 3ocOAgN3uBFN2A4iiryaTtj3W9L+Rs/OqvPm6tkxUSDaDTwOdwd8/Pu/Ifi+QJ0QUs/m LHWiefrKi4xN5+MPZFVCiZrYU1zh7i8S44IEzmsqWhGefv7rNoRl5nDPhHImUxby/gDG QTz67OllXp04O+N3lWf2vmD9mU7Mh1necFodT9rHVUFwqv+NdwVsZAtDYNjiVlhbks81 SKJA== 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=mK1Mxmy8gjxZsWNkRGotQZ29oypV89+uGRiHMjVfyh4=; b=EidfsF4N++zfqADJljo1MVAR/h1kC9FRaIrRGPm5zCxgx3qDo90/rm0SIFE5IROW0O eon1KWWasY26gKq/tt7jDj8wZ9vrKfTeGenxyregz8GX6/+6JT0zw7pesDXHDq9Y+Rgo xpEJiB3dEVz+15dHAg+HNZ/0FhBEIWX1U2wmN38Dl6bGO5dOWL4swE4BJ99oUSA3E21h y42A8wDYuoXl7Q84gqvtQGef1FZc4ydT4FUzruVk3ONkCiDr5CXjNumwpgJY71G45f9z 2aSn3+0rz3wQzhw9QNeOPUmLzd4F7fwXi5wE1SQmB1MCUnQD6Oss68bcj/aRgRB9nQEN PN+A== 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 a90si14971091pla.401.2019.03.25.07.38.32; Mon, 25 Mar 2019 07:38:47 -0700 (PDT) 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 S1728995AbfCYOhd (ORCPT + 99 others); Mon, 25 Mar 2019 10:37:33 -0400 Received: from www62.your-server.de ([213.133.104.62]:47760 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725355AbfCYOhc (ORCPT ); Mon, 25 Mar 2019 10:37:32 -0400 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 1h8Qj8-0002YL-6x; Mon, 25 Mar 2019 15:37:26 +0100 Received: from [178.197.248.24] (helo=linux.home) by sslproxy06.your-server.de with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1h8Qj7-0004hr-Uo; Mon, 25 Mar 2019 15:37:26 +0100 Subject: Re: [PATCH] x86, retpolines: entirely disable switch jump tables when retpolines are enabled To: David Woodhouse , tglx@linutronix.de Cc: linux-kernel@vger.kernel.org, mliska@suse.cz, "H . J . Lu" , Linus Torvalds , Jesper Dangaard Brouer , =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , Magnus Karlsson , Alexei Starovoitov , "David S . Miller" References: <20190325135620.14882-1-daniel@iogearbox.net> <73ab8319a67a2d894564019c6bb0a806455987c6.camel@infradead.org> From: Daniel Borkmann Message-ID: Date: Mon, 25 Mar 2019 15:37:25 +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: <73ab8319a67a2d894564019c6bb0a806455987c6.camel@infradead.org> 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/25399/Mon Mar 25 08:46:48 2019) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/25/2019 03:28 PM, David Woodhouse wrote: > On Mon, 2019-03-25 at 14:56 +0100, Daniel Borkmann wrote: >> More than 20 switch cases are not expected to be fast-path critical, but >> it would still be good to align with gcc behavior for versions < 8.4.0 in >> order to have consistency across supported gcc versions. vmlinux size is >> slightly growing by 0.27% for older gcc. This flag is only set to work >> around affected gcc, no change for clang. > > I note your final sentence doesn't actually say that clang doesn't have > this problem, and doesn't *need* this (or an equivalent) change. > > It should say that (if it's true). And if it isn't true, then other > remedial action would be in order. clang doesn't have this problem as analyzed back in ce02ef06fcf7 ("x86, retpolines: Raise limit for generating indirect calls from switch-case"). I thought both here would make it quite clear, from this patch commit msg: "After this has been brought to attention to gcc folks [0], Martin Liska has then fixed gcc to align with clang by avoiding to generate switch jump tables entirely under retpolines." And the comment in the Makefile code: # Additionally, avoid generating expensive indirect jumps which # are subject to retpolines for small number of switch cases. # clang turns off jump table generation by default when under # retpoline builds, however, gcc does not for x86. This has # only been fixed starting from gcc stable version 8.4.0 and # onwards, but not for older ones. See gcc bug #86952. Thanks, Daniel