From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Borntraeger Subject: Re: [PATCH 0/2] KVM: s390: avoid jump tables Date: Thu, 8 Feb 2018 10:07:40 +0100 Message-ID: <1cce9ec4-d32e-a12b-7151-f719cd68f72e@de.ibm.com> References: <20180206112127.19014-1-borntraeger@de.ibm.com> <7e9bb181-cec9-0781-03c0-b74d5d087c8a@redhat.com> <20180208085819.GC3937@osiris> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: Janosch Frank , KVM , Cornelia Huck , linux-s390 To: Heiko Carstens , David Hildenbrand Return-path: Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:57080 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751544AbeBHJHs (ORCPT ); Thu, 8 Feb 2018 04:07:48 -0500 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w1894fJG164239 for ; Thu, 8 Feb 2018 04:07:48 -0500 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0b-001b2d01.pphosted.com with ESMTP id 2g0jg5u7yc-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 08 Feb 2018 04:07:47 -0500 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 8 Feb 2018 09:07:44 -0000 In-Reply-To: <20180208085819.GC3937@osiris> Content-Language: en-US Sender: kvm-owner@vger.kernel.org List-ID: On 02/08/2018 09:58 AM, Heiko Carstens wrote: > On Tue, Feb 06, 2018 at 01:30:28PM +0100, David Hildenbrand wrote: >> On 06.02.2018 12:21, Christian Borntraeger wrote: >>> Some old patches refreshed. >>> >> >> Certainly the right thing to do. Especially also interesting due to >> retpotline (if we get something like that on s390x). If I remember >> correctly, x86 highly benefits by replacing magic function pointer by >> switch statements. > > If you look at the generated code for the first patch: gcc now generates > its own jump table which then jumps (indirectly) to a brasl... So it's two > instead of one branch. > I'm not saying that this patch is not good, but there seem be a wrong > assumptions about the benefit here. Seems to depend on the compiler. The gcc 7.2 from my Fedora 27 seems to do the right thing for intercept.o and priv.o. In the end this will also help the new -mindirect-branch thing as the gcc support also avoids jump tables if we use thunks.