Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1151147imm; Thu, 6 Sep 2018 16:41:23 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYFyQIjPwMc3WUD6Tdb53xOesrjJqza7YY6hiSTBxe9gqrMwq8DdLOcv5WWzSrUapsvldbk X-Received: by 2002:a17:902:76c5:: with SMTP id j5-v6mr5221352plt.140.1536277283239; Thu, 06 Sep 2018 16:41:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536277283; cv=none; d=google.com; s=arc-20160816; b=Cw7DmycgYnRwcMnfCZzBZKu/rGjJlpZA8ukq52bNlPtsqD9T0+rMpIWsBizGEEcYoa 9RvXvi0WahlPQHT3i+Zq0E8EllDPUzJCepIvbjvEd1vnvR6ai94mR5e1Kkx8RFN4sjUQ WpJP90dirCtatsAaOFMzgmWLekv6burL+4CptzV3I9dPG823HFfdLA/KdwXoDjIzppgq PxXjgXLDCYha7zdKZwjAFNPANFlL0PlaEidrdxe/H7sxCllAwom1F3T27jIr0coaC/90 UlTF7idouZ5oEzpHCEs1SAAxaVgVEhfbtx/VXiEEWWaXkIFUOGdRUVkE8Xx1tv7Jctpg c4Pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=C/xkJatHzHtOw2T2Hfx8S7IzLJ36glKCXB4R5dSARyQ=; b=qoi9E9XxZH0WDzz5rNJXvLWwTROUyH8eEblHGLvPgD96G6iQYVgGwBndMaburO9K1W yWZ1YoETAfJIsyqYah5rB8bVmsykApmaeG2e4kYSPZS667eirX7Onzu1pqEZ+Ghxifpc eWo6DD/j7Ro+XdXs+qi3+6l1uMFuS6fRR0RUzI/MbbEh6rQdFCWm0B4skx6T0R8KZ/mV SW9G4YruMbvvq87ODZmKQbD4i04pNAwHoUQrr79oGC2t9R96lJm6fVeO4HuJwRZFJ2xo tY7QU99YNih2IMhCvSHzmNKaQRkx5h+P7y8+r4eMlfQpWTjf4HphyTJ0tZwVdzRmC0td cmzw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t30-v6si6286092pgm.517.2018.09.06.16.41.07; Thu, 06 Sep 2018 16:41:23 -0700 (PDT) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726043AbeIGEEb (ORCPT + 99 others); Fri, 7 Sep 2018 00:04:31 -0400 Received: from mga18.intel.com ([134.134.136.126]:7671 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725745AbeIGEEb (ORCPT ); Fri, 7 Sep 2018 00:04:31 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Sep 2018 16:26:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,339,1531810800"; d="scan'208";a="89645201" Received: from rchatre-mobl.amr.corp.intel.com (HELO [10.24.14.122]) ([10.24.14.122]) by orsmga002.jf.intel.com with ESMTP; 06 Sep 2018 16:26:25 -0700 Subject: Re: [PATCH V2 4/6] x86/intel_rdt: Add helper to obtain performance counter index To: Peter Zijlstra Cc: tglx@linutronix.de, fenghua.yu@intel.com, tony.luck@intel.com, mingo@redhat.com, acme@kernel.org, vikas.shivappa@linux.intel.com, gavin.hindman@intel.com, jithu.joseph@intel.com, dave.hansen@intel.com, hpa@zytor.com, x86@kernel.org, linux-kernel@vger.kernel.org References: <20180906144751.GH24106@hirez.programming.kicks-ass.net> From: Reinette Chatre Message-ID: Date: Thu, 6 Sep 2018 16:26:24 -0700 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180906144751.GH24106@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Peter, On 9/6/2018 7:47 AM, Peter Zijlstra wrote: > On Thu, Aug 16, 2018 at 01:16:07PM -0700, Reinette Chatre wrote: > >> +static inline int x86_perf_rdpmc_ctr_get(struct perf_event *event) >> +{ >> + lockdep_assert_irqs_disabled(); >> + >> + return IS_ERR_OR_NULL(event) ? -1 : event->hw.event_base_rdpmc; >> +} > > That should be in arch/x86/include/asm/perf_event.h if anywhere. Also, > call the thing x86_perf_rdpmc_index(), that's consistent with the other > naming. Moving it to arch/x86/include/asm/perf_event.h is not trivial since this file is not familiar with struct perf_event. struct perf_event, struct hw_perf_event and its member event_base_rdpmc are all defined in include/linux/perf_event.h - could this function perhaps be moved there? If so, would perf_rdpmc_index() perhaps be a better name to be consistent with the other naming? > > I don't think there's any point in testing for !event, this is an > interface that mandates you know wth you're doing anyway. > I could add: /* !CONFIG_PERF_EVENTS */ static inline int perf_rdpmc_index(struct perf_event *event) { return -1; } Reinette