Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1307314

Re: [RFC PATCH 1/2] irq: Add a framework to measure interrupt timings

Path csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From Daniel Lezcano <daniel.lezcano@linaro.org>
Newsgroups linux.kernel
Subject Re: [RFC PATCH 1/2] irq: Add a framework to measure interrupt timings
Date Tue, 12 Jan 2016 12:50:02 +0100
Message-ID <qQ5Cy-jP-23@gated-at.bofh.it> (permalink)
References <qNYc9-2Y2-7@gated-at.bofh.it> <qNYca-2Y2-15@gated-at.bofh.it> <qOHiW-cO-27@gated-at.bofh.it>
X-Original-To Thomas Gleixner <tglx@linutronix.de>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:subject:to:references:cc:message-id:date:user-agent :mime-version:in-reply-to:content-type:content-transfer-encoding; bh=XWvYVz6CSxnzoMg4l6aWuwVf74FdgOU1q7QDI3fHpG0=; b=UufAlfwEsDTn1Ntuzxiq0uCpbyQjZhxZtqysWAFj8FiiSrN7Uj/W2mMQpucyVB4Not C4D5OLgVkLy16MHuqHwmvNvws4v380t2vfnHp0OF/Aq2Apk2C8VwqctzXg+PFJrQCBfd D9HCUDaBa51aqOvjlFKwbub5wwNN1NnIRtf+g=
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:subject:to:references:cc:message-id:date :user-agent:mime-version:in-reply-to:content-type :content-transfer-encoding; bh=XWvYVz6CSxnzoMg4l6aWuwVf74FdgOU1q7QDI3fHpG0=; b=QRsID7V8RxZpy0XbQLNKBsv9K/JmerCq26yfOX/uzUt/O1/p40VPTiSmzGErZ1k87o C1rgX1oVNU733+qxD/dRP68iY5R+7nGF4H3Rfs8DICQqPt2Ncp4aC5LqE9xqCQnfTjAC vqO2N+V0L7jPcpxdW13StayKZq8PFDNGbFIpNBEPa211cHj+xcbhCXvkY7Cq+vvlet8I 6OlqL1gpMXWIeSeWjuGVLNXt8t6XfYPpvg6yKdYHd05XjBjJI/CfHOJoA6soUXUFC3da EzFzeAv0wH6JOq/gVTC+r+2NZVimwyzb1Qf2yqB9JbC/Da4PvkcgQC3MwUiVAlNOtREl ZduA==
X-Gm-Message-State ALoCoQn6+mpDoKJQArBHfIlDA47j6w4GEjmF6Ep43lYu3EJaDNfzznlGc7yd8Cg6enCKuXbed5hqiuVdhFq9pNSQiBOxIvyfKg==
X-Received by 10.28.4.139 with SMTP id 133mr18307837wme.21.1452598937363; Tue, 12 Jan 2016 03:42:17 -0800 (PST)
User-Agent Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Thunderbird/38.3.0
MIME-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 8bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 166
Organization linux.* mail to news gateway
X-Original-Cc peterz@infradead.org, rafael@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, nicolas.pitre@linaro.org, vincent.guittot@linaro.org
X-Original-Date Tue, 12 Jan 2016 12:42:15 +0100
X-Original-Message-ID <5694E697.6020306@linaro.org>
X-Original-References <1452093774-17831-1-git-send-email-daniel.lezcano@linaro.org> <1452093774-17831-2-git-send-email-daniel.lezcano@linaro.org> <alpine.DEB.2.11.1601081616530.3575@nanos>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1307314

Show key headers only | View raw



Hi Thomas,

thanks for taking some time to review the patches.

