Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp222625rdb; Thu, 19 Oct 2023 02:29:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFXuUCvrusxQaw41CTkHD2eLJgvkhWTvSwdfQ3aWIUPNd3GaSYiwNIGqNlnRFzGjgwsCWNq X-Received: by 2002:a17:902:d294:b0:1c7:23c9:a7db with SMTP id t20-20020a170902d29400b001c723c9a7dbmr1661761plc.26.1697707749670; Thu, 19 Oct 2023 02:29:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697707749; cv=none; d=google.com; s=arc-20160816; b=YqBspDTey9za47oCvIrNJMEdwzdTVXWNIvUAR1QTdF4wzjP8hupLRwT5ehbsUvJ48L 87taHvcpueL3B4vC1cvAQzKMJ147Wp7xUgqLxn2TcwMd0lP0fAz04uPpKbqjAGmShyde SEo3VlwBCYK3KWep+xavhsD83aj9P2MtvfHHT8Iyi9d2YzGekmFbk52G9IIIBQmsrNuf Z6TnaxzT0WHvDHhyE3YayBaGG1fYKOuoF0gJFqIGFOkmexyA5sQKwJTSZqYsHMdZQ5r4 vLghlU1m8cHlk94Elw9X5HXRz9nChlA+jT0HC9X5g1OhPDNfCSEL606kRai0jOHWSJjF wdDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=JHd0ZN4OkAXDPqWpGVCUvAOm6bdfijxr28zsL2qtGDg=; fh=3kTKsv2cAw/HzpZ5MwS0/6eqzVbNIR0k/WjaGE2kPn8=; b=DA1w1sIV3e2TLnYv9ez2gzWqWJUAMpObj+MywZYQ1R9f6kPTjT8hP84jpYkSBWwmyN egXU4kj8OvqtO1OHCp2kFCNvAaF/WfNBj78N3aBNeEi+vt7q/kHpcv8XYW3lSg7yTkY5 7bHVgUakr6urTKCSLxErUgdf4EodbEQOV1SuZSHecmG+rnYjA0N1XyxcBO7k6ZLGUfVo IVvuu8jOuDFd+tXVcvp7P0DIWjnFvJdw0WYz2DchQSLhL9R9VHWpr+xuShcyM/B2HQS2 ZQJ78OIbFytdMaMb0ZBiUuxAVBJvp1ArK9OCzAD16aTsgtzWaL0UbshDkD+j8b9WgQQ1 PG3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b="GKzFE/7w"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id kf4-20020a17090305c400b001c0cb378f04si1753734plb.335.2023.10.19.02.29.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 02:29:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b="GKzFE/7w"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 25E01824928B; Thu, 19 Oct 2023 02:29:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345046AbjJSJ27 (ORCPT + 99 others); Thu, 19 Oct 2023 05:28:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232876AbjJSJ25 (ORCPT ); Thu, 19 Oct 2023 05:28:57 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6807BA3 for ; Thu, 19 Oct 2023 02:28:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=JHd0ZN4OkAXDPqWpGVCUvAOm6bdfijxr28zsL2qtGDg=; b=GKzFE/7w1NtdhLKNKz6RBsX/oT ZupSTF0Vw7mu4VbrATzZOCktNkCHM1Wua5udNwwHcaknuEatj+UX3JNzhwIrMTS9IZ7Ck8Mgr/TyK awZ0HvwyfCfiYfxHheGyV0AzbMpjCBpy0+LYLbuM9iFUBeLDTuj8tpfIScSjMXA4//BksT5DgoSXS Ix8JLZdEFXgUPPG+jdxqvU0paMksy6TyUgRPawGQLHw9XWhtTuO4idJwSQAaEQQnWDe+lpijZwqPK FOXP8+c+kmeSf3jPf8APdJ4qEhsNRtZlzJ2yuJ1UuLhAyZWkZkPof12tt2CNY/WOfR1QoCYOIPo44 YIp+V7Mw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qtPIi-009kg5-13; Thu, 19 Oct 2023 09:28:44 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 03257300338; Thu, 19 Oct 2023 11:26:44 +0200 (CEST) Date: Thu, 19 Oct 2023 11:26:43 +0200 From: Peter Zijlstra To: kan.liang@linux.intel.com Cc: mingo@redhat.com, acme@kernel.org, linux-kernel@vger.kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, namhyung@kernel.org, irogers@google.com, adrian.hunter@intel.com, ak@linux.intel.com, eranian@google.com, alexey.v.bayduraev@linux.intel.com, tinghao.zhang@intel.com Subject: Re: [PATCH V4 4/7] perf/x86/intel: Support LBR event logging Message-ID: <20231019092643.GF36211@noisy.programming.kicks-ass.net> References: <20231004184044.3062788-1-kan.liang@linux.intel.com> <20231004184044.3062788-4-kan.liang@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231004184044.3062788-4-kan.liang@linux.intel.com> X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 19 Oct 2023 02:29:06 -0700 (PDT) On Wed, Oct 04, 2023 at 11:40:41AM -0700, kan.liang@linux.intel.com wrote: > + > static struct attribute *lbr_attrs[] = { > &dev_attr_branches.attr, > + &dev_attr_branch_counter_nr.attr, > + &dev_attr_branch_counter_width.attr, > NULL > }; > > @@ -5590,7 +5665,11 @@ mem_is_visible(struct kobject *kobj, struct attribute *attr, int i) > static umode_t > lbr_is_visible(struct kobject *kobj, struct attribute *attr, int i) > { > - return x86_pmu.lbr_nr ? attr->mode : 0; > + /* branches */ > + if (i == 0) > + return x86_pmu.lbr_nr ? attr->mode : 0; > + > + return (x86_pmu.flags & PMU_FL_LBR_EVENT) ? attr->mode : 0; > } As in the patch this is fairly readable, but I just checked and in the code lbr_attrs and lbr_is_visible() are rather far away from one another which makes the whole i thing hard to interpret. Should we re-organize that a little?