Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp723108pxb; Thu, 21 Jan 2021 19:24:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJzZR3Qd2+8M743ctjrczzDrMIn8H2lJB/cwWUkYkaCRr3dhv8SzmCFgjEsgPiaFEyQeZ6KW X-Received: by 2002:a50:d484:: with SMTP id s4mr1648124edi.13.1611285873101; Thu, 21 Jan 2021 19:24:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611285873; cv=none; d=google.com; s=arc-20160816; b=EPqfs7QIrIxALQfBztbnB9IkWrzznWH0GtkfImLNCd8j10ueDPZYBNZYi6xm7Hszgf 1ZXrrgukfSd/6KfHnJ+Bd/du+ruWEvsM4sqV5phqGpkDURpVGQd23Hvg5C0BsacI7y58 X3sQtUD8R4iBeSqMiR9ZP1vf2ybhGkgnzramIWhJa4vkV2Kynzc3+d26S3jzb/iBpAnU 28CyNdcnWe/KMrt+0NA2ijJPwMeInLb+3kvmljnaWTtxxExKKxdY/+vfwYZiQbRiKy7D cMAR+qbkrtbzT2jL/snAwj5SvpcOR6RH9qRUhyrKo9xDMon0LedvuAU0OQwi+dRGtZuL tKvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:ironport-sdr:ironport-sdr; bh=FEFuPn8NWXCTMbhtMczKhWmIRkO4DLmL2YYsRl5ixRs=; b=cYdNxVgkWf+Cn+vIbNfaTGwyCAolB6NuvjcOooBzwWdRE3r63prCAG+vFncnnDfqUn WxuOl0soBrYvzbOf6E/7WZ5gBLyQdBiAgdIH60fR5SNO0qE7FaBRhcb1ZdnGX2KhQM6y eK++uuQUly6XHlt1bGK9u+1OLeVCEQVXqDHX0HmmV/I3hC7n829ScfuZ1TXngt4+QLye 7lL1Ajfek6ileR2kdc+LcKhn6XJTRJmIl+zEzpqGfKTmPJZuvQ+LTbxBkVn37ugvHKY+ dtMM00+eRp0ueGiBeBjSZNZ6PZ5Bt/PUT+/BI2IOW9DWhOc8XsvXIsE215tFVCWCWeke m8mQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q8si147817edw.344.2021.01.21.19.24.06; Thu, 21 Jan 2021 19:24:33 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726691AbhAVDV3 (ORCPT + 99 others); Thu, 21 Jan 2021 22:21:29 -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); > } >