Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1310269ybn; Wed, 25 Sep 2019 16:07:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqw7ou7Dn9TNz8bZgYwEk9Azq08qnimPfm/P7PhezpHquLZyGNhZ3mVWGYLz8Jy3P5BS59ip X-Received: by 2002:a17:906:134b:: with SMTP id x11mr554639ejb.272.1569452844921; Wed, 25 Sep 2019 16:07:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569452844; cv=none; d=google.com; s=arc-20160816; b=OptYFcQdh1kXV6V+W2LS5tuojlEiLtx/ZQdRapx+EpXOBSVhBZZwv03EMVTkuMmpmS xWCWo3ep58oHtdgPSNZoN53ODCmDUH5K3Q6/e/q229uKTbtSvILU4Go2/s7Knn0jUvop FisebDT8psCxe01+WArY1VydmNM7U+4nyuEL2yJ7HgE9ko+AOW1TJhhFrKp9hZk2yJ6a vGLuSZdfeCJxshpC9SrOrJlYF7QPGl9F7ELJUHIZPCDUBS0mnkoGYxsKDfI9CnStlWHd oPzp+CEPiIz95sRXrdB7quikAXG2T2/VGkf9Z7xyq6rdKq+OvMurNp3MEPdsZOyECwat xlqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=S7VjanyjS4B7NRjsXF9g1bcIxoZH1pkslFhE/IfmOsY=; b=snhwg/Hi6n1vAaoHkcceiXlIEsoehPWNMaEf1ZwXPTM0pN8uDGWqs2W4jbMm0eTKkD Z1f4qqS8loWvpa46xtNIKh7dPZFIf94Hl0spbCy+htSmlghHchTl9JDBZt5G3ej9Jamb 3HwEuH9xTxhVl3irohk1ncWDTwkT+DZE/OZXznOHSvS6LiBfoFMc9QKP1X1YJ2FvLREt OZ229qO3UprNfldoCPzCEwQ71f4h7W9kcObzpQgn3JxooOZdA3YcEi0JypD5iQWsOhV5 haDkbYbj7MpaeWvsUDGo3TGtzeFnsBbtIcXzxMhjN8F+4uTxdXkE2usz++5Y0QowIF3p kgXQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b42si308342edb.11.2019.09.25.16.07.01; Wed, 25 Sep 2019 16:07:24 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733235AbfIWTMy (ORCPT + 99 others); Mon, 23 Sep 2019 15:12:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38284 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726307AbfIWTMy (ORCPT ); Mon, 23 Sep 2019 15:12:54 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0A92B368DA; Mon, 23 Sep 2019 19:12:54 +0000 (UTC) Received: from mail (ovpn-120-159.rdu2.redhat.com [10.10.120.159]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7A2EF5C1B2; Mon, 23 Sep 2019 19:12:51 +0000 (UTC) Date: Mon, 23 Sep 2019 15:12:50 -0400 From: Andrea Arcangeli To: Sean Christopherson Cc: Paolo Bonzini , Vitaly Kuznetsov , "Dr. David Alan Gilbert" , Marcelo Tosatti , Peter Xu , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 15/17] KVM: retpolines: x86: eliminate retpoline from vmx.c exit handlers Message-ID: <20190923191250.GC19996@redhat.com> References: <20190920212509.2578-1-aarcange@redhat.com> <20190920212509.2578-16-aarcange@redhat.com> <87o8zb8ik1.fsf@vitty.brq.redhat.com> <20190923163746.GE18195@linux.intel.com> <24dc5c23-eed8-22db-fd15-5a165a67e747@redhat.com> <20190923174244.GA19996@redhat.com> <20190923181558.GI18195@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190923181558.GI18195@linux.intel.com> User-Agent: Mutt/1.12.1 (2019-06-15) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 23 Sep 2019 19:12:54 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 23, 2019 at 11:15:58AM -0700, Sean Christopherson wrote: > On the flip side, using a switch for the fast-path handlers gives the > compiler more flexibility to rearrange and combine checks. Of course that > doesn't mean the compiler will actually generate faster code for our > purposes :-) > > Anyways, getting rid of the retpolines is much more important. Precisely because of your last point, if we throw away the deterministic priority, then we could drop the whole structure like Vitaly suggested and we'd rely on gcc to add the indirect jump on a non-retpoline build. Solving the nested if we drop the structure and we don't pretend to make it const, isn't tricky: it only requires one more check if nested is enabled. The same variable that will have to be checked is also the variable that needs to be checked in the kvm_x86_ops->check_nested_events replacement later to drop the kvm_x86_ops struct as a whole like kvm_pmu_ops was dropped clean.