Received: by 10.213.65.68 with SMTP id h4csp1041636imn; Wed, 14 Mar 2018 07:56:34 -0700 (PDT) X-Google-Smtp-Source: AG47ELtu/oTF7yOcLk2Mk9EthXkoXJjYX8X8Fp9/F7TFeVZoyPJERmfW64d0be9R2CZpZCzYAuLf X-Received: by 2002:a17:902:6a89:: with SMTP id n9-v6mr4412461plk.51.1521039394212; Wed, 14 Mar 2018 07:56:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521039394; cv=none; d=google.com; s=arc-20160816; b=bNtgZK62m3D5TlfLBnDoqPEXzA/HjL4QdP7Pf66h7QsqNuq6X/Ub7X4g7N+41K/9O+ oVvvziJ3D9OXKKCADAphSaqfdrERIlCx5lPPFTkPOiZjL2SGUrGD1+taYxeU1K8JKWEM MBMBYK5tx6NITtUFq9qMH0ZISrdOXVj21a7rwEMdSY6fr1XvceVBf+P5LySsxUQnP1qk IjBnsArQKfoVDmQaeKgMRKvcY3EdcdK3MPbAu4Vuh7HW5FeymUfn9h9udlM0CVjSTJpq JBRwepdIu7ns/xek6NE8mRIwVMtqPKvYpsIUfjyRnimDvoL0IN1QdHG43+gQxLAR9AL4 rwmQ== 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:arc-authentication-results; bh=1zZTIkoD3zqUL71i0ULjKyv+05KDLLpVUJk/rm/FxKo=; b=1DSNKsAW0b0ZmBYSMN32gl1vaJsAFgldvySwtY8Fhw3i1t40kbwTujlEYtLybP80Hg ojnsKHHzBuIKRcOiGD+5I2tQzkKeFc3BZxvvvkvVR/6FsJ7bJInCnlnpKoGmzyD1NVvP UPA0OXhbSBdFzp6gcYxAZXZJ2x9TLdabMb6Spw0t+lEh33DLmNTwfeRwqbGeOhdmE3ux xC1tchwYh69rPfJaMpgjBjNXqOva7LmxeADQdEQIdlQNUTDw/K3hq4fzU/y8MNgkjPuA tkF5zLTttvwjbjEJcRjXgBB6/U1ZV/oVLkfs2jECuJ1ClaeGNECS026eqPt4YovK3ukE jx4g== 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 h2-v6si2070616plr.1.2018.03.14.07.56.18; Wed, 14 Mar 2018 07:56:34 -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 S932312AbeCNOzE (ORCPT + 99 others); Wed, 14 Mar 2018 10:55:04 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:58108 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751985AbeCNOzC (ORCPT ); Wed, 14 Mar 2018 10:55:02 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 26EB88151D49; Wed, 14 Mar 2018 14:55:02 +0000 (UTC) Received: from [10.36.116.210] (ovpn-116-210.ams2.redhat.com [10.36.116.210]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BAF862166BDA; Wed, 14 Mar 2018 14:54:59 +0000 (UTC) Subject: Re: [PATCH v3 7/7] x86/kvm: use Enlightened VMCS when running on Hyper-V To: Vitaly Kuznetsov , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Thomas Gleixner Cc: kvm@vger.kernel.org, x86@kernel.org, "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , "Michael Kelley (EOSG)" , Mohammed Gamal , Cathy Avery , Bandan Das , linux-kernel@vger.kernel.org References: <20180309140249.2840-1-vkuznets@redhat.com> <20180309140249.2840-8-vkuznets@redhat.com> <87r2opcr6u.fsf@vitty.brq.redhat.com> From: Paolo Bonzini Message-ID: <6a5f2453-cf51-d491-db54-5f239caa29bc@redhat.com> Date: Wed, 14 Mar 2018 15:54:57 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <87r2opcr6u.fsf@vitty.brq.redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 14 Mar 2018 14:55:02 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 14 Mar 2018 14:55:02 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'pbonzini@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/03/2018 15:19, Vitaly Kuznetsov wrote: >>> Static key is being used to avoid performance penalty for non-Hyper-V >>> deployments. Tests show we add around 3 (three) CPU cycles on each >>> VMEXIT (1077.5 cycles before, 1080.7 cycles after for the same CPUID >>> loop on bare metal). We can probably avoid one test/jmp in vmx_vcpu_run() >>> but I don't see a clean way to use static key in assembly. >> STATIC_JUMP_IF_TRUE, STATIC_JUMP_IF_FALSE are your friends. >> > Thanks for the tip, > > with a single kernel user of these APIs it was easy to miss :-) > > Unfortunately, these APIs are only present if HAVE_JUMP_LABEL and > (afaiu) we still care about KVM on !HAVE_JUMP_LABEL builds. It would be > nice if we can make them behave the same way static_branch_likely() and > friends do: compile into something else when !HAVE_JUMP_LABEL so we can > avoid nasty #ifdefs in C code. > > That said I'd like to defer the question to KVM maintainers: Paolo, > Radim, what would you like me to do? Use STATIC_JUMP_IF_TRUE/FALSE as > they are, try to make them work for !HAVE_JUMP_LABEL and use them or > maybe we can commit the series as-is and have it as a future > optimization (e.g. when HAVE_JUMP_LABEL becomes mandatory)? With a single instruction to patch, poking at the text manually might be an option... Otherwise, it's okay as-is. Paolo