Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1225712pxv; Fri, 25 Jun 2021 08:07:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbymP0zkBTyZVxgKEZBkw3wxukakJyFfxo6pRrOi4bLOCmdhoQy0Bg8ldmlV3h7bxPRNRl X-Received: by 2002:a17:907:1607:: with SMTP id hb7mr11211195ejc.255.1624633655630; Fri, 25 Jun 2021 08:07:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624633655; cv=none; d=google.com; s=arc-20160816; b=yBGA7P/KrgFFRBhw5o3/We7i5c8kIZwK9zUYhDLRdlLA0gAywjshcuZ5IPrteNnznW vIPJgr6Ek8yx0eeXb3Q+czG/4coZYeV9iJs7d6V06RZ8it+ttex0MZQhe8OxEiVxvES6 tKm8dyqV6kg4XvncgJSpLdgQwlZjY29mF85dXSaPhTmFvfRdd+pw+0C5M6LiuJk8Fenz 8d3qcDSphWlNuaBdxmDJe6qvuDdMX1d3op+Nt8s3vVuWpxUJ80oUKBAUzNGHJ7tW9bzj ti9scJwXopki2lzYwTAyxZ8BsECTXOV+IfxDYwx42Polzjt/V/7Wi2E9gA27B/TeNT8g wafQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:ironport-sdr:ironport-sdr; bh=qW46sBRilIreUIc5NwvJZzNI0N+4BNrbbCUbnW9H+sk=; b=UcF8j0pWnuk+aF6W0jbYZZDsH+pssXJ6ZKE9n5RnwNfcwZ0JZImlRlsYxl+lCxVJFw 1jZApqu4tlfB78GUlaAHnbebKsQyx3I6tINGA3J/512T7PE54zOd2s4OkpZHPXiJ2V17 J/uI4kE+VfX9zQ1Ul7dgMAwlK9awu2l/ry0lFNZ16OHX2U+oCOqVwYV7ywGRsKCORXnw wa2ygUnDElIZxc2j/XzxL9n0KavGvrHOZEJguZjX0ADrjuWYyqYcawsc5oMkZsnjGGi4 LXM0apbg3pRRVxNbV1VWyQP1M27uYecf/BJQBNJH2ZNsnwPAm2UmUuwp/DnCKdkLhfHH Hh7Q== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s24si6597577ejs.124.2021.06.25.08.07.10; Fri, 25 Jun 2021 08:07:35 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231899AbhFYPFo (ORCPT + 99 others); Fri, 25 Jun 2021 11:05:44 -0400 Received: from mga02.intel.com ([134.134.136.20]:57740 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231883AbhFYPFn (ORCPT ); Fri, 25 Jun 2021 11:05:43 -0400 IronPort-SDR: ZhEYjP3dEhqSMyXc8CStC7Jb2oo106TPbmjXKdILHnj9iQJelKZ7HthCKQei+qxK6812dP/6J5 /Bqo+JPCRmPA== X-IronPort-AV: E=McAfee;i="6200,9189,10026"; a="194827124" X-IronPort-AV: E=Sophos;i="5.83,299,1616482800"; d="scan'208";a="194827124" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jun 2021 08:03:22 -0700 IronPort-SDR: Qj6dKVUrx+GqgKJXj81Hm2bXg/o5Pg+ZeV5BJHY94Fo+i4anCbDu68qmK/FOBeBqEHilul5pjO DJ+YF/vgxXzw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,299,1616482800"; d="scan'208";a="640140034" Received: from linux.intel.com ([10.54.29.200]) by fmsmga006.fm.intel.com with ESMTP; 25 Jun 2021 08:03:21 -0700 Received: from [10.212.190.24] (kliang2-MOBL.ccr.corp.intel.com [10.212.190.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by linux.intel.com (Postfix) with ESMTPS id 562BE5805B5; Fri, 25 Jun 2021 08:03:20 -0700 (PDT) Subject: Re: [PATCH 2/7] perf: Create a symlink for a PMU To: Andi Kleen , Greg KH Cc: peterz@infradead.org, mingo@redhat.com, linux-kernel@vger.kernel.org, eranian@google.com, namhyung@kernel.org, acme@kernel.org, jolsa@redhat.com References: <1624497729-158864-1-git-send-email-kan.liang@linux.intel.com> <1624497729-158864-3-git-send-email-kan.liang@linux.intel.com> <1e536604-cf93-0f09-401e-2073924c5582@linux.intel.com> <29d5f315-578f-103c-9523-ae890e29c7e7@linux.intel.com> <540d8a38-da12-56c8-8306-8d3d61ae1d6b@linux.intel.com> From: "Liang, Kan" Message-ID: Date: Fri, 25 Jun 2021 11:03:18 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/25/2021 10:49 AM, Andi Kleen wrote: > >> Device names will change, that's always a given, as the kernel can never >> always make them the same.  That's why userspace needs to scan the bus >> for all devices and then pick out the one that it wants to look at. > > In perf the tool doesn't normally know what devices (= pmu) the users > want to look at. It's all specified on the command line depending on > what events you want to measure. There's no way for the tool to figure > that out on its own. > > >> Don't hard-encode device names into userspace tools, that way lies >> madness. > > There's no hard coding in the tools (or at least not for the non json > event list case). It all comes from the command line. But that is where > the problem comes from. > >> >>> Anyways thinking about it if Greg doesn't want symlinks (even though >>> sysfs >>> already has symlinks elsewhere), maybe we could just create two devices >>> without symlinks. Kan, do you think that would work? >> Do not have 2 different structures represent the same hardware device, >> that too is a shortcut to madness. >> >> What prevents userspace from handling device names changing today?  Why >> are you forcing userspace to pick a specific device name at all? > > The way the perf tool works is that you have to specify the names on the > command line: > > perf stat -a -e uncore_cha/event=1/ ... > > With the numeric identifiers it would be > > perf stat -a -e uncore_type_X_Y/event=1/ > > The tool handles it all abstractly. > > So yes the user tools itself can handle it. But the problem is that it > is directly exposed to the users, so the users would need to change all > their scripts when switching between the two cases. That is what we're > trying to avoid -- provide them a way that works on both. > We have an attribute "caps/pmu_name" for the core PMU. Maybe we should add it for uncore PMU as well. For example, $ cat /sys/devices/uncore_type_0_0/caps/pmu_name cha_0 Userspace tool can get clues about what type_0_0 is. Thanks, Kan