Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5253528ybl; Tue, 14 Jan 2020 06:06:38 -0800 (PST) X-Google-Smtp-Source: APXvYqwRr3SAwsZnRtTOGfYCQ3LTORh5x+GJJbDzLSyeLB4R0pM44tOWmcK6z5kqR+CPqtoJwO24 X-Received: by 2002:aca:d507:: with SMTP id m7mr15962574oig.48.1579010798690; Tue, 14 Jan 2020 06:06:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579010798; cv=none; d=google.com; s=arc-20160816; b=N+ra0N7tWG/JaCzxmItAkVpavmVxkiRZqhtIBmnGa0DFubJ0jNEhDp4O/MmvYHrjSZ qfM24yKiqWRTtFY5YCvULjSPgswA4CXqSJWqnJWAH9IW2PIKD8/cv4sdVV4hnO6pyZxv n9I5rUy3FGvQU/tUsNgF8e+6WNQ90xMqWnVx/Ik6OhGKXk7GfW01RKtKoHJBceXPGqwn pruWLN9Er2ZIRQZ2t/LFmQzYeOLNnQh43wb/4WkEEwufeAJSRg+igWJkdVOxiK26FP5A khh1rmY75hdlSjO763jHjjp2oEu5WQCSAm5VLfU7bcKWevbfYyw135PDg//5FFN/Qxc+ ddiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=jTUE5nhCTYN++fmwFIP/Eg/oP/RU6xZfZjc736Bpxrw=; b=O5yl1Q8cTaVsyk6Th4OEjZpG9LOD5X2nKO2VY/htEIYhOxIRQ3YbtdEtZsH5w+134e 6gAjXSNiq6oOCWi/tl/YXCFJj+tlEz//8AqK2afJb7X4IHZH5QcqriHlO25uRMKCKQ2i 8RDPM0++WbWVG1IIVQvRz3rIuSXXdN3DbO2t9WeYEK9L0g6xwUoA8S/v1jhemDEI87i6 Rn4ISuCm8yC+nlI/MfT1tINVT8jLtcAPqQcbq5pIYSwZJnPXhra//xOzA4d9RhTWM36x cTmVkYyvxNTiwyLN+7QTI5fjPZy20FoEt83cmA1RGMHy8Xnt3XBg969dihFReA8G9vm9 HERg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=iraABIIR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v23si8346432otk.321.2020.01.14.06.06.11; Tue, 14 Jan 2020 06:06:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=iraABIIR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728883AbgANOEk (ORCPT + 99 others); Tue, 14 Jan 2020 09:04:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:53904 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726115AbgANOEk (ORCPT ); Tue, 14 Jan 2020 09:04:40 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1EFDA2072B; Tue, 14 Jan 2020 14:04:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579010679; bh=iHlBoiWEHE0iPobcdkgXVSMdB0Pebv923SbPBtm3Xd0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=iraABIIRoDS5FdyCTm8XZeR5OLF62WF0i4b42/I5NAqXGgnk1g8RFM2e2qdXhQS4F u+kEJ49NznsuP1I5e8wcjUGBGM11xmXS3df3/Fhy2+r51DrNudiEr6HU11YNpTgnUp FVoOw+Xsns6zoZIShj1UkbmX5zfsLpq/lqu187IQ= Date: Tue, 14 Jan 2020 15:04:36 +0100 From: Greg KH To: Jiri Olsa Cc: "Sudarikov, Roman" , peterz@infradead.org, mingo@redhat.com, acme@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, namhyung@kernel.org, linux-kernel@vger.kernel.org, eranian@google.com, bgregg@netflix.com, ak@linux.intel.com, kan.liang@linux.intel.com, alexander.antonov@intel.com Subject: Re: [PATCH v3 1/2] perf x86: Infrastructure for exposing an Uncore unit to PMON mapping Message-ID: <20200114140436.GA1707494@kroah.com> References: <20200113135444.12027-1-roman.sudarikov@linux.intel.com> <20200113135444.12027-2-roman.sudarikov@linux.intel.com> <20200113143430.GA390411@kroah.com> <9bfcc058-8fde-9b24-3d82-255004e7f057@linux.intel.com> <20200114133958.GE170376@krava> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200114133958.GE170376@krava> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 14, 2020 at 02:39:58PM +0100, Jiri Olsa wrote: > On Tue, Jan 14, 2020 at 04:24:34PM +0300, Sudarikov, Roman wrote: > > SNIP > > > > > { > > > > struct intel_uncore_pmu *pmus; > > > > @@ -950,10 +976,19 @@ static int __init uncore_type_init(struct intel_uncore_type *type, bool setid) > > > > attr_group->attrs[j] = &type->event_descs[j].attr.attr; > > > > type->events_group = &attr_group->group; > > > > - } > > > > + } else > > > > + type->events_group = &empty_group; > > > Why??? > > Hi Greg, > > > > Technically, what I'm trying to do is to add an attribute which depends on > > the uncore pmu type and BIOS support. New attribute is added to the end of > > the attribute groups array. It appears that the events attribute group is > > optional for most of the uncore pmus for x86/intel, i.e. events_group = > > NULL. > > > > NULL element in the middle of the attribute groups array "hides" all others > > attribute groups which follows that element. > > > > To work around it, embedded NULL elements should be either removed from > > the attribute groups array [1] or replaced with empty attribute; see > > implementation above. > > > > If both approaches are incorrect then please advice what would be correct > > solution for that case. > > hi, > I think Greg is reffering to the recent cleanup where we used attribute > groups with is_vissible callbacks, you can check changes below: > > b7c9b3927337 perf/x86/intel: Use ->is_visible callback for default group > 6a9f4efe78af perf/x86: Use update attribute groups for default attributes > b657688069a2 perf/x86/intel: Use update attributes for skylake format > 3ea40ac77261 perf/x86: Use update attribute groups for extra format > 1f157286829c perf/x86: Use update attribute groups for caps > baa0c83363c7 perf/x86: Use the new pmu::update_attrs attribute group Yes, that is the case. Don't abuse things like trying to stick NULL elements in the middle of an attribute group, that's horrid. Use the apis that we have build especially for this type of thing, that is what it is there for and will keep things _MUCH_ simpler over time. thanks, greg k-h