Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1657934pxv; Fri, 2 Jul 2021 09:02:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzgEFbaG3FXK990MLQrMPMQ+w1kElUAHoPOK/YuJWZluotB3pxX3UiST28lEGPJJU5HjXB X-Received: by 2002:a17:907:3e8a:: with SMTP id hs10mr388739ejc.359.1625241765270; Fri, 02 Jul 2021 09:02:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625241765; cv=none; d=google.com; s=arc-20160816; b=JX9WmWfcr9Qp2o5GF1wBVh9XR+chIFEd6NWEbctsoAyO1TKUPmsoGbNT/3Q+9h8yUa eR6sLALmcRcyB0XCxWq72UAS1xbu6G1B2nOxgEJZ6bdM5xumYZTwcUbuebFsKK3aXiEH vrshbWivtlncMCqi5ZGrWUmM81VfF/Li5ocI8yefqPiIB73MXTKznbBCYN3L1LQi2BPG 6X8xEJ9N1N6ITu2swwJPvilkuo0QEHL0p+mvY4Om/K1YIqIAboXbVKBDEoZK4WTsHxOg xITfiyA4EofZKqr2gRl1oxQIRblJCxofXqKvlRehLi8OEqY2DL4rVmeCh9zUtFZFHt15 Fakw== 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 :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=bUC72Y7jyLmC38XcgPlD7eHvAGW+Rhs8Uo3o5KwwWrA=; b=FwFWAPgFcUymYOxRG+bSXPp870trUfgIgezTci6Gcq99ZGQCBTDt5xK5wmuXIStlhE BHKRay3fo6EgFRw8TTW+SduCSZIeQKn3YgcPxSuLqntorgo8fuTgYG7aQXI5wm/EB0Cu Q3D/+wZAUBYln3+v+qBMYVrpgqF+t0JaQQjbmTvuuu0+dE1iJLge7chy6QshUs8cuMfk yu+crp2tc4KQ4s2zi9Ktif2Dl8SXKFV1dY5QA9Ldg/3ohU3Y1hg3PFZ96J08KDyH1JKm 5xbyVuN2Tc0zFKeVcARI5gO0lkFZ65m7CDfCIEPiw6p3jkyas5ATKbcgt70E+smZpVPK Q1EA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w12si3525184edd.491.2021.07.02.09.02.21; Fri, 02 Jul 2021 09:02:45 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231823AbhGBQDH (ORCPT + 99 others); Fri, 2 Jul 2021 12:03:07 -0400 Received: from smtprelay0095.hostedemail.com ([216.40.44.95]:55646 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229807AbhGBQDG (ORCPT ); Fri, 2 Jul 2021 12:03:06 -0400 Received: from omf08.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay07.hostedemail.com (Postfix) with ESMTP id 5E8CE181D207E; Fri, 2 Jul 2021 16:00:33 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf08.hostedemail.com (Postfix) with ESMTPA id 850751A29F9; Fri, 2 Jul 2021 16:00:25 +0000 (UTC) Message-ID: <7379289718c6826dd1affec5824b749be2aee0a4.camel@perches.com> Subject: Re: [PATCH V7 01/18] perf/core: Use static_call to optimize perf_guest_info_callbacks From: Joe Perches To: Peter Zijlstra , Zhu Lingshan Cc: pbonzini@redhat.com, bp@alien8.de, seanjc@google.com, vkuznets@redhat.com, wanpengli@tencent.com, jmattson@google.com, joro@8bytes.org, weijiang.yang@intel.com, kan.liang@linux.intel.com, ak@linux.intel.com, wei.w.wang@intel.com, eranian@google.com, liuxiangdong5@huawei.com, linux-kernel@vger.kernel.org, x86@kernel.org, kvm@vger.kernel.org, like.xu.linux@gmail.com, Like Xu , Will Deacon , Marc Zyngier , Guo Ren , Nick Hu , Paul Walmsley , Boris Ostrovsky , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org, xen-devel@lists.xenproject.org Date: Fri, 02 Jul 2021 09:00:22 -0700 In-Reply-To: References: <20210622094306.8336-1-lingshan.zhu@intel.com> <20210622094306.8336-2-lingshan.zhu@intel.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.40.0-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 850751A29F9 X-Spam-Status: No, score=-1.40 X-Stat-Signature: shha9bwa3wcuy6qog6sh3abeec4qbbut X-Rspamd-Server: rspamout03 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX18c3UUJH2LcjAG65GSZ68xha895S86OjZI= X-HE-Tag: 1625241625-20610 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2021-07-02 at 13:22 +0200, Peter Zijlstra wrote: > On Tue, Jun 22, 2021 at 05:42:49PM +0800, Zhu Lingshan wrote: > > diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c [] > > @@ -90,6 +90,27 @@ DEFINE_STATIC_CALL_NULL(x86_pmu_pebs_aliases, *x86_pmu.pebs_aliases); > > ??*/ > > ?DEFINE_STATIC_CALL_RET0(x86_pmu_guest_get_msrs, *x86_pmu.guest_get_msrs); > > ? > > > > +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)); > > + > > +void arch_perf_update_guest_cbs(void) > > +{ > > + static_call_update(x86_guest_state, (void *)&__static_call_return0); > > + static_call_update(x86_guest_get_ip, (void *)&__static_call_return0); > > + static_call_update(x86_guest_handle_intel_pt_intr, (void *)&__static_call_return0); > > + > > + if (perf_guest_cbs && perf_guest_cbs->state) > > + static_call_update(x86_guest_state, perf_guest_cbs->state); > > + > > + if (perf_guest_cbs && perf_guest_cbs->get_ip) > > + static_call_update(x86_guest_get_ip, perf_guest_cbs->get_ip); > > + > > + if (perf_guest_cbs && perf_guest_cbs->handle_intel_pt_intr) > > + static_call_update(x86_guest_handle_intel_pt_intr, > > + perf_guest_cbs->handle_intel_pt_intr); > > +} > > Coding style wants { } on that last if(). That's just your personal preference. The coding-style document doesn't require that. It just says single statement. It's not the number of vertical lines or characters required for the statement. ---------------------------------- Do not unnecessarily use braces where a single statement will do. .. code-block:: c if (condition) action(); and .. code-block:: none if (condition) do_this(); else do_that(); This does not apply if only one branch of a conditional statement is a single statement; in the latter case use braces in both branches: