Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1041022imm; Thu, 6 Sep 2018 14:22:38 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdbq9zU4ifrlw2cah3AA1RtZqYJfhjroDZnvBhi518bO7txnDJ8h18GdU5QUD34S3CAvbTJi X-Received: by 2002:a17:902:bc8b:: with SMTP id bb11-v6mr4718265plb.112.1536268958381; Thu, 06 Sep 2018 14:22:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536268958; cv=none; d=google.com; s=arc-20160816; b=Nn7buUDrxTjybtAEm93AEM4hBE5AZhfexUpUxjqYzfDFFVo66E6tFNsLavNsajhnsu 7GyNj+Fb2FwMA4KPGCv1AXalGDrutfR07GAocbomihFpNAzkPqcR4s7AZI+XYQQHCb7y ekjenD4v33lzymI2lfzkLFpD8Tw5Koff0i12S6AyJmLBXIwuWiokVMu/DbKcimA5/i8q +HzxiDLs3BrkXBxXch5/lu9ntaAyg1RghHJzbsQraSIFQHADV5Kt5eURcIat5TXLDVYQ UU3ULvHukUctaDoNHncR5Tl5QzNaQ08Shbo2fInhi39VOayyf9JSsv0JEiilr18avShN xHeg== 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=qTqzvS/UOuTW99imjkbg8P4hVb1R2/gM57cRougPD8Q=; b=s6W3Ym6yhGqkvB6pXGJI2zQm0S6AlZxwwWEirZU0NrPWlOfc9sHa0wdDq9MiE8KBk+ 8Rk//r+1Fa7D7UgL4tBFs+67/wDm5TirQDJluh6GFEOiflu4phA0niIflq30G8hujcbG nRS7NHoeiAS6Caw/TmFSwEL8dcn0CrRob2bE91ZD3nwQfrNToU7H+uXB1ABvW9r054jH qNUPsJuB2nvWPOC/68Qy6vehTk6DfC7ilUaiN088W3FWU2j+4l2mXFze4nfAp6Jvhcdu F6MiGShWLptjwFsaCFeO6gtOcg4ssZR4ejgzMAANeMuquJzHZ56vUx/QK767gj2a/Ysa muxw== 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 t8-v6si5728832plz.126.2018.09.06.14.22.23; Thu, 06 Sep 2018 14:22:38 -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 S1729121AbeIGAmJ (ORCPT + 99 others); Thu, 6 Sep 2018 20:42:09 -0400 Received: from mga18.intel.com ([134.134.136.126]:52264 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728536AbeIGAmJ (ORCPT ); Thu, 6 Sep 2018 20:42:09 -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 13:05:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,339,1531810800"; d="scan'208";a="89599032" 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 13:05:05 -0700 Subject: Re: [PATCH V2 5/6] x86/intel_rdt: Use perf infrastructure for measurements 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: <30b32ebd826023ab88f3ab3122e4c414ea532722.1534450299.git.reinette.chatre@intel.com> <20180906141524.GF24106@hirez.programming.kicks-ass.net> <40894b6f-c421-32fb-39c3-3dddbed5aa91@intel.com> <20180906194441.GA9358@worktop.programming.kicks-ass.net> From: Reinette Chatre Message-ID: <2465aa4d-fa84-cb0c-082a-15240472b349@intel.com> Date: Thu, 6 Sep 2018 13:05:05 -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: <20180906194441.GA9358@worktop.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 12:44 PM, Peter Zijlstra wrote: > On Thu, Sep 06, 2018 at 12:21:59PM -0700, Reinette Chatre wrote: >> If you do have suggestions on how I can improve the implementation while >> maintaining (or improving) the accuracy of the measurements I would >> greatly appreciate it. > > You can reduce the code duplication by using __always_inline functions > with const function arguments. > Could you please elaborate? I am unable to see how that would help in, for example: if (need_l2) { rdpmcl(l2_hit_pmcnum, l2_hits_after); rdpmcl(l2_miss_pmcnum, l2_miss_after); } if (need_l3) { rdpmcl(l3_hit_pmcnum, l3_hits_after); rdpmcl(l3_miss_pmcnum, l3_miss_after); } Two issues with the above are: - the measurements captured in l2_hits_after and l2_miss_after would include the hits/misses associated with the "if (need_l2)" test - the measurements captured in l3_hits_after and l3_miss_after would include the hits/misses associated with both the "if (need_l2)" and "if (need_l3)" tests. When I separate the above into the two functions it just becomes either: rdpmcl(l2_hit_pmcnum, l2_hits_after); rdpmcl(l2_miss_pmcnum, l2_miss_after); or: rdpmcl(l3_hit_pmcnum, l3_hits_after); rdpmcl(l3_miss_pmcnum, l3_miss_after); Reinette