Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1697684pxv; Fri, 2 Jul 2021 09:58:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztm3Z9lrRis0mzoBnE78w8zE3fneVbBognoxevtJ49nVhEbXD1tby+/+Pekf5xp+NjfymE X-Received: by 2002:a02:2b27:: with SMTP id h39mr406427jaa.62.1625245109442; Fri, 02 Jul 2021 09:58:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625245109; cv=none; d=google.com; s=arc-20160816; b=lKBqmjWU90GLxZqYohpPs/pT12FhMAECdSHss8CkkjEBUK71DtqMbDjo0Esk8N+PZv OW/snBIus62nSJxduw2uHzMihzvsFtjAyQ7sJJcGxAMmGaRzIlW5JIqc+jL9+iAcJPAx NJD+8xVI9d4U5tK7TuvXlynCO31HUVEgCxPcXjuiqJpJm9IJBofSYYflVMyRX3ISnJZH tR9Wn4aR8+i8hZvuQcOf/I8JQaWnv62ByjvFAz3/GqQ+1wpAhm0sdSBR9auWyRSO40w7 XP3LC6BlYFslkitbAkaLpLqtoYttu+9RnCU3pKJI89c0FINf144VNXLPQRSvbp5aphPl UCbw== 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=r98FlWiIfP90qOEg5/lWKF4zGuduf8SOrQFfIlqbquY=; b=AFN1VyKI7PCL7x4sksowq/4JUhFnfcKqrqbbLkz7zL6lCQS7m30F8SE7NzQ9SX1O11 gqB4zt+xXs3GWCtpYKbKN0UiwsjVEKbBYDjmrZz4gp9MLt++IN8U4oBN9N4n543Q48/8 kXzLPyNf74i8fpN5j5+wFA/MtU0/x3jxW5QUcs0cGEzyEeQULGNT+XdvOTYeQGrjizbK 77DeMVcCeUnUx370x/CHYeDlCaINGXIPcHCfuIlTj3hOmhXMN7gr+RKfYAN//DARK2iU iFQIBmcXxU+aOb6Jhlu1Qnenaqpc4OW/wGxXhXAs2dv31E4c/HjjITJENtI/J4FetxLF nJrg== 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 v5si4010106jan.103.2021.07.02.09.58.17; Fri, 02 Jul 2021 09:58:29 -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 S230048AbhGBQ7g (ORCPT + 99 others); Fri, 2 Jul 2021 12:59:36 -0400 Received: from smtprelay0179.hostedemail.com ([216.40.44.179]:38772 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229455AbhGBQ7e (ORCPT ); Fri, 2 Jul 2021 12:59:34 -0400 Received: from omf04.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay03.hostedemail.com (Postfix) with ESMTP id 1BBDF837F27E; Fri, 2 Jul 2021 16:57:01 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf04.hostedemail.com (Postfix) with ESMTPA id D6515D1517; Fri, 2 Jul 2021 16:56:52 +0000 (UTC) Message-ID: <7a2ef915bd08a1c0277b9633e20905c0ca62c568.camel@perches.com> Subject: Re: [PATCH V7 01/18] perf/core: Use static_call to optimize perf_guest_info_callbacks From: Joe Perches To: Mark Rutland Cc: Peter Zijlstra , Zhu Lingshan , wanpengli@tencent.com, Like Xu , eranian@google.com, weijiang.yang@intel.com, Guo Ren , linux-riscv@lists.infradead.org, Will Deacon , kvmarm@lists.cs.columbia.edu, kan.liang@linux.intel.com, ak@linux.intel.com, kvm@vger.kernel.org, Marc Zyngier , joro@8bytes.org, x86@kernel.org, linux-csky@vger.kernel.org, wei.w.wang@intel.com, xen-devel@lists.xenproject.org, liuxiangdong5@huawei.com, bp@alien8.de, Paul Walmsley , Boris Ostrovsky , linux-arm-kernel@lists.infradead.org, jmattson@google.com, like.xu.linux@gmail.com, Nick Hu , seanjc@google.com, linux-kernel@vger.kernel.org, pbonzini@redhat.com, vkuznets@redhat.com Date: Fri, 02 Jul 2021 09:56:51 -0700 In-Reply-To: <20210702163836.GB94260@C02TD0UTHF1T.local> References: <20210622094306.8336-1-lingshan.zhu@intel.com> <20210622094306.8336-2-lingshan.zhu@intel.com> <7379289718c6826dd1affec5824b749be2aee0a4.camel@perches.com> <20210702163836.GB94260@C02TD0UTHF1T.local> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.40.0-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.40 X-Rspamd-Server: rspamout01 X-Rspamd-Queue-Id: D6515D1517 X-Stat-Signature: yfcchsbgyrrjqd9annscud3jta5gtkxi X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX1/FrPSf3Ewjv8gI9yMKoa9Lq2JHlpGAS2Q= X-HE-Tag: 1625245012-826405 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2021-07-02 at 17:38 +0100, Mark Rutland wrote: > On Fri, Jul 02, 2021 at 09:00:22AM -0700, Joe Perches wrote: > > 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: [] > > > > + 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: > > Immediately after this, we say: > > > Also, use braces when a loop contains more than a single simple statement: > > > > .. code-block:: c > > > > ????????while (condition) { > > ????????????????if (test) > > ????????????????????????do_something(); > > ????????} > > > > ... and while that says "a loop", the principle is obviously supposed to > apply to conditionals too; structurally they're no different. We should > just fix the documentation to say "a loop or conditional", or something > to that effect. Maybe. I think there are _way_ too many existing obvious uses where the statement that follows a conditional is multi-line. if (foo) printk(fmt, args...); where the braces wouldn't add anything other than more vertical space. I don't much care one way or another other than Peter's somewhat ambiguous use of the phrase "coding style". checkpatch doesn't emit a message either way. ----------------------------------------- $ cat t_multiline.c // SPDX-License-Identifier: GPL-2.0-only void foo(void) { if (foo) { pr_info(fmt, args); } if (foo) pr_info(fmt, args); if (foo) pr_info(fmt, args); } $ ./scripts/checkpatch.pl -f --strict t_multiline.c total: 0 errors, 0 warnings, 0 checks, 16 lines checked t_multiline.c has no obvious style problems and is ready for submission. ----------------------------------------- cheers, Joe