Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp947650ybn; Wed, 25 Sep 2019 09:59:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqz3XFfltrPhnvveDH4Qq0kTgkwmFvfio1Hv1jUryoJNbZ6h9a6qc2FsmslX3RIUPT0by5v9 X-Received: by 2002:a17:906:3108:: with SMTP id 8mr207321ejx.11.1569430778501; Wed, 25 Sep 2019 09:59:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569430778; cv=none; d=google.com; s=arc-20160816; b=eQGBm/n57yrBJYNGjFZ9Rby+KR4DWEIUlVT8Kcdl4j7OsAW9SUjNgz5jx+/V8+ErTY OCpaLL6QXTAbX0xl8JvITIXWKcMPSBVKvyXuxf3O1Q4yR3HHETUu1rvcdHguWT05SQcJ HyZmqRnsB+yqQtiQpJUTjQDqyf0f/NIWKFbpwEId+nh+s2rBDfeYgxSnL2HOqgDst+LE EooEsB7HcVmaujz/d1u8SRgrQShyy8WVJzW6nmJVn5FZwwAeH7OejaoIMxFY8Qc/sKa4 ekrsat2n8misPElIrC4qLa5CVr95OYtmgqoyp2TCdpvmQkh5Yoq/dw87NAebxJrogbfL wZ2g== 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=woH02+92wViWslv+UONiBrbDco+Gp5xGl8fnKypkUi4=; b=oNr8USSReBi0DCtosNsh0kM9X1Tgc5R0iQr10Vp3dunvO4Oo9Ji4J7QTgvZkRD7Do/ hQDtCHPkkG9e5skE5/klY1OXHq+lt6t6NO6lAM1lx5XHITvHTqk9eaWcWD3K0Yd4RFxe kiDAS8fSAK8pofjeO7I3uihG3Fww0K5nMs3KIJy7DpXLe2qMWvOehmxMq/wmYcicvX8b 7Ytn9itbs85VJdvTYmUksWtYoX13MthM35eN3MjhZ26sjILokhFg5IFmy/Gp4jNQ0h22 Cf3TFAi9pBHbKL1D0JO3XSXXEhGNeaYGg1yYwhB7UuiWOpnfii6XyheMPocoGo81u8SJ at/g== 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 d1si3549884eds.148.2019.09.25.09.59.14; Wed, 25 Sep 2019 09:59:38 -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 S2407662AbfIWRmt (ORCPT + 99 others); Mon, 23 Sep 2019 13:42:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44512 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407617AbfIWRmt (ORCPT ); Mon, 23 Sep 2019 13:42:49 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CADE010CC1F4; Mon, 23 Sep 2019 17:42:48 +0000 (UTC) Received: from mail (ovpn-120-159.rdu2.redhat.com [10.10.120.159]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 868F360BFB; Mon, 23 Sep 2019 17:42:45 +0000 (UTC) Date: Mon, 23 Sep 2019 13:42:44 -0400 From: Andrea Arcangeli To: Paolo Bonzini Cc: Sean Christopherson , 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: <20190923174244.GA19996@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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <24dc5c23-eed8-22db-fd15-5a165a67e747@redhat.com> User-Agent: Mutt/1.12.1 (2019-06-15) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.65]); Mon, 23 Sep 2019 17:42:49 +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 06:53:10PM +0200, Paolo Bonzini wrote: > On 23/09/19 18:37, Sean Christopherson wrote: > >> Would it be too much if we get rid of > >> kvm_vmx_exit_handlers completely replacing this code with one switch()? > > Hmm, that'd require redirects for nVMX functions since they are set at > > runtime. That isn't necessarily a bad thing. The approach could also be > > used if Paolo's idea of making kvm_vmx_max_exit_handlers const allows the > > compiler to avoid retpoline. > > But aren't switch statements also retpolin-ized if they use a jump table? See commit a9d57ef15cbe327fe54416dd194ee0ea66ae53a4. We disabled that feature or the kernel would potentially suffer the downsides of the exit handlers through pointer to functions for every switch statement in the kernel. In turn you can't make it run any faster by converting my "if" to a "switch" at least the "if" can deterministic control the order of what is more likely that we should also re-review, but the order of secondary effect, the important thing is to reduce the retpolines to zero during normal hrtimer guest runtime.