Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752217AbbGWJWu (ORCPT ); Thu, 23 Jul 2015 05:22:50 -0400 Received: from e28smtp05.in.ibm.com ([122.248.162.5]:44653 "EHLO e28smtp05.in.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751173AbbGWJWl (ORCPT ); Thu, 23 Jul 2015 05:22:41 -0400 X-Helo: d28dlp02.in.ibm.com X-MailFrom: maddy@linux.vnet.ibm.com X-RcptTo: linux-kernel@vger.kernel.org Message-ID: <55B0B247.9040207@linux.vnet.ibm.com> Date: Thu, 23 Jul 2015 14:52:15 +0530 From: Madhavan Srinivasan User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Michael Ellerman CC: Daniel Axtens , linux-kernel@vger.kernel.org, Stephane Eranian , Paul Mackerras , Anton Blanchard , Sukadev Bhattiprolu , linuxppc-dev@lists.ozlabs.org, Anshuman Khandual Subject: Re: [PATCH v5 6/7] powerpc/powernv: generic nest pmu event functions References: <1437045206-7491-1-git-send-email-maddy@linux.vnet.ibm.com> <1437045206-7491-7-git-send-email-maddy@linux.vnet.ibm.com> <1437540961.30906.39.camel@axtens.net> <55B08D4C.7050104@linux.vnet.ibm.com> <1437642259.29271.1.camel@ellerman.id.au> In-Reply-To: <1437642259.29271.1.camel@ellerman.id.au> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15072309-0017-0000-0000-00000651409C Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1584 Lines: 46 On Thursday 23 July 2015 02:34 PM, Michael Ellerman wrote: > On Thu, 2015-07-23 at 12:14 +0530, Madhavan Srinivasan wrote: >> On Wednesday 22 July 2015 10:26 AM, Daniel Axtens wrote: >>>> +static void p8_nest_read_counter(struct perf_event *event) >>>> +{ >>>> + uint64_t *addr; >>>> + u64 data = 0; >>> You've got a u64 and a uint64_t, and then... >>>> + >>>> + addr = (u64 *)event->hw.event_base; >>> ... you cast to event_base to a u64 pointer, which you assign to a >>> uint64_t pointer. >>>> + data = __be64_to_cpu(*addr); >>> And now you dereference the pointer. >>> Could you just have: >>> data = __be64_to_cpu(*event->hw.event_base); >>>> + local64_set(&event->hw.prev_count, data); >>>> +} >>>> + >>>> +static void p8_nest_perf_event_update(struct perf_event *event) >>>> +{ >>>> + u64 counter_prev, counter_new, final_count; >>>> + uint64_t *addr; >>>> + >>>> + addr = (uint64_t *)event->hw.event_base; >>> Here at least the cast type is the same as the type of addr, but again, >>> why do you need the different types, and why local variable? >> Damn sorry, copy paste errors. When I added debug prints i messed >> the type case in both the functions. I will make them as uint64_t. > No please use u64/u32 etc. Most code in powerpc does and I prefer them. > > cheers Ok Sure. Will use only u64 and u32. Thanks maddy > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/