Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1568072imm; Fri, 7 Sep 2018 02:30:03 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYYEjdejJim/k1F5EiETcvVp0RJwbZ+2ynBHsZM5G8aFnqihE4hlA+zPmfbIWW6CdjzgOdt X-Received: by 2002:a63:d10c:: with SMTP id k12-v6mr7324607pgg.49.1536312603559; Fri, 07 Sep 2018 02:30:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536312603; cv=none; d=google.com; s=arc-20160816; b=A3ZqcTs8VYFEP6TyD7APLJuXkfHAwN1I+a1m2eNoGPjD4/P756oGlgWEUHAGbmngN0 UeoOTGQRXCtqiK5bNHpXoeylKUJpd0sUUmBDW3XW5ErdAiRYz3FuOTmq44PyjNl9tvpt 9Du5ZbdBSCiYzLjtrCfpa01Gnfy88CsvKRis/qOWorCu8Mx58j58vwH+fjIdPukMNKDg v5FpYM4bfpcwH42IrApjRaK5ujiI10Q+p5fJh9xtETWHdiNJ6hP9XxE0hZBKweqAVvCZ zaV6n2lG+u7k44Qkb4DcK5tre+vlY6JxFviEssnoDG44wbG77Y0rhboluFcUN170l1Ea xUZg== 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:in-reply-to :references:subject:cc:to:mime-version:user-agent:from:date :message-id; bh=hudKYUhG71uvlCrxCPcQuqBdASZQx2m+ECFJDuCF+tY=; b=X38nSBdcqfb+btIXEGjH6jsda61og9bIPyQc7VerhzQ2WmYdKH1CuUoDg3LAarv+ye 61dxtg3r8zQUbYi7I8wagsfpB3LpWvkdNGhL5Gg5s2HO2GMv6fnW5L8bkkMKIMYe1tqQ i14tzl+pM2BXCR4GA8z945g6uqMueLBDuCiQzdg8TSEF/UC4yBOB93k9vd6X357oxTfn ebiBOTPovxBjEZwxx59BsX2EGd9mRm5TXQlLZMIMzPQpeqk5U1mzQD4bt8pA/KMdTuxR 3EnLFmpAHxD9fcEvAYn1oMZ1BB8UlgFjtfx3ySLU45Y1RH3/r1GvT2Thv35+obNyBNR3 M/yQ== 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 z127-v6si7997299pgz.370.2018.09.07.02.29.17; Fri, 07 Sep 2018 02:30:03 -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 S1727651AbeIGLUK (ORCPT + 99 others); Fri, 7 Sep 2018 07:20:10 -0400 Received: from mga03.intel.com ([134.134.136.65]:15867 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725831AbeIGLUK (ORCPT ); Fri, 7 Sep 2018 07:20:10 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Sep 2018 23:40:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,341,1531810800"; d="scan'208";a="260599103" Received: from unknown (HELO [10.239.13.3]) ([10.239.13.3]) by fmsmga005.fm.intel.com with ESMTP; 06 Sep 2018 23:40:41 -0700 Message-ID: <5B921E84.4010008@intel.com> Date: Fri, 07 Sep 2018 14:45:24 +0800 From: Wei Wang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Andi Kleen CC: "linux-kernel@vger.kernel.org" , "kvm@vger.kernel.org" , "pbonzini@redhat.com" , "Liang, Kan" , "peterz@infradead.org" , "mingo@redhat.com" , "rkrcmar@redhat.com" , "Xu, Like" Subject: Re: [PATCH v2 1/8] perf/x86: add a function to get the lbr stack References: <1536233456-12173-1-git-send-email-wei.w.wang@intel.com> <1536233456-12173-2-git-send-email-wei.w.wang@intel.com> <20180907032811.GO27886@tassilo.jf.intel.com> In-Reply-To: <20180907032811.GO27886@tassilo.jf.intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/07/2018 11:28 AM, Andi Kleen wrote: >> +int perf_get_lbr_stack(struct perf_lbr_stack *stack) >> +{ >> + stack->lbr_nr = x86_pmu.lbr_nr; >> + stack->lbr_tos = x86_pmu.lbr_tos; >> + stack->lbr_from = x86_pmu.lbr_from; >> + stack->lbr_to = x86_pmu.lbr_to; >> + >> + if (x86_pmu.intel_cap.lbr_format == LBR_FORMAT_INFO) >> + stack->lbr_info = MSR_LBR_INFO_0; >> + else >> + stack->lbr_info = 0; > Seems weird to export the enum value if the enum isn't exported. > How can it be used? > I'm not sure about the issue. The caller gets the value of MSR_LBR_INFO_0 (not the enum, LBR_FORMAT_INFO) only when the hardware supports it. If hardware doesn't support it, just sets it to 0, and there will be no lbr info msr to be passed through. Best, Wei