On 01/08/2016 04:31 PM, Thomas Gleixner wrote:
> On Wed, 6 Jan 2016, Daniel Lezcano wrote:
>> +#ifdef CONFIG_IRQ_TIMINGS
>> +/**
>> + * timing handler to be called when an interrupt happens
>> + */
>> +typedef void (*irqt_handler_t)(unsigned int, ktime_t, void *, void *);
>> +
>> +/**
>> + * struct irqtimings - per interrupt irq timings descriptor
>> + * @handler:   interrupt handler timings function
>> + * @data:      pointer to the private data to be passed to the handler
>> + * @timestamp: latest interruption occurence
>
> There is no timestamp member.
>
>> + */
>> +struct irqtimings {
>> +	irqt_handler_t	  handler;
>> +	void              *data;
>
> What's that data thingy for. The proposed user does not use it at all and I
> have no idea why any user would want it. All it does is provide another level
> of indirection in the hotpath.

Yes, I agree. I added this private_data field for future use in case it 
would be needed but it does not make sense now.

>> +} ____cacheline_internodealigned_in_smp;
>
>> +/**
>> + * struct irqt_ops - structure to be used by the subsystem to call the
>> + * register and unregister ops when an irq is setup or freed.
>> + * @setup: registering callback
>> + * @free: unregistering callback
>> + *
>> + * The callbacks assumes the lock is held on the irq desc
>
> Crap. It's called outside of the locked region and the proposed user locks the
> descriptor itself, but that's a different story.
>
>> +static inline void free_irq_timings(unsigned int irq, void *dev_id)
>> +{
>> +	;
>
> What's the purpose of this semicolon?

Bah, old habit. I will remove it.

>> +#ifdef CONFIG_IRQ_TIMINGS
>> +void handle_irqt_event(struct irqtimings *irqt, struct irqaction *action)
>
> static ?
>
>> +{
>> +	if (irqt)
>
> This want's to use a static key.

Ok, I will look at that. I already used static keys to disable a portion 
of code from sysfs but never this way.

>> +		irqt->handler(action->irq, ktime_get(),
>> +			      action->dev_id, irqt->data);
>> +}
>> +#else
>> +#define handle_irqt_event(a, b)
>
> static inline stub if at all.

ok.

>> +#ifdef CONFIG_IRQ_TIMINGS
>> +/*
>> + * Global variable, only used by accessor functions, currently only
>> + * one user is allowed ...
>
> That variable is static not global. And what the heck means:
>
>>                          ... and it is up to the caller to make sure to
>> + * setup the irq timings which are already setup.
>
> -ENOPARSE.

hmm , yes ... it is not clear :)

I should have say:

"... and it is up to the caller to register the irq timing callback for 
the interrupts which are already setup."

>> + */
>> +static struct irqtimings_ops *irqtimings_ops;
>> +
>> +/**
>> + * register_irq_timings - register the ops when an irq is setup or freed
>> + *
>> + * @ops: the register/unregister ops to be called when at setup or
>> + * free time
>> + *
>> + * Returns -EBUSY if the slot is already in use, zero on success.
>> + */
>> +int register_irq_timings(struct irqtimings_ops *ops)
>> +{
>> +	if (irqtimings_ops)
>> +		return -EBUSY;
>> +
>> +	irqtimings_ops = ops;
>> +
>> +	return 0;
>> +}
>> +
>> +/**
>> + * setup_irq_timings - call the timing register callback
>> + *
>> + * @desc: an irq desc structure
>
> The argument list tells a different story.
>
>> + *
>> + * Returns -EINVAL in case of error, zero on success.
>> + */
>> +int setup_irq_timings(unsigned int irq, struct irqaction *act)
>
> static is not in your book, right? These functions are only used in this file,
> so no point for having them global visible and the stubs should be local as
> well.

Ok.

>> +{
>> +	if (irqtimings_ops && irqtimings_ops->setup)
>> +		return irqtimings_ops->setup(irq, act);
>> +	return 0;
>> +}
>
> ...
>
>> @@ -1408,6 +1469,8 @@ static struct irqaction *__free_irq(unsigned int irq, void *dev_id)
>>
>>   	unregister_handler_proc(irq, action);
>>
>> +	free_irq_timings(irq, dev_id);
>
> This needs to go to the point where the interrupt is already synchronized and
> the action about to be destroyed.

Ok, noted.

Thanks !

   -- Daniel


-- 
  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[RFC PATCH 0/2] IRQ based next prediction Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-01-06 16:30 +0100
  [RFC PATCH 1/2] irq: Add a framework to measure interrupt timings Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-01-06 16:30 +0100
    Re: [RFC PATCH 1/2] irq: Add a framework to measure interrupt  timings Thomas Gleixner <tglx@linutronix.de> - 2016-01-08 16:40 +0100
      Re: [RFC PATCH 1/2] irq: Add a framework to measure interrupt timings Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-01-12 12:50 +0100

csiph-web