genirq: error reporting for non-percpu interrupt in request_percpu_irq()
PATCH 1/1 genirq: error reporting for non-percpu interrupt in request_percpu_irq()
Return a separate error code when a non-percpu interrupt is passed to request_percpu_irq().
--- kernel/irq/manage.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
kernel/irq/manage.c +4 -2
@@ -1671,10 +1671,12 @@ int request_percpu_irq(unsigned int irq, irq_handler_t handler,return -EINVAL ; desc =irq_to_desc (irq); -if (!desc || !irq_settings_can_request (desc) || - !irq_settings_is_per_cpu_devid (desc)) +if (!desc || !irq_settings_can_request (desc))return -EINVAL ; +if (!irq_settings_is_per_cpu_devid (desc)) +return -EPERM ; + action =kzalloc (sizeof (struct irqaction ),GFP_KERNEL );if (!action)return -ENOMEM ;
Signature · 1 line
1.7.9.5
Need for this patch is discussed in mail-thread [1].
[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2013-October/204414.html
Thanks
-Vinayak
Quoted 31 lines · Vinayak Kale
Return a separate error code when a non-percpu interrupt is passed to
request_percpu_irq().Suggested-by Will Deacon <[email protected]>Signed-off-by Vinayak Kale <[email protected]>--- kernel/irq/manage.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)kernel/irq/manage.c +4
-3@@ -1671,10 +1671,12 @@ int request_percpu_irq(unsigned int irq, irq_handler_t handler,return -EINVAL ; desc =irq_to_desc (irq); -if (!desc || !irq_settings_can_request (desc) || - !irq_settings_is_per_cpu_devid (desc)) +if (!desc || !irq_settings_can_request (desc))return -EINVAL ; +if (!irq_settings_is_per_cpu_devid (desc)) +return -EPERM ; + action =kzalloc (sizeof (struct irqaction ),GFP_KERNEL );if (!action)return -ENOMEM ; --1.7.9.5
Quoted 14 lines · Vinayak Kale
Return a separate error code when a non-percpu interrupt is passed to
request_percpu_irq().Suggested-by Will Deacon <[email protected]>Signed-off-by Vinayak Kale <[email protected]>--- kernel/irq/manage.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)kernel/irq/manage.c +0
-0
kernel/irq/manage.c int request_percpu_irq(unsigned int irq, irq_handler_t handler, · line 1678
Quoted 10 lines
kernel/irq/manage.c +3
-2@@ -1671,10 +1671,12 @@ int request_percpu_irq(unsigned int irq, irq_handler_t handler,return -EINVAL ; desc =irq_to_desc (irq); -if (!desc || !irq_settings_can_request (desc) || - !irq_settings_is_per_cpu_devid (desc)) +if (!desc || !irq_settings_can_request (desc))return -EINVAL ; +if (!irq_settings_is_per_cpu_devid (desc)) +return -EPERM ;
<bikeshedding> I reckon -ENODEV is clearer here. </bikeshedding>
Also, there's a counterpart to this code in request_threaded_irq, where I think we should do something similar.
Will
Hi Will,
Quoted 23 lines · Will Deacon
Quoted 22 lines · Vinayak Kale
Return a separate error code when a non-percpu interrupt is passed to
request_percpu_irq().Suggested-by Will Deacon <[email protected]>Signed-off-by Vinayak Kale <[email protected]>--- kernel/irq/manage.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)kernel/irq/manage.c +1
-2@@ -1671,10 +1671,12 @@ int request_percpu_irq(unsigned int irq, irq_handler_t handler,return -EINVAL ; desc =irq_to_desc (irq); -if (!desc || !irq_settings_can_request (desc) || - !irq_settings_is_per_cpu_devid (desc)) +if (!desc || !irq_settings_can_request (desc))return -EINVAL ;
Quoted 4 lines
kernel/irq/manage.c int request_percpu_irq(unsigned int irq, irq_handler_t handler, · line 1678
Quoted 2 lines
kernel/irq/manage.c +2
-0+if (!irq_settings_is_per_cpu_devid (desc)) +return -EPERM ;<bikeshedding> I reckon
-ENODEVis clearer here. </bikeshedding>
I looked at the issue as "operation not allowed since interrupt is non-percpu" and I found below comment for EPERM in 'include/uapi/asm-generic/errno-base.h' . So thought this error code could be more fitting.
#define EPERM 1 /* Operation not permitted */
Quoted 3 lines
Also, there's a counterpart to this code in
request_threaded_irq, where I think we should do something similar.
So in request_threaded_irq, we would still keep the WARN_ON for percpu interrupt and return a different error code. Is my understanding correct?
Quoted 40 lines · Vinayak Kale
Hi Will,
Quoted 23 lines · Will Deacon
Quoted 22 lines · Vinayak Kale
Return a separate error code when a non-percpu interrupt is passed to
request_percpu_irq().Suggested-by Will Deacon <[email protected]>Signed-off-by Vinayak Kale <[email protected]>--- kernel/irq/manage.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)kernel/irq/manage.c +1
-2@@ -1671,10 +1671,12 @@ int request_percpu_irq(unsigned int irq, irq_handler_t handler,return -EINVAL ; desc =irq_to_desc (irq); -if (!desc || !irq_settings_can_request (desc) || - !irq_settings_is_per_cpu_devid (desc)) +if (!desc || !irq_settings_can_request (desc))return -EINVAL ;Quoted 4 lines
kernel/irq/manage.c int request_percpu_irq(unsigned int irq, irq_handler_t handler, · line 1678
Quoted 2 lines
kernel/irq/manage.c +2
-0+if (!irq_settings_is_per_cpu_devid (desc)) +return -EPERM ;<bikeshedding> I reckon
-ENODEVis clearer here. </bikeshedding>I looked at the issue as "operation not allowed since interrupt is non-percpu" and I found below comment for EPERM in '
include/uapi/asm-generic/errno-base.h' . So thought this error code could be more fitting.#define EPERM 1 /* Operation not permitted */
Quoted 1 line
Quoted 6 lines
Quoted 2 lines
Also, there's a counterpart to this code in
request_threaded_irq, where I think we should do something similar.So in
request_threaded_irq, we would still keep theWARN_ONfor percpu interrupt and return a different error code. Is my understanding correct?
Please ignore my this comment.
If we do something similar in request_threaded_irq then we will have to remove WARN_ON for percpu interrupt.
Quoted 4 lines · Vinayak Kale
Need for this patch is discussed in mail-thread [1].
[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2013-October/204414.html
I can't see anything which makes use of the separate error code in that patch.
Thanks,
tglx
Quoted 33 lines · Vinayak Kale
Quoted 31 lines
Return a separate error code when a non-percpu interrupt is passed to
request_percpu_irq().Suggested-by Will Deacon <[email protected]>Signed-off-by Vinayak Kale <[email protected]>--- kernel/irq/manage.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)kernel/irq/manage.c +4
-3@@ -1671,10 +1671,12 @@ int request_percpu_irq(unsigned int irq, irq_handler_t handler,return -EINVAL ; desc =irq_to_desc (irq); -if (!desc || !irq_settings_can_request (desc) || - !irq_settings_is_per_cpu_devid (desc)) +if (!desc || !irq_settings_can_request (desc))return -EINVAL ; +if (!irq_settings_is_per_cpu_devid (desc)) +return -EPERM ; + action =kzalloc (sizeof (struct irqaction ),GFP_KERNEL );if (!action)return -ENOMEM ; --1.7.9.5
Hi Thomas,
Quoted 9 lines · Thomas Gleixner
Quoted 4 lines · Vinayak Kale
Need for this patch is discussed in mail-thread [1].
[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2013-October/204414.html
I can't see anything which makes use of the separate error code in that patch.
It was suggested by Will in response to above mentioned patch. Will's response can be found here:
http://lists.infradead.org/pipermail/linux-arm-kernel/2013-October/204491.html
Sorry for wrong link.
Thanks
-Vinayak