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=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,URIBL_BLOCKED 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 185A6C11F6B for ; Fri, 2 Jul 2021 16:57:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 01B3E613EE for ; Fri, 2 Jul 2021 16:57:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230093AbhGBQ7g (ORCPT ); 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-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 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=-4.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED 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 098B8C11F68 for ; Fri, 2 Jul 2021 16:57:35 +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 C0461613EE for ; Fri, 2 Jul 2021 16:57:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C0461613EE Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=perches.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+linux-riscv=archiver.kernel.org@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:MIME-Version:References:In-Reply-To: Date:Cc:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RiD3aaGtp4W+xKyRvLZ2NR3B87UIB+ikHca8czNhVZ0=; b=C8SjpTiUR46VE5 EXLSu7rKS5bsyk/fNAUAA7PiOR2Ozf47eM71ApY7BMIFn5/2REWw0pHyoYLFlxB5vVpTc1RsjloVV u31QpqjcSaUVoFbiQK7ubK0K7J4qGp6htIjSO/hnExJMbJV6amo+Um11w+YnabtBcabfiSE+Dcq26 NhpKN/aBwjC6XNqt+sCWyK53lF2PMVwI6ACZCO3JU3+QfLginxIukT9zfXq2knriUboAiaGTD/Uzq M1u/jMmcp+QytjCEI/AwcGJTu5yAHAox4mvSp/01be9m8/vs6+a+1k+EoOKTLTn4g+pCQa5G3Sgwi PEVxnsZZyMrCMlaZyoPA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lzMTc-003a8W-IP; Fri, 02 Jul 2021 16:57:16 +0000 Received: from smtprelay0041.hostedemail.com ([216.40.44.41] helo=smtprelay.hostedemail.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lzMTQ-003a6W-TV; Fri, 02 Jul 2021 16:57:06 +0000 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> User-Agent: Evolution 3.40.0-1 MIME-Version: 1.0 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210702_095705_099294_1EDCE06F X-CRM114-Status: GOOD ( 24.30 ) 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="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.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 stateme= nt: > > = > > .. code-block:: c > > = > > =A0=A0=A0=A0=A0=A0=A0=A0while (condition) { > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0if (test) > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0do_something(); > > =A0=A0=A0=A0=A0=A0=A0=A0} > > = > = > ... 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 _______________________________________________ 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=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,URIBL_BLOCKED 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 D7D67C11F68 for ; Fri, 2 Jul 2021 16:57:06 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 47F2061420 for ; Fri, 2 Jul 2021 16:57:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 47F2061420 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=perches.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id B982F4B08E; Fri, 2 Jul 2021 12:57:05 -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 VPDyIQJD7vgu; Fri, 2 Jul 2021 12:57:04 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id B12924081C; Fri, 2 Jul 2021 12:57:04 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 358214081C for ; Fri, 2 Jul 2021 12:57:03 -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 QcV+N1AzUX+s for ; Fri, 2 Jul 2021 12:57:02 -0400 (EDT) Received: from smtprelay.hostedemail.com (smtprelay0248.hostedemail.com [216.40.44.248]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 2DC0E4066E for ; Fri, 2 Jul 2021 12:57:02 -0400 (EDT) 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 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> User-Agent: Evolution 3.40.0-1 MIME-Version: 1.0 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 Cc: wanpengli@tencent.com, kvm@vger.kernel.org, Peter Zijlstra , 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, Like Xu , 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 , vkuznets@redhat.com, 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, Zhu Lingshan 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="iso-8859-1" Content-Transfer-Encoding: quoted-printable Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu 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 stateme= nt: > > = > > .. code-block:: c > > = > > =A0=A0=A0=A0=A0=A0=A0=A0while (condition) { > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0if (test) > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0do_something(); > > =A0=A0=A0=A0=A0=A0=A0=A0} > > = > = > ... 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 _______________________________________________ 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=-4.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED 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 DCC54C11F68 for ; Fri, 2 Jul 2021 16:59:00 +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 9E198613EE for ; Fri, 2 Jul 2021 16:59:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9E198613EE Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=perches.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@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:MIME-Version:References:In-Reply-To: Date:Cc:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vIfFbacKN4c9eL1Fxz53PZzclBzW6jScvKG7B2AvmtE=; b=oEP8oCTYVoihar /+BrMn+Z+8JLh7s9KYGr9PpExbmr3b8KvWBy27pkbVOP7lszUU8HPuqrnVYJd8UjXBgtwMmbqNzcE uZfIfSN9bOzuX0IBiVTUFr0qxm3YYfFUOeXeR2pgAas+WtrRTfv2S6DVhfeg1xZ2dAagDO1VrqbIx /cH/sMlQXdvKTWTxBh1S06tCAW4hZgyIfJpKtB9L37vsdvR4sXwCeC2h7cpn9hpTPtgNzMwmHkL60 ivYZMWWr89uLhkt5TBscHvsWCsQ0SmjlOP4jc1Kclr7ZhpQ+Ks1lJR2lGjuM15XvcL/PHrCN241rc mnpXvuauIXurgpgBRu3A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lzMTT-003a7G-RG; Fri, 02 Jul 2021 16:57:07 +0000 Received: from smtprelay0041.hostedemail.com ([216.40.44.41] helo=smtprelay.hostedemail.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lzMTQ-003a6W-TV; Fri, 02 Jul 2021 16:57:06 +0000 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> User-Agent: Evolution 3.40.0-1 MIME-Version: 1.0 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210702_095705_099294_1EDCE06F X-CRM114-Status: GOOD ( 24.30 ) 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="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 stateme= nt: > > = > > .. code-block:: c > > = > > =A0=A0=A0=A0=A0=A0=A0=A0while (condition) { > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0if (test) > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0do_something(); > > =A0=A0=A0=A0=A0=A0=A0=A0} > > = > = > ... 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,URIBL_BLOCKED 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 4FD42C11F68 for ; Fri, 2 Jul 2021 16:57:17 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 0BDEC613EE for ; Fri, 2 Jul 2021 16:57:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0BDEC613EE Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=perches.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.149252.275950 (Exim 4.92) (envelope-from ) id 1lzMTR-0005ck-03; Fri, 02 Jul 2021 16:57:05 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 149252.275950; Fri, 02 Jul 2021 16:57:04 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lzMTQ-0005cd-TD; Fri, 02 Jul 2021 16:57:04 +0000 Received: by outflank-mailman (input) for mailman id 149252; Fri, 02 Jul 2021 16:57:03 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lzMTP-0005cX-7b for xen-devel@lists.xenproject.org; Fri, 02 Jul 2021 16:57:03 +0000 Received: from smtprelay.hostedemail.com (unknown [216.40.44.146]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 859efe72-db56-11eb-83be-12813bfff9fa; Fri, 02 Jul 2021 16:57:02 +0000 (UTC) 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) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 859efe72-db56-11eb-83be-12813bfff9fa 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-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 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