From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752841AbdFVOrh (ORCPT ); Thu, 22 Jun 2017 10:47:37 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:56065 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752081AbdFVOrg (ORCPT ); Thu, 22 Jun 2017 10:47:36 -0400 Date: Thu, 22 Jun 2017 16:47:33 +0200 (CEST) From: Thomas Gleixner To: Daniel Lezcano cc: linux-kernel@vger.kernel.org, Peter Zijlstra , "Rafael J . Wysocki" , Vincent Guittot , Nicolas Pitre , Hannes Reinecke , Jens Axboe , Bjorn Helgaas Subject: Re: [PATCH 2/3] irq: Track the interrupt timings In-Reply-To: <1497994139-19816-2-git-send-email-daniel.lezcano@linaro.org> Message-ID: References: <20170620212657.GB1812@mai> <1497994139-19816-1-git-send-email-daniel.lezcano@linaro.org> <1497994139-19816-2-git-send-email-daniel.lezcano@linaro.org> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 20 Jun 2017, Daniel Lezcano wrote: > + > +struct irq_timings { > + u64 values[IRQ_TIMINGS_SIZE]; /* our circular buffer */ > + unsigned int count; /* Number of interruptions since last inspection */ Groan. These tail comments are horrible. Please make the struct member names tabular aligned and add proper kernel doc comments if you want to add useful documentations for the fields. > +}; > + > +DECLARE_PER_CPU(struct irq_timings, irq_timings); > + > +static inline void remove_timings(struct irq_desc *desc) irq_remove_timings > +{ > + desc->istate &= ~IRQS_TIMINGS; > +} > + > +static inline void setup_timings(struct irq_desc *desc, struct irqaction *act) ... > +{ > + /* > + * We don't need the measurement because the idle code already > + * knows the next expiry event. > + */ > + if (act->flags & __IRQF_TIMER) > + return; > + > + desc->istate |= IRQS_TIMINGS; > +} > + > +extern void irq_timings_enable(void); > +extern void irq_timings_disable(void); > + > +extern struct static_key_false irq_timing_enabled; DECLARE_STATIC_KEY_FALSE > +/* > + * The interrupt number and the timestamp are encoded into a single > + * u64 variable to optimize the size. > + * 48 bit time stamp and 16 bit IRQ number is way sufficient. > + * Who cares an IRQ after 78 hours of idle time? > + */ > +static inline u64 irq_timing_encode(u64 timestamp, int irq) > +{ > + return (timestamp << 16) | irq; > +} > + > +static inline void irq_timing_decode(u64 value, u64 *timestamp, int *irq) What's wrong with using a return value instead of void? > +{ > + *timestamp = value >> 16; > + *irq = value & U16_MAX; > +} Thanks, tglx