Received: by 10.223.164.202 with SMTP id h10csp510134wrb; Fri, 17 Nov 2017 04:22:40 -0800 (PST) X-Google-Smtp-Source: AGs4zMZ1gYVkYIvECh/ojOvSUWEE4NhoAO2f+U0urwUbRlDCfci40fWgu7NxO2HQLoJ28h5tnX61 X-Received: by 10.98.97.1 with SMTP id v1mr1889018pfb.105.1510921359915; Fri, 17 Nov 2017 04:22:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510921359; cv=none; d=google.com; s=arc-20160816; b=wYjxzm3dCBRhemnBNF5PfvBKDJmjWxgTseUtntyBdJ5Ra+uPY+RleSpQ3Z+JvK3O0a b5s4xlygP48re34Ecr4hDTmlXZvCHGWSQ59uC2mBN+SbUTvUIo4qxtpkqz190fX+WP5c YUH2xd3jxxUghOyEmylozXPf31q2TW30jZ9mZQUjQ2RTKbPXaAjrdSh8qsIJeQoMH+r2 3sCVOAgss79CWPFQ2JamZOqI0njJDQ7C73GDKA7Z4A05l0Fssdnnxi1RW1noSuNfHx0U uu644Ogg2vE+jsFXUF+mNQw6RwF5Z0txH/4BElie9kZpMqEYpxCehYKDzLKMS7mjem3i 8kEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :dlp-reaction:dlp-version:dlp-product:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:arc-authentication-results; bh=EV3ma8ChzZK/Ld2wcFbinShnYJhCofDnh7L92RQ+dZU=; b=rOrQm/ngGx8k1T74tjUqwj+swNEtV9K3hfSbA5IDJrhzSQFHIQ58tIJGr+KBQTJuUz eDcVe0m7N8eOJ0FFtRmPRp/aXp9tflYw7+toTLZ0o78Y2Gj5EQTKHfB+fbwffsRpBCyM K2q+tSRZEwoA9dfKFe2ckXLmc4kV3Gn47KKOxLVr75l9ddm+ru2QXnc6o7PSBtloNlJs VpU6aYUCY9QRSIaxYMF5Zb5GTHLKIeK10jch5ckcTJfPgFC7xknMBfAB/64zxo/wPupL RGECU7rJnnLH3fOS3DRoqvavSm4p6/2AhsflMOfkCj1uz0VH8FE/ux95m4kQIWNNIhXJ KLiw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n1si2636478pgc.308.2017.11.17.04.22.26; Fri, 17 Nov 2017 04:22:39 -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; 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 S932149AbdKQCSz convert rfc822-to-8bit (ORCPT + 91 others); Thu, 16 Nov 2017 21:18:55 -0500 Received: from mga05.intel.com ([192.55.52.43]:45393 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932080AbdKQCSt (ORCPT ); Thu, 16 Nov 2017 21:18:49 -0500 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Nov 2017 18:18:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,406,1505804400"; d="scan'208";a="2733530" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by FMSMGA003.fm.intel.com with ESMTP; 16 Nov 2017 18:18:49 -0800 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 16 Nov 2017 18:18:48 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by shsmsx102.ccr.corp.intel.com ([169.254.2.175]) with mapi id 14.03.0319.002; Fri, 17 Nov 2017 10:18:46 +0800 From: "Liang, Kan" To: "tglx@linutronix.de" , "peterz@infradead.org" , "mingo@redhat.com" , "linux-kernel@vger.kernel.org" CC: "acme@kernel.org" , "eranian@google.com" , "ak@linux.intel.com" Subject: RE: [PATCH V4 1/8] perf/x86/intel/uncore: customized event_read for client IMC uncore Thread-Topic: [PATCH V4 1/8] perf/x86/intel/uncore: customized event_read for client IMC uncore Thread-Index: AQHTVBlqGRFRpql890mawI5nnEriBKMX6r8g Date: Fri, 17 Nov 2017 02:18:46 +0000 Message-ID: <37D7C6CF3E00A74B8858931C1DB2F077537E383D@SHSMSX103.ccr.corp.intel.com> References: <1509654593-4446-1-git-send-email-kan.liang@intel.com> In-Reply-To: <1509654593-4446-1-git-send-email-kan.liang@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNWE4NjBjZmYtMDMyZS00MzllLTk2ZTQtYTllNzJhMzQ3OWZhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6IldsZ2p3aTI0TnpBdXdcL2tMMk5ZdHdRVlFpcldkUkprdTh1M2dMeFFBWjNjPSJ9 x-ctpclassification: CTP_IC dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Thomas, Any comments for this patch series? Thanks, Kan > > From: Kan Liang > > There are two free running counters for client IMC uncore. The custom > event_init() function hardcode their index to 'UNCORE_PMC_IDX_FIXED' and > 'UNCORE_PMC_IDX_FIXED + 1'. To support the 'UNCORE_PMC_IDX_FIXED + > 1' > case, the generic uncore_perf_event_update is obscurely hacked. > The code quality issue will bring problem when new counter index is > introduced into generic code. For example, free running counter index. > > Introduce customized event_read function for client IMC uncore. > The customized function is exactly copied from previous generic > uncore_pmu_event_read. > The 'UNCORE_PMC_IDX_FIXED + 1' case will be isolated for client IMC uncore > only. > > Signed-off-by: Kan Liang > --- > > Change since V3: > - Use the customized read function to replace uncore_perf_event_update. > - Move generic code change to patch 3/8. > > arch/x86/events/intel/uncore_snb.c | 33 > +++++++++++++++++++++++++++++++-- > 1 file changed, 31 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/events/intel/uncore_snb.c > b/arch/x86/events/intel/uncore_snb.c > index db1127c..b6d0d72 100644 > --- a/arch/x86/events/intel/uncore_snb.c > +++ b/arch/x86/events/intel/uncore_snb.c > @@ -449,6 +449,35 @@ static void snb_uncore_imc_event_start(struct > perf_event *event, int flags) > uncore_pmu_start_hrtimer(box); > } > > +static void snb_uncore_imc_event_read(struct perf_event *event) { > + struct intel_uncore_box *box = uncore_event_to_box(event); > + u64 prev_count, new_count, delta; > + int shift; > + > + /* > + * There are two free running counters in IMC. > + * The index for the second one is hardcoded to > + * UNCORE_PMC_IDX_FIXED + 1. > + */ > + if (event->hw.idx >= UNCORE_PMC_IDX_FIXED) > + shift = 64 - uncore_fixed_ctr_bits(box); > + else > + shift = 64 - uncore_perf_ctr_bits(box); > + > + /* the hrtimer might modify the previous event value */ > +again: > + prev_count = local64_read(&event->hw.prev_count); > + new_count = uncore_read_counter(box, event); > + if (local64_xchg(&event->hw.prev_count, new_count) != prev_count) > + goto again; > + > + delta = (new_count << shift) - (prev_count << shift); > + delta >>= shift; > + > + local64_add(delta, &event->count); > +} > + > static void snb_uncore_imc_event_stop(struct perf_event *event, int flags) { > struct intel_uncore_box *box = uncore_event_to_box(event); @@ - > 471,7 +500,7 @@ static void snb_uncore_imc_event_stop(struct perf_event > *event, int flags) > * Drain the remaining delta count out of a event > * that we are disabling: > */ > - uncore_perf_event_update(box, event); > + snb_uncore_imc_event_read(event); > hwc->state |= PERF_HES_UPTODATE; > } > } > @@ -533,7 +562,7 @@ static struct pmu snb_uncore_imc_pmu = { > .del = snb_uncore_imc_event_del, > .start = snb_uncore_imc_event_start, > .stop = snb_uncore_imc_event_stop, > - .read = uncore_pmu_event_read, > + .read = snb_uncore_imc_event_read, > }; > > static struct intel_uncore_ops snb_uncore_imc_ops = { > -- > 2.7.4 From 1582987903463221223@xxx Thu Nov 02 20:35:06 +0000 2017 X-GM-THRID: 1582987903463221223 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread