Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp86284pxb; Wed, 3 Nov 2021 00:04:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSQZ+KWFh8gzcyCxNbvTBhDaRjsziAbJnV9rZzJcRP5Hb0w+EhdYvSLPHiLLJN354yUESn X-Received: by 2002:a5e:d80a:: with SMTP id l10mr29727621iok.182.1635923083847; Wed, 03 Nov 2021 00:04:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635923083; cv=none; d=google.com; s=arc-20160816; b=tt+fYNl5Ki4qMs3iLZhwLDAnVQ6zf3O1agEjc80L03xbCwRVjBkEhR3npJhjmna5m9 h2v1lvFm0ZZ59yj4ZVuo+yzYCd5t2olAuryykjNol8ZUUAgWa9HFQRzF0B9gUKvFPFkJ 45SyRUw8qRMGRqwNTEELKvsS6OXzr8I4KDyTsaD5gNRn0WQi3GS1g0BDlDpbp4Q7WYVQ 0MErDOuci6knUM816PxlJKPwthNNHKYjJEBpFi4FGOG3Yt63GXtZVXXtwIuNkv0088xx x134nlMLJvKKVMxzpG/IqNpTc24+fArEzRsima3py0/7WrlmZUa/MydlW+P4dsUmbJC2 ft0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=QGc0CAiOAozapI53hKAH/Jnun3Rk9U/5qkQg7Ukw/Oc=; b=jfYPRJ7jIO0dv1UJiMDgCUL2gLTCXVxoZJV8NeP67o3Q/Oc930i9ElzLqGcJNTS2WT 3dWXsZeUL6TANAzfgg/0kEzsuPFRYpcGyB9NwUM8cZLEyz97LNiFL88ulKhpj+IN0qBH GDvPaNw6l13ivC2yn0LKv6MUNRiRShEmyGDQRHohqWVwJpDOxMVbDcyvg05I9ljiO/6Y MhBvMLfbChUvpRvLTphnoOurchfATC2LPyy2zJTYrn6WwaAFY5BkktAcYe0UbvdqOKEV jZhZa9SibgUfiO8e6940WDffFH7DffXrQQMw8ncDVyrV8ed91XvBWn7IRDS12Yzd9ai+ gtUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=qzNxbe4D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d1si2933099ilg.74.2021.11.03.00.04.30; Wed, 03 Nov 2021 00:04:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=qzNxbe4D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232011AbhKCHF6 (ORCPT + 99 others); Wed, 3 Nov 2021 03:05:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230152AbhKCHF5 (ORCPT ); Wed, 3 Nov 2021 03:05:57 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0766C061714; Wed, 3 Nov 2021 00:03:21 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id gt5so643412pjb.1; Wed, 03 Nov 2021 00:03:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=QGc0CAiOAozapI53hKAH/Jnun3Rk9U/5qkQg7Ukw/Oc=; b=qzNxbe4D6Ddl5KW1/7n3QfLdXFZq6CP0DBEKrBua4sblu9WvMAgiqVo9qPcbJPYG5W bWSdfih3Cz41UpZUgHjD/3eV9JnrRG8fMfH8kCZ9m7IxsZFooYt9uvjgrBTgQsEaxg9b DsMMYVszMaCxUFvdZwYxU9JLFGahQUoPHxP7Epo9GuvdEpnVtqiZ5IOCs6Vumvo+bv3R EELR31KSVS+JUCua5Xicwq2AyuOH7o1QGezmkamlA6BqLf7WeGtdUbbWUUAZ8JmwNp43 YVYitGZb41s1azbojl8EO8ZjM15KVabldcrbP6Ea5iiqWgi4FxD4ZxrRZY526Cs6ywt1 FLAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=QGc0CAiOAozapI53hKAH/Jnun3Rk9U/5qkQg7Ukw/Oc=; b=qTi1PNE0Nu/Dt/4VECj+xpn8Wsn/H2iJ3yqdR1WUKIP+//Mh4twhOFMkTOMjuvvpIL BDKGgQkoSbbAEw+SN70kZbdTZVdXHN8J+Q93xpSG058jUDzdTIfuUToaJBifMSCER2MD llUZ1yVG7hYgYqm0N2lLiWl8jUzOyIu/iuPTxIWm9dUqs3ktjEwzstYveGsBW2PseseZ 0S9Xhev2syY4i9lJ7N25BF+jzrdsoLSCfd5Xl6Zx3tBVB096udVSw1UsTdsvP+fW0SdR 4chP5D/ULmi/3wgE6dZVjZIeJ6b/VJHVuN6nAB9ctz2PCbYVkWqz0oGmp11PE8EeFYcS MDJA== X-Gm-Message-State: AOAM532SSFKuqULeA9NmHxHXoSyhTGrjQJN++nRs0xkarfKjWHd9i67C ZoIBrbbc8UigHIv5WCkWzU4= X-Received: by 2002:a17:90b:1c8f:: with SMTP id oo15mr12391932pjb.169.1635923001245; Wed, 03 Nov 2021 00:03:21 -0700 (PDT) Received: from localhost.localdomain ([103.7.29.32]) by smtp.gmail.com with ESMTPSA id x9sm4242564pjp.50.2021.11.03.00.03.18 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Nov 2021 00:03:20 -0700 (PDT) From: Like Xu X-Google-Original-From: Like Xu To: Paolo Bonzini Cc: Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/3] Use static_call for kvm_pmu_ops Date: Wed, 3 Nov 2021 15:03:07 +0800 Message-Id: <20211103070310.43380-1-likexu@tencent.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, This is a successor to a previous patch set from Jason Baron. Let's convert kvm_pmu_ops to use static_call. Shows good performance gains for a typical perf use case [2] in the guest (results in patch 3/3). [1] https://lore.kernel.org/lkml/cover.1610680941.git.jbaron@akamai.com/ [2] perf record -e branch-instructions -e branch-misses \ -e cache-misses -e cache-references -e cpu-cycles \ -e instructions ./workload Thanks, Like Xu (3): KVM: x86: Copy kvm_pmu_ops by value to eliminate layer of indirection KVM: x86: Introduce definitions to support static calls for kvm_pmu_ops KVM: x86: Use static calls to reduce kvm_pmu_ops overhead arch/x86/include/asm/kvm-x86-pmu-ops.h | 32 ++++++++++++++++++ arch/x86/kvm/pmu.c | 46 +++++++++++++++----------- arch/x86/kvm/pmu.h | 19 ++++++++++- arch/x86/kvm/vmx/nested.c | 2 +- arch/x86/kvm/x86.c | 5 +++ 5 files changed, 83 insertions(+), 21 deletions(-) create mode 100644 arch/x86/include/asm/kvm-x86-pmu-ops.h -- 2.33.0