Re: [PATCH RFC: linux-next 1/2] irq: Add CPU mask affinity hint callback framework

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Thomas Gleixner
Date: Wednesday, April 28, 2010 - 9:45 am

B1;2005;0cPeter,

On Tue, 27 Apr 2010, Peter P Waskiewicz Jr wrote:

Grr, I knew that I missed something. That'll teach me to review
patches before the coffee has reached my brain cells :)


So you need a reference to your device, so what about the following:

struct irq_affinity_hint;

struct irq_affinity_hint {
       unsigned int (*callback)(unsigned int irq, struct irq_affinity_hint *hint,
				cpumask_var_t *mask);
}

Now you embed that struct into your device private data structure and
you get the reference to it back in the callback function. No extra
kmalloc/kfree, less code.

One other thing I noticed, but forgot to comment on:


 Why do we return 0, when there is no callback and no hint available ?


  We don't want to have cpumask enforced on stack. Please make that:

     	cpumask_var_t mask;

	if (!alloc_cpumask_var(&mask, GFP_KERNEL))
	       return -ENOMEM;


  The access to desc-> needs to be protected with
  desc->lock. Otherwise you might race with a callback unregister.


Thanks,

	tglx
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH RFC: linux-next 1/2] irq: Add CPU mask affinity hin ..., Peter P Waskiewicz Jr, (Sun Apr 18, 9:57 pm)
[PATCH RFC: linux-next 2/2] ixgbe: Example usage of the ne ..., Peter P Waskiewicz Jr, (Sun Apr 18, 9:58 pm)
Re: [PATCH RFC: linux-next 1/2] irq: Add CPU mask affinity ..., Peter P Waskiewicz Jr, (Tue Apr 27, 9:04 am)
Re: [PATCH RFC: linux-next 1/2] irq: Add CPU mask affinity ..., Thomas Gleixner, (Wed Apr 28, 9:45 am)
Re: [PATCH RFC: linux-next 1/2] irq: Add CPU mask affinity ..., Peter P Waskiewicz Jr, (Thu Apr 29, 10:59 am)
Re: [PATCH RFC: linux-next 1/2] irq: Add CPU mask affinity ..., Peter P Waskiewicz Jr, (Thu Apr 29, 1:28 pm)
Re: [PATCH RFC: linux-next 1/2] irq: Add CPU mask affinity ..., Peter P Waskiewicz Jr, (Thu Apr 29, 2:29 pm)