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=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 BFF63C433E0 for ; Fri, 22 Jan 2021 03:21:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7E05223888 for ; Fri, 22 Jan 2021 03:21:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726737AbhAVDVd (ORCPT ); Thu, 21 Jan 2021 22:21:33 -0500 Received: from mga01.intel.com ([192.55.52.88]:21647 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726545AbhAVDV1 (ORCPT ); Thu, 21 Jan 2021 22:21:27 -0500 IronPort-SDR: HTrKpBgI0NUmOO3ofCqVBuL1bF4BTFpctfy6w7wMjnr0quGXU1WKCBQ71XHJdBb/FIHq0JdH8y ug5E+bGePyvQ== X-IronPort-AV: E=McAfee;i="6000,8403,9871"; a="198129875" X-IronPort-AV: E=Sophos;i="5.79,365,1602572400"; d="scan'208";a="198129875" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jan 2021 19:19:36 -0800 IronPort-SDR: jH04a57aMKeVtAXTtbLk4D3Ap7/MQk1yH9/4muPQ+K5nD71B/P4zOgI761fnpB3k+0lgvcfVtG 6geKtOvm55zQ== X-IronPort-AV: E=Sophos;i="5.79,365,1602572400"; d="scan'208";a="427636494" Received: from likexu-mobl1.ccr.corp.intel.com (HELO [10.238.4.93]) ([10.238.4.93]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jan 2021 19:19:33 -0800 Subject: Re: [PATCH] x86/perf: Use static_call for x86_pmu.guest_get_msrs To: Peter Zijlstra Cc: kbuild-all@lists.01.org, clang-built-linux@googlegroups.com, Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Thomas Gleixner , Borislav Petkov , x86@kernel.org, linux-kernel@vger.kernel.org, Jason Baron , Josh Poimboeuf , kernel test robot References: <20210118072151.44481-1-like.xu@linux.intel.com> <202101182008.jQybUDa0-lkp@intel.com> From: Like Xu Organization: Intel OTC Message-ID: <7f31ae2f-25a1-a7fb-1598-a8f21f3bc447@linux.intel.com> Date: Fri, 22 Jan 2021 11:19:31 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/1/18 21:35, Peter Zijlstra wrote: > On Mon, Jan 18, 2021 at 09:05:06PM +0800, Like Xu wrote: >> I guess this fix will silence the compiler error, >> and v2 will be sent after the local 0day test passes. > > I think there's also a problem where you don't assign a function at all. Thank you! > > I think you want something like > > if (!x86_pmu.guest_get_msr) > x86_pmu.guest_get_msr = guest_get_msr_nop; > > right before x86_pmu_static_call_update(); > > And then have it be something like: > > static void *guest_et_msr_nop(int *nr) The [-Werror=incompatible-pointer-types] will yell at "void *". Please review the v2 version. https://lore.kernel.org/lkml/20210122030324.2754492-1-like.xu@linux.intel.com/T/#u > { > *nr = 0; > return NULL; > } > > and then you can reduce the entire thing to: > > struct perf_guest_switch_msr *perf_guest_get_msrs(int *nr) > { > return static_call(x86_pmu_guest_get_msrs)(nr); > } >