From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C811C433EF for ; Fri, 17 Sep 2021 08:46:55 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 7FF5461056 for ; Fri, 17 Sep 2021 08:46:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7FF5461056 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id EEB464B0B8; Fri, 17 Sep 2021 04:46:53 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@google.com Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id z8DnAOPrRIZw; Fri, 17 Sep 2021 04:46:52 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id BD3454B0CB; Fri, 17 Sep 2021 04:46:52 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 7F6C449E93 for ; Thu, 16 Sep 2021 17:37:50 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7d-51o9avn2r for ; Thu, 16 Sep 2021 17:37:49 -0400 (EDT) Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 5777E49E57 for ; Thu, 16 Sep 2021 17:37:49 -0400 (EDT) Received: by mail-pj1-f54.google.com with SMTP id k23-20020a17090a591700b001976d2db364so5799436pji.2 for ; Thu, 16 Sep 2021 14:37:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=HRmclIUd+IXQYZmIP/8HeB41v2sSRX/lMU3hqPZHzVc=; b=Y5uK5usJpzBqYTtETIZzqzrlpEcCGhV1j72nBokzqPxRHfzfqcv9p8/VHqtByMLMa0 7qnKk2mXRWZ/QVGLWlLUF5fmAtrANk6SVsEq1yvp8Onbj0l+EW2VdhbQ4ssaqq3XvXG+ UIKM1VSQcdm2YELLCqHTNz0YRbJwYR+FmuDGCbuEaAumq4dsS2jCwrqpahV4jYDPFBXn +EFOprbkB9HNvtLDp/UkAPEYfLhp0RIxcvNz5Sev+mrGTECnwFfzaEXBv/uyDuKWSXl9 MKEl69zQIthFjeiLPFYtD50iSHjTDfTtVEJ8PfVuNwd6e3VXHqiBdyMOjirUU+xrvFcM TwGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=HRmclIUd+IXQYZmIP/8HeB41v2sSRX/lMU3hqPZHzVc=; b=y7PULFTMnBbgIvzpUloD9V/bGKDTKyLdy37VI5kM7GS6tV12i48pFEhORTKOlUzE1S 9WXl1LymDYxbnkIANY2zqvz70zPMtKFkqE0mbIvCl3EALZMzSyyxeZ/hXRJGIG0AtElI B3/DMaLzUwt90ID3kDIDhd1gTu5BamAwAnqiYyFIUDws0WRPfhkjachKtKteD4cWSfpd kqePiyI1CuUZpQsyjGsVT0eQO6h9i/hAPJMFX4WvaNjTWMWghuEOwitcjLf1DR+3+3Th 4V98VuFNXp+TbVUqM19qh0phqHYjq3V5WAeH8FKoRF0iGGU8SJLT9QO1OQSEXnfM7Qsr GkOw== X-Gm-Message-State: AOAM531wuMzvWy9EZAgaXYIVejVZeC4nlzHYIyF9gfs8DY+g7Btcyx6A MHCzx7YvTJBc51JqgyRA5Ev7+Q== X-Google-Smtp-Source: ABdhPJxrNs7jIZy34jmkRTyON4Y+9pNnsbkx7GECTLo7e1rXLwAWohi0Xxo5Jb11PEVRFoL9wO4HSQ== X-Received: by 2002:a17:90b:1291:: with SMTP id fw17mr6609537pjb.135.1631828268138; Thu, 16 Sep 2021 14:37:48 -0700 (PDT) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id t15sm4013977pgk.13.2021.09.16.14.37.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Sep 2021 14:37:47 -0700 (PDT) Date: Thu, 16 Sep 2021 21:37:43 +0000 From: Sean Christopherson To: Peter Zijlstra Subject: Re: [PATCH v2 00/13] perf: KVM: Fix, optimize, and clean up callbacks Message-ID: References: <20210828003558.713983-1-seanjc@google.com> <20210828201336.GD4353@worktop.programming.kicks-ass.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210828201336.GD4353@worktop.programming.kicks-ass.net> X-Mailman-Approved-At: Fri, 17 Sep 2021 04:46:52 -0400 Cc: Wanpeng Li , kvm@vger.kernel.org, Alexander Shishkin , Catalin Marinas , Guo Ren , "H. Peter Anvin" , linux-riscv@lists.infradead.org, Vincent Chen , Jiri Olsa , Boris Ostrovsky , Stefano Stabellini , xen-devel@lists.xenproject.org, Marc Zyngier , Joerg Roedel , x86@kernel.org, linux-csky@vger.kernel.org, kvmarm@lists.cs.columbia.edu, Ingo Molnar , Like Xu , Albert Ou , Zhu Lingshan , Will Deacon , Arnaldo Carvalho de Melo , Borislav Petkov , Greentime Hu , Paul Walmsley , Namhyung Kim , Thomas Gleixner , Artem Kashkanov , linux-arm-kernel@lists.infradead.org, Jim Mattson , Juergen Gross , Nick Hu , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Palmer Dabbelt , Paolo Bonzini , Vitaly Kuznetsov X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On Sat, Aug 28, 2021, Peter Zijlstra wrote: > On Fri, Aug 27, 2021 at 05:35:45PM -0700, Sean Christopherson wrote: > > Like Xu (2): > > perf/core: Rework guest callbacks to prepare for static_call support > > perf/core: Use static_call to optimize perf_guest_info_callbacks > > > > Sean Christopherson (11): > > perf: Ensure perf_guest_cbs aren't reloaded between !NULL check and > > deref > > KVM: x86: Register perf callbacks after calling vendor's > > hardware_setup() > > KVM: x86: Register Processor Trace interrupt hook iff PT enabled in > > guest > > perf: Stop pretending that perf can handle multiple guest callbacks > > perf: Force architectures to opt-in to guest callbacks > > KVM: x86: Drop current_vcpu for kvm_running_vcpu + kvm_arch_vcpu > > variable > > KVM: x86: More precisely identify NMI from guest when handling PMI > > KVM: Move x86's perf guest info callbacks to generic KVM > > KVM: x86: Move Intel Processor Trace interrupt handler to vmx.c > > KVM: arm64: Convert to the generic perf callbacks > > KVM: arm64: Drop perf.c and fold its tiny bits of code into arm.c / > > pmu.c Argh, sorry, I somehow managed to miss all of your replies. I'll get back to this series next week. Thanks for the quick response! > Lets keep the whole intel_pt crud inside x86... In theory, I like the idea of burying intel_pt inside x86 (and even in Intel+VMX code for the most part), but the actual implementation is a bit gross. Because of the whole "KVM can be a module" thing, either the static call and __static_call_return0 would need to be exported, or a new register/unregister pair would have to be exported. The unregister path would also need its own synchronize_rcu(). In general, I don't love duplicating the logic, but it's not the end of the world. Either way works for me. Paolo or Peter, do either of you have a preference? > --- > Index: linux-2.6/arch/x86/events/core.c > =================================================================== > --- linux-2.6.orig/arch/x86/events/core.c > +++ linux-2.6/arch/x86/events/core.c > @@ -92,7 +92,7 @@ DEFINE_STATIC_CALL_RET0(x86_pmu_guest_ge > > DEFINE_STATIC_CALL_RET0(x86_guest_state, *(perf_guest_cbs->state)); > DEFINE_STATIC_CALL_RET0(x86_guest_get_ip, *(perf_guest_cbs->get_ip)); > -DEFINE_STATIC_CALL_RET0(x86_guest_handle_intel_pt_intr, *(perf_guest_cbs->handle_intel_pt_intr)); > +DEFINE_STATIC_CALL_RET0(x86_guest_handle_intel_pt_intr, unsigned int (*)(void)); FWIW, the param needs to be a raw function, not a function pointer. _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F306DC43217 for ; Thu, 16 Sep 2021 21:38:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D79C461206 for ; Thu, 16 Sep 2021 21:38:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230051AbhIPVjf (ORCPT ); Thu, 16 Sep 2021 17:39:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231883AbhIPVjJ (ORCPT ); Thu, 16 Sep 2021 17:39:09 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B9BDC061766 for ; Thu, 16 Sep 2021 14:37:48 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id j1so5498154pjv.3 for ; Thu, 16 Sep 2021 14:37:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=HRmclIUd+IXQYZmIP/8HeB41v2sSRX/lMU3hqPZHzVc=; b=Y5uK5usJpzBqYTtETIZzqzrlpEcCGhV1j72nBokzqPxRHfzfqcv9p8/VHqtByMLMa0 7qnKk2mXRWZ/QVGLWlLUF5fmAtrANk6SVsEq1yvp8Onbj0l+EW2VdhbQ4ssaqq3XvXG+ UIKM1VSQcdm2YELLCqHTNz0YRbJwYR+FmuDGCbuEaAumq4dsS2jCwrqpahV4jYDPFBXn +EFOprbkB9HNvtLDp/UkAPEYfLhp0RIxcvNz5Sev+mrGTECnwFfzaEXBv/uyDuKWSXl9 MKEl69zQIthFjeiLPFYtD50iSHjTDfTtVEJ8PfVuNwd6e3VXHqiBdyMOjirUU+xrvFcM TwGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=HRmclIUd+IXQYZmIP/8HeB41v2sSRX/lMU3hqPZHzVc=; b=1aYqjzgQUwQYA0ueWNdRg8Q/iC/d+h7izZW4zipqAfV6YKvMU0w2El/tr0rY5fWyBV Qs+2z6RX5TH3YDn77MZk/mfkMtH3JHjsUP5y2D44gdSpOf+zlWkFvdViM6MIIRd7B+8w yDLSbSRU7dZaX0gmxuEHc9nyhaHKuThTfhEpPWSJ9P4MUmXQpA1ECM3WYOb+e/m7g1C6 wyuEm2ejNSAsadIZhYxkUhXnyQ9/OaOuJUO1cqo6smLZMygxuyG4Ce4ZTx1mh7iJjLuR rmtCssjuEM05QxuiiatEMIeScFP7sCqpQTBEMO2soZF9ghh5+5dQ63k19NJq6QCrTFtS oW/Q== X-Gm-Message-State: AOAM532xrgzqLaZr3HqeAbQzIfG1l7jz/Wjt1HBy4snswz5fIT7vuYHq TZgHdboHZ6eZ45IwGWH15J+HLA== X-Google-Smtp-Source: ABdhPJxrNs7jIZy34jmkRTyON4Y+9pNnsbkx7GECTLo7e1rXLwAWohi0Xxo5Jb11PEVRFoL9wO4HSQ== X-Received: by 2002:a17:90b:1291:: with SMTP id fw17mr6609537pjb.135.1631828268138; Thu, 16 Sep 2021 14:37:48 -0700 (PDT) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id t15sm4013977pgk.13.2021.09.16.14.37.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Sep 2021 14:37:47 -0700 (PDT) Date: Thu, 16 Sep 2021 21:37:43 +0000 From: Sean Christopherson To: Peter Zijlstra Cc: Ingo Molnar , Arnaldo Carvalho de Melo , Will Deacon , Mark Rutland , Catalin Marinas , Marc Zyngier , Guo Ren , Nick Hu , Greentime Hu , Vincent Chen , Paul Walmsley , Palmer Dabbelt , Albert Ou , Thomas Gleixner , Borislav Petkov , x86@kernel.org, Paolo Bonzini , Boris Ostrovsky , Juergen Gross , Alexander Shishkin , Jiri Olsa , Namhyung Kim , James Morse , Alexandru Elisei , Suzuki K Poulose , "H. Peter Anvin" , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Stefano Stabellini , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org, kvm@vger.kernel.org, xen-devel@lists.xenproject.org, Artem Kashkanov , Like Xu , Zhu Lingshan Subject: Re: [PATCH v2 00/13] perf: KVM: Fix, optimize, and clean up callbacks Message-ID: References: <20210828003558.713983-1-seanjc@google.com> <20210828201336.GD4353@worktop.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210828201336.GD4353@worktop.programming.kicks-ass.net> Precedence: bulk List-ID: X-Mailing-List: linux-csky@vger.kernel.org On Sat, Aug 28, 2021, Peter Zijlstra wrote: > On Fri, Aug 27, 2021 at 05:35:45PM -0700, Sean Christopherson wrote: > > Like Xu (2): > > perf/core: Rework guest callbacks to prepare for static_call support > > perf/core: Use static_call to optimize perf_guest_info_callbacks > > > > Sean Christopherson (11): > > perf: Ensure perf_guest_cbs aren't reloaded between !NULL check and > > deref > > KVM: x86: Register perf callbacks after calling vendor's > > hardware_setup() > > KVM: x86: Register Processor Trace interrupt hook iff PT enabled in > > guest > > perf: Stop pretending that perf can handle multiple guest callbacks > > perf: Force architectures to opt-in to guest callbacks > > KVM: x86: Drop current_vcpu for kvm_running_vcpu + kvm_arch_vcpu > > variable > > KVM: x86: More precisely identify NMI from guest when handling PMI > > KVM: Move x86's perf guest info callbacks to generic KVM > > KVM: x86: Move Intel Processor Trace interrupt handler to vmx.c > > KVM: arm64: Convert to the generic perf callbacks > > KVM: arm64: Drop perf.c and fold its tiny bits of code into arm.c / > > pmu.c Argh, sorry, I somehow managed to miss all of your replies. I'll get back to this series next week. Thanks for the quick response! > Lets keep the whole intel_pt crud inside x86... In theory, I like the idea of burying intel_pt inside x86 (and even in Intel+VMX code for the most part), but the actual implementation is a bit gross. Because of the whole "KVM can be a module" thing, either the static call and __static_call_return0 would need to be exported, or a new register/unregister pair would have to be exported. The unregister path would also need its own synchronize_rcu(). In general, I don't love duplicating the logic, but it's not the end of the world. Either way works for me. Paolo or Peter, do either of you have a preference? > --- > Index: linux-2.6/arch/x86/events/core.c > =================================================================== > --- linux-2.6.orig/arch/x86/events/core.c > +++ linux-2.6/arch/x86/events/core.c > @@ -92,7 +92,7 @@ DEFINE_STATIC_CALL_RET0(x86_pmu_guest_ge > > DEFINE_STATIC_CALL_RET0(x86_guest_state, *(perf_guest_cbs->state)); > DEFINE_STATIC_CALL_RET0(x86_guest_get_ip, *(perf_guest_cbs->get_ip)); > -DEFINE_STATIC_CALL_RET0(x86_guest_handle_intel_pt_intr, *(perf_guest_cbs->handle_intel_pt_intr)); > +DEFINE_STATIC_CALL_RET0(x86_guest_handle_intel_pt_intr, unsigned int (*)(void)); FWIW, the param needs to be a raw function, not a function pointer. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BDE0BC433EF for ; Thu, 16 Sep 2021 21:38:18 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4309360F26 for ; Thu, 16 Sep 2021 21:38:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4309360F26 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=CHEdE7rYtE2JRkBL+hFhUPbZTbHRPJrhnX65oPIJ5Tw=; b=I4ABjIQzSGczGo pezL3ltQKy/ehGYtxLcphyEr+QNP44bYN5kOjfHEA4VArKP4u1ErSWkdYcpupOOBdITftipZ3FPsx wTWGrwwKFJKqBrjAb3CQvjdFMNga8uCIdEWZuWIMrmXlkxAej9sCfPIo7PIrm+eoG2xjEJa/WJoFO eb5GmKfWsvB4SXWi0cjBPuTunmb4Iw0UfahifBsCgedoXTg8mhxjMYdyUHkmOfFLCOkwm+P+NnI75 5zI/hT8w5BhK4bYFPBuEUR986ge1Lc5IzmQzR7UFP+l+xvU6oixKnEwJFFr51V1gxP1Di1HzLeyc0 s3GP05Mm+Mfr2B+dx0fA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mQz4t-00CQVb-Ht; Thu, 16 Sep 2021 21:37:55 +0000 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mQz4q-00CQUD-JZ for linux-riscv@lists.infradead.org; Thu, 16 Sep 2021 21:37:54 +0000 Received: by mail-pl1-x62d.google.com with SMTP id bg1so4739522plb.13 for ; Thu, 16 Sep 2021 14:37:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=HRmclIUd+IXQYZmIP/8HeB41v2sSRX/lMU3hqPZHzVc=; b=Y5uK5usJpzBqYTtETIZzqzrlpEcCGhV1j72nBokzqPxRHfzfqcv9p8/VHqtByMLMa0 7qnKk2mXRWZ/QVGLWlLUF5fmAtrANk6SVsEq1yvp8Onbj0l+EW2VdhbQ4ssaqq3XvXG+ UIKM1VSQcdm2YELLCqHTNz0YRbJwYR+FmuDGCbuEaAumq4dsS2jCwrqpahV4jYDPFBXn +EFOprbkB9HNvtLDp/UkAPEYfLhp0RIxcvNz5Sev+mrGTECnwFfzaEXBv/uyDuKWSXl9 MKEl69zQIthFjeiLPFYtD50iSHjTDfTtVEJ8PfVuNwd6e3VXHqiBdyMOjirUU+xrvFcM TwGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=HRmclIUd+IXQYZmIP/8HeB41v2sSRX/lMU3hqPZHzVc=; b=Y0jn8DVFv0ASAIwaFylimHU37SiSGMrUujtv9ombMrqKtBFHvrEjG90Qv2QcszxjIw jhdCzYTMHbDRvmTZXd1lR1xNK/si7tPf8nL96ZUxsKgog2JRSGu5OAcCsFEdYM481WaY vrWf2kgRp9CCNvNSipgTbVvr6eA73Q6Mjgln6ee9iupgNe6BvovVZyeLnY0z4YJ3tDiG gN8hY4TIfwFKINGjQzECCxrxF4lfBZI/AjVKTWZuqjT6t0hsy6NV1mIV6iqVHKKNKfhD ECSlsD8+TYiugq7RsYsuTFKHfE8mheFWaqtyopQoRoBRo+YBA+boz4urRa8se5zwmp6q t4xQ== X-Gm-Message-State: AOAM530o1i3U7kYHd+zBoSIRufqEFTI/v0M+oCUneznD5sovy1HuMIj9 8C81lIjFteKTe8u1S2D65Vvdwg== X-Google-Smtp-Source: ABdhPJxrNs7jIZy34jmkRTyON4Y+9pNnsbkx7GECTLo7e1rXLwAWohi0Xxo5Jb11PEVRFoL9wO4HSQ== X-Received: by 2002:a17:90b:1291:: with SMTP id fw17mr6609537pjb.135.1631828268138; Thu, 16 Sep 2021 14:37:48 -0700 (PDT) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id t15sm4013977pgk.13.2021.09.16.14.37.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Sep 2021 14:37:47 -0700 (PDT) Date: Thu, 16 Sep 2021 21:37:43 +0000 From: Sean Christopherson To: Peter Zijlstra Cc: Ingo Molnar , Arnaldo Carvalho de Melo , Will Deacon , Mark Rutland , Catalin Marinas , Marc Zyngier , Guo Ren , Nick Hu , Greentime Hu , Vincent Chen , Paul Walmsley , Palmer Dabbelt , Albert Ou , Thomas Gleixner , Borislav Petkov , x86@kernel.org, Paolo Bonzini , Boris Ostrovsky , Juergen Gross , Alexander Shishkin , Jiri Olsa , Namhyung Kim , James Morse , Alexandru Elisei , Suzuki K Poulose , "H. Peter Anvin" , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Stefano Stabellini , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org, kvm@vger.kernel.org, xen-devel@lists.xenproject.org, Artem Kashkanov , Like Xu , Zhu Lingshan Subject: Re: [PATCH v2 00/13] perf: KVM: Fix, optimize, and clean up callbacks Message-ID: References: <20210828003558.713983-1-seanjc@google.com> <20210828201336.GD4353@worktop.programming.kicks-ass.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210828201336.GD4353@worktop.programming.kicks-ass.net> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210916_143752_679393_60BF3877 X-CRM114-Status: GOOD ( 19.31 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Sat, Aug 28, 2021, Peter Zijlstra wrote: > On Fri, Aug 27, 2021 at 05:35:45PM -0700, Sean Christopherson wrote: > > Like Xu (2): > > perf/core: Rework guest callbacks to prepare for static_call support > > perf/core: Use static_call to optimize perf_guest_info_callbacks > > > > Sean Christopherson (11): > > perf: Ensure perf_guest_cbs aren't reloaded between !NULL check and > > deref > > KVM: x86: Register perf callbacks after calling vendor's > > hardware_setup() > > KVM: x86: Register Processor Trace interrupt hook iff PT enabled in > > guest > > perf: Stop pretending that perf can handle multiple guest callbacks > > perf: Force architectures to opt-in to guest callbacks > > KVM: x86: Drop current_vcpu for kvm_running_vcpu + kvm_arch_vcpu > > variable > > KVM: x86: More precisely identify NMI from guest when handling PMI > > KVM: Move x86's perf guest info callbacks to generic KVM > > KVM: x86: Move Intel Processor Trace interrupt handler to vmx.c > > KVM: arm64: Convert to the generic perf callbacks > > KVM: arm64: Drop perf.c and fold its tiny bits of code into arm.c / > > pmu.c Argh, sorry, I somehow managed to miss all of your replies. I'll get back to this series next week. Thanks for the quick response! > Lets keep the whole intel_pt crud inside x86... In theory, I like the idea of burying intel_pt inside x86 (and even in Intel+VMX code for the most part), but the actual implementation is a bit gross. Because of the whole "KVM can be a module" thing, either the static call and __static_call_return0 would need to be exported, or a new register/unregister pair would have to be exported. The unregister path would also need its own synchronize_rcu(). In general, I don't love duplicating the logic, but it's not the end of the world. Either way works for me. Paolo or Peter, do either of you have a preference? > --- > Index: linux-2.6/arch/x86/events/core.c > =================================================================== > --- linux-2.6.orig/arch/x86/events/core.c > +++ linux-2.6/arch/x86/events/core.c > @@ -92,7 +92,7 @@ DEFINE_STATIC_CALL_RET0(x86_pmu_guest_ge > > DEFINE_STATIC_CALL_RET0(x86_guest_state, *(perf_guest_cbs->state)); > DEFINE_STATIC_CALL_RET0(x86_guest_get_ip, *(perf_guest_cbs->get_ip)); > -DEFINE_STATIC_CALL_RET0(x86_guest_handle_intel_pt_intr, *(perf_guest_cbs->handle_intel_pt_intr)); > +DEFINE_STATIC_CALL_RET0(x86_guest_handle_intel_pt_intr, unsigned int (*)(void)); FWIW, the param needs to be a raw function, not a function pointer. _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3F2FC433EF for ; Thu, 16 Sep 2021 21:40:21 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6A4F661206 for ; Thu, 16 Sep 2021 21:40:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6A4F661206 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cD9tsbcbMmwyD6J/4eq3ZB/tsCT+oLxeEqwxSNcWlvk=; b=rolUe4NhKJE/qn e4zSyE+6ykQMAU2NY8VGW6CAgR2I5SYoJZp1eO+ArPj6lkI0KEjKjo9G9tG5PHCSNVwkgEbMTSRZK yd3udvzte3x1OW9VV7GJinsaCXUIETAaYG+99oKUgb+AdfhIyA5bDZ/GzVPkA/6Aww/wEHKdHOk0C vz3rskeEOrqvGsf6JBe9VOWXBpA8dusaIwSCYRVFjtoz8AjFd0dFomNAUjxlHV06xKX9XJifKDxXU Jn8xVU1mVQLHRobPCvwaitOYBd2PjBlVQImgqxhDEy5+r+ljSp3PPgX2frN7qJdGO63HVA9EOLNRr jlGANJTJea+IkRBlG9uw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mQz4w-00CQVl-0s; Thu, 16 Sep 2021 21:37:58 +0000 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mQz4q-00CQUC-KL for linux-arm-kernel@lists.infradead.org; Thu, 16 Sep 2021 21:37:54 +0000 Received: by mail-pj1-x1036.google.com with SMTP id p12-20020a17090adf8c00b0019c959bc795so190965pjv.1 for ; Thu, 16 Sep 2021 14:37:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=HRmclIUd+IXQYZmIP/8HeB41v2sSRX/lMU3hqPZHzVc=; b=Y5uK5usJpzBqYTtETIZzqzrlpEcCGhV1j72nBokzqPxRHfzfqcv9p8/VHqtByMLMa0 7qnKk2mXRWZ/QVGLWlLUF5fmAtrANk6SVsEq1yvp8Onbj0l+EW2VdhbQ4ssaqq3XvXG+ UIKM1VSQcdm2YELLCqHTNz0YRbJwYR+FmuDGCbuEaAumq4dsS2jCwrqpahV4jYDPFBXn +EFOprbkB9HNvtLDp/UkAPEYfLhp0RIxcvNz5Sev+mrGTECnwFfzaEXBv/uyDuKWSXl9 MKEl69zQIthFjeiLPFYtD50iSHjTDfTtVEJ8PfVuNwd6e3VXHqiBdyMOjirUU+xrvFcM TwGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=HRmclIUd+IXQYZmIP/8HeB41v2sSRX/lMU3hqPZHzVc=; b=ml//93WkEi/aF9qbQtDFXWXuprAF++lj+drym0VO2AYEpS2hifnttfVU77XFBquvGB nkzOcgp4xI0+DMfzGnd2vIES1TonB9+05Xm6wnWOPR1JcjXrrocONDLgILqmtOBhIP8D CYocOdJMWDfs7B6Faa1I8rO3ONv7wie3dEcLKGMBFqOa9bRPzfc+nGJAHV0U7wERxZib NTaC7S52x7uOtSg7I5Y7MG5vmmfEruTyaOk8Rhh4MNZu38gi4G3CNOOpU7OXwnW+aR99 og+a5RRszpx5LeNSHFJZuOCGN6ZdK4OgSccpyBEk9DNjNSy8fM0Rp12MRhsx3i+dRXMM 9WJg== X-Gm-Message-State: AOAM530I6pfcO0nYHUbr6fupdPnp66E20U55uI7am0RfU2q/TUd8pebz ZYe55OezvHnN3YPNM2ujTt6TAg== X-Google-Smtp-Source: ABdhPJxrNs7jIZy34jmkRTyON4Y+9pNnsbkx7GECTLo7e1rXLwAWohi0Xxo5Jb11PEVRFoL9wO4HSQ== X-Received: by 2002:a17:90b:1291:: with SMTP id fw17mr6609537pjb.135.1631828268138; Thu, 16 Sep 2021 14:37:48 -0700 (PDT) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id t15sm4013977pgk.13.2021.09.16.14.37.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Sep 2021 14:37:47 -0700 (PDT) Date: Thu, 16 Sep 2021 21:37:43 +0000 From: Sean Christopherson To: Peter Zijlstra Cc: Ingo Molnar , Arnaldo Carvalho de Melo , Will Deacon , Mark Rutland , Catalin Marinas , Marc Zyngier , Guo Ren , Nick Hu , Greentime Hu , Vincent Chen , Paul Walmsley , Palmer Dabbelt , Albert Ou , Thomas Gleixner , Borislav Petkov , x86@kernel.org, Paolo Bonzini , Boris Ostrovsky , Juergen Gross , Alexander Shishkin , Jiri Olsa , Namhyung Kim , James Morse , Alexandru Elisei , Suzuki K Poulose , "H. Peter Anvin" , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Stefano Stabellini , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org, kvm@vger.kernel.org, xen-devel@lists.xenproject.org, Artem Kashkanov , Like Xu , Zhu Lingshan Subject: Re: [PATCH v2 00/13] perf: KVM: Fix, optimize, and clean up callbacks Message-ID: References: <20210828003558.713983-1-seanjc@google.com> <20210828201336.GD4353@worktop.programming.kicks-ass.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210828201336.GD4353@worktop.programming.kicks-ass.net> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210916_143752_702193_282BACDA X-CRM114-Status: GOOD ( 20.72 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Sat, Aug 28, 2021, Peter Zijlstra wrote: > On Fri, Aug 27, 2021 at 05:35:45PM -0700, Sean Christopherson wrote: > > Like Xu (2): > > perf/core: Rework guest callbacks to prepare for static_call support > > perf/core: Use static_call to optimize perf_guest_info_callbacks > > > > Sean Christopherson (11): > > perf: Ensure perf_guest_cbs aren't reloaded between !NULL check and > > deref > > KVM: x86: Register perf callbacks after calling vendor's > > hardware_setup() > > KVM: x86: Register Processor Trace interrupt hook iff PT enabled in > > guest > > perf: Stop pretending that perf can handle multiple guest callbacks > > perf: Force architectures to opt-in to guest callbacks > > KVM: x86: Drop current_vcpu for kvm_running_vcpu + kvm_arch_vcpu > > variable > > KVM: x86: More precisely identify NMI from guest when handling PMI > > KVM: Move x86's perf guest info callbacks to generic KVM > > KVM: x86: Move Intel Processor Trace interrupt handler to vmx.c > > KVM: arm64: Convert to the generic perf callbacks > > KVM: arm64: Drop perf.c and fold its tiny bits of code into arm.c / > > pmu.c Argh, sorry, I somehow managed to miss all of your replies. I'll get back to this series next week. Thanks for the quick response! > Lets keep the whole intel_pt crud inside x86... In theory, I like the idea of burying intel_pt inside x86 (and even in Intel+VMX code for the most part), but the actual implementation is a bit gross. Because of the whole "KVM can be a module" thing, either the static call and __static_call_return0 would need to be exported, or a new register/unregister pair would have to be exported. The unregister path would also need its own synchronize_rcu(). In general, I don't love duplicating the logic, but it's not the end of the world. Either way works for me. Paolo or Peter, do either of you have a preference? > --- > Index: linux-2.6/arch/x86/events/core.c > =================================================================== > --- linux-2.6.orig/arch/x86/events/core.c > +++ linux-2.6/arch/x86/events/core.c > @@ -92,7 +92,7 @@ DEFINE_STATIC_CALL_RET0(x86_pmu_guest_ge > > DEFINE_STATIC_CALL_RET0(x86_guest_state, *(perf_guest_cbs->state)); > DEFINE_STATIC_CALL_RET0(x86_guest_get_ip, *(perf_guest_cbs->get_ip)); > -DEFINE_STATIC_CALL_RET0(x86_guest_handle_intel_pt_intr, *(perf_guest_cbs->handle_intel_pt_intr)); > +DEFINE_STATIC_CALL_RET0(x86_guest_handle_intel_pt_intr, unsigned int (*)(void)); FWIW, the param needs to be a raw function, not a function pointer. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel